From 10a06020e8c9da2705cea7952d9ddce6f67388dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 18 Jul 2023 16:30:46 +0200 Subject: [PATCH 01/12] Close apps drawer and widgets screen when navigating to other apps This closes #17, closes #57 --- .../simplemobiletools/launcher/activities/MainActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt index 0dadc51..b8e2529 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -178,6 +178,14 @@ class MainActivity : SimpleActivity(), FlingListener { home_screen_grid.appWidgetHost.startListening() } + override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) { + super.onTopResumedActivityChanged(isTopResumedActivity) + if (!isTopResumedActivity) { + hideFragment(all_apps_fragment) + hideFragment(widgets_fragment) + } + } + override fun onResume() { super.onResume() updateStatusbarColor(Color.TRANSPARENT) From 1913d0b739f16e3fd0548a11f5e7407168dfaae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Wed, 19 Jul 2023 10:21:45 +0200 Subject: [PATCH 02/12] Add delay to drawer and widgets closing --- .../launcher/activities/MainActivity.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt index b8e2529..1d61562 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -30,10 +30,7 @@ import androidx.core.graphics.drawable.toBitmap import androidx.core.view.GestureDetectorCompat import androidx.core.view.isVisible import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.ensureBackgroundThread -import com.simplemobiletools.commons.helpers.isPiePlus -import com.simplemobiletools.commons.helpers.isQPlus -import com.simplemobiletools.commons.helpers.isRPlus +import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.launcher.BuildConfig import com.simplemobiletools.launcher.R import com.simplemobiletools.launcher.dialogs.RenameItemDialog @@ -181,8 +178,10 @@ class MainActivity : SimpleActivity(), FlingListener { override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) { super.onTopResumedActivityChanged(isTopResumedActivity) if (!isTopResumedActivity) { - hideFragment(all_apps_fragment) - hideFragment(widgets_fragment) + Handler(mainLooper).postDelayed({ + hideFragment(all_apps_fragment) + hideFragment(widgets_fragment) + }, 1000L) } } From d5aff09c8ea41e6d63ce0f3c072262373844db32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Wed, 19 Jul 2023 10:28:53 +0200 Subject: [PATCH 03/12] Add setting for navigating to home screen always --- .../launcher/activities/MainActivity.kt | 2 +- .../launcher/activities/SettingsActivity.kt | 9 +++++++++ .../simplemobiletools/launcher/helpers/Config.kt | 4 ++++ .../launcher/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 15 +++++++++++++++ app/src/main/res/values-ar/strings.xml | 3 ++- app/src/main/res/values-bg/strings.xml | 1 + app/src/main/res/values-ca/strings.xml | 3 ++- app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 3 ++- app/src/main/res/values-el/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-et/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-gl/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-in/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-iw/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-ml/strings.xml | 1 + app/src/main/res/values-nb-rNO/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 3 ++- app/src/main/res/values-pa-rPK/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 3 ++- app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ro/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 3 ++- app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sl/strings.xml | 1 + app/src/main/res/values-sr/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 3 ++- app/src/main/res/values-uk/strings.xml | 1 + app/src/main/res/values-w600dp/strings.xml | 4 ++++ app/src/main/res/values-zgh/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 3 ++- app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 43 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 app/src/main/res/values-w600dp/strings.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt index 1d61562..0456c9f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -177,7 +177,7 @@ class MainActivity : SimpleActivity(), FlingListener { override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) { super.onTopResumedActivityChanged(isTopResumedActivity) - if (!isTopResumedActivity) { + if (!isTopResumedActivity && config.alwaysNavigateToHomeScreen) { Handler(mainLooper).postDelayed({ hideFragment(all_apps_fragment) hideFragment(widgets_fragment) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt index b42fe3b..4f6649a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt @@ -35,6 +35,7 @@ class SettingsActivity : SimpleActivity() { setupPurchaseThankYou() setupCustomizeColors() setupUseEnglish() + setupAlwaysNavigateToHomeScreen() setupDrawerColumnCount() setupDrawerSearchBar() setupLanguage() @@ -87,6 +88,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupAlwaysNavigateToHomeScreen() { + settings_navigate_to_home_grid_on_home.isChecked = config.alwaysNavigateToHomeScreen + settings_navigate_to_home_grid_on_home_holder.setOnClickListener { + settings_navigate_to_home_grid_on_home.toggle() + config.alwaysNavigateToHomeScreen = settings_navigate_to_home_grid_on_home.isChecked + } + } + private fun setupDrawerColumnCount() { val currentColumnCount = config.drawerColumnCount settings_drawer_column_count.text = currentColumnCount.toString() diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Config.kt index 637394a..bc55404 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Config.kt @@ -20,4 +20,8 @@ class Config(context: Context) : BaseConfig(context) { var showSearchBar: Boolean get() = prefs.getBoolean(SHOW_SEARCH_BAR, true) set(showSearchBar) = prefs.edit().putBoolean(SHOW_SEARCH_BAR, showSearchBar).apply() + + var alwaysNavigateToHomeScreen: Boolean + get() = prefs.getBoolean(ALWAYS_NAVIGATE_TO_HOME_SCREEN, true) + set(alwaysNavigateToHomeScreen) = prefs.edit().putBoolean(ALWAYS_NAVIGATE_TO_HOME_SCREEN, alwaysNavigateToHomeScreen).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Constants.kt index f543854..d94e6e5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/helpers/Constants.kt @@ -7,6 +7,7 @@ const val WIDGET_LIST_ITEMS_HOLDER = 1 const val WAS_HOME_SCREEN_INIT = "was_home_screen_init" const val DRAWER_COLUMN_COUNT = "drawer_column_count" const val SHOW_SEARCH_BAR = "show_search_bar" +const val ALWAYS_NAVIGATE_TO_HOME_SCREEN = "always_navigate_to_home_screen" // default home screen grid size const val ROW_COUNT = 6 diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 88073cf..a47f5e8 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -136,6 +136,21 @@ + + + + + + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index bc085c1..2ced7a2 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -12,8 +12,9 @@ اﻷيقونات المخفية لا يمكن إلغاء تثبيت بعض التطبيقات بسبب قيود النظام، ولكن يمكن إخفاء أيقوناتها لتجنب ظهورها. درج التطبيق + Always navigate to home screen on home button - \ No newline at end of file + diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index d74b98e..eb5c471 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -12,6 +12,7 @@ Скрити икони Някои приложения не могат да бъдат деинсталирани поради системни ограничения, но можете поне да скриете иконите им, за да не ги виждате. App drawer + Always navigate to home screen on home button - \ No newline at end of file + diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 734f9eb..21284a6 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -12,7 +12,7 @@ Скрити икони Някои приложения не могат да бъдат деинсталирани поради системни ограничения, но можете поне да скриете иконите им, за да не ги виждате. App drawer - Always navigate to home screen on home button + Close app drawer on opening an app Home screen Widget is too big for current home screen size