Make heart visible in android studio and move logic to the right file.
This commit is contained in:
parent
74173317de
commit
bfac73b992
|
@ -1,6 +1,8 @@
|
||||||
package org.schabi.newpipe.info_list.holder;
|
package org.schabi.newpipe.info_list.holder;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -31,11 +33,13 @@ import org.schabi.newpipe.local.history.HistoryRecordManager;
|
||||||
|
|
||||||
public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
|
public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
|
||||||
public final TextView itemTitleView;
|
public final TextView itemTitleView;
|
||||||
|
private final ImageView itemHeartView;
|
||||||
|
|
||||||
public CommentsInfoItemHolder(final InfoItemBuilder infoItemBuilder, final ViewGroup parent) {
|
public CommentsInfoItemHolder(final InfoItemBuilder infoItemBuilder, final ViewGroup parent) {
|
||||||
super(infoItemBuilder, R.layout.list_comments_item, parent);
|
super(infoItemBuilder, R.layout.list_comments_item, parent);
|
||||||
|
|
||||||
itemTitleView = itemView.findViewById(R.id.itemTitleView);
|
itemTitleView = itemView.findViewById(R.id.itemTitleView);
|
||||||
|
itemHeartView = itemView.findViewById(R.id.detail_heart_image_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,5 +53,7 @@ public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
|
||||||
final CommentsInfoItem item = (CommentsInfoItem) infoItem;
|
final CommentsInfoItem item = (CommentsInfoItem) infoItem;
|
||||||
|
|
||||||
itemTitleView.setText(item.getUploaderName());
|
itemTitleView.setText(item.getUploaderName());
|
||||||
|
|
||||||
|
itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.text.style.URLSpan;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -46,7 +45,6 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
private final TextView itemContentView;
|
private final TextView itemContentView;
|
||||||
private final TextView itemLikesCountView;
|
private final TextView itemLikesCountView;
|
||||||
private final TextView itemDislikesCountView;
|
private final TextView itemDislikesCountView;
|
||||||
private final ImageView itemHeartView;
|
|
||||||
private final TextView itemPublishedTime;
|
private final TextView itemPublishedTime;
|
||||||
|
|
||||||
private String commentText;
|
private String commentText;
|
||||||
|
@ -82,7 +80,6 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
itemDislikesCountView = itemView.findViewById(R.id.detail_thumbs_down_count_view);
|
itemDislikesCountView = itemView.findViewById(R.id.detail_thumbs_down_count_view);
|
||||||
itemPublishedTime = itemView.findViewById(R.id.itemPublishedTime);
|
itemPublishedTime = itemView.findViewById(R.id.itemPublishedTime);
|
||||||
itemContentView = itemView.findViewById(R.id.itemCommentContentView);
|
itemContentView = itemView.findViewById(R.id.itemCommentContentView);
|
||||||
itemHeartView = itemView.findViewById(R.id.detail_heart_image_view);
|
|
||||||
|
|
||||||
downloadThumbnailKey = infoItemBuilder.getContext().
|
downloadThumbnailKey = infoItemBuilder.getContext().
|
||||||
getString(R.string.download_thumbnail_key);
|
getString(R.string.download_thumbnail_key);
|
||||||
|
@ -155,12 +152,6 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
itemPublishedTime.setText(item.getTextualUploadDate());
|
itemPublishedTime.setText(item.getTextualUploadDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.isHeartedByUploader()) {
|
|
||||||
itemHeartView.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
itemHeartView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
itemView.setOnClickListener(view -> {
|
itemView.setOnClickListener(view -> {
|
||||||
toggleEllipsize();
|
toggleEllipsize();
|
||||||
if (itemBuilder.getOnCommentsSelectedListener() != null) {
|
if (itemBuilder.getOnCommentsSelectedListener() != null) {
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
android:layout_toRightOf="@+id/detail_thumbs_up_count_view"
|
android:layout_toRightOf="@+id/detail_thumbs_up_count_view"
|
||||||
android:contentDescription="@string/detail_heart_img_view_description"
|
android:contentDescription="@string/detail_heart_img_view_description"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"
|
||||||
app:srcCompat="@drawable/ic_heart" />
|
app:srcCompat="@drawable/ic_heart" />
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue