diff --git a/app/src/main/java/com/sduduzog/slimlauncher/adapters/AppDrawerAdapter.kt b/app/src/main/java/com/sduduzog/slimlauncher/adapters/AppDrawerAdapter.kt index 1c6467f4..14103589 100644 --- a/app/src/main/java/com/sduduzog/slimlauncher/adapters/AppDrawerAdapter.kt +++ b/app/src/main/java/com/sduduzog/slimlauncher/adapters/AppDrawerAdapter.kt @@ -89,9 +89,10 @@ class AppDrawerAdapter( private fun updateFilteredApps(filterQuery: String = "") { val showDrawerHeadings = corePreferencesRepo.get().showDrawerHeadings + val searchAllApps = corePreferencesRepo.get().searchAllAppsInDrawer && filterQuery != "" val displayableApps = apps .filter { app -> - app.displayInDrawer && regex.replace(app.displayName, "") + (app.displayInDrawer || searchAllApps) && regex.replace(app.displayName, "") .contains(filterQuery, ignoreCase = true) } diff --git a/app/src/main/java/com/sduduzog/slimlauncher/datasource/coreprefs/CorePreferencesRepository.kt b/app/src/main/java/com/sduduzog/slimlauncher/datasource/coreprefs/CorePreferencesRepository.kt index 4c743b1b..ba924c09 100644 --- a/app/src/main/java/com/sduduzog/slimlauncher/datasource/coreprefs/CorePreferencesRepository.kt +++ b/app/src/main/java/com/sduduzog/slimlauncher/datasource/coreprefs/CorePreferencesRepository.kt @@ -93,4 +93,12 @@ class CorePreferencesRepository( } } } + + fun updateSearchAllAppsInDrawer(searchAllAppsInDrawer: Boolean) { + lifecycleScope.launch { + corePreferencesStore.updateData { + it.toBuilder().setSearchAllAppsInDrawer(searchAllAppsInDrawer).build() + } + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/sduduzog/slimlauncher/ui/options/CustomizeSearchFieldFragment.kt b/app/src/main/java/com/sduduzog/slimlauncher/ui/options/CustomizeSearchFieldFragment.kt index 195e6dd0..4ed7bab1 100644 --- a/app/src/main/java/com/sduduzog/slimlauncher/ui/options/CustomizeSearchFieldFragment.kt +++ b/app/src/main/java/com/sduduzog/slimlauncher/ui/options/CustomizeSearchFieldFragment.kt @@ -15,6 +15,7 @@ import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field_options.customize_app_drawer_fragment_search_field_position import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field_options.customize_app_drawer_fragment_show_search_field_switch import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field_options.customize_app_drawer_open_keyboard_switch +import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field_options.customize_app_drawer_search_all_switch import javax.inject.Inject @@ -42,6 +43,7 @@ class CustomizeSearchFieldFragment : BaseFragment() { setupShowSearchBarSwitch() setupSearchBarPositionOption() setupKeyboardSwitch() + setupSearchAllAppsSwitch() } private fun setupShowSearchBarSwitch() { @@ -91,4 +93,19 @@ class CustomizeSearchFieldFragment : BaseFragment() { R.string.customize_app_drawer_fragment_open_keyboard_subtitle ) } + + private fun setupSearchAllAppsSwitch() { + val prefsRepo = unlauncherDataSource.corePreferencesRepo + customize_app_drawer_search_all_switch.setOnCheckedChangeListener { _, checked -> + prefsRepo.updateSearchAllAppsInDrawer(checked) + } + prefsRepo.liveData().observe(viewLifecycleOwner) { + customize_app_drawer_search_all_switch.isChecked = it.searchAllAppsInDrawer + } + customize_app_drawer_search_all_switch.text = + createTitleAndSubtitleText( + requireContext(), R.string.customize_app_drawer_fragment_search_all, + R.string.customize_app_drawer_fragment_search_all_subtitle + ) + } } \ No newline at end of file diff --git a/app/src/main/proto/core_preferences.proto b/app/src/main/proto/core_preferences.proto index 7243fc91..ed358aae 100644 --- a/app/src/main/proto/core_preferences.proto +++ b/app/src/main/proto/core_preferences.proto @@ -9,6 +9,7 @@ message CorePreferences { optional bool show_search_bar = 3; SearchBarPosition search_bar_position = 4; bool show_drawer_headings = 5; + bool search_all_apps_in_drawer = 6; } enum SearchBarPosition { diff --git a/app/src/main/res/layout/customize_app_drawer_fragment_search_field_options.xml b/app/src/main/res/layout/customize_app_drawer_fragment_search_field_options.xml index 3004531a..3adbc9f6 100644 --- a/app/src/main/res/layout/customize_app_drawer_fragment_search_field_options.xml +++ b/app/src/main/res/layout/customize_app_drawer_fragment_search_field_options.xml @@ -44,4 +44,16 @@ android:textSize="@dimen/_20ssp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/customize_app_drawer_fragment_search_field_position" /> + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 458ed5f7..b7bf7037 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -60,6 +60,7 @@ Unten Tastatur anzeigen + Suche in allen Apps Appsichtbarkeit einstellen Themenhintergrund verwenden Unlauncher muss die standard Start-App sein diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9d4fb97c..66c55ba7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,6 +54,8 @@ Hide Status Bar Show Status Bar Open Keyboard + Search all apps + Hidden apps can be found when searching Set theme background as wallpaper App needs to be default launcher Visible Apps