diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a734e7b..4f4e89c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -44,13 +44,19 @@ android:configChanges="orientation|keyboardHidden|screenSize" android:excludeFromRecents="true" android:exported="true" - android:launchMode="singleTop" + android:launchMode="singleTask" android:screenOrientation="portrait" android:theme="@style/LauncherTheme"> + + + + + + - @@ -116,7 +121,6 @@ - @@ -135,7 +139,6 @@ - @@ -154,7 +157,6 @@ - @@ -173,7 +175,6 @@ - @@ -192,7 +193,6 @@ - @@ -211,7 +211,6 @@ - @@ -230,7 +229,6 @@ - @@ -249,7 +247,6 @@ - @@ -268,7 +265,6 @@ - @@ -287,7 +283,6 @@ - @@ -306,7 +301,6 @@ - @@ -325,7 +319,6 @@ - @@ -344,7 +337,6 @@ - @@ -363,7 +355,6 @@ - @@ -382,7 +373,6 @@ - @@ -401,7 +391,6 @@ - @@ -420,7 +409,6 @@ - @@ -439,7 +427,6 @@ - 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 f0768a7..db13253 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -69,6 +69,7 @@ class MainActivity : SimpleActivity(), FlingListener { private var mActionOnCanBindWidget: ((granted: Boolean) -> Unit)? = null private var mActionOnWidgetConfiguredWidget: ((granted: Boolean) -> Unit)? = null private var mActionOnAddShortcut: ((shortcutId: String, label: String, icon: Drawable) -> Unit)? = null + private var wasJustPaused: Boolean = false private lateinit var mDetector: GestureDetectorCompat @@ -113,6 +114,17 @@ class MainActivity : SimpleActivity(), FlingListener { override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) + if (wasJustPaused) { + if (isAllAppsFragmentExpanded()) { + hideFragment(all_apps_fragment) + } + if (isWidgetsFragmentExpanded()) { + hideFragment(widgets_fragment) + } + } else { + closeAppDrawer() + closeWidgetsFragment() + } if (intent != null) { handleIntentAction(intent) } @@ -198,6 +210,7 @@ class MainActivity : SimpleActivity(), FlingListener { override fun onResume() { super.onResume() + wasJustPaused = false updateStatusbarColor(Color.TRANSPARENT) main_holder.onGlobalLayout { @@ -247,6 +260,12 @@ class MainActivity : SimpleActivity(), FlingListener { override fun onStop() { super.onStop() home_screen_grid?.appWidgetHost?.stopListening() + wasJustPaused = false + } + + override fun onPause() { + super.onPause() + wasJustPaused = true } override fun onBackPressed() { @@ -488,13 +507,35 @@ class MainActivity : SimpleActivity(), FlingListener { } } - fun closeAppDrawer() { + fun closeAppDrawer(delayed: Boolean = false) { if (isAllAppsFragmentExpanded()) { - Handler(Looper.getMainLooper()).postDelayed({ + val close = { all_apps_fragment.y = mScreenHeight.toFloat() all_apps_fragment.all_apps_grid.scrollToPosition(0) + (all_apps_fragment as AllAppsFragment).touchDownY = -1 home_screen_grid.fragmentCollapsed() - }, APP_DRAWER_CLOSE_DELAY) + } + if (delayed) { + Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY) + } else { + close() + } + } + } + + fun closeWidgetsFragment(delayed: Boolean = false) { + if (isWidgetsFragmentExpanded()) { + val close = { + widgets_fragment.y = mScreenHeight.toFloat() + widgets_fragment.widgets_list.scrollToPosition(0) + (widgets_fragment as WidgetsFragment).touchDownY = -1 + home_screen_grid.fragmentCollapsed() + } + if (delayed) { + Handler(Looper.getMainLooper()).postDelayed(close, APP_DRAWER_CLOSE_DELAY) + } else { + close() + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt index 4ced1d8..7e5cfe5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt @@ -121,7 +121,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment LaunchersAdapter(activity!!, launchers, this) { activity?.launchApp((it as AppLauncher).packageName, it.activityName) if (activity?.config?.closeAppDrawer == true) { - activity?.closeAppDrawer() + activity?.closeAppDrawer(delayed = true) } ignoreTouches = false touchDownY = -1 diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index ae567e4..5ca242a 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -19,4 +19,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index d0601c9..d68b328 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -15,4 +15,4 @@ Tanca el calaix d\'aplicacions en obrir una aplicació Home screen El giny és massa gros per a la mida de la pantalla d\'inici actual - \ 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 94e6720..d737988 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -15,4 +15,4 @@ App-Schublade beim Öffnen einer App schließen Startbildschirm Das Widget ist zu groß für den aktuellen Startbildschirm - \ No newline at end of file + diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index edf16ba..e582525 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -15,4 +15,4 @@ App-overzicht sluiten na het kiezen van een app Beginscherm Widget is te groot voor de huidige afmetingen van het beginscherm - \ No newline at end of file + diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 85a8fb8..957191d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -15,4 +15,4 @@ Zamykaj szufladę aplikacji przy uruchomieniu aplikacji Ekran główny Widżet jest za duży dla aktualnego rozmiaru ekranu głównego - \ No newline at end of file + diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 6a62028..eeaaec3 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -15,4 +15,4 @@ Закрывать боковую панель при открытии приложения Домашний экран Виджет слишком велик для текущего размера домашнего экрана - \ No newline at end of file + diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index e104448..2399ce1 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -15,4 +15,4 @@ Bir uygulama açıldığında uygulama çekmecesini kapat Ana ekran Widget, şu anki ana ekran boyutu için çok büyük - \ No newline at end of file + diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2fef3c4..d587d86 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -15,4 +15,4 @@ 打开抽屉内应用时关闭抽屉 主屏幕 小部件对当前屏幕尺寸而言太大了 - \ No newline at end of file +