Make heart visible in android studio and move logic to the right file.

This commit is contained in:
Kalle Struik 2021-07-27 22:34:59 +02:00
parent 74173317de
commit bfac73b992
3 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,8 @@
package org.schabi.newpipe.info_list.holder;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import org.schabi.newpipe.R;
@ -31,11 +33,13 @@ import org.schabi.newpipe.local.history.HistoryRecordManager;
public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
public final TextView itemTitleView;
private final ImageView itemHeartView;
public CommentsInfoItemHolder(final InfoItemBuilder infoItemBuilder, final ViewGroup parent) {
super(infoItemBuilder, R.layout.list_comments_item, parent);
itemTitleView = itemView.findViewById(R.id.itemTitleView);
itemHeartView = itemView.findViewById(R.id.detail_heart_image_view);
}
@Override
@ -49,5 +53,7 @@ public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
final CommentsInfoItem item = (CommentsInfoItem) infoItem;
itemTitleView.setText(item.getUploaderName());
itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE);
}
}

View File

@ -7,7 +7,6 @@ import android.text.style.URLSpan;
import android.text.util.Linkify;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -46,7 +45,6 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
private final TextView itemContentView;
private final TextView itemLikesCountView;
private final TextView itemDislikesCountView;
private final ImageView itemHeartView;
private final TextView itemPublishedTime;
private String commentText;
@ -82,7 +80,6 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
itemDislikesCountView = itemView.findViewById(R.id.detail_thumbs_down_count_view);
itemPublishedTime = itemView.findViewById(R.id.itemPublishedTime);
itemContentView = itemView.findViewById(R.id.itemCommentContentView);
itemHeartView = itemView.findViewById(R.id.detail_heart_image_view);
downloadThumbnailKey = infoItemBuilder.getContext().
getString(R.string.download_thumbnail_key);
@ -155,12 +152,6 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
itemPublishedTime.setText(item.getTextualUploadDate());
}
if (item.isHeartedByUploader()) {
itemHeartView.setVisibility(View.VISIBLE);
} else {
itemHeartView.setVisibility(View.GONE);
}
itemView.setOnClickListener(view -> {
toggleEllipsize();
if (itemBuilder.getOnCommentsSelectedListener() != null) {

View File

@ -80,6 +80,7 @@
android:layout_toRightOf="@+id/detail_thumbs_up_count_view"
android:contentDescription="@string/detail_heart_img_view_description"
android:visibility="gone"
tools:visibility="visible"
app:srcCompat="@drawable/ic_heart" />