summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-04-29 03:20:29 +0200
committerDavid A. Madore <david+git@madore.org>2010-04-29 03:20:29 +0200
commit6b1b044c5e51218c03eeccf5dddb65b58e25d22f (patch)
tree6a1cda3401b2c375c6651002235e2b6feab9a013
parente57621493d1fa3cb1f9bd14b14e8012d7503e816 (diff)
downloadUnicodeMap-6b1b044c5e51218c03eeccf5dddb65b58e25d22f.tar.gz
UnicodeMap-6b1b044c5e51218c03eeccf5dddb65b58e25d22f.tar.bz2
UnicodeMap-6b1b044c5e51218c03eeccf5dddb65b58e25d22f.zip
Add range description to subrange titles.
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeCharacter.java1
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeMapActivity.java15
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeRangeable.java1
3 files changed, 12 insertions, 5 deletions
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 ; base<to0 ; base+=128 ) {
- final int from1 = base<from?from:base;
- final int to1 = base+128>to?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();
}