Skip to content

Commit

Permalink
Bump targetSdkVersion to 35 and update dependencies
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexbakker committed Oct 18, 2024
1 parent 939fa0e commit d395bbe
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 57 deletions.
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/com/beemdevelopment/aegis/ThemeMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,4 @@ private ThemeMap() {
Theme.DARK, R.style.Theme_Aegis_Dark,
Theme.AMOLED, R.style.Theme_Aegis_Amoled
);

public static final Map<Theme, Integer> 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
);
}
34 changes: 18 additions & 16 deletions app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
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;
import android.view.WindowManager;
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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
android:fitsSystemWindows="true"
tools:context="com.beemdevelopment.aegis.ui.AboutActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_assign_icons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
tools:context="com.beemdevelopment.aegis.ui.AssignIconsActivity">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_auth.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<LinearLayout
android:layout_width="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_edit_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:fitsSystemWindows="true"
tools:context="com.beemdevelopment.aegis.ui.EditEntryActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
Expand Down Expand Up @@ -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"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_groups.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
tools:context="com.beemdevelopment.aegis.ui.GroupManagerActivity">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_import_entries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
tools:context="com.beemdevelopment.aegis.ui.ImportEntriesActivity">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
android:orientation="vertical"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_scanner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
tools:context="com.beemdevelopment.aegis.ui.ScannerActivity">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar_layout"
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_share_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
tools:context="com.beemdevelopment.aegis.ui.TransferEntriesActivity">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar_layout"
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/raw/aboutlibraries.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"metadata": {
"generated": "2024-09-21T10:56:03.535Z"
"generated": "2024-10-18T11:49:53.854Z"
},
"libraries": [
{
Expand All @@ -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"
],
Expand All @@ -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"
],
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,12 @@

<style name="Theme.Aegis.Light" parent="Base.Theme.Aegis.Light">
</style>
<style name="Theme.Aegis.Light.Fullscreen" parent="Theme.Aegis.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>

<style name="Theme.Aegis.Dark" parent="Base.Theme.Aegis.Dark">
</style>
<style name="Theme.Aegis.Dark.Fullscreen" parent="Theme.Aegis.Dark">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>

<style name="Theme.Aegis.Amoled" parent="Base.Theme.Aegis.Amoled">
</style>
<style name="Theme.Aegis.Amoled.Fullscreen" parent="Theme.Aegis.Amoled">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>

<style name="Widget.Aegis.Dropdown" parent="Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;

import androidx.preference.PreferenceManager;
import androidx.test.core.app.ApplicationProvider;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.util.Date;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public class PreferencesTest {
@Test
public void testIsPasswordReminderNeeded() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import android.graphics.Rect;
import android.media.Image;
import android.os.Build;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand All @@ -18,6 +19,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -26,6 +28,7 @@
import java.util.zip.GZIPInputStream;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public class QrCodeAnalyzerTest {
private static final String _expectedUri = "otpauth://totp/neo4j:Charlotte?secret=B33WS2ALPT34K4BNY24AYROE4M&issuer=neo4j&algorithm=SHA1&digits=6&period=30";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static org.junit.Assert.fail;

import android.content.Context;
import android.os.Build;

import androidx.test.core.app.ApplicationProvider;

Expand All @@ -25,13 +26,15 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public class DatabaseImporterTest {
private List<VaultEntry> _vectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import static org.junit.Assert.assertThrows;

import android.os.Build;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public class GoogleAuthInfoTest {
@Test
public void testGoogleAuthInfoEmptySecret() throws GoogleAuthInfoException {
Expand Down
Loading

0 comments on commit d395bbe

Please sign in to comment.