From 6ea6a4b951913e22a37299a5f6b71b874fd76402 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Fri, 24 Jul 2020 15:37:00 -0400 Subject: [PATCH] fix natgeotravel --- app/build.gradle | 2 ++ .../java/awais/instagrabber/MainHelper.java | 5 ----- .../instagrabber/adapters/FeedAdapter.java | 21 +++---------------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 569eff1e..51118cd3 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,6 +12,8 @@ android { // REMEMBER TO CHANGE versionCode as well // 16.7 is 32 + // next version: fixed natgeotravel mention text problem + versionCode 32 versionName '16.7' diff --git a/app/src/main/java/awais/instagrabber/MainHelper.java b/app/src/main/java/awais/instagrabber/MainHelper.java index 68dd6b16..f18e180b 100755 --- a/app/src/main/java/awais/instagrabber/MainHelper.java +++ b/app/src/main/java/awais/instagrabber/MainHelper.java @@ -962,11 +962,6 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener { boolean ok = false; String action; - // arg: follow / restrict / block - - // restrict https://www.instagram.com/web/restrict_action/(un)restrict/ - // requires form data "target_user_id: " - protected Void doInBackground(String... rawAction) { action = rawAction[0]; final String url = "https://www.instagram.com/web/"+ diff --git a/app/src/main/java/awais/instagrabber/adapters/FeedAdapter.java b/app/src/main/java/awais/instagrabber/adapters/FeedAdapter.java index 2ab2af93..a2dc283d 100755 --- a/app/src/main/java/awais/instagrabber/adapters/FeedAdapter.java +++ b/app/src/main/java/awais/instagrabber/adapters/FeedAdapter.java @@ -227,7 +227,7 @@ public final class FeedAdapter extends RecyclerView.Adapter if (!captionEmpty && Utils.hasMentions(postCaption)) { postCaption = Utils.getMentionText(postCaption); - //feedModel.setPostCaption(postCaption); + feedModel.setPostCaption(postCaption); viewHolder.viewerCaption.setText(postCaption, TextView.BufferType.SPANNABLE); viewHolder.viewerCaption.setMentionClickListener(mentionClickListener); } else { @@ -363,23 +363,8 @@ public final class FeedAdapter extends RecyclerView.Adapter final int minTrim = Math.min(255, i); if (captionLen <= minTrim) return false; - final CharSequence mentionText = caption.subSequence(0, Math.min(captionLen, minTrim)); - final SpannableStringBuilder stringBuilder = new SpannableStringBuilder(mentionText).append(ellipsize); - final int spanLen = stringBuilder.length(); - - // fixed @mention...more merging into one span - final CommentMentionClickSpan[] spans = stringBuilder.getSpans(0, mentionText.length(), CommentMentionClickSpan.class); - if (spans != null) { - for (final CommentMentionClickSpan span : spans) { - final int spanStart = stringBuilder.getSpanStart(span); - stringBuilder.removeSpan(span); - stringBuilder.setSpan(span, spanStart, mentionText.length(), 0); - } - } - - stringBuilder.setSpan(new StyleSpan(Typeface.BOLD), spanLen - ellipsize.length(), spanLen, 0); - - textView.setText(stringBuilder, bufferType); + if (Utils.hasMentions(caption)) + textView.setText(Utils.getMentionText(caption), TextView.BufferType.SPANNABLE); textView.setCaptionIsExpandable(true); textView.setCaptionIsExpanded(true); } else {