mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-11 01:40:59 +00:00
Merge pull request #2724 from PeterHindes/dev
[Bug Fixed] Playlists With No Uploader No Longer Crash The App When Added To Users Library
This commit is contained in:
commit
0f04dd6dae
@ -1,5 +1,7 @@
|
|||||||
package org.schabi.newpipe.database.playlist.model;
|
package org.schabi.newpipe.database.playlist.model;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.room.ColumnInfo;
|
import androidx.room.ColumnInfo;
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.Ignore;
|
import androidx.room.Ignore;
|
||||||
@ -72,10 +74,16 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem {
|
|||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
public boolean isIdenticalTo(final PlaylistInfo info) {
|
public boolean isIdenticalTo(final PlaylistInfo info) {
|
||||||
return getServiceId() == info.getServiceId() && getName().equals(info.getName()) &&
|
/*
|
||||||
getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) &&
|
* Returns boolean comparing the online playlist and the local copy.
|
||||||
getThumbnailUrl().equals(info.getThumbnailUrl()) &&
|
* (False if info changed such as playlist name or track count)
|
||||||
getUploader().equals(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());
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getUid() {
|
public long getUid() {
|
||||||
|
@ -259,7 +259,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
|||||||
animateView(headerRootLayout, true, 100);
|
animateView(headerRootLayout, true, 100);
|
||||||
animateView(headerUploaderLayout, true, 300);
|
animateView(headerUploaderLayout, true, 300);
|
||||||
headerUploaderLayout.setOnClickListener(null);
|
headerUploaderLayout.setOnClickListener(null);
|
||||||
if (!TextUtils.isEmpty(result.getUploaderName())) {
|
if (!TextUtils.isEmpty(result.getUploaderName())) { // If we have an uploader : Put them into the ui
|
||||||
headerUploaderName.setText(result.getUploaderName());
|
headerUploaderName.setText(result.getUploaderName());
|
||||||
if (!TextUtils.isEmpty(result.getUploaderUrl())) {
|
if (!TextUtils.isEmpty(result.getUploaderUrl())) {
|
||||||
headerUploaderLayout.setOnClickListener(v -> {
|
headerUploaderLayout.setOnClickListener(v -> {
|
||||||
@ -273,6 +273,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else { // Else : say we have no uploader
|
||||||
|
headerUploaderName.setText(R.string.playlist_no_uploader);
|
||||||
}
|
}
|
||||||
|
|
||||||
playlistCtrl.setVisibility(View.VISIBLE);
|
playlistCtrl.setVisibility(View.VISIBLE);
|
||||||
|
@ -10,6 +10,8 @@ import org.schabi.newpipe.local.history.HistoryRecordManager;
|
|||||||
import org.schabi.newpipe.util.ImageDisplayConstants;
|
import org.schabi.newpipe.util.ImageDisplayConstants;
|
||||||
import org.schabi.newpipe.util.Localization;
|
import org.schabi.newpipe.util.Localization;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
|
||||||
public class RemotePlaylistItemHolder extends PlaylistItemHolder {
|
public class RemotePlaylistItemHolder extends PlaylistItemHolder {
|
||||||
@ -28,8 +30,14 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder {
|
|||||||
|
|
||||||
itemTitleView.setText(item.getName());
|
itemTitleView.setText(item.getName());
|
||||||
itemStreamCountView.setText(String.valueOf(item.getStreamCount()));
|
itemStreamCountView.setText(String.valueOf(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(),
|
itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(),
|
||||||
NewPipe.getNameOfService(item.getServiceId())));
|
NewPipe.getNameOfService(item.getServiceId())));
|
||||||
|
} else {
|
||||||
|
itemUploaderView.setText(NewPipe.getNameOfService(item.getServiceId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
itemBuilder.displayImage(item.getThumbnailUrl(), itemThumbnailView,
|
itemBuilder.displayImage(item.getThumbnailUrl(), itemThumbnailView,
|
||||||
ImageDisplayConstants.DISPLAY_PLAYLIST_OPTIONS);
|
ImageDisplayConstants.DISPLAY_PLAYLIST_OPTIONS);
|
||||||
|
@ -455,6 +455,7 @@
|
|||||||
<string name="playlist_add_stream_success">Playlisted</string>
|
<string name="playlist_add_stream_success">Playlisted</string>
|
||||||
<string name="playlist_thumbnail_change_success">Playlist thumbnail changed.</string>
|
<string name="playlist_thumbnail_change_success">Playlist thumbnail changed.</string>
|
||||||
<string name="playlist_delete_failure">Could not delete playlist.</string>
|
<string name="playlist_delete_failure">Could not delete playlist.</string>
|
||||||
|
<string name="playlist_no_uploader">Auto-generated (no uploader found)</string>
|
||||||
<!-- Players -->
|
<!-- Players -->
|
||||||
<string name="caption_none">No Captions</string>
|
<string name="caption_none">No Captions</string>
|
||||||
<string name="resize_fit">Fit</string>
|
<string name="resize_fit">Fit</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user