use of com.ichi2.compat.customtabs.CustomTabActivityHelper in project AnkiChinaAndroid by ankichinateam.
the class AnkiActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Timber.i("AnkiActivity::onCreate - %s-%d", mActivityName, getStatusBarColorAttr());
// The hardware buttons should control the music volume
setVolumeControlStream(AudioManager.STREAM_MUSIC);
// Set the theme
TypedValue value = new TypedValue();
getTheme().resolveAttribute(getStatusBarColorAttr(), value, true);
Timber.i("AnkiActivity::onCreate - %s-%d", mActivityName, value.resourceId);
Themes.setTheme(this, isStatusBarTransparent(), getStatusBarColorAttr());
super.onCreate(savedInstanceState);
// Disable the notifications bar if running under the test monkey.
if (AdaptionUtil.isUserATestClient()) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mCustomTabActivityHelper = new CustomTabActivityHelper();
}
use of com.ichi2.compat.customtabs.CustomTabActivityHelper in project Anki-Android by ankidroid.
the class AnkiActivity method onCreate.
// #9332: UI Visibility -> Insets
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
Timber.i("AnkiActivity::onCreate - %s", mActivityName);
// The hardware buttons should control the music volume
setVolumeControlStream(AudioManager.STREAM_MUSIC);
// Set the theme
Themes.setTheme(this);
Themes.disableXiaomiForceDarkMode(this);
super.onCreate(savedInstanceState);
// Disable the notifications bar if running under the test monkey.
if (AdaptionUtil.isUserATestClient()) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mCustomTabActivityHelper = new CustomTabActivityHelper();
}
use of com.ichi2.compat.customtabs.CustomTabActivityHelper 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.CustomTabActivityHelper 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