diff --git a/app/build.gradle b/app/build.gradle index 5133006d1cce96d4cbb58fb4c6e2311708cf0b8c..910511d7f7dc681aaff5d72757fc99f64ae9bd44 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -159,6 +159,9 @@ dependencies { implementation Libs.AndroidX.Room.runtime kapt Libs.AndroidX.Room.compiler + // Apache Commons + implementation Libs.ApacheCommons.commonsLang + // Unit test dependencies testImplementation Libs.junit testImplementation Libs.robolectric diff --git a/app/src/main/java/foundation/e/blisslauncher/core/Utilities.java b/app/src/main/java/foundation/e/blisslauncher/core/Utilities.java index 51492aa865ab082756671eac81e0c7f454d24fc7..60939bd9c50ff32504db243ec118064898e2d05c 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/Utilities.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/Utilities.java @@ -14,6 +14,8 @@ import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; +import org.apache.commons.lang3.StringUtils; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Method; @@ -217,4 +219,8 @@ public class Utilities { public static int boundToRange(int value, int lowerBound, int upperBound) { return Math.max(lowerBound, Math.min(value, upperBound)); } + + public static String stripCaseAndAccents(String input) { + return StringUtils.stripAccents(input.toLowerCase()); + } } diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index 7d5b99b7a313269f29dffe3ee4cbb9ce44261f99..d380d9d5cdeb4f430e37cef430252a0bc786ce6e 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -79,6 +79,7 @@ import androidx.viewpager.widget.ViewPager; import com.jakewharton.rxbinding3.widget.RxTextView; + import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -1595,7 +1596,7 @@ public class LauncherActivity extends AppCompatActivity implements private Observable searchForLauncherItems( CharSequence charSequence) { - String query = charSequence.toString().toLowerCase(); + String query = Utilities.stripCaseAndAccents(charSequence.toString()); SuggestionsResult suggestionsResult = new SuggestionsResult( query); List launcherItems = new ArrayList<>(); @@ -1606,11 +1607,11 @@ public class LauncherActivity extends AppCompatActivity implements if (launcherItem.itemType == Constants.ITEM_TYPE_FOLDER) { FolderItem folderItem = (FolderItem) launcherItem; for (LauncherItem item : folderItem.items) { - if (item.title.toString().toLowerCase().contains(query)) { + if (Utilities.stripCaseAndAccents(item.title.toString()).contains(query)) { launcherItems.add(item); } } - } else if (launcherItem.title.toString().toLowerCase().contains(query)) { + } else if (Utilities.stripCaseAndAccents(launcherItem.title.toString()).contains(query)) { launcherItems.add(launcherItem); } } @@ -1622,11 +1623,11 @@ public class LauncherActivity extends AppCompatActivity implements if (launcherItem.itemType == Constants.ITEM_TYPE_FOLDER) { FolderItem folderItem = (FolderItem) launcherItem; for (LauncherItem item : folderItem.items) { - if (item.title.toString().toLowerCase().contains(query)) { + if (Utilities.stripCaseAndAccents(item.title.toString()).contains(query)) { launcherItems.add(item); } } - } else if (launcherItem.title.toString().toLowerCase().contains(query)) { + } else if (Utilities.stripCaseAndAccents(launcherItem.title.toString()).contains(query)) { launcherItems.add(launcherItem); } } diff --git a/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt b/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt index 6160b2b8b7dad6fee4fdde13c790fa4ddeaf466f..0ee7c3d5d163ac080c205f97f9a0386258ad5a2f 100644 --- a/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt +++ b/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt @@ -34,6 +34,10 @@ object Libs { const val robolectric = "org.robolectric:robolectric:${Versions.robolectric}" const val mockK = "io.mockk:mockk:${Versions.mockK}" + object ApacheCommons { + const val commonsLang = "org.apache.commons:commons-lang3:3.12.0" + } + object Google { const val firebaseCore = "com.google.firebase:firebase-core:${Versions.firebase_core}" const val crashlytics = "com.crashlytics.sdk.android:crashlytics:${Versions.crashlytics}"