mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-05-31 19:09:15 +02:00
Add animation on home button if no other app was on top
This commit is contained in:
parent
3fc14045b6
commit
564d92f7a7
@ -33,6 +33,7 @@ import androidx.core.graphics.drawable.toBitmap
|
|||||||
import androidx.core.view.GestureDetectorCompat
|
import androidx.core.view.GestureDetectorCompat
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.launcher.BuildConfig
|
import com.simplemobiletools.launcher.BuildConfig
|
||||||
@ -69,6 +70,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
private var mActionOnCanBindWidget: ((granted: Boolean) -> Unit)? = null
|
private var mActionOnCanBindWidget: ((granted: Boolean) -> Unit)? = null
|
||||||
private var mActionOnWidgetConfiguredWidget: ((granted: Boolean) -> Unit)? = null
|
private var mActionOnWidgetConfiguredWidget: ((granted: Boolean) -> Unit)? = null
|
||||||
private var mActionOnAddShortcut: ((shortcutId: String, label: String, icon: Drawable) -> Unit)? = null
|
private var mActionOnAddShortcut: ((shortcutId: String, label: String, icon: Drawable) -> Unit)? = null
|
||||||
|
private var wasJustPaused: Boolean = false
|
||||||
|
|
||||||
private lateinit var mDetector: GestureDetectorCompat
|
private lateinit var mDetector: GestureDetectorCompat
|
||||||
|
|
||||||
@ -113,8 +115,17 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
closeAppDrawer()
|
if (wasJustPaused) {
|
||||||
closeWidgetsFragment()
|
if (isAllAppsFragmentExpanded()) {
|
||||||
|
hideFragment(all_apps_fragment)
|
||||||
|
}
|
||||||
|
if (isWidgetsFragmentExpanded()) {
|
||||||
|
hideFragment(widgets_fragment)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
closeAppDrawer()
|
||||||
|
closeWidgetsFragment()
|
||||||
|
}
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
handleIntentAction(intent)
|
handleIntentAction(intent)
|
||||||
}
|
}
|
||||||
@ -200,6 +211,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
wasJustPaused = false
|
||||||
updateStatusbarColor(Color.TRANSPARENT)
|
updateStatusbarColor(Color.TRANSPARENT)
|
||||||
|
|
||||||
main_holder.onGlobalLayout {
|
main_holder.onGlobalLayout {
|
||||||
@ -249,6 +261,12 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
home_screen_grid?.appWidgetHost?.stopListening()
|
home_screen_grid?.appWidgetHost?.stopListening()
|
||||||
|
wasJustPaused = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
wasJustPaused = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user