summaryrefslogtreecommitdiffstats
path: root/src/org/madore
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2012-03-16 18:49:50 +0100
committerDavid A. Madore <david+git@madore.org>2012-03-16 18:49:50 +0100
commit3141ca4e4f232a4efae252fcdb15cc8f84e72fed (patch)
tree52ce28ba7f71dce32e0b571a83ed40cbf04b5126 /src/org/madore
parentec3d53a4066b57cc47b2c0c4880e7566410d20a5 (diff)
downloadUnicodeMap-3141ca4e4f232a4efae252fcdb15cc8f84e72fed.tar.gz
UnicodeMap-3141ca4e4f232a4efae252fcdb15cc8f84e72fed.tar.bz2
UnicodeMap-3141ca4e4f232a4efae252fcdb15cc8f84e72fed.zip
Add copy and append buttons to character popup.
Diffstat (limited to 'src/org/madore')
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeMapActivity.java27
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() {