use of org.chromium.chrome.browser.snackbar.SnackbarManager in project AndroidChromium by JackyAndroid.
the class SnackbarActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
mSnackbarManager = new SnackbarManager(this);
}
use of org.chromium.chrome.browser.snackbar.SnackbarManager in project AndroidChromium by JackyAndroid.
the class AutoSigninSnackbarController method showSnackbar.
/**
* Displays Auto sign-in snackbar, which communicates to the users that they
* were signed in to the web site.
*/
@CalledByNative
private static void showSnackbar(Tab tab, String text) {
SnackbarManager snackbarManager = tab.getSnackbarManager();
if (snackbarManager == null)
return;
AutoSigninSnackbarController snackbarController = new AutoSigninSnackbarController(snackbarManager, tab);
Snackbar snackbar = Snackbar.make(text, snackbarController, Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_AUTO_LOGIN);
Resources resources = tab.getWindowAndroid().getActivity().get().getResources();
int backgroundColor = ApiCompatibilityUtils.getColor(resources, R.color.light_active_color);
Bitmap icon = BitmapFactory.decodeResource(resources, R.drawable.account_management_no_picture);
snackbar.setSingleLine(false).setBackgroundColor(backgroundColor).setProfileImage(icon);
snackbarManager.showSnackbar(snackbar);
}
use of org.chromium.chrome.browser.snackbar.SnackbarManager in project AndroidChromium by JackyAndroid.
the class LocaleManager method showSnackbar.
private void showSnackbar(CharSequence title) {
SnackbarManager manager = mSnackbarManager.get();
if (manager == null)
return;
Context context = ContextUtils.getApplicationContext();
Snackbar snackbar = Snackbar.make(title, mSnackbarController, Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_SPECIAL_LOCALE);
snackbar.setDuration(SNACKBAR_DURATION_MS);
snackbar.setAction(context.getString(R.string.preferences), null);
manager.showSnackbar(snackbar);
}
use of org.chromium.chrome.browser.snackbar.SnackbarManager in project AndroidChromium by JackyAndroid.
the class ChromeActivity method postInflationStartup.
@SuppressLint("NewApi")
@Override
public void postInflationStartup() {
super.postInflationStartup();
mSnackbarManager = new SnackbarManager(this);
mDataUseSnackbarController = new DataUseSnackbarController(this, getSnackbarManager());
mAssistStatusHandler = createAssistStatusHandler();
if (mAssistStatusHandler != null) {
if (mTabModelSelector != null) {
mAssistStatusHandler.setTabModelSelector(mTabModelSelector);
}
mAssistStatusHandler.updateAssistState();
}
// is only the case for grandfathered-in svelte users. We no longer do so for newer users.
if (!ChromePreferenceManager.getInstance(this).getAllowLowEndDeviceUi()) {
CommandLine.getInstance().appendSwitch(BaseSwitches.DISABLE_LOW_END_DEVICE_MODE);
}
AccessibilityManager manager = (AccessibilityManager) getBaseContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
manager.addAccessibilityStateChangeListener(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mTouchExplorationStateChangeListener = new TouchExplorationStateChangeListener() {
@Override
public void onTouchExplorationStateChanged(boolean enabled) {
checkAccessibility();
}
};
manager.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
}
// Make the activity listen to policy change events
CombinedPolicyProvider.get().addPolicyChangeListener(this);
// Set up the animation placeholder to be the SurfaceView. This disables the
// SurfaceView's 'hole' clipping during animations that are notified to the window.
mWindowAndroid.setAnimationPlaceholderView(mCompositorViewHolder.getSurfaceView());
// Inform the WindowAndroid of the keyboard accessory view.
mWindowAndroid.setKeyboardAccessoryView((ViewGroup) findViewById(R.id.keyboard_accessory));
initializeToolbar();
}
Aggregations