mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 14:31:30 +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.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
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.R
|
||||||
import de.jrpie.android.launcher.REQUEST_UNINSTALL
|
import de.jrpie.android.launcher.REQUEST_UNINSTALL
|
||||||
import de.jrpie.android.launcher.UIObject
|
import de.jrpie.android.launcher.UIObject
|
||||||
|
import de.jrpie.android.launcher.databinding.ListBinding
|
||||||
import de.jrpie.android.launcher.getPreferences
|
import de.jrpie.android.launcher.getPreferences
|
||||||
import de.jrpie.android.launcher.list.apps.ListFragmentApps
|
import de.jrpie.android.launcher.list.apps.ListFragmentApps
|
||||||
import de.jrpie.android.launcher.list.other.LauncherAction
|
import de.jrpie.android.launcher.list.other.LauncherAction
|
||||||
import de.jrpie.android.launcher.list.other.ListFragmentOther
|
import de.jrpie.android.launcher.list.other.ListFragmentOther
|
||||||
import de.jrpie.android.launcher.vibrantColor
|
import de.jrpie.android.launcher.vibrantColor
|
||||||
import de.jrpie.android.launcher.databinding.ListBinding
|
|
||||||
|
|
||||||
|
|
||||||
var intendedChoosePause = false // know when to close
|
var intendedChoosePause = false // know when to close
|
||||||
|
@ -57,24 +58,29 @@ class ListActivity : AppCompatActivity(), UIObject {
|
||||||
LauncherAction.SETTINGS.launch(this@ListActivity)
|
LauncherAction.SETTINGS.launch(this@ListActivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// android:windowSoftInputMode="adjustResize" doesn't work in full screen.
|
// android:windowSoftInputMode="adjustResize" doesn't work in full screen.
|
||||||
// workaround from https://stackoverflow.com/a/57623505
|
// workaround from https://stackoverflow.com/a/57623505
|
||||||
this.window.decorView.viewTreeObserver.addOnGlobalLayoutListener {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||||
val r = Rect()
|
this.window.decorView.viewTreeObserver.addOnGlobalLayoutListener {
|
||||||
window.decorView.getWindowVisibleDisplayFrame(r)
|
val r = Rect()
|
||||||
val height: Int =
|
window.decorView.getWindowVisibleDisplayFrame(r)
|
||||||
binding.listContainer.context.resources.displayMetrics.heightPixels
|
val height: Int =
|
||||||
val diff = height - r.bottom
|
binding.listContainer.context.resources.displayMetrics.heightPixels
|
||||||
if (diff != 0 && getPreferences(this).getBoolean(PREF_SCREEN_FULLSCREEN, false)) {
|
val diff = height - r.bottom
|
||||||
if (binding.listContainer.paddingBottom !== diff) {
|
if (diff != 0 &&
|
||||||
binding.listContainer.setPadding(0, 0, 0, diff)
|
getPreferences(this).getBoolean(PREF_SCREEN_FULLSCREEN, true)) {
|
||||||
}
|
if (binding.listContainer.paddingBottom !== diff) {
|
||||||
} else {
|
binding.listContainer.setPadding(0, 0, 0, diff)
|
||||||
if (binding.listContainer.paddingBottom !== 0) {
|
}
|
||||||
binding.listContainer.setPadding(0, 0, 0, 0)
|
} else {
|
||||||
|
if (binding.listContainer.paddingBottom !== 0) {
|
||||||
|
binding.listContainer.setPadding(0, 0, 0, 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart(){
|
override fun onStart(){
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
android:id="@+id/list_container"
|
android:id="@+id/list_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
tools:context=".list.ListActivity">
|
tools:context=".list.ListActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
|
Loading…
Add table
Reference in a new issue