Commit 4aa1dbe3 authored by Mygod's avatar Mygod

Make navbar transparent in gesture mode

parent 24aea2ad
......@@ -125,8 +125,8 @@ fun Resources.Theme.resolveResourceId(@AttrRes resId: Int): Int {
val Intent.datas get() = listOfNotNull(data) + (clipData?.asIterable()?.mapNotNull { it.uri } ?: emptyList())
fun AppCompatActivity.consumeSystemWindowInsetsWithList() {
findViewById<View>(android.R.id.content).setOnApplyWindowInsetsListener { v, insets ->
fun AppCompatActivity.consumeSystemWindowInsetsWithList() = findViewById<View>(android.R.id.content).apply {
setOnApplyWindowInsetsListener { v, insets ->
v.updateLayoutParams<ViewGroup.MarginLayoutParams> {
leftMargin = insets.systemWindowInsetLeft
topMargin = insets.systemWindowInsetTop
......@@ -135,6 +135,7 @@ fun AppCompatActivity.consumeSystemWindowInsetsWithList() {
@Suppress("DEPRECATION")
insets.replaceSystemWindowInsets(0, 0, 0, insets.systemWindowInsetBottom)
}
systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
}
fun printLog(t: Throwable) {
......
......@@ -32,6 +32,7 @@ import android.util.Log
import android.view.KeyCharacterMap
import android.view.KeyEvent
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
......@@ -159,6 +160,7 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Callback, OnPref
stats = findViewById(R.id.stats)
stats.setOnClickListener { if (state == BaseService.State.Connected) stats.testConnection() }
drawer = findViewById(R.id.drawer)
drawer.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
navigation = findViewById(R.id.navigation)
navigation.setNavigationItemSelectedListener(this)
if (savedInstanceState == null) {
......
......@@ -9,13 +9,8 @@
<item name="colorPrimaryDark">@color/color_primary_dark</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="ThemeOverlay.MaterialComponents.Dialog.Alert.Immersive">
<item name="android:windowTranslucentNavigation">false</item>
</style>
<style name="Theme.Shadowsocks.Immersive">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="alertDialogTheme">@style/ThemeOverlay.MaterialComponents.Dialog.Alert.Immersive</item>
<item name="android:navigationBarColor">#6000</item>
</style>
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment