Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 13 additions & 29 deletions Simperium/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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;
});
}
}
}
3 changes: 2 additions & 1 deletion Simperium/src/main/res/layout/activity_authentication.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:background="@android:color/white"
android:id="@+id/activity_authentication_root"
android:background="@color/background_primary"
android:clipToPadding="false"
android:layout_gravity="center_horizontal"
android:layout_height="match_parent"
Expand Down
11 changes: 7 additions & 4 deletions Simperium/src/main/res/layout/activity_credentials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:background="@android:color/white"
android:background="@color/background_primary"
android:elevation="0dp"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light"
app:theme="@style/ThemeOverlay.MaterialComponents.ActionBar"
app:titleTextColor="@color/text_title"
app:navigationIconTint="@color/text_title"
Comment thread
mzorz marked this conversation as resolved.
Outdated
app:popupTheme="@style/ThemeOverlay.MaterialComponents"
app:theme="@style/ThemeOverlay.MaterialComponents"
tools:layout_height="wrap_content">
</androidx.appcompat.widget.Toolbar>

<RelativeLayout
android:background="@color/background_primary"
android:clipToPadding="false"
android:layout_centerHorizontal="true"
android:layout_height="match_parent"
Expand Down Expand Up @@ -81,7 +84,7 @@
android:layout_width="match_parent"
android:minHeight="@dimen/height_button"
android:textAllCaps="true"
android:textColor="@android:color/white"
android:textColor="@color/text_button_primary"
tools:text="@string/simperium_button_login"
style="@style/Widget.AppCompat.Button">
</androidx.appcompat.widget.AppCompatButton>
Expand Down
2 changes: 1 addition & 1 deletion Simperium/src/main/res/layout/sheet_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:background="@android:color/white"
android:background="@color/background_primary"
android:clipToPadding="false"
android:layout_height="wrap_content"
android:layout_width="@dimen/width_layout"
Expand Down
21 changes: 21 additions & 0 deletions Simperium/src/main/res/values-night-v27/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>

<resources>

<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog">
<item name="android:navigationBarColor">@color/background_primary</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightNavigationBar">false</item>
</style>

<style name="Simperium" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:navigationBarColor">@color/background_primary</item>
<item name="android:statusBarColor">@color/background_primary</item>
<item name="android:windowLightNavigationBar">false</item>
<item name="android:windowLightStatusBar">false</item>
<item name="colorAccent">@color/background_button_primary</item>
<item name="colorPrimary">@color/background_button_primary</item>
<item name="colorPrimaryDark">@color/background_button_primary</item>
</style>

</resources>
24 changes: 24 additions & 0 deletions Simperium/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>

<resources>

<!-- APPLICATION - Dark Mode Colors -->
<color name="background_button_disabled">@color/gray_40</color>
<color name="background_button_primary">@color/primary</color>
<color name="background_button_secondary">@color/gray_40</color>
<color name="primary">@color/gray_b</color>
<color name="primary_dark">@color/gray_b</color>
<color name="text_button_disabled">@color/gray_40</color>
<color name="text_button_primary">@color/gray_1</color>
<color name="text_button_secondary">@color/gray_1</color>
<color name="text_button_tertiary">@color/gray_b</color>
<color name="text_link">@color/primary</color>
<color name="text_footer">@color/gray_b</color>
<color name="text_subtitle">@color/gray_b</color>
<color name="text_title">@android:color/white</color>
Comment thread
mzorz marked this conversation as resolved.

<!-- Background colors for dark mode -->
<color name="background_primary">@color/gray_1</color>
<color name="background_secondary">@color/gray_3</color>

</resources>
23 changes: 23 additions & 0 deletions Simperium/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>

<resources>

<style name="BaseBottomSheetDialog" parent="Theme.MaterialComponents.DayNight.BottomSheetDialog">
<item name="android:colorBackground">@color/background_primary</item>
<item name="android:windowIsFloating">false</item>
<item name="bottomSheetStyle">@style/Widget.Design.BottomSheet.Modal</item>
</style>

<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog">
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<style name="BaseBottomSheetDialog" parent="Theme.MaterialComponents.DayNight.BottomSheetDialog">
<item name="android:colorBackground">@color/background_primary</item>
<item name="android:windowIsFloating">false</item>
<item name="bottomSheetStyle">@style/Widget.Design.BottomSheet.Modal</item>
</style>
<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog">
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

Since the BaseBottomSheetDialog and BottomSheetDialogTheme styles are exactly the same for both values/styles.xml and values-night/styles.xml, we can delete them in values-night/styles.xml. It doesn't hurt to leave keep them though. It's just a suggestion in case we want to add only the differences between dark and light styles in values-night/styles.xml.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, addressed in 4066d5a (can't apply an "outdated suggestion" since the branch moved)

<style name="Simperium" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:statusBarColor">@color/background_primary</item>
<item name="android:windowLightStatusBar">false</item>
<item name="colorAccent">@color/background_button_primary</item>
<item name="colorPrimary">@color/background_button_primary</item>
<item name="colorPrimaryDark">@color/background_button_primary</item>
</style>

</resources>
8 changes: 4 additions & 4 deletions Simperium/src/main/res/values-v27/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<resources>

<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog">
<item name="android:navigationBarColor">@android:color/white</item>
<item name="android:navigationBarColor">@color/background_primary</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightNavigationBar">true</item>
</style>

<style name="Simperium" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:navigationBarColor">@android:color/white</item>
<item name="android:statusBarColor">@android:color/white</item>
<style name="Simperium" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:navigationBarColor">@color/background_primary</item>
<item name="android:statusBarColor">@color/background_primary</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:windowLightStatusBar">true</item>
<item name="colorAccent">@color/background_button_primary</item>
Expand Down
4 changes: 4 additions & 0 deletions Simperium/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<color name="text_subtitle">@color/gray_1</color>
<color name="text_title">@color/gray_1</color>
Comment thread
mzorz marked this conversation as resolved.

<!-- Background colors for light mode -->
<color name="background_primary">@android:color/white</color>
<color name="background_secondary">@color/gray_b</color>

<!-- STANDARD -->
<color name="gray_1">#111111</color>
<color name="gray_3">#333333</color>
Expand Down
8 changes: 4 additions & 4 deletions Simperium/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<resources>

<style name="BaseBottomSheetDialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<item name="android:colorBackground">@android:color/white</item>
<style name="BaseBottomSheetDialog" parent="Theme.MaterialComponents.DayNight.BottomSheetDialog">
<item name="android:colorBackground">@color/background_primary</item>
<item name="android:windowIsFloating">false</item>
<item name="bottomSheetStyle">@style/Widget.Design.BottomSheet.Modal</item>
</style>
Expand All @@ -12,8 +12,8 @@
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

<style name="Simperium" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:statusBarColor">@android:color/white</item>
<style name="Simperium" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:statusBarColor">@color/background_primary</item>
<item name="android:windowLightStatusBar">true</item>
<item name="colorAccent">@color/background_button_primary</item>
<item name="colorPrimary">@color/background_button_primary</item>
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Aug 06 09:56:31 CEST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginManagement {
plugins {
id("com.android.library") version "4.2.2"
id("com.automattic.android.publish-to-s3") version "0.6.1"
id("com.android.library") version "8.11.1"
id("com.automattic.android.publish-to-s3") version "0.10.0"
}
repositories {
maven {
Expand Down