diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad51f0a1..bf933838 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# browser-switch-android Release Notes
+## unreleased
+
+* Upgrade `compileSdkVersion` and `targetSdkVersion` to API 35
+* Breaking Changes
+ * Bump target Java version to Java 17
+
## 3.0.0-beta1
* Make `BrowserSwitchClient.assertCanPerformBrowserSwitch()` public
diff --git a/browser-switch/build.gradle b/browser-switch/build.gradle
index fa40cbb9..ba335cc7 100644
--- a/browser-switch/build.gradle
+++ b/browser-switch/build.gradle
@@ -19,9 +19,6 @@ android {
sourceCompatibility versions.javaSourceCompatibility
targetCompatibility versions.javaTargetCompatibility
}
- kotlinOptions {
- jvmTarget = "11"
- }
// robolectric
testOptions {
diff --git a/build.gradle b/build.gradle
index 139327ec..62f7bedb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,7 +7,7 @@ buildscript {
}
}
- def sdkTargetJavaVersion = JavaVersion.VERSION_11
+ def sdkTargetJavaVersion = JavaVersion.VERSION_17
ext.versions = [
"javaSourceCompatibility": sdkTargetJavaVersion,
"javaTargetCompatibility": sdkTargetJavaVersion,
@@ -28,7 +28,7 @@ buildscript {
]
dependencies {
- classpath 'com.android.tools.build:gradle:8.1.4'
+ classpath 'com.android.tools.build:gradle:8.5.2'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.10'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0'
}
@@ -43,9 +43,9 @@ plugins {
version = '3.0.0-beta2-SNAPSHOT'
group = "com.braintreepayments"
ext {
- compileSdkVersion = 34
+ compileSdkVersion = 35
minSdkVersion = 23
- targetSdkVersion = 34
+ targetSdkVersion = 35
versionCode = 71
versionName = version
}
diff --git a/demo/build.gradle b/demo/build.gradle
index 7a322625..726e269b 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -30,9 +30,6 @@ android {
sourceCompatibility versions.javaSourceCompatibility
targetCompatibility versions.javaTargetCompatibility
}
- kotlinOptions {
- jvmTarget = "11"
- }
buildFeatures {
compose true
}
diff --git a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt
index 0853740d..a14c0c55 100644
--- a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt
+++ b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt
@@ -8,6 +8,8 @@ import androidx.activity.viewModels
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.safeDrawingPadding
+import androidx.compose.foundation.layout.safeGesturesPadding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -35,7 +37,7 @@ class ComposeActivity : ComponentActivity() {
browserSwitchClient = BrowserSwitchClient()
setContent {
- Column(modifier = Modifier.padding(10.dp)) {
+ Column(modifier = Modifier.safeGesturesPadding()) {
BrowserSwitchButton {
startBrowserSwitch()
}
diff --git a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/DemoActivitySingleTop.java b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/DemoActivitySingleTop.java
index 15caaa77..8ac4888e 100644
--- a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/DemoActivitySingleTop.java
+++ b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/DemoActivitySingleTop.java
@@ -2,10 +2,14 @@
import android.content.Intent;
import android.os.Bundle;
+import android.view.View;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@@ -15,6 +19,7 @@
import com.braintreepayments.api.BrowserSwitchOptions;
import com.braintreepayments.api.BrowserSwitchStartResult;
import com.braintreepayments.api.browserswitch.demo.utils.PendingRequestStore;
+import com.braintreepayments.api.demo.R;
import java.util.Objects;
@@ -37,6 +42,19 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
.add(android.R.id.content, new DemoFragment(), FRAGMENT_TAG)
.commit();
}
+
+ // Support Edge-to-Edge layout in Android 15
+ // Ref: https://developer.android.com/develop/ui/views/layout/edge-to-edge#cutout-insets
+ View navHostView = findViewById(android.R.id.content);
+ ViewCompat.setOnApplyWindowInsetsListener(navHostView, (v, insets) -> {
+ @WindowInsetsCompat.Type.InsetsType int insetTypeMask =
+ WindowInsetsCompat.Type.systemBars()
+ | WindowInsetsCompat.Type.displayCutout()
+ | WindowInsetsCompat.Type.systemGestures();
+ Insets bars = insets.getInsets(insetTypeMask);
+ v.setPadding(bars.left, bars.top, bars.right, bars.bottom);
+ return WindowInsetsCompat.CONSUMED;
+ });
}
@Override
diff --git a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/MainActivity.java b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/MainActivity.java
index c8ea4c3f..d2cf6528 100644
--- a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/MainActivity.java
+++ b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/MainActivity.java
@@ -1,6 +1,9 @@
package com.braintreepayments.api.browserswitch.demo;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
import android.content.Intent;
import android.os.Bundle;
@@ -21,6 +24,19 @@ protected void onCreate(Bundle savedInstanceState) {
Button singleTopButton = findViewById(R.id.single_top_button);
singleTopButton.setOnClickListener(this::launchSingleTopBrowserSwitch);
+
+ // Support Edge-to-Edge layout in Android 15
+ // Ref: https://developer.android.com/develop/ui/views/layout/edge-to-edge#cutout-insets
+ View navHostView = findViewById(R.id.content);
+ ViewCompat.setOnApplyWindowInsetsListener(navHostView, (v, insets) -> {
+ @WindowInsetsCompat.Type.InsetsType int insetTypeMask =
+ WindowInsetsCompat.Type.systemBars()
+ | WindowInsetsCompat.Type.displayCutout()
+ | WindowInsetsCompat.Type.systemGestures();
+ Insets bars = insets.getInsets(insetTypeMask);
+ v.setPadding(bars.left, bars.top, bars.right, bars.bottom);
+ return WindowInsetsCompat.CONSUMED;
+ });
}
public void launchStandardBrowserSwitch(View view) {
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
index d4cf47f2..5e6a043f 100644
--- a/demo/src/main/res/layout/activity_main.xml
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -1,35 +1,30 @@
+ android:orientation="vertical"
+ tools:context="com.braintreepayments.api.browserswitch.demo.MainActivity">
+ android:text="Browser Switch"
+ android:textSize="40sp" />
+ android:text="Launch Mode: Standard" />
+ android:text="Launch Mode: Single Top" />
\ No newline at end of file
diff --git a/demo/src/main/res/layout/demo_fragment.xml b/demo/src/main/res/layout/demo_fragment.xml
index da72c7f1..eea2c0a2 100644
--- a/demo/src/main/res/layout/demo_fragment.xml
+++ b/demo/src/main/res/layout/demo_fragment.xml
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
- tools:context=".DemoFragment"
+ tools:context="com.braintreepayments.api.browserswitch.demo.DemoActivitySingleTop"
>
-
+
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 413faf00..cdfd13ff 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Jul 17 09:55:05 CDT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists