Fix recovery code keyboard input for Android 15
We need to account for IME insets when applying padding to the window.
This commit is contained in:
parent
f7354a3d79
commit
b7b07d0ba1
5 changed files with 22 additions and 25 deletions
|
@ -101,7 +101,8 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".settings.SettingsActivity"
|
android:name=".settings.SettingsActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:permission="com.stevesoltys.seedvault.OPEN_SETTINGS" />
|
android:permission="com.stevesoltys.seedvault.OPEN_SETTINGS"
|
||||||
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.storage.StorageActivity"
|
android:name=".ui.storage.StorageActivity"
|
||||||
|
@ -114,7 +115,8 @@
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.recoverycode.RecoveryCodeActivity"
|
android:name=".ui.recoverycode.RecoveryCodeActivity"
|
||||||
android:label="@string/recovery_code_title" />
|
android:label="@string/recovery_code_title"
|
||||||
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".restore.RestoreActivity"
|
android:name=".restore.RestoreActivity"
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2024 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.stevesoltys.seedvault.extensions
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.core.view.WindowCompat
|
|
||||||
import androidx.core.view.WindowInsetsCompat
|
|
||||||
|
|
||||||
fun Activity.setupEdgeToEdge() {
|
|
||||||
val rootView = window.decorView.rootView
|
|
||||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(rootView) { v, windowInsets ->
|
|
||||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
|
||||||
v.setPadding(insets.left, insets.top, insets.right, insets.bottom)
|
|
||||||
WindowInsetsCompat.CONSUMED
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,7 +11,6 @@ import androidx.annotation.CallSuper
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.extensions.setupEdgeToEdge
|
|
||||||
|
|
||||||
abstract class BackupActivity : AppCompatActivity() {
|
abstract class BackupActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,25 @@ package com.stevesoltys.seedvault.ui
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.text.format.DateUtils.MINUTE_IN_MILLIS
|
import android.text.format.DateUtils.MINUTE_IN_MILLIS
|
||||||
import android.text.format.DateUtils.getRelativeTimeSpanString
|
import android.text.format.DateUtils.getRelativeTimeSpanString
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener
|
||||||
|
import androidx.core.view.WindowCompat.setDecorFitsSystemWindows
|
||||||
|
import androidx.core.view.WindowInsetsCompat.CONSUMED
|
||||||
|
import androidx.core.view.WindowInsetsCompat.Type.displayCutout
|
||||||
|
import androidx.core.view.WindowInsetsCompat.Type.ime
|
||||||
|
import androidx.core.view.WindowInsetsCompat.Type.systemBars
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
|
|
||||||
|
fun AppCompatActivity.setupEdgeToEdge() {
|
||||||
|
val rootView = window.decorView.rootView
|
||||||
|
setDecorFitsSystemWindows(window, false)
|
||||||
|
setOnApplyWindowInsetsListener(rootView) { v, windowInsets ->
|
||||||
|
val insets = windowInsets.getInsets(systemBars() or ime() or displayCutout())
|
||||||
|
v.setPadding(insets.left, insets.top, insets.right, insets.bottom)
|
||||||
|
CONSUMED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun Long.toRelativeTime(context: Context): CharSequence {
|
fun Long.toRelativeTime(context: Context): CharSequence {
|
||||||
return if (this == 0L || this == -1L) {
|
return if (this == 0L || this == -1L) {
|
||||||
context.getString(R.string.settings_backup_last_backup_never)
|
context.getString(R.string.settings_backup_last_backup_never)
|
||||||
|
|
|
@ -8,7 +8,7 @@ package com.stevesoltys.seedvault.ui.storage
|
||||||
import android.content.Intent.FLAG_GRANT_PREFIX_URI_PERMISSION
|
import android.content.Intent.FLAG_GRANT_PREFIX_URI_PERMISSION
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.stevesoltys.seedvault.extensions.setupEdgeToEdge
|
import com.stevesoltys.seedvault.ui.setupEdgeToEdge
|
||||||
|
|
||||||
class PermissionGrantActivity : AppCompatActivity() {
|
class PermissionGrantActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue