From c1a67ff1f8b07d6427201395753c1edb8eb4e308 Mon Sep 17 00:00:00 2001 From: Ritvik Saraf <13ritvik@gmail.com> Date: Fri, 7 Dec 2018 06:45:33 +0530 Subject: [PATCH] minor scrolling fix and ellipsize fix --- .../android/support/design/widget/FlingBehavior.java | 3 +++ .../info_list/holder/CommentsMiniInfoItemHolder.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/android/support/design/widget/FlingBehavior.java b/app/src/main/java/android/support/design/widget/FlingBehavior.java index a453d302b..59eb08294 100644 --- a/app/src/main/java/android/support/design/widget/FlingBehavior.java +++ b/app/src/main/java/android/support/design/widget/FlingBehavior.java @@ -30,6 +30,9 @@ public final class FlingBehavior extends AppBarLayout.Behavior { // We're scrolling down } else { // We're scrolling up + if (mOffsetAnimator != null && mOffsetAnimator.isRunning()) { + mOffsetAnimator.cancel(); + } min = -child.getUpNestedPreScrollRange(); max = 0; consumed[1] = scroll(coordinatorLayout, child, dy, min, max); diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java index 046cadc3f..bf63c7c2d 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java @@ -1,7 +1,10 @@ package org.schabi.newpipe.info_list.holder; import android.support.v7.app.AppCompatActivity; +import android.text.SpannableString; import android.text.TextUtils; +import android.text.method.LinkMovementMethod; +import android.text.util.Linkify; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -15,6 +18,7 @@ import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.util.ImageDisplayConstants; import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.NavigationHelper; +import org.schabi.newpipe.views.TouchTextView; import de.hdodenhof.circleimageview.CircleImageView; @@ -31,9 +35,9 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder { super(infoItemBuilder, layoutId, parent); itemThumbnailView = itemView.findViewById(R.id.itemThumbnailView); - itemContentView = itemView.findViewById(R.id.itemCommentContentView); itemLikesCountView = itemView.findViewById(R.id.detail_thumbs_up_count_view); itemDislikesCountView = itemView.findViewById(R.id.detail_thumbs_down_count_view); + itemContentView = itemView.findViewById(R.id.itemCommentContentView); } public CommentsMiniInfoItemHolder(InfoItemBuilder infoItemBuilder, ViewGroup parent) { @@ -66,6 +70,12 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder { } }); + // ellipsize if not already ellipsized + if (null == itemContentView.getEllipsize()) { + itemContentView.setEllipsize(TextUtils.TruncateAt.END); + itemContentView.setMaxLines(commentDefaultLines); + } + itemContentView.setText(item.getCommentText()); if (null != item.getLikeCount()) { itemLikesCountView.setText(String.valueOf(item.getLikeCount()));