diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeMapActivity.java | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java index 9db0476..f82382b 100644 --- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java +++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java @@ -29,6 +29,7 @@ public final class UnicodeMapActivity extends ListActivity { protected UnicodeDatabase db; protected ListView lv; + protected ClipboardManager cmgr; protected static abstract class Display { protected String title; @@ -300,11 +301,11 @@ public final class UnicodeMapActivity extends ListActivity { } public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { - UnicodeDisplayable it + final UnicodeDisplayable it = (UnicodeDisplayable)parent.getItemAtPosition(position); if ( it instanceof UnicodeCharacter ) { - UnicodeCharacter itch = (UnicodeCharacter)it; - Dialog dialog = new Dialog(UnicodeMapActivity.this); + final UnicodeCharacter itch = (UnicodeCharacter)it; + final Dialog dialog = new Dialog(UnicodeMapActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setOwnerActivity(UnicodeMapActivity.this); dialog.setContentView(R.layout.char_details); @@ -327,6 +328,23 @@ public final class UnicodeMapActivity extends ListActivity { text.setText(new String(s)); text = (TextView) dialog.findViewById(R.id.categoryLabel); text.setText(itch.getCategory().getDescr()); + final Button copyCharButton = (Button) dialog.findViewById(R.id.copyCharButton); + copyCharButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + dialog.dismiss(); + cmgr.setText(itch.getChar()); + Toast.makeText(UnicodeMapActivity.this, + R.string.copied_toast, + Toast.LENGTH_SHORT).show(); + } + }); + final Button appendCharButton = (Button) dialog.findViewById(R.id.appendCharButton); + appendCharButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + dialog.dismiss(); + textForm.append(itch.getChar()); + } + }); if ( UnicodeCharacter.Range.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A.belongs(itch) || UnicodeCharacter.Range.CJK_UNIFIED_IDEOGRAPHS.belongs(itch) || UnicodeCharacter.Range.CJK_COMPATIBILITY_IDEOGRAPHS.belongs(itch) @@ -393,6 +411,7 @@ public final class UnicodeMapActivity extends ListActivity { if ( needPopulate ) launchPopulation(); lv = getListView(); + cmgr = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); Object testament = getLastNonConfigurationInstance(); if ( testament != null ) { @SuppressWarnings("unchecked") @@ -405,8 +424,6 @@ public final class UnicodeMapActivity extends ListActivity { lv.setSelectionFromTop(saved.getSelPosition(), saved.getYOffset()); } else doDisplay(new RootDisplay(), true); - final ClipboardManager cmgr - = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); final Button btn = (Button) findViewById(R.id.copyButton); textForm = (EditText) findViewById(R.id.edit); btn.setOnClickListener(new View.OnClickListener() { |