summaryrefslogtreecommitdiffstats
path: root/src/org/madore
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2013-09-04 22:30:06 +0200
committerDavid A. Madore <david+git@madore.org>2013-09-04 22:30:06 +0200
commitb0124ceb30ebde2aa7ff42351d4160f5cb85d8c2 (patch)
tree4256afa542808a557f558fbbf49babe53a68c66b /src/org/madore
parent47f5265ebe5e2c5a6ae2e4e40f620426f7eb15ed (diff)
downloadUnicodeMap-master.tar.gz
UnicodeMap-master.tar.bz2
UnicodeMap-master.zip
Indicate character block (and not just category) in details.HEADmaster
Diffstat (limited to 'src/org/madore')
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeCharacter.java15
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeMapActivity.java18
2 files changed, 31 insertions, 2 deletions
diff --git a/src/org/madore/android/unicodeMap/UnicodeCharacter.java b/src/org/madore/android/unicodeMap/UnicodeCharacter.java
index 0228644..89c83be 100644
--- a/src/org/madore/android/unicodeMap/UnicodeCharacter.java
+++ b/src/org/madore/android/unicodeMap/UnicodeCharacter.java
@@ -233,7 +233,8 @@ public class UnicodeCharacter implements UnicodeDisplayable {
TAGS(0xE0000, 0xE007F, "Tags"),
VARIATION_SELECTORS_SUPPLEMENT(0xE0100, 0xE01EF, "Variation Selectors Supplement"),
SUPPLEMENTARY_PRIVATE_USE_AREA_A(0xF0000, 0xFFFFF, "Supplementary Private Use Area-A"),
- SUPPLEMENTARY_PRIVATE_USE_AREA_B(0x100000, 0x10FFFF, "Supplementary Private Use Area-B");
+ SUPPLEMENTARY_PRIVATE_USE_AREA_B(0x100000, 0x10FFFF, "Supplementary Private Use Area-B"),
+ UNASSIGNED(0x110000, 0x110000, "Not Assigned");
protected final int from; protected final int to;
protected final String descr;
Range(int from, int last, String descr) {
@@ -422,6 +423,7 @@ public class UnicodeCharacter implements UnicodeDisplayable {
protected final int codePoint;
protected final String name;
+ protected Range range;
protected final Category category;
protected final boolean isUnicode;
protected final String charStr;
@@ -441,6 +443,7 @@ public class UnicodeCharacter implements UnicodeDisplayable {
public UnicodeCharacter(int codePoint, String name, Category category) {
this.codePoint = codePoint;
this.name = name;
+ this.range = null;
this.category = category;
this.isUnicode = true;
this.charStr = makeCharStr();
@@ -451,6 +454,7 @@ public class UnicodeCharacter implements UnicodeDisplayable {
boolean isUnicode) {
this.codePoint = codePoint;
this.name = name;
+ this.range = null;
this.category = category;
this.isUnicode = isUnicode;
this.charStr = makeCharStr();
@@ -465,6 +469,15 @@ public class UnicodeCharacter implements UnicodeDisplayable {
return this.name;
}
+ public Range getRange() {
+ if ( this.range != null )
+ return this.range;
+ for ( Range r : Range.values() )
+ if ( this.codePoint >= r.from && this.codePoint < r.to )
+ return this.range = r;
+ return this.range = Range.UNASSIGNED;
+ }
+
public Category getCategory() {
return this.category;
}
diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
index 57e6a5e..c72549d 100644
--- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
+++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
@@ -191,7 +191,8 @@ public final class UnicodeMapActivity extends ListActivity {
&& rng != UnicodeCharacter.Range.LOW_SURROGATES
&& rng != UnicodeCharacter.Range.PRIVATE_USE_AREA
&& rng != UnicodeCharacter.Range.SUPPLEMENTARY_PRIVATE_USE_AREA_A
- && rng != UnicodeCharacter.Range.SUPPLEMENTARY_PRIVATE_USE_AREA_B )
+ && rng != UnicodeCharacter.Range.SUPPLEMENTARY_PRIVATE_USE_AREA_B
+ && rng != UnicodeCharacter.Range.UNASSIGNED )
list.add(rng);
disp.setListCache(list);
adapter = new UnicodeArrayAdapter(this, list);
@@ -339,6 +340,8 @@ public final class UnicodeMapActivity extends ListActivity {
fmt.format(" 0x%02x", bytes[i]);
text.setText(new String(s));
textMakeSelectableIfPossible(text);
+ text = (TextView) dialog.findViewById(R.id.rangeLabel);
+ text.setText(itch.getRange().getDescr());
text = (TextView) dialog.findViewById(R.id.categoryLabel);
text.setText(itch.getCategory().getDescr());
final Button copyCharButton = (Button) dialog.findViewById(R.id.copyCharButton);
@@ -358,6 +361,19 @@ public final class UnicodeMapActivity extends ListActivity {
textForm.append(itch.getChar());
}
});
+ final Button copyCodeButton = (Button) dialog.findViewById(R.id.copyCodeButton);
+ copyCodeButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View view) {
+ dialog.dismiss();
+ StringBuilder s = new StringBuilder();
+ Formatter fmt = new Formatter(s);
+ fmt.format("%04X", itch.getCodePoint());
+ cmgr.setText(new String(s));
+ Toast.makeText(UnicodeMapActivity.this,
+ R.string.copied_toast,
+ Toast.LENGTH_SHORT).show();
+ }
+ });
final Button copyNameButton = (Button) dialog.findViewById(R.id.copyNameButton);
copyNameButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {