From 0c841f1aa3ddb5d381e9e85ae47c257914dfd491 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 18 Sep 2024 00:36:45 -0500 Subject: [PATCH] Nicer custom tab (cherry picked from commit 40b28c7f5869852ea570656dc4cc406fcd7ae8d2) --- src/cheogram/res/anim/slide_in_right.xml | 7 +++++++ src/cheogram/res/anim/slide_out_left.xml | 7 +++++++ .../java/de/monocles/chat/BrowserHelper.java | 11 ++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/cheogram/res/anim/slide_in_right.xml create mode 100644 src/cheogram/res/anim/slide_out_left.xml diff --git a/src/cheogram/res/anim/slide_in_right.xml b/src/cheogram/res/anim/slide_in_right.xml new file mode 100644 index 000000000..ff9a1ea47 --- /dev/null +++ b/src/cheogram/res/anim/slide_in_right.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/src/cheogram/res/anim/slide_out_left.xml b/src/cheogram/res/anim/slide_out_left.xml new file mode 100644 index 000000000..2dcddafc4 --- /dev/null +++ b/src/cheogram/res/anim/slide_out_left.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/src/monocleschat/java/de/monocles/chat/BrowserHelper.java b/src/monocleschat/java/de/monocles/chat/BrowserHelper.java index b2ec9e247..b7f174080 100644 --- a/src/monocleschat/java/de/monocles/chat/BrowserHelper.java +++ b/src/monocleschat/java/de/monocles/chat/BrowserHelper.java @@ -15,6 +15,8 @@ import java.util.List; import java.util.Set; import androidx.browser.customtabs.CustomTabsIntent; +import eu.siacs.conversations.R; +import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.ui.XmppActivity; public class BrowserHelper { @@ -78,7 +80,14 @@ public class BrowserHelper { launchNativeBeforeApi30(context, uri); if (!launched) { - var builder = new CustomTabsIntent.Builder().setShowTitle(true); + var builder = new CustomTabsIntent.Builder() + .setShowTitle(true) + .setShareState(CustomTabsIntent.SHARE_STATE_ON) + .setBackgroundInteractionEnabled(true) + .setStartAnimations(context, R.anim.slide_in_right, R.anim.slide_out_left) + .setExitAnimations(context, android.R.anim.slide_in_left, android.R.anim.slide_out_right) + .setCloseButtonIcon(FileBackend.drawDrawable(context.getDrawable(R.drawable.ic_arrow_back_24dp))) + .setCloseButtonPosition(CustomTabsIntent.CLOSE_BUTTON_POSITION_START); if (context instanceof XmppActivity) { builder = builder.setColorScheme(((XmppActivity) context).isDark() ? CustomTabsIntent.COLOR_SCHEME_DARK : CustomTabsIntent.COLOR_SCHEME_LIGHT); }