From c5953928bd83c577f1ec5fdd95b4a9c03fc49b4f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Sep 2022 21:41:26 +0200 Subject: [PATCH] show a darker navigation bar if some fragment is pulled up --- .../launcher/activities/MainActivity.kt | 11 ++++++----- app/src/main/res/values/colors.xml | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/values/colors.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 c528bfc..4bc668b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -33,7 +33,6 @@ import com.simplemobiletools.launcher.interfaces.FlingListener import com.simplemobiletools.launcher.models.HomeScreenGridItem import kotlinx.android.synthetic.main.activity_main.* - class MainActivity : SimpleActivity(), FlingListener { private val ANIMATION_DURATION = 150L @@ -122,7 +121,7 @@ class MainActivity : SimpleActivity(), FlingListener { if (!mIgnoreUpEvent) { if (all_apps_fragment.y < mScreenHeight * 0.7) { showFragment(all_apps_fragment) - } else { + } else if (all_apps_fragment.y != realScreenSize.y.toFloat()) { hideFragment(all_apps_fragment) } } @@ -144,6 +143,8 @@ class MainActivity : SimpleActivity(), FlingListener { interpolator = DecelerateInterpolator() start() } + + window.navigationBarColor = resources.getColor(R.color.semitransparent_navigation) } private fun hideFragment(fragment: View) { @@ -152,6 +153,8 @@ class MainActivity : SimpleActivity(), FlingListener { interpolator = DecelerateInterpolator() start() } + + window.navigationBarColor = Color.TRANSPARENT } fun homeScreenLongPressed(x: Float, y: Float) { @@ -192,9 +195,7 @@ class MainActivity : SimpleActivity(), FlingListener { inflate(R.menu.menu_home_screen) setOnMenuItemClickListener { item -> when (item.itemId) { - R.id.widgets -> { - showWidgetsFragment() - } + R.id.widgets -> showWidgetsFragment() } true } diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..72a2b9b --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #33000000 +