diff options
-rw-r--r-- | res/layout/main_layout.xml | 28 | ||||
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeListActivity.java | 16 | ||||
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeMapActivity.java | 1 |
3 files changed, 41 insertions, 4 deletions
diff --git a/res/layout/main_layout.xml b/res/layout/main_layout.xml new file mode 100644 index 0000000..9500f4d --- /dev/null +++ b/res/layout/main_layout.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical"> + <ListView android:id="@id/android:list" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1" /> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:background="#ff808080"> + <EditText android:id="@+id/edit" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" /> + <Button android:id="@+id/button" + android:layout_width="wrap_content" + android:layout_height="fill_parent" + android:text="Copy" /> + </LinearLayout> + <TextView android:id="@id/android:empty" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:text="Nothing here" /> +</LinearLayout> 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<UnicodeCharacter>(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(); |