forked from mirror/monocles_chat_clean
Nicer custom tab
(cherry picked from commit 40b28c7f5869852ea570656dc4cc406fcd7ae8d2)
This commit is contained in:
parent
f83c2e421c
commit
0c841f1aa3
3 changed files with 24 additions and 1 deletions
7
src/cheogram/res/anim/slide_in_right.xml
Normal file
7
src/cheogram/res/anim/slide_in_right.xml
Normal 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>
|
7
src/cheogram/res/anim/slide_out_left.xml
Normal file
7
src/cheogram/res/anim/slide_out_left.xml
Normal 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>
|
|
@ -15,6 +15,8 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import androidx.browser.customtabs.CustomTabsIntent;
|
import androidx.browser.customtabs.CustomTabsIntent;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.persistance.FileBackend;
|
||||||
import eu.siacs.conversations.ui.XmppActivity;
|
import eu.siacs.conversations.ui.XmppActivity;
|
||||||
|
|
||||||
public class BrowserHelper {
|
public class BrowserHelper {
|
||||||
|
@ -78,7 +80,14 @@ public class BrowserHelper {
|
||||||
launchNativeBeforeApi30(context, uri);
|
launchNativeBeforeApi30(context, uri);
|
||||||
|
|
||||||
if (!launched) {
|
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) {
|
if (context instanceof XmppActivity) {
|
||||||
builder = builder.setColorScheme(((XmppActivity) context).isDark() ? CustomTabsIntent.COLOR_SCHEME_DARK : CustomTabsIntent.COLOR_SCHEME_LIGHT);
|
builder = builder.setColorScheme(((XmppActivity) context).isDark() ? CustomTabsIntent.COLOR_SCHEME_DARK : CustomTabsIntent.COLOR_SCHEME_LIGHT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue