add content filter to mediaccc

This commit is contained in:
Christian Schabesberger 2019-01-29 17:20:30 +01:00
parent d0a3125df4
commit 6edbfe2a6f
4 changed files with 11 additions and 3 deletions

View file

@ -57,7 +57,7 @@ dependencies {
exclude module: 'support-annotations' exclude module: 'support-annotations'
}) })
implementation 'com.github.TeamNewPipe:NewPipeExtractor:d0efe8bd47' implementation 'com.github.TeamNewPipe:NewPipeExtractor:79b0a19d1af'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0' testImplementation 'org.mockito:mockito-core:2.23.0'

View file

@ -104,8 +104,13 @@ public class SearchFragment
// this three represet the current search query // this three represet the current search query
@State @State
protected String searchString; protected String searchString;
/**
* No content filter should add like contentfilter = all
* be aware of this when implementing an extractor.
*/
@State @State
protected String[] contentFilter; protected String[] contentFilter = new String[0];
@State @State
protected String sortFilter; protected String sortFilter;
@ -335,7 +340,7 @@ public class SearchFragment
|| (searchEditText != null && !TextUtils.isEmpty(searchEditText.getText()))) { || (searchEditText != null && !TextUtils.isEmpty(searchEditText.getText()))) {
search(!TextUtils.isEmpty(searchString) search(!TextUtils.isEmpty(searchString)
? searchString ? searchString
: searchEditText.getText().toString(), new String[0], ""); : searchEditText.getText().toString(), this.contentFilter, "");
} else { } else {
if (searchEditText != null) { if (searchEditText != null) {
searchEditText.setText(""); searchEditText.setText("");

View file

@ -40,6 +40,8 @@ public class ServiceHelper {
case "playlists": return c.getString(R.string.playlists); case "playlists": return c.getString(R.string.playlists);
case "tracks": return c.getString(R.string.tracks); case "tracks": return c.getString(R.string.tracks);
case "users": return c.getString(R.string.users); case "users": return c.getString(R.string.users);
case "conferences" : return c.getString(R.string.conferences);
case "events" : return c.getString(R.string.events);
default: return filter; default: return filter;
} }
} }

View file

@ -137,6 +137,7 @@
<string name="videos">Videos</string> <string name="videos">Videos</string>
<string name="tracks">Tracks</string> <string name="tracks">Tracks</string>
<string name="users">Users</string> <string name="users">Users</string>
<string name="events">Events</string>
<string name="yes">Yes</string> <string name="yes">Yes</string>
<string name="later">Later</string> <string name="later">Later</string>
<string name="disabled">Disabled</string> <string name="disabled">Disabled</string>