From c05adf6e39faf272e727061190956008b8de2197 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 5 Aug 2025 11:34:19 +0200 Subject: [PATCH 01/11] updated targetSdk to 35, added several changes to login screen for dark mode compatibility and edge-to-edge support --- Simperium/build.gradle | 13 +++-- .../android/AuthenticationActivity.java | 55 +++++++++++++++++++ .../res/layout/activity_authentication.xml | 3 +- .../main/res/layout/activity_credentials.xml | 5 +- Simperium/src/main/res/layout/sheet_login.xml | 2 +- .../src/main/res/values-night-v27/styles.xml | 21 +++++++ .../src/main/res/values-night/colors.xml | 24 ++++++++ .../src/main/res/values-night/styles.xml | 23 ++++++++ Simperium/src/main/res/values-v27/styles.xml | 8 +-- Simperium/src/main/res/values/colors.xml | 4 ++ Simperium/src/main/res/values/styles.xml | 8 +-- 11 files changed, 148 insertions(+), 18 deletions(-) create mode 100644 Simperium/src/main/res/values-night-v27/styles.xml create mode 100644 Simperium/src/main/res/values-night/colors.xml create mode 100644 Simperium/src/main/res/values-night/styles.xml diff --git a/Simperium/build.gradle b/Simperium/build.gradle index c4fa714a..7b64b805 100644 --- a/Simperium/build.gradle +++ b/Simperium/build.gradle @@ -10,11 +10,12 @@ repositories { } android { - compileSdkVersion 30 + namespace 'com.simperium' + compileSdkVersion 36 defaultConfig { minSdkVersion 23 - targetSdkVersion 30 + targetSdkVersion 35 // Calculating PIN for certificate: OU=Domain Control Validated, CN=*.simperium.com // Pin Value: e25695097d04927c9d90206333a687a7b1f99708 @@ -24,11 +25,11 @@ android { defaultPublishConfig 'clientRelease' dependencies { - androidTestImplementation 'androidx.test:core:1.2.0' - androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test:core:1.7.0' + androidTestImplementation 'androidx.test:runner:1.7.0' - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'com.google.android.material:material:1.1.0-alpha07' + implementation 'androidx.appcompat:appcompat:1.7.1' + implementation 'com.google.android.material:material:1.12.0' implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.koushikdutta.async:androidasync:3.1.0' implementation 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0' diff --git a/Simperium/src/main/java/com/simperium/android/AuthenticationActivity.java b/Simperium/src/main/java/com/simperium/android/AuthenticationActivity.java index 575aedde..77d19185 100644 --- a/Simperium/src/main/java/com/simperium/android/AuthenticationActivity.java +++ b/Simperium/src/main/java/com/simperium/android/AuthenticationActivity.java @@ -1,12 +1,19 @@ package com.simperium.android; import android.content.Intent; +import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.view.View; import android.view.Window; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.AppCompatButton; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowCompat; +import androidx.core.view.WindowInsetsCompat; +import androidx.core.view.WindowInsetsControllerCompat; import com.simperium.R; import com.simperium.android.LoginBottomSheetDialogFragment.LoginSheetListener; @@ -22,6 +29,11 @@ public void onCreate(Bundle savedInstanceState) { this.setTheme(R.style.Simperium); setContentView(R.layout.activity_authentication); + // Handle edge-to-edge display for Android 15+ where system bar colors are deprecated + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { + setupEdgeToEdgeForAndroid15(); + } + AppCompatButton buttonLogin = findViewById(R.id.button_login); buttonLogin.setOnClickListener( new View.OnClickListener() { @@ -70,4 +82,47 @@ protected void buttonSignupClicked() { startActivity(intent); finish(); } + + private void setupEdgeToEdgeForAndroid15() { + // Enable edge-to-edge display + WindowCompat.setDecorFitsSystemWindows(getWindow(), false); + + // Determine if we're in light or dark theme + boolean isLightTheme = (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) + != Configuration.UI_MODE_NIGHT_YES; + + // Set system bar appearance based on theme + WindowInsetsControllerCompat controller = WindowCompat.getInsetsController( + getWindow(), + getWindow().getDecorView() + ); + + if (controller != null) { + controller.setAppearanceLightStatusBars(isLightTheme); + controller.setAppearanceLightNavigationBars(isLightTheme); + } + + // Apply window insets to the main content + View contentView = findViewById(R.id.activity_authentication_root); + if (contentView == null) { + // Fallback to the layout's root view + contentView = findViewById(android.R.id.content); + } + + if (contentView != null) { + ViewCompat.setOnApplyWindowInsetsListener(contentView, (v, windowInsets) -> { + Insets systemBars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); + + // Apply padding to avoid overlap with system bars + v.setPadding( + systemBars.left, + systemBars.top, + systemBars.right, + systemBars.bottom + ); + + return WindowInsetsCompat.CONSUMED; + }); + } + } } diff --git a/Simperium/src/main/res/layout/activity_authentication.xml b/Simperium/src/main/res/layout/activity_authentication.xml index 67bb83f0..6b37eb70 100644 --- a/Simperium/src/main/res/layout/activity_authentication.xml +++ b/Simperium/src/main/res/layout/activity_authentication.xml @@ -3,7 +3,8 @@ diff --git a/Simperium/src/main/res/layout/sheet_login.xml b/Simperium/src/main/res/layout/sheet_login.xml index 7e7f8e51..39db3493 100644 --- a/Simperium/src/main/res/layout/sheet_login.xml +++ b/Simperium/src/main/res/layout/sheet_login.xml @@ -3,7 +3,7 @@ + + + + + + + + \ No newline at end of file diff --git a/Simperium/src/main/res/values-night/colors.xml b/Simperium/src/main/res/values-night/colors.xml new file mode 100644 index 00000000..724d05fe --- /dev/null +++ b/Simperium/src/main/res/values-night/colors.xml @@ -0,0 +1,24 @@ + + + + + + @color/gray_40 + @color/primary + @color/gray_40 + @color/gray_b + @color/gray_b + @color/gray_40 + @color/gray_1 + @color/gray_1 + @color/gray_b + @color/primary + @color/gray_b + @color/gray_b + @android:color/white + + + @color/gray_1 + @color/gray_3 + + \ No newline at end of file diff --git a/Simperium/src/main/res/values-night/styles.xml b/Simperium/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..9f820d2c --- /dev/null +++ b/Simperium/src/main/res/values-night/styles.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Simperium/src/main/res/values-v27/styles.xml b/Simperium/src/main/res/values-v27/styles.xml index 17140676..5c618135 100755 --- a/Simperium/src/main/res/values-v27/styles.xml +++ b/Simperium/src/main/res/values-v27/styles.xml @@ -3,14 +3,14 @@ - @@ -12,8 +12,8 @@ @android:color/transparent - @@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@ - - -