From d395bbeb8dbd488afa6154ef2cc4a6b9f3776762 Mon Sep 17 00:00:00 2001 From: Alexander Bakker Date: Fri, 18 Oct 2024 15:27:26 +0200 Subject: [PATCH] Bump targetSdkVersion to 35 and update dependencies This also includes changes to make the status guard hack work on Android 15 and a couple of small adjustments to support edge-to-edge in all activities. --- app/build.gradle | 12 +++---- .../com/beemdevelopment/aegis/ThemeMap.java | 6 ---- .../aegis/ui/AegisActivity.java | 34 ++++++++++--------- .../aegis/ui/ScannerActivity.java | 6 ---- app/src/main/res/layout/activity_about.xml | 1 + .../main/res/layout/activity_assign_icons.xml | 1 + app/src/main/res/layout/activity_auth.xml | 1 + .../main/res/layout/activity_edit_entry.xml | 3 +- app/src/main/res/layout/activity_groups.xml | 1 + .../res/layout/activity_import_entries.xml | 1 + .../main/res/layout/activity_preferences.xml | 1 + app/src/main/res/layout/activity_scanner.xml | 2 +- .../main/res/layout/activity_share_entry.xml | 2 +- app/src/main/res/raw/aboutlibraries.json | 12 +++---- app/src/main/res/values/themes.xml | 12 ------- .../aegis/PreferencesTest.java | 3 ++ .../aegis/helpers/QrCodeAnalyzerTest.java | 3 ++ .../aegis/importers/DatabaseImporterTest.java | 3 ++ .../aegis/otp/GoogleAuthInfoTest.java | 4 +++ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 21 files changed, 55 insertions(+), 57 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4fc2bbab9b..4f5fba7fd2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,14 +20,14 @@ def fileProviderAuthority = "${packageName}.fileprovider" def fileProviderAuthorityDebug = "${packageName}.debug.fileprovider" android { - compileSdk 34 + compileSdk 35 namespace packageName defaultConfig { applicationId "${packageName}" minSdkVersion 21 - targetSdkVersion 34 + targetSdkVersion 35 versionCode 71 versionName "3.2" multiDexEnabled true @@ -143,19 +143,19 @@ aboutLibraries { dependencies { def cameraxVersion = '1.3.4' def glideVersion = '4.16.0' - def guavaVersion = '33.3.0' + def guavaVersion = '33.3.1' def hiltVersion = '2.52' def junitVersion = '4.13.2' def libsuVersion = '6.0.0' def roomVersion = "2.6.1" - annotationProcessor 'androidx.annotation:annotation:1.8.2' + annotationProcessor 'androidx.annotation:annotation:1.9.0' annotationProcessor "androidx.room:room-compiler:$roomVersion" annotationProcessor "com.google.dagger:hilt-compiler:$hiltVersion" annotationProcessor "com.github.bumptech.glide:compiler:${glideVersion}" implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.activity:activity:1.9.2' + implementation 'androidx.activity:activity:1.9.3' implementation 'androidx.appcompat:appcompat:1.7.0' implementation "androidx.biometric:biometric:1.1.0" implementation "androidx.camera:camera-camera2:$cameraxVersion" @@ -202,7 +202,7 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.6.1' androidTestImplementation 'androidx.test.espresso:espresso-intents:3.6.1' androidTestImplementation "junit:junit:${junitVersion}" - androidTestUtil 'androidx.test:orchestrator:1.5.0' + androidTestUtil 'androidx.test:orchestrator:1.5.1' testImplementation 'androidx.test:core:1.6.1' testImplementation "com.google.guava:guava:${guavaVersion}-jre" diff --git a/app/src/main/java/com/beemdevelopment/aegis/ThemeMap.java b/app/src/main/java/com/beemdevelopment/aegis/ThemeMap.java index 52ac054c29..26859bc640 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ThemeMap.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ThemeMap.java @@ -14,10 +14,4 @@ private ThemeMap() { Theme.DARK, R.style.Theme_Aegis_Dark, Theme.AMOLED, R.style.Theme_Aegis_Amoled ); - - public static final Map FULLSCREEN = ImmutableMap.of( - Theme.LIGHT, R.style.Theme_Aegis_Light_Fullscreen, - Theme.DARK, R.style.Theme_Aegis_Dark_Fullscreen, - Theme.AMOLED, R.style.Theme_Aegis_Amoled_Fullscreen - ); } diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java b/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java index a44eaa5ece..5a467fbcb2 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java @@ -4,7 +4,7 @@ import android.app.Activity; import android.content.Intent; import android.content.res.Configuration; -import android.os.Build; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; @@ -12,7 +12,6 @@ import android.widget.Toast; import androidx.annotation.CallSuper; -import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.view.ActionMode; @@ -26,6 +25,7 @@ import com.beemdevelopment.aegis.icons.IconPackManager; import com.beemdevelopment.aegis.vault.VaultManager; import com.beemdevelopment.aegis.vault.VaultRepositoryException; +import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.color.MaterialColors; import java.lang.reflect.Field; @@ -186,13 +186,9 @@ public void onSupportActionModeFinished(@NonNull ActionMode mode) { private class ActionModeStatusGuardHack { private Field _fadeAnimField; private Field _actionModeViewField; - - @ColorInt - private final int _statusBarColor; + private Drawable _appBarBackground; private ActionModeStatusGuardHack() { - _statusBarColor = getWindow().getStatusBarColor(); - try { _fadeAnimField = getDelegate().getClass().getDeclaredField("mFadeAnim"); _fadeAnimField.setAccessible(true); @@ -216,20 +212,26 @@ private void apply(int visibility) { return; } - if (fadeAnim == null || actionModeView == null) { + AppBarLayout appBarLayout = findViewById(R.id.app_bar_layout); + if (appBarLayout != null && _appBarBackground == null) { + _appBarBackground = appBarLayout.getBackground(); + } + + if (fadeAnim == null || actionModeView == null || appBarLayout == null || _appBarBackground == null) { return; } fadeAnim.cancel(); - actionModeView.setVisibility(visibility); - actionModeView.setAlpha(visibility == View.VISIBLE ? 1f : 0f); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - int statusBarColor = visibility == View.VISIBLE - ? MaterialColors.getColor(actionModeView, com.google.android.material.R.attr.colorSurfaceContainer) - : _statusBarColor; - getWindow().setStatusBarColor(statusBarColor); + if (visibility == View.VISIBLE) { + actionModeView.setVisibility(visibility); + actionModeView.setAlpha(1f); + int color = MaterialColors.getColor(appBarLayout, com.google.android.material.R.attr.colorSurfaceContainer); + appBarLayout.setBackgroundColor(color); + } else { + actionModeView.setVisibility(visibility); + actionModeView.setAlpha(0f); + appBarLayout.setBackground(_appBarBackground); } } } diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/ScannerActivity.java b/app/src/main/java/com/beemdevelopment/aegis/ui/ScannerActivity.java index d6d1b1c5f1..e98a2ca3a6 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/ScannerActivity.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/ScannerActivity.java @@ -18,7 +18,6 @@ import androidx.core.content.ContextCompat; import com.beemdevelopment.aegis.R; -import com.beemdevelopment.aegis.ThemeMap; import com.beemdevelopment.aegis.helpers.QrCodeAnalyzer; import com.beemdevelopment.aegis.otp.GoogleAuthInfo; import com.beemdevelopment.aegis.otp.GoogleAuthInfoException; @@ -87,11 +86,6 @@ public void onCreate(Bundle savedInstanceState) { }, ContextCompat.getMainExecutor(this)); } - @Override - protected void onSetTheme() { - _themeHelper.setTheme(ThemeMap.FULLSCREEN); - } - @Override protected void onDestroy() { if (_executor != null) { diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 8a6c3b5182..280d52d547 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -7,6 +7,7 @@ android:fitsSystemWindows="true" tools:context="com.beemdevelopment.aegis.ui.AboutActivity"> diff --git a/app/src/main/res/layout/activity_assign_icons.xml b/app/src/main/res/layout/activity_assign_icons.xml index 44460c208e..0ff0dee197 100644 --- a/app/src/main/res/layout/activity_assign_icons.xml +++ b/app/src/main/res/layout/activity_assign_icons.xml @@ -8,6 +8,7 @@ tools:context="com.beemdevelopment.aegis.ui.AssignIconsActivity"> diff --git a/app/src/main/res/layout/activity_auth.xml b/app/src/main/res/layout/activity_auth.xml index b11f3b171b..45e4ae125a 100644 --- a/app/src/main/res/layout/activity_auth.xml +++ b/app/src/main/res/layout/activity_auth.xml @@ -5,6 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" + android:fitsSystemWindows="true" tools:context="com.beemdevelopment.aegis.ui.AuthActivity"> @@ -201,7 +202,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/secret" - android:inputType="textPassword | textMultiLine"/> + android:inputType="textPassword|textMultiLine"/> diff --git a/app/src/main/res/layout/activity_import_entries.xml b/app/src/main/res/layout/activity_import_entries.xml index da5eeef063..da32516c30 100644 --- a/app/src/main/res/layout/activity_import_entries.xml +++ b/app/src/main/res/layout/activity_import_entries.xml @@ -9,6 +9,7 @@ tools:context="com.beemdevelopment.aegis.ui.ImportEntriesActivity"> diff --git a/app/src/main/res/layout/activity_preferences.xml b/app/src/main/res/layout/activity_preferences.xml index 7bc815f239..3dc74edffd 100644 --- a/app/src/main/res/layout/activity_preferences.xml +++ b/app/src/main/res/layout/activity_preferences.xml @@ -6,6 +6,7 @@ android:orientation="vertical" android:fitsSystemWindows="true"> diff --git a/app/src/main/res/layout/activity_scanner.xml b/app/src/main/res/layout/activity_scanner.xml index 6481463349..29b4ed7e7d 100644 --- a/app/src/main/res/layout/activity_scanner.xml +++ b/app/src/main/res/layout/activity_scanner.xml @@ -9,7 +9,7 @@ tools:context="com.beemdevelopment.aegis.ui.ScannerActivity"> diff --git a/app/src/main/res/raw/aboutlibraries.json b/app/src/main/res/raw/aboutlibraries.json index 609c42e5f5..a91d29ce76 100644 --- a/app/src/main/res/raw/aboutlibraries.json +++ b/app/src/main/res/raw/aboutlibraries.json @@ -1,6 +1,6 @@ { "metadata": { - "generated": "2024-09-21T10:56:03.535Z" + "generated": "2024-10-18T11:49:53.854Z" }, "libraries": [ { @@ -13,14 +13,14 @@ "name": "The Android Open Source Project" } ], - "artifactVersion": "1.9.2", + "artifactVersion": "1.9.3", "description": "Provides the base Activity subclass and the relevant hooks to build a composable structure on top.", "scm": { "connection": "scm:git:https://android.googlesource.com/platform/frameworks/support", "url": "https://cs.android.com/androidx/platform/frameworks/support" }, "name": "Activity", - "website": "https://developer.android.com/jetpack/androidx/releases/activity#1.9.2", + "website": "https://developer.android.com/jetpack/androidx/releases/activity#1.9.3", "licenses": [ "Apache-2.0" ], @@ -38,14 +38,14 @@ "name": "The Android Open Source Project" } ], - "artifactVersion": "1.9.2", + "artifactVersion": "1.9.3", "description": "Kotlin extensions for 'activity' artifact", "scm": { "connection": "scm:git:https://android.googlesource.com/platform/frameworks/support", "url": "https://cs.android.com/androidx/platform/frameworks/support" }, "name": "Activity Kotlin Extensions", - "website": "https://developer.android.com/jetpack/androidx/releases/activity#1.9.2", + "website": "https://developer.android.com/jetpack/androidx/releases/activity#1.9.3", "licenses": [ "Apache-2.0" ], @@ -2350,7 +2350,7 @@ "developers": [ ], - "artifactVersion": "33.3.0-android", + "artifactVersion": "33.3.1-android", "description": "Guava is a suite of core and expanded libraries that include\n utility classes, Google's collections, I/O classes, and\n much more.", "scm": { "connection": "scm:git:https://github.com/google/guava.git", diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 8f84698ca0..b563a99dee 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -176,24 +176,12 @@ - - -