Nicer custom tab

(cherry picked from commit 40b28c7f5869852ea570656dc4cc406fcd7ae8d2)
This commit is contained in:
Stephen Paul Weber 2024-09-18 00:36:45 -05:00 committed by Arne
parent 90ebdca6fc
commit 69d4709c9d
3 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="50%p" android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime" />
</set>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="-50%p"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="@android:integer/config_mediumAnimTime" />
</set>

View file

@ -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);
}