X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=96f385e9c048ac78c6cfe2469d6748e85521ae9b;hb=c79058e796a2f2555c9f361934e733c4e31e08df;hp=34ea4f646a00a5fd6a436682f36890b383b79daf;hpb=79a9eb18c67443c7a2591a597f57aa8e3c828c87;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 34ea4f6..96f385e 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -32,6 +32,7 @@ import android.text.Selection; import android.text.Spannable; import android.text.TextWatcher; import android.text.method.LinkMovementMethod; +import android.text.style.ClickableSpan; import android.text.style.StyleSpan; import android.util.Log; import android.util.TypedValue; @@ -1261,6 +1262,7 @@ public class DictionaryActivity extends ListActivity { final TextViewLongClickListener textViewLongClickListenerIndex0 = new TextViewLongClickListener( 0); textView.setOnLongClickListener(textViewLongClickListenerIndex0); + result.setLongClickable(true); // Doesn't work: // textView.setTextColor(android.R.color.secondary_text_light); @@ -1278,9 +1280,16 @@ public class DictionaryActivity extends ListActivity { tableRow.addView(textView); if (!htmlEntries.isEmpty()) { - final ImageButton button = new ImageButton(context); - button.setImageResource(R.drawable.ic_menu_forward); - button.setOnClickListener(new OnClickListener() { + final ClickableSpan clickableSpan = new ClickableSpan() { + @Override + public void onClick(View widget) { + } + }; + ((Spannable) textView.getText()).setSpan(clickableSpan, 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); + result.setClickable(true); + textView.setClickable(true); + textView.setMovementMethod(LinkMovementMethod.getInstance()); + textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final String html = HtmlEntry.htmlBody(htmlEntries, index.shortName); @@ -1291,14 +1300,7 @@ public class DictionaryActivity extends ListActivity { 0); } }); - tableRow.addView(button); - lp = new TableRow.LayoutParams(1); - lp.weight = 0.0f; - button.setLayoutParams(lp); - // result.setColumnStretchable(0, true); - // result.setColumnStretchable(1, false); } - result.setLongClickable(true); return result; }