From 6b1b044c5e51218c03eeccf5dddb65b58e25d22f Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Thu, 29 Apr 2010 03:20:29 +0200 Subject: Add range description to subrange titles. --- src/org/madore/android/unicodeMap/UnicodeCharacter.java | 1 + src/org/madore/android/unicodeMap/UnicodeMapActivity.java | 15 ++++++++++----- src/org/madore/android/unicodeMap/UnicodeRangeable.java | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/org') diff --git a/src/org/madore/android/unicodeMap/UnicodeCharacter.java b/src/org/madore/android/unicodeMap/UnicodeCharacter.java index f399d2b..58835bc 100644 --- a/src/org/madore/android/unicodeMap/UnicodeCharacter.java +++ b/src/org/madore/android/unicodeMap/UnicodeCharacter.java @@ -221,6 +221,7 @@ public class UnicodeCharacter implements UnicodeDisplayable { public int getFrom() { return this.from; } public int getTo() { return this.to; } public String getDescr() { return this.descr; } + public String getTitle() { return this.descr; } @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 5410b11..2795c28 100644 --- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java +++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java @@ -54,7 +54,7 @@ public final class UnicodeMapActivity extends ListActivity { this.from = from; this.to = to; this.limit = limit; } public RangeDisplay(UnicodeRangeable rng, int limit) { - super(rng.getDescr()); + super(rng.getTitle()); this.from = rng.getFrom(); this.to = rng.getTo(); this.limit = limit; } public int getFrom() { return this.from; } @@ -162,6 +162,7 @@ public final class UnicodeMapActivity extends ListActivity { // public int getFrom() { return 0x4DF8; } // public int getTo() { return 0x4E10; } // public String getDescr() { return "TEST"; } + // public String getTitle() { return "TEST"; } // }); for ( UnicodeCharacter.Range rng : UnicodeCharacter.Range.values() ) list.add(rng); @@ -177,13 +178,17 @@ public final class UnicodeMapActivity extends ListActivity { int from0 = from&(~127); int to0 = ((to-1)|127)+1; for ( int base=from0 ; baseto?to:base+128; - final String str = String.format("%04X\u2013%04X", from1, to1-1); + final int from1 = Math.max(from,base); + final int to1 = Math.min(to,base+128); + final String descr + = String.format("%04X\u2013%04X", from1, to1-1); + final String title + = String.format("%s (%s)", disp.getTitle(), descr); list.add(new UnicodeRangeable() { public int getFrom() { return from1; } public int getTo() { return to1; } - public String getDescr() { return str; } + public String getDescr() { return descr; } + public String getTitle() { return title; } }); } } else { diff --git a/src/org/madore/android/unicodeMap/UnicodeRangeable.java b/src/org/madore/android/unicodeMap/UnicodeRangeable.java index c3a7825..89bc5b7 100644 --- a/src/org/madore/android/unicodeMap/UnicodeRangeable.java +++ b/src/org/madore/android/unicodeMap/UnicodeRangeable.java @@ -4,4 +4,5 @@ public interface UnicodeRangeable extends UnicodeDisplayable { public int getFrom(); public int getTo(); public String getDescr(); + public String getTitle(); } -- cgit v1.2.3