From: Thad Hughes Date: Wed, 25 Jan 2012 19:32:40 +0000 (-0800) Subject: 2nd row in DictionaryManager. X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=commitdiff_plain;h=c332b9768f8b6d1b81137dba2aa6e0cb06c76046 2nd row in DictionaryManager. --- diff --git a/res/values/strings.xml b/res/values/strings.xml index e0ddfba..99f5cd0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -10,7 +10,7 @@ Update (%.1fMB) Move to top Delete dictionary - %1$s=%2$d entries + %1$s: %2$d words 3.1_a diff --git a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java index 6ea4e09..3638aac 100644 --- a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java @@ -31,6 +31,7 @@ import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; +import android.view.ViewGroup.LayoutParams; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; @@ -250,12 +251,20 @@ public class DictionaryManagerActivity extends ListActivity { // Add the information about each index. final LinearLayout row2 = new LinearLayout(parent.getContext()); row2.setOrientation(LinearLayout.HORIZONTAL); + final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); + row2.setLayoutParams(layoutParams); result.addView(row2); + final StringBuilder builder = new StringBuilder(); for (final IndexInfo indexInfo : dictionaryInfo.indexInfos) { - final TextView indexView = new TextView(parent.getContext()); - indexView.setText(getString(R.string.indexInfo, indexInfo.shortName, indexInfo.mainTokenCount)); - row2.addView(indexView); + if (builder.length() > 0) { + builder.append(" | "); + } + builder.append(getString(R.string.indexInfo, indexInfo.shortName, indexInfo.mainTokenCount)); } + final TextView indexView = new TextView(parent.getContext()); + indexView.setText(builder.toString()); + row2.addView(indexView); + // Because we have a Button inside a ListView row: // http://groups.google.com/group/android-developers/browse_thread/thread/3d96af1530a7d62a?pli=1