diff --git a/app/src/main/java/app/olauncher/data/Prefs.kt b/app/src/main/java/app/olauncher/data/Prefs.kt index 758fc74b..147cf133 100644 --- a/app/src/main/java/app/olauncher/data/Prefs.kt +++ b/app/src/main/java/app/olauncher/data/Prefs.kt @@ -20,6 +20,7 @@ class Prefs(context: Context) { private val DAILY_WALLPAPER = "DAILY_WALLPAPER" private val DAILY_WALLPAPER_URL = "DAILY_WALLPAPER_URL" private val WALLPAPER_UPDATED_DAY = "WALLPAPER_UPDATED_DAY" + private val AUTO_LAUNCH_ENABLED = "AUTO_LAUNCH_ENABLED" private val HOME_ALIGNMENT = "HOME_ALIGNMENT" private val HOME_BOTTOM_ALIGNMENT = "HOME_BOTTOM_ALIGNMENT" private val APP_LABEL_ALIGNMENT = "APP_LABEL_ALIGNMENT" @@ -131,6 +132,10 @@ class Prefs(context: Context) { get() = prefs.getString(DAILY_WALLPAPER_URL, "").toString() set(value) = prefs.edit().putString(DAILY_WALLPAPER_URL, value).apply() + var autoLaunchEnabled: Boolean + get() = prefs.getBoolean(AUTO_LAUNCH_ENABLED, true) + set(value) = prefs.edit().putBoolean(AUTO_LAUNCH_ENABLED, value).apply() + var homeAppsNum: Int get() = prefs.getInt(HOME_APPS_NUM, 4) set(value) = prefs.edit().putInt(HOME_APPS_NUM, value).apply() @@ -458,4 +463,4 @@ class Prefs(context: Context) { fun getAppRenameLabel(appPackage: String): String = prefs.getString(appPackage, "").toString() fun setAppRenameLabel(appPackage: String, renameLabel: String) = prefs.edit().putString(appPackage, renameLabel).apply() -} \ No newline at end of file +} diff --git a/app/src/main/java/app/olauncher/ui/AppDrawerAdapter.kt b/app/src/main/java/app/olauncher/ui/AppDrawerAdapter.kt index cc9dd2c9..303404bf 100644 --- a/app/src/main/java/app/olauncher/ui/AppDrawerAdapter.kt +++ b/app/src/main/java/app/olauncher/ui/AppDrawerAdapter.kt @@ -26,6 +26,7 @@ import java.text.Normalizer class AppDrawerAdapter( private var flag: Int, private val appLabelGravity: Int, + private val enableAutoLaunch: Boolean, private val appClickListener: (AppModel) -> Unit, private val appInfoListener: (AppModel) -> Unit, private val appDeleteListener: (AppModel) -> Unit, @@ -80,7 +81,7 @@ class AppDrawerAdapter( return object : Filter() { override fun performFiltering(charSearch: CharSequence?): FilterResults { isBangSearch = charSearch?.startsWith("!") ?: false - autoLaunch = charSearch?.startsWith(" ")?.not() ?: true + autoLaunch = enableAutoLaunch && (charSearch?.startsWith(" ")?.not() ?: true) val appFilteredList = (if (charSearch.isNullOrBlank()) appsList else appsList.filter { app -> diff --git a/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt b/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt index 1986300f..8ffd3854 100644 --- a/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt +++ b/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt @@ -108,6 +108,7 @@ class AppDrawerFragment : Fragment() { adapter = AppDrawerAdapter( flag, prefs.appLabelAlignment, + prefs.autoLaunchEnabled, appClickListener = { if (it.appPackage.isEmpty()) return@AppDrawerAdapter @@ -284,4 +285,4 @@ class AppDrawerFragment : Fragment() { super.onDestroyView() _binding = null } -} \ No newline at end of file +} diff --git a/app/src/main/java/app/olauncher/ui/SettingsFragment.kt b/app/src/main/java/app/olauncher/ui/SettingsFragment.kt index b64a7ca3..96f1ad7e 100644 --- a/app/src/main/java/app/olauncher/ui/SettingsFragment.kt +++ b/app/src/main/java/app/olauncher/ui/SettingsFragment.kt @@ -73,6 +73,7 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe populateScreenTimeOnOff() populateLockSettings() populateWallpaperText() + populateAutoLaunchEnabled() populateAppThemeText() populateTextSize() populateAlignment() @@ -103,6 +104,7 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe R.id.toggleLock -> toggleLockMode() R.id.autoShowKeyboard -> toggleKeyboardText() R.id.homeAppsNum -> binding.appsNumSelectLayout.visibility = View.VISIBLE + R.id.autoLaunchEnabled -> toggleAutoLaunchEnabled() R.id.dailyWallpaperUrl -> requireContext().openUrl(prefs.dailyWallpaperUrl) R.id.dailyWallpaper -> toggleDailyWallpaperUpdate() R.id.alignment -> binding.alignmentSelectLayout.visibility = View.VISIBLE @@ -202,6 +204,7 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe binding.screenTimeOnOff.setOnClickListener(this) binding.dailyWallpaperUrl.setOnClickListener(this) binding.dailyWallpaper.setOnClickListener(this) + binding.autoLaunchEnabled.setOnClickListener(this) binding.alignment.setOnClickListener(this) binding.alignmentLeft.setOnClickListener(this) binding.alignmentCenter.setOnClickListener(this) @@ -315,6 +318,14 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe } } + private fun populateAutoLaunchEnabled() { + if (prefs.autoLaunchEnabled) { + binding.autoLaunchEnabled.text = getString(R.string.on) + } else { + binding.autoLaunchEnabled.text = getString(R.string.off) + } + } + private fun toggleDateTime(selected: Int) { prefs.dateTimeVisibility = selected populateDateTime() @@ -449,6 +460,11 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe requireContext().showToast(getString(R.string.olauncher_is_not_default_launcher), Toast.LENGTH_LONG) } + private fun toggleAutoLaunchEnabled() { + prefs.autoLaunchEnabled = !prefs.autoLaunchEnabled + populateAutoLaunchEnabled() + } + private fun updateHomeAppsNum(num: Int) { binding.homeAppsNum.text = num.toString() binding.appsNumSelectLayout.visibility = View.GONE @@ -641,4 +657,4 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe viewModel.checkForMessages.call() super.onDestroy() } -} \ No newline at end of file +} diff --git a/app/src/main/res/layout-land/fragment_settings.xml b/app/src/main/res/layout-land/fragment_settings.xml index eeebae41..9a53a8ab 100644 --- a/app/src/main/res/layout-land/fragment_settings.xml +++ b/app/src/main/res/layout-land/fragment_settings.xml @@ -475,32 +475,6 @@ android:text="@string/appearance" android:textColor="?attr/primaryColor" /> - - - - - - - + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 514f3854..6ca2d06e 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -493,32 +493,6 @@ android:text="@string/appearance" android:textColor="?attr/primaryColor" /> - - - - - - - + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 912d5913..69f708f9 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -76,6 +76,7 @@ افتح عند التمرير لليسار افتح عند التمرير لليمين العرض التلقائي للوحة المفاتيح + تشغيل التطبيق تلقائيًا يخفي أظهر شريط الحالة إعادة تسمية diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 95489af2..d54921f3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -77,6 +77,7 @@ Wischen Sie nach links über die App Wischen Sie nach rechts über die App Tastatur automatisch anzeigen + App automatisch starten Verstecken Zeige Statusleiste Umbenennen diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 69bf5866..48d14654 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -44,6 +44,7 @@ De acuerdo ¡Guay! Mostrar teclado automáticamente + Aplicación de inicio automático Ocultar Mostrar barra de estado Renombrar diff --git a/app/src/main/res/values-es-rUS/strings.xml b/app/src/main/res/values-es-rUS/strings.xml index 0bba7120..ed5b000e 100644 --- a/app/src/main/res/values-es-rUS/strings.xml +++ b/app/src/main/res/values-es-rUS/strings.xml @@ -44,6 +44,7 @@ Bueno ¡Fresco! Mostrar teclado automáticamente + Aplicación de inicio automático Ocultar Mostrar barra de estado Renombrar diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index da25890f..77207730 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -44,6 +44,7 @@ D\'accord Cool ! Afficher automatiquement le clavier + Lancement automatique de l\'application Cacher Afficher la barre d\'état Renommer diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 3f2c8504..8a015006 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -44,6 +44,7 @@ U redu Cool! Automatski prikaži tipkovnicu + Automatsko pokretanje aplikacije Sakrij Prikaži statusnu traku Preimenuj diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 4c2cdfd3..c9c7850c 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -42,6 +42,7 @@ Rendben Szuper! Billentyűzet auto. megjelenítése + Alkalmazás automatikus indítása Elrejtés Állapotsor megjelenítése fent Átnevezés diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index be78aeb5..9b00d0c4 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -44,6 +44,7 @@ Oke Keren! Tampilkan keyboard secara otomatis + Aplikasi peluncuran otomatis Sembunyikan Tampilkan bilah status Ganti nama diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index cec987a8..b48049f4 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -43,6 +43,7 @@ OK Freddo Tastiera di visualizzazione automatica + Avvio automatico dell\'app Nascondi Mostra la barra di stato Rinomina diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 66bc8935..553dbbfa 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -78,6 +78,7 @@ アプリを左にスワイプ アプリを右にスワイプ キーボードの自動表示 + アプリの自動起動 隠れる ステータスバーを表示する 名前の変更 diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7ed26a56..7ea75d16 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -77,6 +77,7 @@ Przesuń w lewo aplikację Przesuń w prawo aplikację Automatyczne wyświetlanie klawiatury + Automatyczne uruchamianie aplikacji Ukryj Pokaż pasek stanu Zmień nazwę diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d9d59542..ffdb0206 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -44,6 +44,7 @@ Ok Boa! Exibição automática do teclado + Aplicativo de inicialização automática Esconder Mostrar barra de status Alterar nome diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml index 11ab2152..ca393e5e 100644 --- a/app/src/main/res/values-ru-rRU/strings.xml +++ b/app/src/main/res/values-ru-rRU/strings.xml @@ -44,6 +44,7 @@ Хорошо Круто! Автопоказ клавиатуры + Автоматический запуск приложения Скрыть Показывать строку состояния Переименовать diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 92a8a616..a07b7db2 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -43,6 +43,7 @@ Okej Coolt! Visa tangentbord automatiskt + Starta appen automatiskt Dölj Statusfält överst Byt namn diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 2529a50d..2d872434 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -77,6 +77,7 @@ Uygulamayı sola kaydırın Uygulamayı sağa kaydırın Klavyeyi otomatik göster + Uygulamayı otomatik başlat Saklamak Durum çubuğunu göster Yeniden isimlendirmek diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index be05fb18..5f479fe5 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -44,6 +44,7 @@ Добре Круто! Автопоказ клавіатури + Автоматичний запуск програми Приховати Показувати рядок стану Перенайменувати diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index b1daf054..370fb6eb 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -77,6 +77,7 @@ 7 8 自动显示键盘 + 自动启动应用程序 隐藏 显示状态栏 改名 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 876d807f..b6fe9b58 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -60,6 +60,7 @@ Okay Cool! Auto show keyboard + Auto launch app Hide Status bar on top Rename diff --git a/kls_database.db b/kls_database.db new file mode 100644 index 00000000..6434eb98 Binary files /dev/null and b/kls_database.db differ