summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/compat
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-03-13 11:14:16 -0700
committerWinson Chung <winsonc@google.com>2015-03-13 11:48:45 -0700
commit888b3a10bf1e99192f12c844ee275c6f360d6b34 (patch)
tree0dd028c7b444b7deb9a9c34a91f1efe3a81d1466 /src/com/android/launcher3/compat
parent93f98eaf1800024cb2f28379bdd997f3debae63a (diff)
downloadandroid_packages_apps_Trebuchet-888b3a10bf1e99192f12c844ee275c6f360d6b34.tar.gz
android_packages_apps_Trebuchet-888b3a10bf1e99192f12c844ee275c6f360d6b34.tar.bz2
android_packages_apps_Trebuchet-888b3a10bf1e99192f12c844ee275c6f360d6b34.zip
Minor changes to apps view.
- Ensuring that apps with numbers and in other locals have a section header. - Adding an empty state when there are no apps with the current filter - Removing unnecessary call to check AppInfos Change-Id: I9dc541c680475b98745fa257ad7e4af06e3966c9
Diffstat (limited to 'src/com/android/launcher3/compat')
-rw-r--r--src/com/android/launcher3/compat/AlphabeticIndexCompat.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java
index 602a84566..47e1b7a98 100644
--- a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java
+++ b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java
@@ -27,7 +27,7 @@ class BaseAlphabeticIndex {
/**
* Returns the index of the bucket in which the given string should appear.
*/
- public int getBucketIndex(String s) {
+ protected int getBucketIndex(String s) {
if (s.isEmpty()) {
return UNKNOWN_BUCKET_INDEX;
}
@@ -41,7 +41,7 @@ class BaseAlphabeticIndex {
/**
* Returns the label for the bucket at the given index (as returned by getBucketIndex).
*/
- public String getBucketLabel(int index) {
+ protected String getBucketLabel(int index) {
return BUCKETS.substring(index, index + 1);
}
}
@@ -100,11 +100,29 @@ public class AlphabeticIndexCompat extends BaseAlphabeticIndex {
}
/**
+ * Computes the section name for an given string {@param s}.
+ */
+ public String computeSectionName(String s) {
+ String sectionName = getBucketLabel(getBucketIndex(s));
+ if (sectionName.trim().isEmpty() && s.length() > 0) {
+ boolean startsWithDigit = Character.isDigit(s.charAt(0));
+ if (startsWithDigit) {
+ // Digit section
+ return "#";
+ } else {
+ // Unknown section
+ return "\u2022";
+ }
+ }
+ return sectionName;
+ }
+
+ /**
* Returns the index of the bucket in which {@param s} should appear.
* Function is synchronized because underlying routine walks an iterator
* whose state is maintained inside the index object.
*/
- public int getBucketIndex(String s) {
+ protected int getBucketIndex(String s) {
if (mHasValidAlphabeticIndex) {
try {
return (Integer) mGetBucketIndexMethod.invoke(mAlphabeticIndex, s);
@@ -118,7 +136,7 @@ public class AlphabeticIndexCompat extends BaseAlphabeticIndex {
/**
* Returns the label for the bucket at the given index (as returned by getBucketIndex).
*/
- public String getBucketLabel(int index) {
+ protected String getBucketLabel(int index) {
if (mHasValidAlphabeticIndex) {
try {
return (String) mGetBucketLabelMethod.invoke(mAlphabeticIndex, index);