From bd2b32bfbc790c29f3b93dd8f0c232975622aac7 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Mon, 14 Oct 2019 11:55:55 -0600 Subject: [PATCH 01/30] Fixed Playlists With No Uploader Crashing The App --- .../playlist/model/PlaylistRemoteEntity.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index bf446ca1f..c6a96ec13 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -16,6 +16,8 @@ import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.RE import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_TABLE; import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_URL; +import android.text.TextUtils; + @Entity(tableName = REMOTE_PLAYLIST_TABLE, indices = { @Index(value = {REMOTE_PLAYLIST_NAME}), @@ -72,10 +74,18 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { - return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && + boolean returnMe; + if (!TextUtils.isEmpty(getUploader())) { // If the playlist has an uploader + returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()) && getUploader().equals(info.getUploaderName()); + } else { // Else ignore uploader + returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && + getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && + getThumbnailUrl().equals(info.getThumbnailUrl()); + } + return returnMe; } public long getUid() { From 3794002c7b77bd17ba4ece5d9b6545c88a2cc92a Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Mon, 14 Oct 2019 14:56:04 -0600 Subject: [PATCH 02/30] much simpler, "uploader" will never change on a playlist --- .../playlist/model/PlaylistRemoteEntity.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index c6a96ec13..e23b1cf20 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -74,18 +74,9 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { - boolean returnMe; - if (!TextUtils.isEmpty(getUploader())) { // If the playlist has an uploader - returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && + return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && - getThumbnailUrl().equals(info.getThumbnailUrl()) && - getUploader().equals(info.getUploaderName()); - } else { // Else ignore uploader - returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && - getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && - getThumbnailUrl().equals(info.getThumbnailUrl()); - } - return returnMe; + getThumbnailUrl().equals(info.getThumbnailUrl()); } public long getUid() { From cb5c219ffe0dc67b8868d30ac7c97e7d38abbb4f Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Mon, 14 Oct 2019 16:37:58 -0600 Subject: [PATCH 03/30] Added a restart song button to signle track expanded notification ... and some comments to the code --- .../schabi/newpipe/player/BackgroundPlayer.java | 14 ++++++++++++-- .../res/layout/player_notification_expanded.xml | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index ab07ded22..42ed546f1 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -219,20 +219,30 @@ public final class BackgroundPlayer extends Service { remoteViews.setOnClickPendingIntent(R.id.notificationContent, PendingIntent.getActivity(this, NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)); - if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { + // Lets check if we are playing more than one song in the background + if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { // If we have more than one song + // Use track skiping for forward and back remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_previous); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_next); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_NEXT), PendingIntent.FLAG_UPDATE_CURRENT)); - } else { + // We dont need a restart track button (skip track backwards) + remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.INVISIBLE); + } else { // But if we only have one song + // Use time skipping for fastforward/rewind remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_rewind); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_fastforward); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_REWIND), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_FORWARD), PendingIntent.FLAG_UPDATE_CURRENT)); + // Add a restart track button (skip track backwards) + remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.VISIBLE); + remoteViews.setOnClickPendingIntent(R.id.notificationRestartTrack, + PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); + } setRepeatModeIcon(remoteViews, basePlayerImpl.getRepeatMode()); diff --git a/app/src/main/res/layout/player_notification_expanded.xml b/app/src/main/res/layout/player_notification_expanded.xml index 090642303..d8ed96bf0 100644 --- a/app/src/main/res/layout/player_notification_expanded.xml +++ b/app/src/main/res/layout/player_notification_expanded.xml @@ -116,6 +116,22 @@ android:src="@drawable/ic_repeat_white" tools:ignore="ContentDescription"/> + + Date: Mon, 14 Oct 2019 16:41:38 -0600 Subject: [PATCH 04/30] Revert "Added a restart song button to signle track expanded notification" This reverts commit cb5c219ffe0dc67b8868d30ac7c97e7d38abbb4f. --- .../schabi/newpipe/player/BackgroundPlayer.java | 14 ++------------ .../res/layout/player_notification_expanded.xml | 16 ---------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index 42ed546f1..ab07ded22 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -219,30 +219,20 @@ public final class BackgroundPlayer extends Service { remoteViews.setOnClickPendingIntent(R.id.notificationContent, PendingIntent.getActivity(this, NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)); - // Lets check if we are playing more than one song in the background - if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { // If we have more than one song - // Use track skiping for forward and back + if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_previous); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_next); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_NEXT), PendingIntent.FLAG_UPDATE_CURRENT)); - // We dont need a restart track button (skip track backwards) - remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.INVISIBLE); - } else { // But if we only have one song - // Use time skipping for fastforward/rewind + } else { remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_rewind); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_fastforward); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_REWIND), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_FORWARD), PendingIntent.FLAG_UPDATE_CURRENT)); - // Add a restart track button (skip track backwards) - remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.VISIBLE); - remoteViews.setOnClickPendingIntent(R.id.notificationRestartTrack, - PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); - } setRepeatModeIcon(remoteViews, basePlayerImpl.getRepeatMode()); diff --git a/app/src/main/res/layout/player_notification_expanded.xml b/app/src/main/res/layout/player_notification_expanded.xml index d8ed96bf0..090642303 100644 --- a/app/src/main/res/layout/player_notification_expanded.xml +++ b/app/src/main/res/layout/player_notification_expanded.xml @@ -116,22 +116,6 @@ android:src="@drawable/ic_repeat_white" tools:ignore="ContentDescription"/> - - Date: Mon, 14 Oct 2019 16:48:44 -0600 Subject: [PATCH 05/30] Explain What we did in the code itself --- .../database/playlist/model/PlaylistRemoteEntity.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index e23b1cf20..f57f8c5d9 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -74,6 +74,15 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { + // Returns boolean comparing the online playlist and the local copy. + // (False if info changed such as playlist name or track count) + // [Note that we don't check if the playlist creator changed: + // getUploader().equals(info.getUploaderName()) + // because this would crash the app on playlists that are auto-generated with no creator, + // and the creator can not change to my knowledge. + // if you need this functionality back please use + // getUploader() == info.getUploaderName() + // instead as it will work with blank names (Null value if I remember correctly). return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()); From c93c52a58ce62b132f353eec8da5db7b0c009116 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Mon, 14 Oct 2019 16:55:16 -0600 Subject: [PATCH 06/30] Wrap in multiline comment so it colapses --- .../newpipe/database/playlist/model/PlaylistRemoteEntity.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index f57f8c5d9..2fc6cfde7 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -74,6 +74,7 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { + /* // Returns boolean comparing the online playlist and the local copy. // (False if info changed such as playlist name or track count) // [Note that we don't check if the playlist creator changed: @@ -83,6 +84,7 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { // if you need this functionality back please use // getUploader() == info.getUploaderName() // instead as it will work with blank names (Null value if I remember correctly). + */ return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()); From bfc987f81b482ecab1669c3c35f3bd5b5107f33f Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Mon, 14 Oct 2019 18:01:15 -0600 Subject: [PATCH 07/30] Revert "Revert "Added a restart song button to signle track expanded notification"" This reverts commit 646e327ed2972811c595cac6d0543baaad61e44b. --- .../schabi/newpipe/player/BackgroundPlayer.java | 14 ++++++++++++-- .../res/layout/player_notification_expanded.xml | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index ab07ded22..42ed546f1 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -219,20 +219,30 @@ public final class BackgroundPlayer extends Service { remoteViews.setOnClickPendingIntent(R.id.notificationContent, PendingIntent.getActivity(this, NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)); - if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { + // Lets check if we are playing more than one song in the background + if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { // If we have more than one song + // Use track skiping for forward and back remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_previous); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_next); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_NEXT), PendingIntent.FLAG_UPDATE_CURRENT)); - } else { + // We dont need a restart track button (skip track backwards) + remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.INVISIBLE); + } else { // But if we only have one song + // Use time skipping for fastforward/rewind remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_rewind); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_fastforward); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_REWIND), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_FORWARD), PendingIntent.FLAG_UPDATE_CURRENT)); + // Add a restart track button (skip track backwards) + remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.VISIBLE); + remoteViews.setOnClickPendingIntent(R.id.notificationRestartTrack, + PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); + } setRepeatModeIcon(remoteViews, basePlayerImpl.getRepeatMode()); diff --git a/app/src/main/res/layout/player_notification_expanded.xml b/app/src/main/res/layout/player_notification_expanded.xml index 090642303..d8ed96bf0 100644 --- a/app/src/main/res/layout/player_notification_expanded.xml +++ b/app/src/main/res/layout/player_notification_expanded.xml @@ -116,6 +116,22 @@ android:src="@drawable/ic_repeat_white" tools:ignore="ContentDescription"/> + + Date: Tue, 15 Oct 2019 07:18:06 -0600 Subject: [PATCH 08/30] Fixes Improved --- .../playlist/model/PlaylistRemoteEntity.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index 2fc6cfde7..d51267220 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -16,8 +16,6 @@ import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.RE import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_TABLE; import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_URL; -import android.text.TextUtils; - @Entity(tableName = REMOTE_PLAYLIST_TABLE, indices = { @Index(value = {REMOTE_PLAYLIST_NAME}), @@ -75,19 +73,18 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { /* - // Returns boolean comparing the online playlist and the local copy. - // (False if info changed such as playlist name or track count) - // [Note that we don't check if the playlist creator changed: - // getUploader().equals(info.getUploaderName()) - // because this would crash the app on playlists that are auto-generated with no creator, - // and the creator can not change to my knowledge. - // if you need this functionality back please use - // getUploader() == info.getUploaderName() - // instead as it will work with blank names (Null value if I remember correctly). + * Returns boolean comparing the online playlist and the local copy. + * (False if info changed such as playlist name or track count) + * [Note that + * getUploader().equals(info.getUploaderName()) + * crashes the app on playlists that are auto-generated with no creator, + * please use + * getUploader() == info.getUploaderName() + * instead as it will work with blank names (Null value if I remember correctly). */ return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && - getThumbnailUrl().equals(info.getThumbnailUrl()); + getThumbnailUrl().equals(info.getThumbnailUrl()) && getUploader() == info.getUploaderName(); } public long getUid() { From c68c35e0846cbecbbd1b35280d8647b2a4e74a23 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 07:19:11 -0600 Subject: [PATCH 09/30] Better FIx, Improved Comment Style --- .../playlist/model/PlaylistRemoteEntity.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index 2fc6cfde7..a3efa20d5 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -16,8 +16,6 @@ import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.RE import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_TABLE; import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_URL; -import android.text.TextUtils; - @Entity(tableName = REMOTE_PLAYLIST_TABLE, indices = { @Index(value = {REMOTE_PLAYLIST_NAME}), @@ -75,19 +73,18 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { /* - // Returns boolean comparing the online playlist and the local copy. - // (False if info changed such as playlist name or track count) - // [Note that we don't check if the playlist creator changed: - // getUploader().equals(info.getUploaderName()) - // because this would crash the app on playlists that are auto-generated with no creator, - // and the creator can not change to my knowledge. - // if you need this functionality back please use - // getUploader() == info.getUploaderName() - // instead as it will work with blank names (Null value if I remember correctly). - */ + * Returns boolean comparing the online playlist and the local copy. + * (False if info changed such as playlist name or track count) + * [Note that + * getUploader().equals(info.getUploaderName()) + * crashes the app on playlists that are auto-generated with no creator, + * please use + * getUploader() == info.getUploaderName() + * instead as it will work with blank names (Null value if I remember correctly). + */ return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && - getThumbnailUrl().equals(info.getThumbnailUrl()); + getThumbnailUrl().equals(info.getThumbnailUrl()) && getUploader() == info.getUploaderName(); } public long getUid() { From 4106645d6e89a2fbff494e3db4c482cfa1ded8f1 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 08:40:51 -0600 Subject: [PATCH 10/30] Polished Results --- .../playlist/model/PlaylistRemoteEntity.java | 27 +++++++++++++------ .../list/playlist/PlaylistFragment.java | 6 ++++- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index a3efa20d5..e3b38851b 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -1,14 +1,19 @@ package org.schabi.newpipe.database.playlist.model; +import android.text.TextUtils; +import android.util.Log; + import androidx.room.ColumnInfo; import androidx.room.Entity; import androidx.room.Ignore; import androidx.room.Index; import androidx.room.PrimaryKey; +import org.schabi.newpipe.BuildConfig; import org.schabi.newpipe.database.playlist.PlaylistLocalItem; import org.schabi.newpipe.extractor.playlist.PlaylistInfo; import org.schabi.newpipe.util.Constants; +import org.w3c.dom.Text; import static org.schabi.newpipe.database.LocalItem.LocalItemType.PLAYLIST_REMOTE_ITEM; import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_NAME; @@ -72,19 +77,25 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { + String TAG = "isIdenticalTo"; + boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release"); /* * Returns boolean comparing the online playlist and the local copy. * (False if info changed such as playlist name or track count) - * [Note that - * getUploader().equals(info.getUploaderName()) - * crashes the app on playlists that are auto-generated with no creator, - * please use - * getUploader() == info.getUploaderName() - * instead as it will work with blank names (Null value if I remember correctly). */ - return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && + boolean returnMe = true; + String uploaderAction = ""; + if (!TextUtils.isEmpty(getUploader()) || !TextUtils.isEmpty(info.getUploaderName())) { // We have an uploader, add it to the comparison + returnMe &= getUploader().equals(info.getUploaderName()); // Use .equals for uploader names + uploaderAction = "We compared uploaders: "+returnMe; + } else { + uploaderAction = "No Uploader"; + } + returnMe &= getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && - getThumbnailUrl().equals(info.getThumbnailUrl()) && getUploader() == info.getUploaderName(); + getThumbnailUrl().equals(info.getThumbnailUrl()); + if (DEBUG) Log.d(TAG, TAG+" Called With Result: "+returnMe+". And Uploader Action: "+uploaderAction); + return returnMe; } public long getUid() { 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 32b83bb22..c2defb0de 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 @@ -259,7 +259,8 @@ public class PlaylistFragment extends BaseListInfoFragment { animateView(headerRootLayout, true, 100); animateView(headerUploaderLayout, true, 300); headerUploaderLayout.setOnClickListener(null); - if (!TextUtils.isEmpty(result.getUploaderName())) { + if (!TextUtils.isEmpty(result.getUploaderName())) { // If we have an uploader : Put them into the ui + //headerUploaderLayout.setVisibility(View.VISIBLE); headerUploaderName.setText(result.getUploaderName()); if (!TextUtils.isEmpty(result.getUploaderUrl())) { headerUploaderLayout.setOnClickListener(v -> { @@ -273,6 +274,9 @@ public class PlaylistFragment extends BaseListInfoFragment { } }); } + } else { // Else : hide the uploader section + //headerUploaderLayout.setVisibility(View.INVISIBLE); + headerUploaderName.setText("Auto-Generated"); } playlistCtrl.setVisibility(View.VISIBLE); From 8c73253a52c3765ea54ffcaaa9406dfb84186d23 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 08:48:36 -0600 Subject: [PATCH 11/30] follow stye on debug --- .../database/playlist/model/PlaylistRemoteEntity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index e3b38851b..3c9085069 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -13,7 +13,6 @@ import org.schabi.newpipe.BuildConfig; import org.schabi.newpipe.database.playlist.PlaylistLocalItem; import org.schabi.newpipe.extractor.playlist.PlaylistInfo; import org.schabi.newpipe.util.Constants; -import org.w3c.dom.Text; import static org.schabi.newpipe.database.LocalItem.LocalItemType.PLAYLIST_REMOTE_ITEM; import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_NAME; @@ -87,14 +86,14 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { String uploaderAction = ""; if (!TextUtils.isEmpty(getUploader()) || !TextUtils.isEmpty(info.getUploaderName())) { // We have an uploader, add it to the comparison returnMe &= getUploader().equals(info.getUploaderName()); // Use .equals for uploader names - uploaderAction = "We compared uploaders: "+returnMe; + uploaderAction = "compared uploaders: "+returnMe; } else { - uploaderAction = "No Uploader"; + uploaderAction = "no uploader"; } returnMe &= getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()); - if (DEBUG) Log.d(TAG, TAG+" Called With Result: "+returnMe+". And Uploader Action: "+uploaderAction); + if (DEBUG) Log.d(TAG, TAG+"() called with result: returnMe = "+returnMe+". and uploaderAction: "+uploaderAction); return returnMe; } From cc1e5edaec8784e56f69ba8a110a39909a8803b5 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 08:52:51 -0600 Subject: [PATCH 12/30] Revert "Merge branch 'dev-all-changes' into dev" This reverts commit f6060261a194d8744e73ee4c0c9d272d7198ec0c, reversing changes made to 8c73253a52c3765ea54ffcaaa9406dfb84186d23. --- .../schabi/newpipe/player/BackgroundPlayer.java | 14 ++------------ .../res/layout/player_notification_expanded.xml | 16 ---------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index 42ed546f1..ab07ded22 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -219,30 +219,20 @@ public final class BackgroundPlayer extends Service { remoteViews.setOnClickPendingIntent(R.id.notificationContent, PendingIntent.getActivity(this, NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)); - // Lets check if we are playing more than one song in the background - if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { // If we have more than one song - // Use track skiping for forward and back + if (basePlayerImpl.playQueue != null && basePlayerImpl.playQueue.size() > 1) { remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_previous); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_next); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_NEXT), PendingIntent.FLAG_UPDATE_CURRENT)); - // We dont need a restart track button (skip track backwards) - remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.INVISIBLE); - } else { // But if we only have one song - // Use time skipping for fastforward/rewind + } else { remoteViews.setInt(R.id.notificationFRewind, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_rewind); remoteViews.setInt(R.id.notificationFForward, SET_IMAGE_RESOURCE_METHOD, R.drawable.exo_controls_fastforward); remoteViews.setOnClickPendingIntent(R.id.notificationFRewind, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_REWIND), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.notificationFForward, PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_FAST_FORWARD), PendingIntent.FLAG_UPDATE_CURRENT)); - // Add a restart track button (skip track backwards) - remoteViews.setViewVisibility(R.id.notificationRestartTrack, View.VISIBLE); - remoteViews.setOnClickPendingIntent(R.id.notificationRestartTrack, - PendingIntent.getBroadcast(this, NOTIFICATION_ID, new Intent(ACTION_PLAY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT)); - } setRepeatModeIcon(remoteViews, basePlayerImpl.getRepeatMode()); diff --git a/app/src/main/res/layout/player_notification_expanded.xml b/app/src/main/res/layout/player_notification_expanded.xml index d8ed96bf0..090642303 100644 --- a/app/src/main/res/layout/player_notification_expanded.xml +++ b/app/src/main/res/layout/player_notification_expanded.xml @@ -116,22 +116,6 @@ android:src="@drawable/ic_repeat_white" tools:ignore="ContentDescription"/> - - Date: Tue, 15 Oct 2019 09:01:30 -0600 Subject: [PATCH 13/30] describe what "Auto-Generated" Means --- .../newpipe/fragments/list/playlist/PlaylistFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c2defb0de..3bd03508b 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 @@ -276,7 +276,7 @@ public class PlaylistFragment extends BaseListInfoFragment { } } else { // Else : hide the uploader section //headerUploaderLayout.setVisibility(View.INVISIBLE); - headerUploaderName.setText("Auto-Generated"); + headerUploaderName.setText("Auto-Generated (no uploader found)"); } playlistCtrl.setVisibility(View.VISIBLE); From df2bb228c5ed6a7d5d39c8f342865c3578c81614 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 09:11:04 -0600 Subject: [PATCH 14/30] Much Simpler Fix --- .../database/playlist/model/PlaylistRemoteEntity.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index 3c9085069..4a7ff06d2 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -83,17 +83,10 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { * (False if info changed such as playlist name or track count) */ boolean returnMe = true; - String uploaderAction = ""; - if (!TextUtils.isEmpty(getUploader()) || !TextUtils.isEmpty(info.getUploaderName())) { // We have an uploader, add it to the comparison - returnMe &= getUploader().equals(info.getUploaderName()); // Use .equals for uploader names - uploaderAction = "compared uploaders: "+returnMe; - } else { - uploaderAction = "no uploader"; - } returnMe &= getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && - getThumbnailUrl().equals(info.getThumbnailUrl()); - if (DEBUG) Log.d(TAG, TAG+"() called with result: returnMe = "+returnMe+". and uploaderAction: "+uploaderAction); + getThumbnailUrl().equals(info.getThumbnailUrl()) && TextUtils.equals(getUploader(), info.getUploaderName()); + if (DEBUG) Log.d(TAG, TAG+"() called with result: returnMe = "+returnMe); return returnMe; } From 9c00e7f45cd00330599bbec191cc5f5288dd4032 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 12:49:24 -0600 Subject: [PATCH 15/30] Using Strings still need to find out why its null on the library --- .../newpipe/fragments/list/playlist/PlaylistFragment.java | 2 +- app/src/main/res/values/strings.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 3bd03508b..38ae88efa 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 @@ -276,7 +276,7 @@ public class PlaylistFragment extends BaseListInfoFragment { } } else { // Else : hide the uploader section //headerUploaderLayout.setVisibility(View.INVISIBLE); - headerUploaderName.setText("Auto-Generated (no uploader found)"); + headerUploaderName.setText(R.string.playlist_no_uploader); } playlistCtrl.setVisibility(View.VISIBLE); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cb7adfe75..70bd9e0a8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -428,6 +428,7 @@ Playlisted Playlist thumbnail changed. Could not delete playlist. + Auto-Generated (no uploader found) No Captions Fit From 797e1a105d7f40d5b9a9c613df049c670a16c741 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 14:02:37 -0600 Subject: [PATCH 16/30] Comment out debuging code --- .../playlist/model/PlaylistRemoteEntity.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index 4a7ff06d2..1a1474f80 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -76,18 +76,18 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { - String TAG = "isIdenticalTo"; - boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release"); + //String TAG = "isIdenticalTo"; + //boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release"); /* * Returns boolean comparing the online playlist and the local copy. * (False if info changed such as playlist name or track count) */ - boolean returnMe = true; - returnMe &= getServiceId() == info.getServiceId() && getName().equals(info.getName()) && + //boolean returnMe = true; + return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()) && TextUtils.equals(getUploader(), info.getUploaderName()); - if (DEBUG) Log.d(TAG, TAG+"() called with result: returnMe = "+returnMe); - return returnMe; + //if (DEBUG) Log.d(TAG, TAG+"() called with result: returnMe = "+returnMe); + //return returnMe; } public long getUid() { From ad2de3a828707ef36ddbb355569bc491ce2f2869 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 15 Oct 2019 17:22:17 -0600 Subject: [PATCH 17/30] only use TextUtils.equals (fixes more crashes) --- .../database/playlist/model/PlaylistRemoteEntity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index 1a1474f80..75515b33a 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -83,9 +83,12 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { * (False if info changed such as playlist name or track count) */ //boolean returnMe = true; - return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && - getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && - getThumbnailUrl().equals(info.getThumbnailUrl()) && TextUtils.equals(getUploader(), info.getUploaderName()); + return getServiceId() == info.getServiceId() + && getStreamCount() == info.getStreamCount() + && TextUtils.equals(getName(), info.getName()) + && TextUtils.equals(getUrl(), info.getUrl()) + && TextUtils.equals(getThumbnailUrl(), info.getThumbnailUrl()) + && TextUtils.equals(getUploader(), info.getUploaderName()); //if (DEBUG) Log.d(TAG, TAG+"() called with result: returnMe = "+returnMe); //return returnMe; } From 87378fc79c0f89f06a4cb335389f3ce2dde6fb71 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Wed, 16 Oct 2019 19:56:31 -0600 Subject: [PATCH 18/30] Fixed library showing null --- .../database/playlist/model/PlaylistRemoteEntity.java | 7 ------- .../newpipe/local/holder/RemotePlaylistItemHolder.java | 5 +++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index 75515b33a..fa257cfed 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -1,7 +1,6 @@ package org.schabi.newpipe.database.playlist.model; import android.text.TextUtils; -import android.util.Log; import androidx.room.ColumnInfo; import androidx.room.Entity; @@ -9,7 +8,6 @@ import androidx.room.Ignore; import androidx.room.Index; import androidx.room.PrimaryKey; -import org.schabi.newpipe.BuildConfig; import org.schabi.newpipe.database.playlist.PlaylistLocalItem; import org.schabi.newpipe.extractor.playlist.PlaylistInfo; import org.schabi.newpipe.util.Constants; @@ -76,21 +74,16 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { - //String TAG = "isIdenticalTo"; - //boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release"); /* * Returns boolean comparing the online playlist and the local copy. * (False if info changed such as playlist name or track count) */ - //boolean returnMe = true; return getServiceId() == info.getServiceId() && getStreamCount() == info.getStreamCount() && TextUtils.equals(getName(), info.getName()) && TextUtils.equals(getUrl(), info.getUrl()) && TextUtils.equals(getThumbnailUrl(), info.getThumbnailUrl()) && TextUtils.equals(getUploader(), info.getUploaderName()); - //if (DEBUG) Log.d(TAG, TAG+"() called with result: returnMe = "+returnMe); - //return returnMe; } public long getUid() { 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 f9542850e..b30a6230d 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 @@ -28,8 +28,13 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder { itemTitleView.setText(item.getName()); itemStreamCountView.setText(String.valueOf(item.getStreamCount())); + // Here is where the uploader name is set in the bookmarked playlists library itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), NewPipe.getNameOfService(item.getServiceId()))); + if (item.getUploader() == null) { + itemUploaderView.setText(NewPipe.getNameOfService(item.getServiceId())); + } + itemBuilder.displayImage(item.getThumbnailUrl(), itemThumbnailView, ImageDisplayConstants.DISPLAY_PLAYLIST_OPTIONS); From 8f46757c0dda80ca32ac15381dbf65bc367ef171 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Wed, 16 Oct 2019 20:32:12 -0600 Subject: [PATCH 19/30] New no uploader, still needs a way to programaticly switch preferably they can both be the same file and modified at runtime --- app/src/main/res/layout/playlist_header.xml | 34 +++---- .../layout/playlist_header_no_uploader.xml | 94 +++++++++++++++++++ 2 files changed, 111 insertions(+), 17 deletions(-) create mode 100644 app/src/main/res/layout/playlist_header_no_uploader.xml diff --git a/app/src/main/res/layout/playlist_header.xml b/app/src/main/res/layout/playlist_header.xml index f49ca295d..93fde3b8f 100644 --- a/app/src/main/res/layout/playlist_header.xml +++ b/app/src/main/res/layout/playlist_header.xml @@ -33,8 +33,6 @@ android:layout_marginLeft="4dp" android:layout_marginRight="6dp" android:layout_marginTop="6dp" - android:layout_toLeftOf="@+id/playlist_stream_count" - android:layout_toStartOf="@+id/playlist_stream_count" android:background="?attr/selectableItemBackground" android:gravity="left|center_vertical" android:padding="2dp" @@ -65,23 +63,25 @@ tools:ignore="RtlHardcoded" tools:text="Typical uploader name"/> - - + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 7d80d04f343263fcc2408aae7ea78e9b6035e06d Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Fri, 6 Dec 2019 08:32:45 -0700 Subject: [PATCH 20/30] Remove unused code pt1 --- .../newpipe/fragments/list/playlist/PlaylistFragment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 38ae88efa..21ff73d49 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 @@ -275,7 +275,6 @@ public class PlaylistFragment extends BaseListInfoFragment { }); } } else { // Else : hide the uploader section - //headerUploaderLayout.setVisibility(View.INVISIBLE); headerUploaderName.setText(R.string.playlist_no_uploader); } @@ -448,4 +447,4 @@ public class PlaylistFragment extends BaseListInfoFragment { playlistBookmarkButton.setIcon(ThemeHelper.resolveResourceIdFromAttr(activity, iconAttr)); playlistBookmarkButton.setTitle(titleRes); } -} \ No newline at end of file +} From c05633979c7abffbae9f85c31be1f7520c2393d2 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Fri, 6 Dec 2019 08:35:14 -0700 Subject: [PATCH 21/30] Update app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java Co-Authored-By: Redirion --- .../newpipe/local/holder/RemotePlaylistItemHolder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 b30a6230d..e73d1000b 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 @@ -31,7 +31,10 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder { // Here is where the uploader name is set in the bookmarked playlists library itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), NewPipe.getNameOfService(item.getServiceId()))); - if (item.getUploader() == null) { + if (item.getUploader() != null) { + itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), + NewPipe.getNameOfService(item.getServiceId()))); + } else { itemUploaderView.setText(NewPipe.getNameOfService(item.getServiceId())); } From 693756bdd6b5cfead25c286d16b12b1fb3aa7835 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Fri, 6 Dec 2019 08:36:57 -0700 Subject: [PATCH 22/30] Removed redundant. Related to last merge --- .../schabi/newpipe/local/holder/RemotePlaylistItemHolder.java | 2 -- 1 file changed, 2 deletions(-) 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 e73d1000b..105eb6a68 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 @@ -29,8 +29,6 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder { itemTitleView.setText(item.getName()); itemStreamCountView.setText(String.valueOf(item.getStreamCount())); // Here is where the uploader name is set in the bookmarked playlists library - itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), - NewPipe.getNameOfService(item.getServiceId()))); if (item.getUploader() != null) { itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), NewPipe.getNameOfService(item.getServiceId()))); From ae88b4c697e5bcb24f9dbe5095b10b61bacfd84b Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Fri, 6 Dec 2019 08:38:15 -0700 Subject: [PATCH 23/30] remove unused code pt2 --- .../newpipe/fragments/list/playlist/PlaylistFragment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 21ff73d49..6941741af 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 @@ -260,7 +260,6 @@ public class PlaylistFragment extends BaseListInfoFragment { animateView(headerUploaderLayout, true, 300); headerUploaderLayout.setOnClickListener(null); if (!TextUtils.isEmpty(result.getUploaderName())) { // If we have an uploader : Put them into the ui - //headerUploaderLayout.setVisibility(View.VISIBLE); headerUploaderName.setText(result.getUploaderName()); if (!TextUtils.isEmpty(result.getUploaderUrl())) { headerUploaderLayout.setOnClickListener(v -> { @@ -274,7 +273,7 @@ public class PlaylistFragment extends BaseListInfoFragment { } }); } - } else { // Else : hide the uploader section + } else { // Else : say we have no uploader headerUploaderName.setText(R.string.playlist_no_uploader); } From 054279d5535ed4e086ca56531d5b458743f2ae26 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 10 Dec 2019 09:37:57 -0700 Subject: [PATCH 24/30] Update app/src/main/res/values/strings.xml Co-Authored-By: Stypox --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 23b8f9c36..a0e84974c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -444,7 +444,7 @@ Playlisted Playlist thumbnail changed. Could not delete playlist. - Auto-Generated (no uploader found) + Auto-generated (no uploader found) No Captions Fit From 7844547e4f44ad4a76703887b4df98132b94e717 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 10 Dec 2019 09:44:02 -0700 Subject: [PATCH 25/30] not used --- .../layout/playlist_header_no_uploader.xml | 94 ------------------- 1 file changed, 94 deletions(-) delete mode 100644 app/src/main/res/layout/playlist_header_no_uploader.xml diff --git a/app/src/main/res/layout/playlist_header_no_uploader.xml b/app/src/main/res/layout/playlist_header_no_uploader.xml deleted file mode 100644 index 0f692c690..000000000 --- a/app/src/main/res/layout/playlist_header_no_uploader.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 68a14073141829017b82ec73b17b9a1a2365e3e3 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 10 Dec 2019 09:48:16 -0700 Subject: [PATCH 26/30] Dont update this --- app/src/main/res/layout/playlist_header.xml | 36 ++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/src/main/res/layout/playlist_header.xml b/app/src/main/res/layout/playlist_header.xml index 93fde3b8f..c599a53a5 100644 --- a/app/src/main/res/layout/playlist_header.xml +++ b/app/src/main/res/layout/playlist_header.xml @@ -33,6 +33,8 @@ android:layout_marginLeft="4dp" android:layout_marginRight="6dp" android:layout_marginTop="6dp" + android:layout_toLeftOf="@+id/playlist_stream_count" + android:layout_toStartOf="@+id/playlist_stream_count" android:background="?attr/selectableItemBackground" android:gravity="left|center_vertical" android:padding="2dp" @@ -63,24 +65,22 @@ tools:ignore="RtlHardcoded" tools:text="Typical uploader name"/> - - + + - \ No newline at end of file + From ea70a1f334cf90550d16e90575a59dd4dd4ac882 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 10 Dec 2019 09:50:33 -0700 Subject: [PATCH 27/30] no change --- app/src/main/res/layout/playlist_header.xml | 34 ++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src/main/res/layout/playlist_header.xml b/app/src/main/res/layout/playlist_header.xml index 93fde3b8f..f49ca295d 100644 --- a/app/src/main/res/layout/playlist_header.xml +++ b/app/src/main/res/layout/playlist_header.xml @@ -33,6 +33,8 @@ android:layout_marginLeft="4dp" android:layout_marginRight="6dp" android:layout_marginTop="6dp" + android:layout_toLeftOf="@+id/playlist_stream_count" + android:layout_toStartOf="@+id/playlist_stream_count" android:background="?attr/selectableItemBackground" android:gravity="left|center_vertical" android:padding="2dp" @@ -63,24 +65,22 @@ tools:ignore="RtlHardcoded" tools:text="Typical uploader name"/> - - + + Date: Tue, 10 Dec 2019 09:50:53 -0700 Subject: [PATCH 28/30] Revert "Merge branch 'dev' of https://github.com/PeterHindes/NewPipe into dev" This reverts commit 23ee22566daa27b6021081a8916db349aa3ec43d, reversing changes made to ea70a1f334cf90550d16e90575a59dd4dd4ac882. --- app/src/main/res/layout/playlist_header.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/playlist_header.xml b/app/src/main/res/layout/playlist_header.xml index c599a53a5..f49ca295d 100644 --- a/app/src/main/res/layout/playlist_header.xml +++ b/app/src/main/res/layout/playlist_header.xml @@ -90,4 +90,4 @@ - + \ No newline at end of file From 19fb8cfbfe705dec2315ab90c6fa8bcfcb2730b7 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 10 Dec 2019 12:13:04 -0700 Subject: [PATCH 29/30] Update app/src/main/java/org/schabi/newpipe/local/holder/RemotePlaylistItemHolder.java Co-Authored-By: Redirion --- .../schabi/newpipe/local/holder/RemotePlaylistItemHolder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 105eb6a68..6dacee4d0 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 @@ -29,7 +29,7 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder { itemTitleView.setText(item.getName()); itemStreamCountView.setText(String.valueOf(item.getStreamCount())); // Here is where the uploader name is set in the bookmarked playlists library - if (item.getUploader() != null) { + if (!TextUtils.isEmpty(item.getUploader)) { itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), NewPipe.getNameOfService(item.getServiceId()))); } else { From b365973ac62007fa1c6d22ecfbc927cf00278490 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Tue, 10 Dec 2019 12:18:49 -0700 Subject: [PATCH 30/30] fix last recomendation. syntax and imports --- .../schabi/newpipe/local/holder/RemotePlaylistItemHolder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 6dacee4d0..8bb16c318 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 @@ -10,6 +10,8 @@ import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.util.ImageDisplayConstants; import org.schabi.newpipe.util.Localization; +import android.text.TextUtils; + import java.text.DateFormat; public class RemotePlaylistItemHolder extends PlaylistItemHolder { @@ -29,7 +31,7 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder { itemTitleView.setText(item.getName()); itemStreamCountView.setText(String.valueOf(item.getStreamCount())); // Here is where the uploader name is set in the bookmarked playlists library - if (!TextUtils.isEmpty(item.getUploader)) { + if (!TextUtils.isEmpty(item.getUploader())) { itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), NewPipe.getNameOfService(item.getServiceId()))); } else {