use of com.ichi2.compat.customtabs.CustomTabsFallback in project AnkiChinaAndroid by ankichinateam.
the class AnkiActivity method openUrl.
public void openUrl(Uri url) {
// DEFECT: We might want a custom view for the toast, given i8n may make the text too long for some OSes to
// display the toast
Timber.i("final get url:%s", url);
if (!AdaptionUtil.hasWebBrowser(this)) {
UIUtils.showThemedToast(this, getResources().getString(R.string.no_browser_notification) + url, false);
return;
}
CustomTabActivityHelper helper = getCustomTabActivityHelper();
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(helper.getSession());
builder.setToolbarColor(ContextCompat.getColor(this, R.color.material_light_blue_500)).setShowTitle(true);
builder.setStartAnimations(this, R.anim.slide_right_in, R.anim.slide_left_out);
builder.setExitAnimations(this, R.anim.slide_left_in, R.anim.slide_right_out);
builder.setCloseButtonIcon(BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_arrow_back_white_24dp));
CustomTabsIntent customTabsIntent = builder.build();
CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
CustomTabActivityHelper.openCustomTab(this, customTabsIntent, url, new CustomTabsFallback());
}
use of com.ichi2.compat.customtabs.CustomTabsFallback in project Anki-Android by ankidroid.
the class AnkiActivity method openUrl.
public void openUrl(@NonNull Uri url) {
// display the toast
if (!AdaptionUtil.hasWebBrowser(this)) {
UIUtils.showThemedToast(this, getResources().getString(R.string.no_browser_notification) + url, false);
return;
}
int toolbarColor = Themes.getColorFromAttr(this, R.attr.colorPrimary);
int navBarColor = Themes.getColorFromAttr(this, R.attr.customTabNavBarColor);
CustomTabColorSchemeParams colorSchemeParams = new CustomTabColorSchemeParams.Builder().setToolbarColor(toolbarColor).setNavigationBarColor(navBarColor).build();
CustomTabActivityHelper helper = getCustomTabActivityHelper();
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(helper.getSession()).setShowTitle(true).setStartAnimations(this, R.anim.slide_right_in, R.anim.slide_left_out).setExitAnimations(this, R.anim.slide_left_in, R.anim.slide_right_out).setCloseButtonIcon(BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_back_arrow_custom_tab)).setColorScheme(getColorScheme()).setDefaultColorSchemeParams(colorSchemeParams);
CustomTabsIntent customTabsIntent = builder.build();
CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
CustomTabActivityHelper.openCustomTab(this, customTabsIntent, url, new CustomTabsFallback());
}
Aggregations