OSDN Git Service

Fixing text search where a word starting with lower case was
authorSunny Goyal <sunnygoyal@google.com>
Wed, 19 Oct 2016 06:53:43 +0000 (07:53 +0100)
committerSunny Goyal <sunnygoyal@google.com>
Wed, 19 Oct 2016 06:54:22 +0000 (07:54 +0100)
not being matched

Bug: 32249413
Change-Id: I0f5e24052759a734fe0df3bd3d0bf2e7ef7f2713

src/com/android/launcher3/allapps/DefaultAppSearchAlgorithm.java
tests/src/com/android/launcher3/allapps/DefaultAppSearchAlgorithmTest.java

index ac22dd2..06cf9aa 100644 (file)
@@ -115,7 +115,7 @@ public class DefaultAppSearchAlgorithm {
                 return prevType != Character.UPPERCASE_LETTER;
             case Character.LOWERCASE_LETTER:
                 // Break point if previous was not a letter.
-                return prevType > Character.OTHER_LETTER;
+                return prevType > Character.OTHER_LETTER || prevType <= Character.UNASSIGNED;
             case Character.DECIMAL_DIGIT_NUMBER:
             case Character.LETTER_NUMBER:
             case Character.OTHER_NUMBER:
index 4d0a7a9..18570de 100644 (file)
@@ -67,6 +67,10 @@ public class DefaultAppSearchAlgorithmTest extends InstrumentationTestCase {
 
         assertTrue(mAlgorithm.matches(getInfo("Q"), "q"));
         assertTrue(mAlgorithm.matches(getInfo("  Q"), "q"));
+
+        // match lower case words
+        assertTrue(mAlgorithm.matches(getInfo("elephant"), "e"));
+
     }
 
     private AppInfo getInfo(String title) {