Search in sources :

Example 1 with SnackbarManager

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);
}
Also used : SnackbarManager(org.chromium.chrome.browser.snackbar.SnackbarManager)

Example 2 with SnackbarManager

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);
}
Also used : Bitmap(android.graphics.Bitmap) SnackbarManager(org.chromium.chrome.browser.snackbar.SnackbarManager) Resources(android.content.res.Resources) Snackbar(org.chromium.chrome.browser.snackbar.Snackbar) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 3 with SnackbarManager

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);
}
Also used : Context(android.content.Context) SnackbarManager(org.chromium.chrome.browser.snackbar.SnackbarManager) Snackbar(org.chromium.chrome.browser.snackbar.Snackbar)

Example 4 with SnackbarManager

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();
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) SnackbarManager(org.chromium.chrome.browser.snackbar.SnackbarManager) DataUseSnackbarController(org.chromium.chrome.browser.snackbar.DataUseSnackbarController) TouchExplorationStateChangeListener(android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener) SuppressLint(android.annotation.SuppressLint)

Aggregations

SnackbarManager (org.chromium.chrome.browser.snackbar.SnackbarManager)4 Snackbar (org.chromium.chrome.browser.snackbar.Snackbar)2 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 Resources (android.content.res.Resources)1 Bitmap (android.graphics.Bitmap)1 AccessibilityManager (android.view.accessibility.AccessibilityManager)1 TouchExplorationStateChangeListener (android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener)1 CalledByNative (org.chromium.base.annotations.CalledByNative)1 DataUseSnackbarController (org.chromium.chrome.browser.snackbar.DataUseSnackbarController)1