From 8d56c5f19480646445fc277ee14addad597617c6 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Sun, 25 Apr 2010 19:52:37 +0200 Subject: Start using a non-trivial layout. So far, doesn't do much. --- .../madore/android/unicodeMap/UnicodeListActivity.java | 16 ++++++++++++---- .../madore/android/unicodeMap/UnicodeMapActivity.java | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/org/madore/android/unicodeMap/UnicodeListActivity.java b/src/org/madore/android/unicodeMap/UnicodeListActivity.java index 1495bbc..a08dbe2 100644 --- a/src/org/madore/android/unicodeMap/UnicodeListActivity.java +++ b/src/org/madore/android/unicodeMap/UnicodeListActivity.java @@ -25,6 +25,7 @@ public final class UnicodeListActivity extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setContentView(R.layout.main_layout); this.db = new UnicodeDatabase(this); Intent intent = getIntent(); int from = intent.getIntExtra(EXTRA_FROM, 0); @@ -35,15 +36,22 @@ public final class UnicodeListActivity extends ListActivity { final ClipboardManager cmgr = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); setListAdapter(new ArrayAdapter(this, R.layout.list_item, list)); - ListView lv = getListView(); + final Button btn = (Button) findViewById(R.id.button); + final EditText txt = (EditText) findViewById(R.id.edit); + btn.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + cmgr.setText(txt.getText()); + Toast.makeText(getApplicationContext(), "Copied to clipboard", + Toast.LENGTH_SHORT).show(); + } + }); + final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) { UnicodeCharacter it = (UnicodeCharacter)parent.getItemAtPosition(position); - Toast.makeText(getApplicationContext(), it.getName(), - Toast.LENGTH_SHORT).show(); - cmgr.setText(new String(Character.toChars(it.getCodePoint()))); + txt.append(new String(Character.toChars(it.getCodePoint()))); } }); diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java index 55cf6ed..de026de 100644 --- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java +++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java @@ -206,6 +206,7 @@ public final class UnicodeMapActivity extends ListActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); android.util.Log.v("UnicodeMapActivity", "creating activity"); + setContentView(R.layout.main_layout); final UnicodeDatabase db = new UnicodeDatabase(this); final boolean needPopulate = db.needPopulate(); db.close(); -- cgit v1.2.3