From 2a71c8de60c1f4348288c88b6cdcef3fd4a415c6 Mon Sep 17 00:00:00 2001 From: Natalie Date: Thu, 25 Jan 2024 20:33:51 +1300 Subject: [PATCH] refactor: android custom tabs to not use lambdas (#62) --- Source/Immutable/Immutable_UPL_Android.xml | 10 ++++++++++ .../Android/Java/CustomTabsController.java | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Source/Immutable/Immutable_UPL_Android.xml b/Source/Immutable/Immutable_UPL_Android.xml index 816c424..a8d6c3e 100644 --- a/Source/Immutable/Immutable_UPL_Android.xml +++ b/Source/Immutable/Immutable_UPL_Android.xml @@ -18,6 +18,16 @@ -keep interface androidx.** { *; } + + + android { + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } + } + + diff --git a/Source/Immutable/Private/Immutable/Android/Java/CustomTabsController.java b/Source/Immutable/Private/Immutable/Android/Java/CustomTabsController.java index 49584a9..c73bbf9 100644 --- a/Source/Immutable/Private/Immutable/Android/Java/CustomTabsController.java +++ b/Source/Immutable/Private/Immutable/Android/Java/CustomTabsController.java @@ -111,14 +111,17 @@ public void launch(@NonNull final Uri uri) { context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); } else { // Running in a different thread to prevent doing too much work on main thread - new Thread(() -> { - try { - launchCustomTabs(context, uri); - } catch (ActivityNotFoundException ex) { - // Failed to launch Custom Tab browser, so launch in browser - context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); - } - }).start(); + new Thread(new Runnable() { + @Override + public void run() { + try { + launchCustomTabs(context, uri); + } catch (ActivityNotFoundException ex) { + // Failed to launch Custom Tab browser, so launch in browser + context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); + } + } + }).start(); } }