From 2710d9de5bf8b23acf30ea4aa0bdeb34e7fd88c9 Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 17 Mar 2020 18:41:39 +0100 Subject: [PATCH 1/8] Add support for INFINITE_ and MORE_THAN_100_ITEMS in playlists --- app/build.gradle | 2 +- .../fragments/list/playlist/PlaylistFragment.java | 12 ++++++++++-- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b714faa8420..981a5b4f18c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,7 +136,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.TeamNewPipe:NewPipeExtractor:a5155fb' + implementation 'com.github.XiangRongLin:NewPipeExtractor:6a23efa8d41a05f37b8f523aa08af7e0a9d6c4e1' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0' diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index e3eac27ca98..7c21c073d68 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -27,6 +27,7 @@ import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ExtractionException; +import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.playlist.PlaylistInfo; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamType; @@ -302,8 +303,15 @@ public void handleResult(@NonNull final PlaylistInfo result) { IMAGE_LOADER.displayImage(result.getUploaderAvatarUrl(), headerUploaderAvatar, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); - headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos, - (int) result.getStreamCount(), (int) result.getStreamCount())); + + int streamCount = (int) result.getStreamCount(); + if (streamCount == PlaylistExtractor.MORE_THAN_100_ITEMS) { + headerStreamCount.setText(getResources().getString(R.string.playlist_more_than_100_items)); + } else if (streamCount == PlaylistExtractor.INFINITE_ITEMS) { + headerStreamCount.setText(getResources().getString(R.string.playlist_infinite_items)); + } else { + headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos, streamCount, streamCount)); + } if (!result.getErrors().isEmpty()) { showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ea2202c5858..d8641cc0ff1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -458,6 +458,8 @@ Playlist thumbnail changed. Could not delete playlist. Auto-generated (no uploader found) + 100+ videos + ∞ videos No Captions Fit From 625419a7db7e93cec83633cd6b0bee9e3aabf797 Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 20 Mar 2020 20:57:56 +0100 Subject: [PATCH 2/8] Detect ITEM_COUNT_* in localizeStreamCount() ITEM_COUNT_INFINITE and ITEM_COUNT_MORE_THAN_100. Use localizeStreamCount in PlaylistFragment and PlaylistItemHolder --- app/build.gradle | 2 +- .../fragments/list/playlist/PlaylistFragment.java | 13 +++---------- .../holder/PlaylistMiniInfoItemHolder.java | 4 +++- .../java/org/schabi/newpipe/util/Localization.java | 13 +++++++++++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 981a5b4f18c..3357b4b3194 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,7 +136,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.XiangRongLin:NewPipeExtractor:6a23efa8d41a05f37b8f523aa08af7e0a9d6c4e1' + implementation 'com.github.XiangRongLin:NewPipeExtractor:f9a084f8f9611a87d0f8d6f309a40429304b2ac9' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0' diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index 7c21c073d68..93df98c9727 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -27,7 +27,6 @@ import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ExtractionException; -import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.playlist.PlaylistInfo; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamType; @@ -40,6 +39,7 @@ import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.util.ExtractorHelper; import org.schabi.newpipe.util.ImageDisplayConstants; +import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.ShareUtils; import org.schabi.newpipe.util.StreamDialogEntry; @@ -303,15 +303,8 @@ public void handleResult(@NonNull final PlaylistInfo result) { IMAGE_LOADER.displayImage(result.getUploaderAvatarUrl(), headerUploaderAvatar, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); - - int streamCount = (int) result.getStreamCount(); - if (streamCount == PlaylistExtractor.MORE_THAN_100_ITEMS) { - headerStreamCount.setText(getResources().getString(R.string.playlist_more_than_100_items)); - } else if (streamCount == PlaylistExtractor.INFINITE_ITEMS) { - headerStreamCount.setText(getResources().getString(R.string.playlist_infinite_items)); - } else { - headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos, streamCount, streamCount)); - } + headerStreamCount.setText(Localization + .localizeStreamCount(getContext(), result.getStreamCount())); if (!result.getErrors().isEmpty()) { showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST, diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java index c6e6378815a..2b0c2ef2883 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java @@ -10,6 +10,7 @@ import org.schabi.newpipe.info_list.InfoItemBuilder; import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.util.ImageDisplayConstants; +import org.schabi.newpipe.util.Localization; public class PlaylistMiniInfoItemHolder extends InfoItemHolder { public final ImageView itemThumbnailView; @@ -41,7 +42,8 @@ public void updateFromItem(final InfoItem infoItem, final PlaylistInfoItem item = (PlaylistInfoItem) infoItem; itemTitleView.setText(item.getName()); - itemStreamCountView.setText(String.valueOf(item.getStreamCount())); + itemStreamCountView.setText(Localization + .localizeStreamCount(itemStreamCountView.getContext(), item.getStreamCount())); itemUploaderView.setText(item.getUploaderName()); itemBuilder.getImageLoader() diff --git a/app/src/main/java/org/schabi/newpipe/util/Localization.java b/app/src/main/java/org/schabi/newpipe/util/Localization.java index 0b81df07d70..c7d10438fe2 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Localization.java +++ b/app/src/main/java/org/schabi/newpipe/util/Localization.java @@ -6,6 +6,8 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.preference.PreferenceManager; + +import org.schabi.newpipe.extractor.ListExtractor; import android.text.TextUtils; import android.util.DisplayMetrics; @@ -151,8 +153,15 @@ public static String localizeViewCount(final Context context, final long viewCou } public static String localizeStreamCount(final Context context, final long streamCount) { - return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount, - localizeNumber(context, streamCount)); + switch ((int) streamCount) { + case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: + return context.getResources().getString(R.string.playlist_more_than_100_items); + case (int) ListExtractor.ITEM_COUNT_INFINITE: + return context.getResources().getString(R.string.playlist_infinite_items); + default: + return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount, + localizeNumber(context, streamCount)); + } } public static String localizeWatchingCount(final Context context, final long watchingCount) { From 2b47a1b06ab7378f0c28838cdce78e2108ce3b67 Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 20 Mar 2020 21:22:09 +0100 Subject: [PATCH 3/8] Also use localizeStreamCount() in local items --- .../schabi/newpipe/local/holder/LocalPlaylistItemHolder.java | 4 +++- .../schabi/newpipe/local/holder/RemotePlaylistItemHolder.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java b/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java index 3ff4f707ae0..a3d72094da5 100644 --- a/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java @@ -8,6 +8,7 @@ import org.schabi.newpipe.local.LocalItemBuilder; import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.util.ImageDisplayConstants; +import org.schabi.newpipe.util.Localization; import java.text.DateFormat; @@ -31,7 +32,8 @@ public void updateFromItem(final LocalItem localItem, final PlaylistMetadataEntry item = (PlaylistMetadataEntry) localItem; itemTitleView.setText(item.name); - itemStreamCountView.setText(String.valueOf(item.streamCount)); + itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(), + item.streamCount)); itemUploaderView.setVisibility(View.INVISIBLE); itemBuilder.displayImage(item.thumbnailUrl, itemThumbnailView, diff --git a/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java b/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java index c6d387fd412..015173842a7 100644 --- a/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java @@ -34,7 +34,8 @@ public void updateFromItem(final LocalItem localItem, final PlaylistRemoteEntity item = (PlaylistRemoteEntity) localItem; itemTitleView.setText(item.getName()); - itemStreamCountView.setText(String.valueOf(item.getStreamCount())); + itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(), + item.getStreamCount())); // Here is where the uploader name is set in the bookmarked playlists library if (!TextUtils.isEmpty(item.getUploader())) { itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), From 914d3c4a66ae5d32b4badd9e49c3e2961ca40ddc Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 20 Mar 2020 21:43:17 +0100 Subject: [PATCH 4/8] Use "mini" stream count alternatives for info items Note: more_than_100_videos_mini and infinite_videos_mini are untranslatable --- .../holder/PlaylistMiniInfoItemHolder.java | 2 +- .../local/holder/LocalPlaylistItemHolder.java | 4 ++-- .../local/holder/RemotePlaylistItemHolder.java | 4 ++-- .../org/schabi/newpipe/util/Localization.java | 16 ++++++++++++++-- app/src/main/res/values/strings.xml | 6 ++++-- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java index 2b0c2ef2883..d4af630623b 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/PlaylistMiniInfoItemHolder.java @@ -43,7 +43,7 @@ public void updateFromItem(final InfoItem infoItem, itemTitleView.setText(item.getName()); itemStreamCountView.setText(Localization - .localizeStreamCount(itemStreamCountView.getContext(), item.getStreamCount())); + .localizeStreamCountMini(itemStreamCountView.getContext(), item.getStreamCount())); itemUploaderView.setText(item.getUploaderName()); itemBuilder.getImageLoader() diff --git a/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java b/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java index a3d72094da5..458b3c30eae 100644 --- a/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/local/holder/LocalPlaylistItemHolder.java @@ -32,8 +32,8 @@ public void updateFromItem(final LocalItem localItem, final PlaylistMetadataEntry item = (PlaylistMetadataEntry) localItem; itemTitleView.setText(item.name); - itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(), - item.streamCount)); + itemStreamCountView.setText(Localization.localizeStreamCountMini( + itemStreamCountView.getContext(), item.streamCount)); itemUploaderView.setVisibility(View.INVISIBLE); itemBuilder.displayImage(item.thumbnailUrl, itemThumbnailView, diff --git a/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java b/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java index 015173842a7..a47d61d2f72 100644 --- a/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java @@ -34,8 +34,8 @@ public void updateFromItem(final LocalItem localItem, final PlaylistRemoteEntity item = (PlaylistRemoteEntity) localItem; itemTitleView.setText(item.getName()); - itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(), - item.getStreamCount())); + itemStreamCountView.setText(Localization.localizeStreamCountMini( + itemStreamCountView.getContext(), item.getStreamCount())); // Here is where the uploader name is set in the bookmarked playlists library if (!TextUtils.isEmpty(item.getUploader())) { itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), diff --git a/app/src/main/java/org/schabi/newpipe/util/Localization.java b/app/src/main/java/org/schabi/newpipe/util/Localization.java index c7d10438fe2..b8431adff56 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Localization.java +++ b/app/src/main/java/org/schabi/newpipe/util/Localization.java @@ -8,6 +8,7 @@ import android.preference.PreferenceManager; import org.schabi.newpipe.extractor.ListExtractor; + import android.text.TextUtils; import android.util.DisplayMetrics; @@ -155,15 +156,26 @@ public static String localizeViewCount(final Context context, final long viewCou public static String localizeStreamCount(final Context context, final long streamCount) { switch ((int) streamCount) { case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: - return context.getResources().getString(R.string.playlist_more_than_100_items); + return context.getResources().getString(R.string.more_than_100_videos); case (int) ListExtractor.ITEM_COUNT_INFINITE: - return context.getResources().getString(R.string.playlist_infinite_items); + return context.getResources().getString(R.string.infinite_videos); default: return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount, localizeNumber(context, streamCount)); } } + public static String localizeStreamCountMini(final Context context, final long streamCount) { + switch ((int) streamCount) { + case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: + return context.getResources().getString(R.string.more_than_100_videos_mini); + case (int) ListExtractor.ITEM_COUNT_INFINITE: + return context.getResources().getString(R.string.infinite_videos_mini); + default: + return String.valueOf(streamCount); + } + } + public static String localizeWatchingCount(final Context context, final long watchingCount) { return getQuantity(context, R.plurals.watching, R.string.no_one_watching, watchingCount, localizeNumber(context, watchingCount)); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d8641cc0ff1..93097466834 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -284,6 +284,10 @@ %s listeners No videos + 100+ videos + ∞ videos + 100+ + %s video %s videos @@ -458,8 +462,6 @@ Playlist thumbnail changed. Could not delete playlist. Auto-generated (no uploader found) - 100+ videos - ∞ videos No Captions Fit From 63e489f1346fd675c5040e18e8292755dc5a52ee Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 20 Mar 2020 22:01:56 +0100 Subject: [PATCH 5/8] Use ITEM_COUNT_UNKNOWN --- app/build.gradle | 2 +- .../java/org/schabi/newpipe/util/Localization.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3357b4b3194..056602f9c70 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,7 +136,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.XiangRongLin:NewPipeExtractor:f9a084f8f9611a87d0f8d6f309a40429304b2ac9' + implementation 'com.github.XiangRongLin:NewPipeExtractor:34073527498a22e1f7c1feb18132bf62fb544825' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0' diff --git a/app/src/main/java/org/schabi/newpipe/util/Localization.java b/app/src/main/java/org/schabi/newpipe/util/Localization.java index b8431adff56..c799c44c828 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Localization.java +++ b/app/src/main/java/org/schabi/newpipe/util/Localization.java @@ -155,10 +155,12 @@ public static String localizeViewCount(final Context context, final long viewCou public static String localizeStreamCount(final Context context, final long streamCount) { switch ((int) streamCount) { - case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: - return context.getResources().getString(R.string.more_than_100_videos); + case (int) ListExtractor.ITEM_COUNT_UNKNOWN: + return ""; case (int) ListExtractor.ITEM_COUNT_INFINITE: return context.getResources().getString(R.string.infinite_videos); + case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: + return context.getResources().getString(R.string.more_than_100_videos); default: return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount, localizeNumber(context, streamCount)); @@ -167,10 +169,12 @@ public static String localizeStreamCount(final Context context, final long strea public static String localizeStreamCountMini(final Context context, final long streamCount) { switch ((int) streamCount) { - case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: - return context.getResources().getString(R.string.more_than_100_videos_mini); + case (int) ListExtractor.ITEM_COUNT_UNKNOWN: + return ""; case (int) ListExtractor.ITEM_COUNT_INFINITE: return context.getResources().getString(R.string.infinite_videos_mini); + case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: + return context.getResources().getString(R.string.more_than_100_videos_mini); default: return String.valueOf(streamCount); } From 41a100613f2d40510ba1a1bc4bf0f46faa77c03d Mon Sep 17 00:00:00 2001 From: wb9688 Date: Tue, 17 Mar 2020 11:39:01 +0100 Subject: [PATCH 6/8] Add ability to translate YouTube Music search options --- app/build.gradle | 2 +- .../java/org/schabi/newpipe/util/ServiceHelper.java | 10 ++++++++++ app/src/main/res/values-nl/strings.xml | 7 ++++++- app/src/main/res/values/strings.xml | 5 +++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 056602f9c70..75cbf8fba19 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,7 +136,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.XiangRongLin:NewPipeExtractor:34073527498a22e1f7c1feb18132bf62fb544825' + implementation 'com.github.wb9688:NewPipeExtractor:3b4fca8133456cc8839c465341cf185eb2d276be' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0' diff --git a/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java b/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java index cea62466387..369627041eb 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java @@ -61,6 +61,16 @@ public static String getTranslatedFilterString(final String filter, final Contex return c.getString(R.string.conferences); case "events": return c.getString(R.string.events); + case "music_songs": + return c.getString(R.string.music_songs); + case "music_videos": + return c.getString(R.string.music_videos); + case "music_albums": + return c.getString(R.string.music_albums); + case "music_playlists": + return c.getString(R.string.music_playlists); + case "music_artists": + return c.getString(R.string.music_artists); default: return filter; } diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 88c012ef5c2..6f72b322645 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -596,4 +596,9 @@ Toggle service, momenteel geselecteerd: Meest geliked NewPipe werd gesloten terwijl het bezig was met het bestand - \ No newline at end of file + Music/Nummers + Music/Video\'s + Music/Albums + Music/Afspeellijsten + Music/Artiesten + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 93097466834..76e018eebbf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -150,6 +150,11 @@ Tracks Users Events + Music/Songs + Music/Videos + Music/Albums + Music/Playlists + Music/Artists Yes Later Disabled From 2852815e1ab5553f22403ca31cb5e422d56de1aa Mon Sep 17 00:00:00 2001 From: wb9688 Date: Sat, 21 Mar 2020 20:53:30 +0100 Subject: [PATCH 7/8] Use suggested layout for search filters --- app/build.gradle | 2 +- .../fragments/list/search/SearchFragment.java | 7 +++++++ .../java/org/schabi/newpipe/util/Localization.java | 4 +--- .../java/org/schabi/newpipe/util/ServiceHelper.java | 12 +++++------- app/src/main/res/values-nl/strings.xml | 8 +++----- app/src/main/res/values/strings.xml | 8 +++----- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 75cbf8fba19..e6a37527d40 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,7 +136,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.wb9688:NewPipeExtractor:3b4fca8133456cc8839c465341cf185eb2d276be' + implementation 'com.github.wb9688:NewPipeExtractor:c1cfdb3356a1024953c506a1849c64d3595f41f6' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0' diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index 718865f1083..6dd52c59ef8 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -416,6 +416,13 @@ public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { boolean isFirstItem = true; final Context c = getContext(); 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); MenuItem item = menu.add(1, itemId++, diff --git a/app/src/main/java/org/schabi/newpipe/util/Localization.java b/app/src/main/java/org/schabi/newpipe/util/Localization.java index c799c44c828..7e336f02d5d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Localization.java +++ b/app/src/main/java/org/schabi/newpipe/util/Localization.java @@ -6,9 +6,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.preference.PreferenceManager; - -import org.schabi.newpipe.extractor.ListExtractor; - import android.text.TextUtils; import android.util.DisplayMetrics; @@ -19,6 +16,7 @@ import org.ocpsoft.prettytime.PrettyTime; import org.ocpsoft.prettytime.units.Decade; import org.schabi.newpipe.R; +import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.localization.ContentCountry; import java.math.BigDecimal; diff --git a/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java b/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java index 369627041eb..dacf7d8442c 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java @@ -48,10 +48,12 @@ public static String getTranslatedFilterString(final String filter, final Contex case "all": return c.getString(R.string.all); case "videos": + case "music_videos": return c.getString(R.string.videos_string); case "channels": return c.getString(R.string.channels); case "playlists": + case "music_playlists": return c.getString(R.string.playlists); case "tracks": return c.getString(R.string.tracks); @@ -62,15 +64,11 @@ public static String getTranslatedFilterString(final String filter, final Contex case "events": return c.getString(R.string.events); case "music_songs": - return c.getString(R.string.music_songs); - case "music_videos": - return c.getString(R.string.music_videos); + return c.getString(R.string.songs); case "music_albums": - return c.getString(R.string.music_albums); - case "music_playlists": - return c.getString(R.string.music_playlists); + return c.getString(R.string.albums); case "music_artists": - return c.getString(R.string.music_artists); + return c.getString(R.string.artists); default: return filter; } diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 6f72b322645..9df0b7f6143 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -596,9 +596,7 @@ Toggle service, momenteel geselecteerd: Meest geliked NewPipe werd gesloten terwijl het bezig was met het bestand - Music/Nummers - Music/Video\'s - Music/Albums - Music/Afspeellijsten - Music/Artiesten + Nummers + Albums + Artiesten diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 76e018eebbf..4af6149b49e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -150,11 +150,9 @@ Tracks Users Events - Music/Songs - Music/Videos - Music/Albums - Music/Playlists - Music/Artists + Songs + Albums + Artists Yes Later Disabled From 9bbd03c14e9a734d97e05420f072d1881d4889ba Mon Sep 17 00:00:00 2001 From: wb9688 Date: Sat, 4 Apr 2020 16:55:26 +0200 Subject: [PATCH 8/8] Bump NewPipeExtractor version --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index e6a37527d40..6db015b7bc9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,7 +136,7 @@ dependencies { exclude module: 'support-annotations' }) - implementation 'com.github.wb9688:NewPipeExtractor:c1cfdb3356a1024953c506a1849c64d3595f41f6' + implementation 'com.github.TeamNewPipe:NewPipeExtractor:a5155fb562ca99ca4a9c8caa2fd60f2f0a305eb0' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.23.0'