app v1.1.1: fix top bar drawing under the status bar (edge-to-edge insets)
Android 15 / targetSdk 35 forces edge-to-edge, so the app bar and its buttons drew behind the status bar (under the clock/battery). fitsSystemWindows on the root CoordinatorLayout insets the app bar below the status bar, and a window-insets listener pads the queue list above the gesture nav bar. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -22,8 +22,8 @@ android {
|
|||||||
applicationId = "eu.itaz.internaluploader"
|
applicationId = "eu.itaz.internaluploader"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 2
|
versionCode = 3
|
||||||
versionName = "1.1.0"
|
versionName = "1.1.1"
|
||||||
|
|
||||||
// The one place the server address exists. Never rendered in the UI;
|
// The one place the server address exists. Never rendered in the UI;
|
||||||
// a pairing QR can carry a different origin and overrides this.
|
// a pairing QR can carry a different origin and overrides this.
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.browser.customtabs.CustomTabsIntent
|
import androidx.browser.customtabs.CustomTabsIntent
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.journeyapps.barcodescanner.ScanContract
|
import com.journeyapps.barcodescanner.ScanContract
|
||||||
@@ -70,6 +73,16 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.queue.layoutManager = LinearLayoutManager(this)
|
binding.queue.layoutManager = LinearLayoutManager(this)
|
||||||
binding.queue.adapter = adapter
|
binding.queue.adapter = adapter
|
||||||
|
|
||||||
|
// Edge-to-edge (forced on Android 15 / targetSdk 35): the app bar is
|
||||||
|
// inset by fitsSystemWindows on the root, but the scrolling list still
|
||||||
|
// needs bottom padding so its last rows clear the gesture nav bar.
|
||||||
|
val basePadding = binding.queue.paddingBottom
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(binding.queue) { view, insets ->
|
||||||
|
val bars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||||
|
view.updatePadding(bottom = basePadding + bars.bottom)
|
||||||
|
insets
|
||||||
|
}
|
||||||
|
|
||||||
binding.scanButton.setOnClickListener { startScan() }
|
binding.scanButton.setOnClickListener { startScan() }
|
||||||
binding.ssoButton.setOnClickListener { startAppSso() }
|
binding.ssoButton.setOnClickListener { startAppSso() }
|
||||||
binding.addButton.setOnClickListener {
|
binding.addButton.setOnClickListener {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user