Merge pull request #4350 from 4D17Y4/commenter
Disabled commenter image view on LoadThumbnail set to false
This commit is contained in:
commit
b1ea7d6cbc
3 changed files with 35 additions and 2 deletions
|
@ -1,13 +1,18 @@
|
||||||
package org.schabi.newpipe.info_list.holder;
|
package org.schabi.newpipe.info_list.holder;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.URLSpan;
|
import android.text.style.URLSpan;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.extractor.InfoItem;
|
import org.schabi.newpipe.extractor.InfoItem;
|
||||||
|
@ -31,7 +36,12 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
private static final int COMMENT_DEFAULT_LINES = 2;
|
private static final int COMMENT_DEFAULT_LINES = 2;
|
||||||
private static final int COMMENT_EXPANDED_LINES = 1000;
|
private static final int COMMENT_EXPANDED_LINES = 1000;
|
||||||
private static final Pattern PATTERN = Pattern.compile("(\\d+:)?(\\d+)?:(\\d+)");
|
private static final Pattern PATTERN = Pattern.compile("(\\d+:)?(\\d+)?:(\\d+)");
|
||||||
|
private final String downloadThumbnailKey;
|
||||||
|
private final int commentHorizontalPadding;
|
||||||
|
private final int commentVerticalPadding;
|
||||||
|
|
||||||
|
private SharedPreferences preferences = null;
|
||||||
|
private final RelativeLayout itemRoot;
|
||||||
public final CircleImageView itemThumbnailView;
|
public final CircleImageView itemThumbnailView;
|
||||||
private final TextView itemContentView;
|
private final TextView itemContentView;
|
||||||
private final TextView itemLikesCountView;
|
private final TextView itemLikesCountView;
|
||||||
|
@ -65,11 +75,20 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
final ViewGroup parent) {
|
final ViewGroup parent) {
|
||||||
super(infoItemBuilder, layoutId, parent);
|
super(infoItemBuilder, layoutId, parent);
|
||||||
|
|
||||||
|
itemRoot = itemView.findViewById(R.id.itemRoot);
|
||||||
itemThumbnailView = itemView.findViewById(R.id.itemThumbnailView);
|
itemThumbnailView = itemView.findViewById(R.id.itemThumbnailView);
|
||||||
itemLikesCountView = itemView.findViewById(R.id.detail_thumbs_up_count_view);
|
itemLikesCountView = itemView.findViewById(R.id.detail_thumbs_up_count_view);
|
||||||
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);
|
||||||
|
|
||||||
|
downloadThumbnailKey = infoItemBuilder.getContext().
|
||||||
|
getString(R.string.download_thumbnail_key);
|
||||||
|
|
||||||
|
commentHorizontalPadding = (int) infoItemBuilder.getContext()
|
||||||
|
.getResources().getDimension(R.dimen.comments_horizontal_padding);
|
||||||
|
commentVerticalPadding = (int) infoItemBuilder.getContext()
|
||||||
|
.getResources().getDimension(R.dimen.comments_vertical_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommentsMiniInfoItemHolder(final InfoItemBuilder infoItemBuilder,
|
public CommentsMiniInfoItemHolder(final InfoItemBuilder infoItemBuilder,
|
||||||
|
@ -85,11 +104,24 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
}
|
}
|
||||||
final CommentsInfoItem item = (CommentsInfoItem) infoItem;
|
final CommentsInfoItem item = (CommentsInfoItem) infoItem;
|
||||||
|
|
||||||
|
preferences = PreferenceManager.getDefaultSharedPreferences(itemBuilder.getContext());
|
||||||
|
|
||||||
itemBuilder.getImageLoader()
|
itemBuilder.getImageLoader()
|
||||||
.displayImage(item.getUploaderAvatarUrl(),
|
.displayImage(item.getUploaderAvatarUrl(),
|
||||||
itemThumbnailView,
|
itemThumbnailView,
|
||||||
ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS);
|
ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS);
|
||||||
|
|
||||||
|
if (preferences.getBoolean(downloadThumbnailKey, true)) {
|
||||||
|
itemThumbnailView.setVisibility(View.VISIBLE);
|
||||||
|
itemRoot.setPadding(commentVerticalPadding, commentVerticalPadding,
|
||||||
|
commentVerticalPadding, commentVerticalPadding);
|
||||||
|
} else {
|
||||||
|
itemThumbnailView.setVisibility(View.GONE);
|
||||||
|
itemRoot.setPadding(commentHorizontalPadding, commentVerticalPadding,
|
||||||
|
commentHorizontalPadding, commentVerticalPadding);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
itemThumbnailView.setOnClickListener(view -> openCommentAuthor(item));
|
itemThumbnailView.setOnClickListener(view -> openCommentAuthor(item));
|
||||||
|
|
||||||
streamUrl = item.getUrl();
|
streamUrl = item.getUrl();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:padding="@dimen/video_item_search_padding">
|
android:padding="@dimen/comments_vertical_padding">
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
android:id="@+id/itemThumbnailView"
|
android:id="@+id/itemThumbnailView"
|
||||||
|
@ -30,7 +30,6 @@
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginBottom="@dimen/video_item_search_image_right_margin"
|
android:layout_marginBottom="@dimen/video_item_search_image_right_margin"
|
||||||
android:layout_toEndOf="@+id/itemThumbnailView"
|
android:layout_toEndOf="@+id/itemThumbnailView"
|
||||||
android:layout_toRightOf="@+id/itemThumbnailView"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
<dimen name="video_item_detail_description_to_details_margin">4dp</dimen>
|
<dimen name="video_item_detail_description_to_details_margin">4dp</dimen>
|
||||||
<dimen name="software_component_item_padding">8dp</dimen>
|
<dimen name="software_component_item_padding">8dp</dimen>
|
||||||
<dimen name="channel_item_grid_padding">12dp</dimen>
|
<dimen name="channel_item_grid_padding">12dp</dimen>
|
||||||
|
<dimen name="comments_horizontal_padding">16dp</dimen>
|
||||||
|
<dimen name="comments_vertical_padding">12dp</dimen>
|
||||||
|
|
||||||
<!-- Players padding & sizes -->
|
<!-- Players padding & sizes -->
|
||||||
<dimen name="player_main_controls_padding">16dp</dimen>
|
<dimen name="player_main_controls_padding">16dp</dimen>
|
||||||
|
|
Loading…
Reference in a new issue