2018-04-23 22:02:36 +02:00
|
|
|
package org.schabi.newpipe.local.holder;
|
2018-02-06 06:32:23 +01:00
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
import android.text.TextUtils;
|
2018-02-06 06:32:23 +01:00
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
|
|
|
import org.schabi.newpipe.database.LocalItem;
|
|
|
|
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
|
2018-04-23 22:02:36 +02:00
|
|
|
import org.schabi.newpipe.local.LocalItemBuilder;
|
2019-08-14 11:42:39 +02:00
|
|
|
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
2018-02-06 06:32:23 +01:00
|
|
|
import org.schabi.newpipe.util.Localization;
|
2023-05-02 11:08:32 +02:00
|
|
|
import org.schabi.newpipe.util.image.PicassoHelper;
|
2022-06-21 21:45:10 +02:00
|
|
|
import org.schabi.newpipe.util.ServiceHelper;
|
2018-02-06 06:32:23 +01:00
|
|
|
|
2020-10-18 08:16:55 +02:00
|
|
|
import java.time.format.DateTimeFormatter;
|
2018-02-06 06:32:23 +01:00
|
|
|
|
|
|
|
public class RemotePlaylistItemHolder extends PlaylistItemHolder {
|
2022-04-14 10:59:52 +02:00
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
public RemotePlaylistItemHolder(final LocalItemBuilder infoItemBuilder,
|
|
|
|
final ViewGroup parent) {
|
2022-04-16 06:00:02 +02:00
|
|
|
super(infoItemBuilder, parent);
|
2018-02-06 06:32:23 +01:00
|
|
|
}
|
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
RemotePlaylistItemHolder(final LocalItemBuilder infoItemBuilder, final int layoutId,
|
|
|
|
final ViewGroup parent) {
|
2018-08-31 13:34:32 +02:00
|
|
|
super(infoItemBuilder, layoutId, parent);
|
|
|
|
}
|
|
|
|
|
2018-02-06 06:32:23 +01:00
|
|
|
@Override
|
2020-03-31 19:20:15 +02:00
|
|
|
public void updateFromItem(final LocalItem localItem,
|
|
|
|
final HistoryRecordManager historyRecordManager,
|
2020-10-18 08:16:55 +02:00
|
|
|
final DateTimeFormatter dateTimeFormatter) {
|
2020-03-31 19:20:15 +02:00
|
|
|
if (!(localItem instanceof PlaylistRemoteEntity)) {
|
|
|
|
return;
|
|
|
|
}
|
2018-02-06 06:32:23 +01:00
|
|
|
final PlaylistRemoteEntity item = (PlaylistRemoteEntity) localItem;
|
|
|
|
|
|
|
|
itemTitleView.setText(item.getName());
|
2020-03-20 21:43:17 +01:00
|
|
|
itemStreamCountView.setText(Localization.localizeStreamCountMini(
|
|
|
|
itemStreamCountView.getContext(), item.getStreamCount()));
|
2019-10-17 03:56:31 +02:00
|
|
|
// Here is where the uploader name is set in the bookmarked playlists library
|
2019-12-10 20:18:49 +01:00
|
|
|
if (!TextUtils.isEmpty(item.getUploader())) {
|
2019-12-06 16:35:14 +01:00
|
|
|
itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(),
|
2022-06-21 21:45:10 +02:00
|
|
|
ServiceHelper.getNameOfServiceById(item.getServiceId())));
|
2019-12-06 16:35:14 +01:00
|
|
|
} else {
|
2022-06-21 21:45:10 +02:00
|
|
|
itemUploaderView.setText(ServiceHelper.getNameOfServiceById(item.getServiceId()));
|
2019-10-17 03:56:31 +02:00
|
|
|
}
|
|
|
|
|
2021-03-27 14:37:44 +01:00
|
|
|
PicassoHelper.loadPlaylistThumbnail(item.getThumbnailUrl()).into(itemThumbnailView);
|
2018-02-06 06:32:23 +01:00
|
|
|
|
2020-10-18 08:16:55 +02:00
|
|
|
super.updateFromItem(localItem, historyRecordManager, dateTimeFormatter);
|
2018-02-06 06:32:23 +01:00
|
|
|
}
|
|
|
|
}
|