minor scrolling fix and ellipsize fix

This commit is contained in:
Ritvik Saraf 2018-12-07 06:45:33 +05:30
parent ff90f257cc
commit c1a67ff1f8
2 changed files with 14 additions and 1 deletions

View file

@ -30,6 +30,9 @@ public final class FlingBehavior extends AppBarLayout.Behavior {
// We're scrolling down // We're scrolling down
} else { } else {
// We're scrolling up // We're scrolling up
if (mOffsetAnimator != null && mOffsetAnimator.isRunning()) {
mOffsetAnimator.cancel();
}
min = -child.getUpNestedPreScrollRange(); min = -child.getUpNestedPreScrollRange();
max = 0; max = 0;
consumed[1] = scroll(coordinatorLayout, child, dy, min, max); consumed[1] = scroll(coordinatorLayout, child, dy, min, max);

View file

@ -1,7 +1,10 @@
package org.schabi.newpipe.info_list.holder; package org.schabi.newpipe.info_list.holder;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.views.TouchTextView;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
@ -31,9 +35,9 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
super(infoItemBuilder, layoutId, parent); super(infoItemBuilder, layoutId, parent);
itemThumbnailView = itemView.findViewById(R.id.itemThumbnailView); itemThumbnailView = itemView.findViewById(R.id.itemThumbnailView);
itemContentView = itemView.findViewById(R.id.itemCommentContentView);
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);
itemContentView = itemView.findViewById(R.id.itemCommentContentView);
} }
public CommentsMiniInfoItemHolder(InfoItemBuilder infoItemBuilder, ViewGroup parent) { 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()); itemContentView.setText(item.getCommentText());
if (null != item.getLikeCount()) { if (null != item.getLikeCount()) {
itemLikesCountView.setText(String.valueOf(item.getLikeCount())); itemLikesCountView.setText(String.valueOf(item.getLikeCount()));