summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/char_details.xml1
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeCharacter.java3
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeMapActivity.java24
4 files changed, 29 insertions, 0 deletions
diff --git a/res/layout/char_details.xml b/res/layout/char_details.xml
index 3912ae5..8d99be4 100644
--- a/res/layout/char_details.xml
+++ b/res/layout/char_details.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/detailsLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9dd3d63..73e6c28 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7,6 +7,7 @@
<string name="copy_button">Copy</string>
<string name="copied_toast">Copied to clipboard</string>
<string name="empty_list">(Empty!)</string>
+ <string name="unihan_lookup">Unihan lookup</string>
<string name="menu_go">Go</string>
<string name="go_title">Go to char number</string>
<string name="go_button">Go</string>
diff --git a/src/org/madore/android/unicodeMap/UnicodeCharacter.java b/src/org/madore/android/unicodeMap/UnicodeCharacter.java
index 5d53ccb..e79a982 100644
--- a/src/org/madore/android/unicodeMap/UnicodeCharacter.java
+++ b/src/org/madore/android/unicodeMap/UnicodeCharacter.java
@@ -225,6 +225,9 @@ public class UnicodeCharacter implements UnicodeDisplayable {
public boolean belongs(int codePoint) {
return ( codePoint>=this.from && codePoint<this.to );
}
+ public boolean belongs(UnicodeCharacter ch) {
+ return ( ch.codePoint>=this.from && ch.codePoint<this.to );
+ }
@Override
public String toString() { return this.descr; }
}
diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
index 01f5fdb..f50ef1f 100644
--- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
+++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
@@ -327,6 +327,30 @@ public final class UnicodeMapActivity extends ListActivity {
text.setText(new String(s));
text = (TextView) dialog.findViewById(R.id.categoryLabel);
text.setText(itch.getCategory().getDescr());
+ if ( UnicodeCharacter.Range.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A.belongs(itch)
+ || UnicodeCharacter.Range.CJK_UNIFIED_IDEOGRAPHS.belongs(itch)
+ || UnicodeCharacter.Range.CJK_COMPATIBILITY_IDEOGRAPHS.belongs(itch)
+ || UnicodeCharacter.Range.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B.belongs(itch)
+ || UnicodeCharacter.Range.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C.belongs(itch)
+ || UnicodeCharacter.Range.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT.belongs(itch) ) {
+ Button btn = new Button(UnicodeMapActivity.this);
+ btn.setText(R.string.unihan_lookup);
+ ((LinearLayout) dialog.findViewById(R.id.detailsLayout))
+ .addView(btn,
+ ViewGroup.LayoutParams.FILL_PARENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT);
+ final String tgt
+ = String.format("http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%04X",
+ itch.getCodePoint());
+ btn.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View view) {
+ Intent intent
+ = new Intent(Intent.ACTION_VIEW,
+ Uri.parse(tgt));
+ startActivity(intent);
+ }
+ });
+ }
dialog.show();
return true;
} else if ( it instanceof UnicodeRangeable ) {