X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=75751c711c1a165c01dd46544a5d0134c7136c9b;hb=9c501f32b5275b07f2104d65d696c0b4735b021c;hp=96f385e9c048ac78c6cfe2469d6748e85521ae9b;hpb=c79058e796a2f2555c9f361934e733c4e31e08df;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 96f385e..75751c7 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -19,6 +19,7 @@ import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Color; import android.graphics.Typeface; import android.net.Uri; import android.os.Bundle; @@ -50,7 +51,6 @@ import android.view.View.OnLongClickListener; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; -import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.BaseAdapter; import android.widget.Button; @@ -125,6 +125,8 @@ public class DictionaryActivity extends ListActivity { TextToSpeech textToSpeech; volatile boolean ttsReady; + + int textColorFg = Color.BLACK; private final Executor searchExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override @@ -206,6 +208,7 @@ public class DictionaryActivity extends ListActivity { application = (DictionaryApplication) getApplication(); theme = application.getSelectedTheme(); + textColorFg = getResources().getColor(theme.tokenRowFgColor); final Intent intent = getIntent(); dictFile = new File(intent.getStringExtra(C.DICT_FILE)); @@ -218,7 +221,7 @@ public class DictionaryActivity extends ListActivity { updateTTSLanuage(); } }); - + try { final String name = application.getDictionaryName(dictFile.getName()); this.setTitle("QuickDic: " + name); @@ -1322,7 +1325,7 @@ public class DictionaryActivity extends ListActivity { } static final Pattern CHAR_DASH = Pattern.compile("['\\p{L}\\p{M}\\p{N}]+"); - + private void createTokenLinkSpans(final TextView textView, final Spannable spannable, final String text) { // Saw from the source code that LinkMovementMethod sets the selection! @@ -1330,7 +1333,7 @@ public class DictionaryActivity extends ListActivity { textView.setMovementMethod(LinkMovementMethod.getInstance()); final Matcher matcher = CHAR_DASH.matcher(text); while (matcher.find()) { - spannable.setSpan(new NonLinkClickableSpan(), matcher.start(), matcher.end(), + spannable.setSpan(new NonLinkClickableSpan(textColorFg), matcher.start(), matcher.end(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); } }