From 1b2acd74d2cc2e3c7d0face409c6075c16e76755 Mon Sep 17 00:00:00 2001 From: Artem Shvadskiy Date: Tue, 10 May 2016 16:42:31 -0700 Subject: Put apps with uncomputable section names in special bucket Change-Id: I8ec0a2a9a46c3f45f2c52ac6a4d4d812881c52b7 issue-id: CYNGNOS-2683 --- .../launcher3/compat/AlphabeticIndexCompat.java | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java index ec1fb669f..c6135e19b 100644 --- a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java +++ b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java @@ -117,22 +117,28 @@ public class AlphabeticIndexCompat extends BaseAlphabeticIndex { public String computeSectionName(CharSequence cs) { String s = Utilities.trim(cs); String sectionName = getBucketLabel(getBucketIndex(s)); - if (Utilities.trim(sectionName).isEmpty() && s.length() > 0) { - int c = s.codePointAt(0); - boolean startsWithDigit = Character.isDigit(c); - if (startsWithDigit) { - // Digit section - return "#"; - } else { - boolean startsWithLetter = Character.isLetter(c); - if (startsWithLetter) { - return mDefaultMiscLabel; + if (Utilities.trim(sectionName).isEmpty()) { + if (s.length() > 0) { + int c = s.codePointAt(0); + boolean startsWithDigit = Character.isDigit(c); + if (startsWithDigit) { + // Digit section + return "#"; } else { - // In languages where these differ, this ensures that we differentiate - // between the misc section in the native language and a misc section - // for everything else. - return MID_DOT; + boolean startsWithLetter = Character.isLetter(c); + if (startsWithLetter) { + return mDefaultMiscLabel; + } else { + // In languages where these differ, this ensures that we differentiate + // between the misc section in the native language and a misc section + // for everything else. + return MID_DOT; + } } + } else { + // Somehow this app's name is all white/java space characters. + // Put it in the bucket with all the other crazies. + return MID_DOT; } } return sectionName; -- cgit v1.2.3