Fix margin too small in crash activity fab

This commit is contained in:
Super12138 2024-01-05 21:00:19 +08:00
parent 8c07ac0b7d
commit 74761c8000
2 changed files with 7 additions and 8 deletions

View file

@ -32,11 +32,10 @@ class CrashActivity : AppCompatActivity() {
ViewCompat.setOnApplyWindowInsetsListener(binding.exitApp) { view, windowInsets ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
leftMargin = insets.left
bottomMargin = insets.bottom
rightMargin = insets.right
leftMargin = if (insets.left == 0) 16 else insets.left
bottomMargin = if (insets.bottom == 0) 48 else insets.bottom + 32
rightMargin = if (insets.right == 0) 48 else insets.right + 32
}
WindowInsetsCompat.CONSUMED
}

View file

@ -33,21 +33,21 @@ class MainActivity : AppCompatActivity() {
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
/*val pref = getSharedPreferences("data",Context.MODE_PRIVATE)
/*val pref = getSharedPreferences("data", Context.MODE_PRIVATE)
val isFirstUse = pref.getBoolean("first_use", false)
if (!isFirstUse) {
MaterialAlertDialogBuilder(this)
.setTitle("欢迎使用待办")
.setMessage("")
.setMessage("本应用不需要任何权限")
.setPositiveButton("确定") { dialog, which ->
val editor = getSharedPreferences("data", Context.MODE_PRIVATE).edit()
editor.putBoolean("first_use", true)
editor.apply()
}
.show()
}
*/
}*/
val isDarkMode = Repository.getPreferenceString(this, "dark_mode", "0")
when (isDarkMode) {
"0" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)