Use suggested layout for search filters

This commit is contained in:
wb9688 2020-03-21 20:53:30 +01:00
parent 41a100613f
commit 2852815e1a
6 changed files with 20 additions and 21 deletions

View File

@ -136,7 +136,7 @@ dependencies {
exclude module: 'support-annotations' exclude module: 'support-annotations'
}) })
implementation 'com.github.wb9688:NewPipeExtractor:3b4fca8133456cc8839c465341cf185eb2d276be' implementation 'com.github.wb9688:NewPipeExtractor:c1cfdb3356a1024953c506a1849c64d3595f41f6'
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

@ -416,6 +416,13 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
boolean isFirstItem = true; boolean isFirstItem = true;
final Context c = getContext(); final Context c = getContext();
for (String filter : service.getSearchQHFactory().getAvailableContentFilter()) { for (String filter : service.getSearchQHFactory().getAvailableContentFilter()) {
if (filter.equals("music_songs")) {
MenuItem musicItem = menu.add(2,
itemId++,
0,
"YouTube Music");
musicItem.setEnabled(false);
}
menuItemToFilterName.put(itemId, filter); menuItemToFilterName.put(itemId, filter);
MenuItem item = menu.add(1, MenuItem item = menu.add(1,
itemId++, itemId++,

View File

@ -6,9 +6,6 @@ import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import org.schabi.newpipe.extractor.ListExtractor;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
@ -19,6 +16,7 @@ import androidx.annotation.StringRes;
import org.ocpsoft.prettytime.PrettyTime; import org.ocpsoft.prettytime.PrettyTime;
import org.ocpsoft.prettytime.units.Decade; import org.ocpsoft.prettytime.units.Decade;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.localization.ContentCountry; import org.schabi.newpipe.extractor.localization.ContentCountry;
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@ -48,10 +48,12 @@ public final class ServiceHelper {
case "all": case "all":
return c.getString(R.string.all); return c.getString(R.string.all);
case "videos": case "videos":
case "music_videos":
return c.getString(R.string.videos_string); return c.getString(R.string.videos_string);
case "channels": case "channels":
return c.getString(R.string.channels); return c.getString(R.string.channels);
case "playlists": case "playlists":
case "music_playlists":
return c.getString(R.string.playlists); return c.getString(R.string.playlists);
case "tracks": case "tracks":
return c.getString(R.string.tracks); return c.getString(R.string.tracks);
@ -62,15 +64,11 @@ public final class ServiceHelper {
case "events": case "events":
return c.getString(R.string.events); return c.getString(R.string.events);
case "music_songs": case "music_songs":
return c.getString(R.string.music_songs); return c.getString(R.string.songs);
case "music_videos":
return c.getString(R.string.music_videos);
case "music_albums": case "music_albums":
return c.getString(R.string.music_albums); return c.getString(R.string.albums);
case "music_playlists":
return c.getString(R.string.music_playlists);
case "music_artists": case "music_artists":
return c.getString(R.string.music_artists); return c.getString(R.string.artists);
default: default:
return filter; return filter;
} }

View File

@ -596,9 +596,7 @@
<string name="drawer_header_description">Toggle service, momenteel geselecteerd:</string> <string name="drawer_header_description">Toggle service, momenteel geselecteerd:</string>
<string name="most_liked">Meest geliked</string> <string name="most_liked">Meest geliked</string>
<string name="error_postprocessing_stopped">NewPipe werd gesloten terwijl het bezig was met het bestand</string> <string name="error_postprocessing_stopped">NewPipe werd gesloten terwijl het bezig was met het bestand</string>
<string name="music_songs">Music/Nummers</string> <string name="songs">Nummers</string>
<string name="music_videos">Music/Video\'s</string> <string name="albums">Albums</string>
<string name="music_albums">Music/Albums</string> <string name="artists">Artiesten</string>
<string name="music_playlists">Music/Afspeellijsten</string>
<string name="music_artists">Music/Artiesten</string>
</resources> </resources>

View File

@ -150,11 +150,9 @@
<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="events">Events</string>
<string name="music_songs">Music/Songs</string> <string name="songs">Songs</string>
<string name="music_videos">Music/Videos</string> <string name="albums">Albums</string>
<string name="music_albums">Music/Albums</string> <string name="artists">Artists</string>
<string name="music_playlists">Music/Playlists</string>
<string name="music_artists">Music/Artists</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>