From 0278ab996f751df3dd735e1d5eeba76248a46618 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Tue, 27 Apr 2010 03:28:16 +0200 Subject: Change title to reflect what is being displayed. --- res/values/strings.xml | 2 ++ .../android/unicodeMap/UnicodeMapActivity.java | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b77be4a..f7fc1c7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,6 +1,7 @@ Unicode Map + Unicode Map: %s Loading Unicode database Please wait Copy @@ -10,5 +11,6 @@ Search in character names Search Case is insensitive and matches whole string; use a % sign as wildcard (e.g.: "latin%letter r%") + search results Only %d first results shown diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java index a13f73a..f9f2a34 100644 --- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java +++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java @@ -31,11 +31,14 @@ public final class UnicodeMapActivity extends ListActivity { public final UnicodeArrayAdapter adapter; public final int selPosition; public final int yOffset; + public final CharSequence title; public ViewHistory(UnicodeArrayAdapter adapter, - int selPosition, int yOffset) { + int selPosition, int yOffset, + CharSequence title) { this.adapter = adapter; this.selPosition = selPosition; this.yOffset = yOffset; + this.title = title; } } @@ -82,7 +85,9 @@ public final class UnicodeMapActivity extends ListActivity { yOffset = selView.getTop(); else yOffset = 0; - historyStack.add(new ViewHistory(adapter, selPosition, yOffset)); + CharSequence title = getTitle(); + historyStack.add(new ViewHistory(adapter, selPosition, yOffset, + title)); } protected void saveView() { @@ -100,7 +105,9 @@ public final class UnicodeMapActivity extends ListActivity { yOffset = view.getTop(); else yOffset = 0; - historyStack.add(new ViewHistory(adapter, position, yOffset)); + CharSequence title = getTitle(); + historyStack.add(new ViewHistory(adapter, position, yOffset, + title)); } protected class MapItemClickListener @@ -124,6 +131,9 @@ public final class UnicodeMapActivity extends ListActivity { list); saveView(view, position); setListAdapter(adapter); + setTitle(String.format(getResources() + .getString(R.string.app_name_spec), + ((UnicodeCharacter.Range)it).getDescr())); } else throw new AssertionError("unknown UnicodeDisplayable"); } @@ -231,6 +241,10 @@ public final class UnicodeMapActivity extends ListActivity { list); saveView(); setListAdapter(adapter); + setTitle(String.format(getResources() + .getString(R.string.app_name_spec), + getResources() + .getString(R.string.search_results))); if ( overflowed ) { String str = getResources().getString(R.string.list_too_long); android.util.Log.e("UnicodeMapActivity", "format is: "+str); @@ -284,6 +298,7 @@ public final class UnicodeMapActivity extends ListActivity { final ListView lv = getListView(); ViewHistory saved = historyStack.remove(historyStack.size()-1); setListAdapter(saved.adapter); + setTitle(saved.title); lv.setSelectionFromTop(saved.selPosition, saved.yOffset); return true; } else if ( keyCode == KeyEvent.KEYCODE_SEARCH ) { -- cgit v1.2.3