From cddec9d933c4bc46e4bec6094630ea7a19fd6860 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Mon, 26 Apr 2010 19:17:24 +0200 Subject: Move certain constant strings to resources. --- res/layout/main_layout.xml | 11 ++++++----- res/values/strings.xml | 7 ++++++- src/org/madore/android/unicodeMap/UnicodeMapActivity.java | 13 +++++++------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/res/layout/main_layout.xml b/res/layout/main_layout.xml index 9500f4d..571a2dc 100644 --- a/res/layout/main_layout.xml +++ b/res/layout/main_layout.xml @@ -7,6 +7,11 @@ android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" /> + + android:text="@string/copy_button" /> - diff --git a/res/values/strings.xml b/res/values/strings.xml index 6409dea..605a255 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,4 +1,9 @@ - UnicodeMapActivity + Unicode Map + Loading Unicode database + Please wait + Copy + Copied to clipboard + (Empty!) diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java index aee9e71..def8537 100644 --- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java +++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java @@ -20,7 +20,7 @@ public final class UnicodeMapActivity extends ListActivity { protected UnicodeDatabase db; protected final List rootList - = new ArrayList(100); + = new ArrayList(200); protected final List> stack = new ArrayList>(10); @@ -28,8 +28,8 @@ public final class UnicodeMapActivity extends ListActivity { protected void launchPopulation() { final ProgressDialog progress = new ProgressDialog(this); progress.setOwnerActivity(this); - progress.setTitle("Loading Unicode database"); - progress.setMessage("Please wait"); + progress.setTitle(R.string.loading_database_title); + progress.setMessage(getResources().getText(R.string.loading_database_msg)); progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progress.setCancelable(false); progress.show(); @@ -57,7 +57,6 @@ public final class UnicodeMapActivity extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - android.util.Log.v("UnicodeMapActivity", "creating activity"); setContentView(R.layout.main_layout); db = new UnicodeDatabase(this); final boolean needPopulate = db.needPopulate(); @@ -74,7 +73,8 @@ public final class UnicodeMapActivity extends ListActivity { btn.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { cmgr.setText(txt.getText()); - Toast.makeText(getApplicationContext(), "Copied to clipboard", + Toast.makeText(getApplicationContext(), + R.string.copied_toast, Toast.LENGTH_SHORT).show(); } }); @@ -96,7 +96,8 @@ public final class UnicodeMapActivity extends ListActivity { list.add(ch); stack.add(list); setListAdapter(new UnicodeArrayAdapter(UnicodeMapActivity.this, list)); - } + } else + throw new AssertionError("unknown UnicodeDisplayable"); } }); } -- cgit v1.2.3