mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	android: Use navigation bar shade view for settings activity
This commit is contained in:
		@@ -8,6 +8,7 @@ import android.content.Intent
 | 
			
		||||
import android.os.Bundle
 | 
			
		||||
import android.view.Menu
 | 
			
		||||
import android.view.View
 | 
			
		||||
import android.view.ViewGroup
 | 
			
		||||
import android.widget.Toast
 | 
			
		||||
import androidx.activity.viewModels
 | 
			
		||||
import androidx.appcompat.app.AppCompatActivity
 | 
			
		||||
@@ -51,9 +52,11 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
 | 
			
		||||
        setSupportActionBar(binding.toolbarSettings)
 | 
			
		||||
        supportActionBar!!.setDisplayHomeAsUpEnabled(true)
 | 
			
		||||
 | 
			
		||||
        ThemeHelper.setNavigationBarColor(
 | 
			
		||||
            this,
 | 
			
		||||
            MaterialColors.getColor(window.decorView, R.attr.colorSurface)
 | 
			
		||||
        binding.navigationBarShade.setBackgroundColor(
 | 
			
		||||
            ThemeHelper.getColorWithOpacity(
 | 
			
		||||
                MaterialColors.getColor(binding.navigationBarShade, R.attr.colorSurface),
 | 
			
		||||
                ThemeHelper.SYSTEM_BAR_ALPHA
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        setInsets()
 | 
			
		||||
@@ -164,6 +167,11 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
 | 
			
		||||
            val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
 | 
			
		||||
            view.updatePadding(left = insets.left, right = insets.right)
 | 
			
		||||
            InsetsHelper.insetAppBar(insets, binding.appbarSettings)
 | 
			
		||||
 | 
			
		||||
            val mlpShade = binding.navigationBarShade.layoutParams as ViewGroup.MarginLayoutParams
 | 
			
		||||
            mlpShade.height = insets.bottom
 | 
			
		||||
            binding.navigationBarShade.layoutParams = mlpShade
 | 
			
		||||
 | 
			
		||||
            windowInsets
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,4 +26,13 @@
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
 | 
			
		||||
 | 
			
		||||
    <View
 | 
			
		||||
        android:id="@+id/navigation_bar_shade"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="1px"
 | 
			
		||||
        android:background="@android:color/transparent"
 | 
			
		||||
        android:clickable="false"
 | 
			
		||||
        android:focusable="false"
 | 
			
		||||
        android:layout_gravity="bottom|center_horizontal" />
 | 
			
		||||
 | 
			
		||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user