mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
fix #9: disable workaround for adjustResize when it is not needed
This commit is contained in:
parent
31727d63c4
commit
522ca697b6
2 changed files with 21 additions and 14 deletions
|
@ -4,6 +4,7 @@ import android.app.Activity
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
|
@ -17,12 +18,12 @@ import de.jrpie.android.launcher.PREF_SCREEN_FULLSCREEN
|
|||
import de.jrpie.android.launcher.R
|
||||
import de.jrpie.android.launcher.REQUEST_UNINSTALL
|
||||
import de.jrpie.android.launcher.UIObject
|
||||
import de.jrpie.android.launcher.databinding.ListBinding
|
||||
import de.jrpie.android.launcher.getPreferences
|
||||
import de.jrpie.android.launcher.list.apps.ListFragmentApps
|
||||
import de.jrpie.android.launcher.list.other.LauncherAction
|
||||
import de.jrpie.android.launcher.list.other.ListFragmentOther
|
||||
import de.jrpie.android.launcher.vibrantColor
|
||||
import de.jrpie.android.launcher.databinding.ListBinding
|
||||
|
||||
|
||||
var intendedChoosePause = false // know when to close
|
||||
|
@ -57,15 +58,18 @@ class ListActivity : AppCompatActivity(), UIObject {
|
|||
LauncherAction.SETTINGS.launch(this@ListActivity)
|
||||
}
|
||||
|
||||
|
||||
// android:windowSoftInputMode="adjustResize" doesn't work in full screen.
|
||||
// workaround from https://stackoverflow.com/a/57623505
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
this.window.decorView.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
val r = Rect()
|
||||
window.decorView.getWindowVisibleDisplayFrame(r)
|
||||
val height: Int =
|
||||
binding.listContainer.context.resources.displayMetrics.heightPixels
|
||||
val diff = height - r.bottom
|
||||
if (diff != 0 && getPreferences(this).getBoolean(PREF_SCREEN_FULLSCREEN, false)) {
|
||||
if (diff != 0 &&
|
||||
getPreferences(this).getBoolean(PREF_SCREEN_FULLSCREEN, true)) {
|
||||
if (binding.listContainer.paddingBottom !== diff) {
|
||||
binding.listContainer.setPadding(0, 0, 0, diff)
|
||||
}
|
||||
|
@ -77,6 +81,8 @@ class ListActivity : AppCompatActivity(), UIObject {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onStart(){
|
||||
super<AppCompatActivity>.onStart()
|
||||
super<UIObject>.onStart()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
android:id="@+id/list_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".list.ListActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
|
|
Loading…
Add table
Reference in a new issue