diff options
author | David A. Madore <david+git@madore.org> | 2010-05-01 23:49:00 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2010-05-01 23:49:00 +0200 |
commit | 8553c842d6eb73c2c775ad8db5047781aec230dd (patch) | |
tree | b2eb16041895ec8a96f4130e437e91dc33b120ed /src | |
parent | 1c6eb70f0640269304041982f7514df92b047776 (diff) | |
download | UnicodeMap-8553c842d6eb73c2c775ad8db5047781aec230dd.tar.gz UnicodeMap-8553c842d6eb73c2c775ad8db5047781aec230dd.tar.bz2 UnicodeMap-8553c842d6eb73c2c775ad8db5047781aec230dd.zip |
Provide links to Unihan database on www.unicode.org for CJK ideographs.
Diffstat (limited to 'src')
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeCharacter.java | 3 | ||||
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeMapActivity.java | 24 |
2 files changed, 27 insertions, 0 deletions
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 ) { |