]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Simplify adding a ClickableLink span.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 10 Dec 2017 22:57:01 +0000 (23:57 +0100)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 10 Dec 2017 22:57:01 +0000 (23:57 +0100)
src/com/hughes/android/dictionary/DictionaryActivity.java

index 34e37d6322a62181632b1bb372b3d4f9831b3a04..9bf6dbabe9e159102dbfbde3d618ace30e6358a1 100644 (file)
@@ -1726,7 +1726,6 @@ public class DictionaryActivity extends ActionBarActivity {
             // Make it so we can long-click on these token rows, too:
             final Spannable textSpannable = new SpannableString(text);
             createTokenLinkSpans(textView, textSpannable, text);
-            textView.setText(textSpannable);
 
             if (!htmlEntries.isEmpty()) {
                 final ClickableSpan clickableSpan = new ClickableSpan() {
@@ -1734,7 +1733,7 @@ public class DictionaryActivity extends ActionBarActivity {
                     public void onClick(View widget) {
                     }
                 };
-                ((Spannable) textView.getText()).setSpan(clickableSpan, 0, text.length(),
+                textSpannable.setSpan(clickableSpan, 0, text.length(),
                         Spannable.SPAN_INCLUSIVE_INCLUSIVE);
                 textView.setOnClickListener(new OnClickListener() {
                     @Override
@@ -1743,6 +1742,7 @@ public class DictionaryActivity extends ActionBarActivity {
                     }
                 });
             }
+            textView.setText(textSpannable);
             return textView;
         }