diff --git a/Simperium/build.gradle b/Simperium/build.gradle index c4fa714a..2fd7421c 100644 --- a/Simperium/build.gradle +++ b/Simperium/build.gradle @@ -6,48 +6,37 @@ plugins { repositories { google() - jcenter() + mavenCentral() } 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 buildConfigField 'String', 'SIMPERIUM_COM_SPKI', '"e25695097d04927c9d90206333a687a7b1f99708"' } - defaultPublishConfig 'clientRelease' + buildFeatures { + buildConfig = true + } 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' } - flavorDimensions "main" - - productFlavors { - // client is the main production build - client { - dimension "main" - } - - // support build is for running tests and includes mock code - support { - dimension "main" - } - } - useLibrary 'android.test.base' useLibrary 'android.test.runner' useLibrary 'org.apache.http.legacy' @@ -58,11 +47,11 @@ tasks.withType(Javadoc) { options.addStringOption('encoding', 'UTF-8') } -afterEvaluate { +project.afterEvaluate { publishing { publications { release(MavenPublication) { - from components.clientRelease + from components.release groupId "com.automattic" artifactId "simperium" // version is set by 'publish-to-s3' plugin @@ -71,11 +60,6 @@ afterEvaluate { } } -publishToS3Plugin { - mavenPublishGroupId "com.automattic" - mavenPublishArtifactId "simperium" -} - task versionConfig(group: "build", description: "Generate version class") { def dir = "${buildDir}/generated/source/version" def file = new File(dir, "com/simperium/Version.java") 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-land/activity_authentication.xml b/Simperium/src/main/res/layout-land/activity_authentication.xml index d5c96151..579b54c5 100644 --- a/Simperium/src/main/res/layout-land/activity_authentication.xml +++ b/Simperium/src/main/res/layout-land/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..5414d63a 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..89257de6 --- /dev/null +++ b/Simperium/src/main/res/values-night/colors.xml @@ -0,0 +1,23 @@ + + + + + + @color/gray_1 + @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 + @android:color/white + @android:color/white + + \ 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..a2dc9164 --- /dev/null +++ b/Simperium/src/main/res/values-night/styles.xml @@ -0,0 +1,13 @@ + + + + + + + \ 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..5875c604 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 -