2018-09-03 01:22:59 +02:00
|
|
|
package org.schabi.newpipe.info_list.holder;
|
|
|
|
|
2021-07-27 22:34:59 +02:00
|
|
|
import android.view.View;
|
2018-09-03 01:22:59 +02:00
|
|
|
import android.view.ViewGroup;
|
2021-07-27 22:34:59 +02:00
|
|
|
import android.widget.ImageView;
|
2018-09-03 01:22:59 +02:00
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import org.schabi.newpipe.R;
|
|
|
|
import org.schabi.newpipe.extractor.InfoItem;
|
|
|
|
import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
|
|
|
|
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
2019-08-14 11:42:39 +02:00
|
|
|
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
2018-09-03 01:22:59 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Created by Christian Schabesberger on 12.02.17.
|
|
|
|
*
|
|
|
|
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
|
|
|
* ChannelInfoItemHolder .java is part of NewPipe.
|
|
|
|
*
|
|
|
|
* NewPipe is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* NewPipe is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
|
|
|
|
public final TextView itemTitleView;
|
2021-07-27 22:34:59 +02:00
|
|
|
private final ImageView itemHeartView;
|
2021-12-24 18:29:34 +01:00
|
|
|
private final ImageView itemPinnedView;
|
2018-09-03 01:22:59 +02:00
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
public CommentsInfoItemHolder(final InfoItemBuilder infoItemBuilder, final ViewGroup parent) {
|
2018-09-03 01:22:59 +02:00
|
|
|
super(infoItemBuilder, R.layout.list_comments_item, parent);
|
|
|
|
|
|
|
|
itemTitleView = itemView.findViewById(R.id.itemTitleView);
|
2021-07-27 22:34:59 +02:00
|
|
|
itemHeartView = itemView.findViewById(R.id.detail_heart_image_view);
|
2021-12-24 18:29:34 +01:00
|
|
|
itemPinnedView = itemView.findViewById(R.id.detail_pinned_view);
|
2018-09-03 01:22:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-03-31 19:20:15 +02:00
|
|
|
public void updateFromItem(final InfoItem infoItem,
|
|
|
|
final HistoryRecordManager historyRecordManager) {
|
2019-08-14 11:42:39 +02:00
|
|
|
super.updateFromItem(infoItem, historyRecordManager);
|
2018-09-03 01:22:59 +02:00
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
if (!(infoItem instanceof CommentsInfoItem)) {
|
|
|
|
return;
|
|
|
|
}
|
2018-09-03 01:22:59 +02:00
|
|
|
final CommentsInfoItem item = (CommentsInfoItem) infoItem;
|
|
|
|
|
2020-04-21 20:08:47 +02:00
|
|
|
itemTitleView.setText(item.getUploaderName());
|
2021-07-27 22:34:59 +02:00
|
|
|
|
|
|
|
itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE);
|
2021-12-24 18:29:34 +01:00
|
|
|
|
|
|
|
itemPinnedView.setVisibility(item.isPinned() ? View.VISIBLE : View.GONE);
|
2018-09-03 01:22:59 +02:00
|
|
|
}
|
|
|
|
}
|