From 98742895f8c53ec49022e825168eed953255ba3d Mon Sep 17 00:00:00 2001 From: Thad Hughes Date: Sun, 15 Dec 2013 15:41:28 -0800 Subject: [PATCH] Using icons in QuickSwitch. --- .../hughes/android/dictionary/DictionaryActivity.java | 11 +---------- .../android/dictionary/DictionaryApplication.java | 3 --- .../android/dictionary/DictionaryManagerActivity.java | 4 ++++ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index d99de3c..bf93cec 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -638,15 +638,8 @@ public class DictionaryActivity extends SherlockListActivity { final LinearLayout result = new LinearLayout(parent.getContext()); for (int i = 0; i < dictionaryInfo.indexInfos.size(); ++i) { - if (i > 0) { - final TextView dash = new TextView(parent.getContext()); - dash.setText("-"); - result.addView(dash); - } - final IndexInfo indexInfo = dictionaryInfo.indexInfos.get(i); - final Button button = new Button(parent.getContext()); - button.setText(indexInfo.shortName); + final View button = application.createButton(parent.getContext(), dictionaryInfo, indexInfo); final IntentLauncher intentLauncher = new IntentLauncher(parent.getContext(), getLaunchIntent( application.getPath(dictionaryInfo.uncompressedFilename), @@ -659,7 +652,6 @@ public class DictionaryActivity extends SherlockListActivity { }; button.setOnClickListener(intentLauncher); result.addView(button); - } final TextView nameView = new TextView(parent.getContext()); @@ -672,7 +664,6 @@ public class DictionaryActivity extends SherlockListActivity { layoutParams.weight = 1.0f; nameView.setLayoutParams(layoutParams); result.addView(nameView); - return result; } diff --git a/src/com/hughes/android/dictionary/DictionaryApplication.java b/src/com/hughes/android/dictionary/DictionaryApplication.java index bc64469..c2bb845 100644 --- a/src/com/hughes/android/dictionary/DictionaryApplication.java +++ b/src/com/hughes/android/dictionary/DictionaryApplication.java @@ -290,9 +290,6 @@ public class DictionaryApplication extends Application { } result.setMinimumWidth(languageButtonPixels); result.setMinimumHeight(languageButtonPixels * 2 / 3); - result.setOnClickListener( - new IntentLauncher(context, - DictionaryActivity.getLaunchIntent(getPath(dictionaryInfo.uncompressedFilename), indexInfo.shortName, ""))); // result.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); return result; } diff --git a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java index c06ccc3..e668b76 100644 --- a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java @@ -221,6 +221,7 @@ public class DictionaryManagerActivity extends SherlockActivity { return true; } }); + filterSearchView.setIconifiedByDefault(false); application.onCreateGlobalOptionsMenu(this, menu); return true; @@ -338,6 +339,9 @@ public class DictionaryManagerActivity extends SherlockActivity { final List sortedIndexInfos = application.sortedIndexInfos(dictionaryInfo.indexInfos); for (IndexInfo indexInfo : sortedIndexInfos) { final View button = application.createButton(buttons.getContext(), dictionaryInfo, indexInfo); + button.setOnClickListener( + new IntentLauncher(buttons.getContext(), + DictionaryActivity.getLaunchIntent(application.getPath(dictionaryInfo.uncompressedFilename), indexInfo.shortName, ""))); buttons.addView(button); } -- 2.43.0