Fixes issue #232 - Allows text selection

This commit is contained in:
stom79 2018-01-07 16:10:15 +01:00
parent 6a02295047
commit c22cba6c9d
6 changed files with 4 additions and 13 deletions

View File

@ -48,7 +48,6 @@ import android.support.v7.widget.PopupMenu;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

View File

@ -31,6 +31,7 @@ import android.text.Spanned;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.text.style.ImageSpan;
import android.text.style.URLSpan;
import android.util.Patterns;
import android.view.View;
@ -612,6 +613,9 @@ public class Status implements Parcelable{
private SpannableString treatment(final Context context, final SpannableString spannableString){
URLSpan[] urls = spannableString.getSpans(0, spannableString.length(), URLSpan.class);
for(URLSpan span : urls)
spannableString.removeSpan(span);
List<Mention> mentions = this.status.getReblog() != null ? this.status.getReblog().getMentions() : this.status.getMentions();
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);

View File

@ -255,7 +255,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
holder.notification_status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
holder.notification_status_content.setMovementMethod(null);
holder.notification_status_content.setMovementMethod(LinkMovementMethod.getInstance());
boolean displayBoost = sharedpreferences.getBoolean(Helper.SET_DISPLAY_BOOST_COUNT, true);
if( displayBoost) {
@ -267,7 +266,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
Helper.absoluteDateTimeReveal(context, holder.status_date, status.getCreated_at());
holder.status_mention_spoiler.setText(Helper.makeMentionsClick(context,status.getMentions()), TextView.BufferType.SPANNABLE);
holder.status_mention_spoiler.setMovementMethod(null);
holder.status_mention_spoiler.setMovementMethod(LinkMovementMethod.getInstance());
//Adds attachment -> disabled, to enable them uncomment the line below

View File

@ -540,7 +540,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
holder.status_content.setMovementMethod(null);
holder.status_content.setMovementMethod(LinkMovementMethod.getInstance());
//Manages translations
@ -583,7 +582,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
}
});
holder.status_content_translated.setMovementMethod(null);
holder.status_content_translated.setMovementMethod(LinkMovementMethod.getInstance());
//-------- END -> Manages translations
@ -650,7 +648,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
});
holder.status_mention_spoiler.setText(Helper.makeMentionsClick(context,status.getMentions()), TextView.BufferType.SPANNABLE);
holder.status_mention_spoiler.setMovementMethod(null);
holder.status_mention_spoiler.setMovementMethod(LinkMovementMethod.getInstance());
boolean displayBoost = sharedpreferences.getBoolean(Helper.SET_DISPLAY_BOOST_COUNT, true);

View File

@ -94,7 +94,6 @@
<TextView
android:id="@+id/status_spoiler"
android:layout_marginTop="10dp"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
@ -126,7 +125,6 @@
android:id="@+id/notification_status_content"
android:layout_marginTop="10dp"
android:textIsSelectable="true"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
@ -264,7 +262,6 @@
<TextView
android:id="@+id/status_mention_spoiler"
android:layout_marginTop="10dp"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -139,7 +139,6 @@
<TextView
android:id="@+id/status_spoiler"
android:layout_marginTop="10dp"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
@ -170,7 +169,6 @@
android:id="@+id/status_content"
android:textIsSelectable="true"
android:layout_marginTop="10dp"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
@ -182,7 +180,6 @@
android:orientation="vertical">
<TextView
android:id="@+id/status_content_translated"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
@ -394,7 +391,6 @@
<TextView
android:id="@+id/status_mention_spoiler"
android:layout_marginTop="10dp"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>