summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-04-26 20:49:35 (GMT)
committerDavid A. Madore <david+git@madore.org>2010-04-27 00:23:39 (GMT)
commite37377a5d3ca4c78c440b097af4186cbbd81a6a0 (patch)
treea8884d4a801f1f1ef0b5350af8ddaf7be0d2aa80
parent4307bce6cd10fe0e3ebb86118d2077fbd78ff1cb (diff)
downloadUnicodeMap-e37377a5d3ca4c78c440b097af4186cbbd81a6a0.zip
UnicodeMap-e37377a5d3ca4c78c440b097af4186cbbd81a6a0.tar.gz
UnicodeMap-e37377a5d3ca4c78c440b097af4186cbbd81a6a0.tar.bz2
Range details similar to character details.
-rw-r--r--res/layout/char_details.xml2
-rw-r--r--res/layout/range_details.xml19
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeCharacter.java5
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeMapActivity.java23
4 files changed, 42 insertions, 7 deletions
diff --git a/res/layout/char_details.xml b/res/layout/char_details.xml
index 57a6b35..1828d2d 100644
--- a/res/layout/char_details.xml
+++ b/res/layout/char_details.xml
@@ -10,7 +10,7 @@
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="#ff000000" />
- <TextView android:id="@+id/utf8Label"
+ <TextView android:id="@+id/encodingLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
diff --git a/res/layout/range_details.xml b/res/layout/range_details.xml
new file mode 100644
index 0000000..1d82698
--- /dev/null
+++ b/res/layout/range_details.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:padding="10dp"
+ android:orientation="vertical"
+ android:background="#f0c4c4e0">
+ <TextView android:id="@+id/rangeDescrLabel"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:textSize="20sp"
+ android:textStyle="bold"
+ android:textColor="#ff000000" />
+ <TextView android:id="@+id/rangeRangeLabel"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:textSize="16sp"
+ android:textColor="#ff404040" />
+</LinearLayout>
diff --git a/src/org/madore/android/unicodeMap/UnicodeCharacter.java b/src/org/madore/android/unicodeMap/UnicodeCharacter.java
index 646c696..0805e8c 100644
--- a/src/org/madore/android/unicodeMap/UnicodeCharacter.java
+++ b/src/org/madore/android/unicodeMap/UnicodeCharacter.java
@@ -284,10 +284,7 @@ public class UnicodeCharacter implements UnicodeDisplayable {
protected String makeLabel() {
StringBuilder s = new StringBuilder();
Formatter fmt = new Formatter(s);
- if ( codePoint < 0x10000 )
- fmt.format("U+%04X %s", codePoint, name);
- else
- fmt.format("U+%X %s", codePoint, name);
+ fmt.format("U+%04X %s", codePoint, name);
return new String(s);
}
diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
index 2d8d61b..1b43d9d 100644
--- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
+++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
@@ -96,12 +96,13 @@ public final class UnicodeMapActivity extends ListActivity {
UnicodeCharacter itch = (UnicodeCharacter)it;
Dialog dialog = new Dialog(UnicodeMapActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ dialog.setOwnerActivity(UnicodeMapActivity.this);
dialog.setContentView(R.layout.char_details);
dialog.setCancelable(true);
TextView text;
text = (TextView) dialog.findViewById(R.id.detailsLabel);
text.setText(itch.getLabel());
- text = (TextView) dialog.findViewById(R.id.utf8Label);
+ text = (TextView) dialog.findViewById(R.id.encodingLabel);
StringBuilder s = new StringBuilder();
Formatter fmt = new Formatter(s);
fmt.format("UTF-8:");
@@ -117,7 +118,25 @@ public final class UnicodeMapActivity extends ListActivity {
dialog.show();
return true;
} else if ( it instanceof UnicodeCharacter.Range ) {
- return false;
+ UnicodeCharacter.Range itr = (UnicodeCharacter.Range)it;
+ Dialog dialog = new Dialog(UnicodeMapActivity.this);
+ dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ dialog.setOwnerActivity(UnicodeMapActivity.this);
+ dialog.setContentView(R.layout.range_details);
+ dialog.setCancelable(true);
+ TextView text;
+ text = (TextView) dialog.findViewById(R.id.rangeDescrLabel);
+ text.setText(itr.getDescr());
+ text = (TextView) dialog.findViewById(R.id.rangeRangeLabel);
+ StringBuilder s = new StringBuilder();
+ Formatter fmt = new Formatter(s);
+ fmt.format("%04X\u2013%04X (%d slots, %d chars)",
+ itr.getFrom(), itr.getTo()-1,
+ itr.getTo()-itr.getFrom(),
+ db.countRange(itr.getFrom(), itr.getTo()));
+ text.setText(new String(s));
+ dialog.show();
+ return true;
} else
throw new AssertionError("unknown UnicodeDisplayable");
}