summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david@procyon.(none)>2010-04-25 17:52:37 (GMT)
committerDavid A. Madore <david@procyon.(none)>2010-04-25 17:52:37 (GMT)
commit8d56c5f19480646445fc277ee14addad597617c6 (patch)
tree6f434096f0bf5aea755de407b239a99d3d002a0c
parentd63ec044325c153fc1bfb3913b207a961382316e (diff)
downloadUnicodeMap-8d56c5f19480646445fc277ee14addad597617c6.zip
UnicodeMap-8d56c5f19480646445fc277ee14addad597617c6.tar.gz
UnicodeMap-8d56c5f19480646445fc277ee14addad597617c6.tar.bz2
Start using a non-trivial layout. So far, doesn't do much.
-rw-r--r--res/layout/main_layout.xml28
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeListActivity.java16
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeMapActivity.java1
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();