Skip to content

Commit 2a71c8d

Browse files
authored
refactor: android custom tabs to not use lambdas (#62)
1 parent 9e5f4c7 commit 2a71c8d

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

Source/Immutable/Immutable_UPL_Android.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
-keep interface androidx.** { *; }
1919
</insert>
2020
</proguardAdditions>
21+
<buildGradleAdditions>
22+
<insert>
23+
android {
24+
compileOptions {
25+
sourceCompatibility 1.8
26+
targetCompatibility 1.8
27+
}
28+
}
29+
</insert>
30+
</buildGradleAdditions>
2131
<androidManifestUpdates>
2232
<addElements tag="queries">
2333
<intent>

Source/Immutable/Private/Immutable/Android/Java/CustomTabsController.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,17 @@ public void launch(@NonNull final Uri uri) {
111111
context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
112112
} else {
113113
// Running in a different thread to prevent doing too much work on main thread
114-
new Thread(() -> {
115-
try {
116-
launchCustomTabs(context, uri);
117-
} catch (ActivityNotFoundException ex) {
118-
// Failed to launch Custom Tab browser, so launch in browser
119-
context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
120-
}
121-
}).start();
114+
new Thread(new Runnable() {
115+
@Override
116+
public void run() {
117+
try {
118+
launchCustomTabs(context, uri);
119+
} catch (ActivityNotFoundException ex) {
120+
// Failed to launch Custom Tab browser, so launch in browser
121+
context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
122+
}
123+
}
124+
}).start();
122125
}
123126
}
124127

0 commit comments

Comments
 (0)