Java Code Examples for org.chromium.chrome.browser.snackbar.SnackbarManager#showSnackbar()

The following examples show how to use org.chromium.chrome.browser.snackbar.SnackbarManager#showSnackbar() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoSigninSnackbarController.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Source File: AutoSigninSnackbarController.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: AutoSigninSnackbarController.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: OfflinePageUtils.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Shows the "reload" snackbar for the given tab.
 * @param activity The activity owning the tab.
 * @param snackbarController Class to show the snackbar.
 */
public static void showReloadSnackbar(Context context, SnackbarManager snackbarManager,
        final SnackbarController snackbarController, int tabId) {
    if (tabId == Tab.INVALID_TAB_ID) return;

    Log.d(TAG, "showReloadSnackbar called with controller " + snackbarController);
    Snackbar snackbar =
            Snackbar.make(context.getString(R.string.offline_pages_viewing_offline_page),
                    snackbarController, Snackbar.TYPE_ACTION, Snackbar.UMA_OFFLINE_PAGE_RELOAD)
                    .setSingleLine(false).setAction(context.getString(R.string.reload), tabId);
    snackbar.setDuration(SNACKBAR_DURATION);
    snackbarManager.showSnackbar(snackbar);
}
 
Example 5
Source File: OfflinePageUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Shows the "reload" snackbar for the given tab.
 * @param activity The activity owning the tab.
 * @param snackbarController Class to show the snackbar.
 */
public static void showReloadSnackbar(Context context, SnackbarManager snackbarManager,
        final SnackbarController snackbarController, int tabId) {
    if (tabId == Tab.INVALID_TAB_ID) return;

    Log.d(TAG, "showReloadSnackbar called with controller " + snackbarController);
    Snackbar snackbar =
            Snackbar.make(context.getString(R.string.offline_pages_viewing_offline_page),
                    snackbarController, Snackbar.TYPE_ACTION, Snackbar.UMA_OFFLINE_PAGE_RELOAD)
                    .setSingleLine(false).setAction(context.getString(R.string.reload), tabId);
    snackbar.setDuration(sSnackbarDurationMs);
    snackbarManager.showSnackbar(snackbar);
}
 
Example 6
Source File: LocaleManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: OfflinePageUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void showReloadSnackbar(Context context, SnackbarManager snackbarManager,
        final SnackbarController snackbarController, int tabId) {
    if (tabId == Tab.INVALID_TAB_ID) return;

    Log.d(TAG, "showReloadSnackbar called with controller " + snackbarController);
    Snackbar snackbar =
            Snackbar.make(context.getString(R.string.offline_pages_viewing_offline_page),
                            snackbarController, Snackbar.TYPE_ACTION,
                            Snackbar.UMA_OFFLINE_PAGE_RELOAD)
                    .setSingleLine(false)
                    .setAction(context.getString(R.string.reload), tabId);
    snackbar.setDuration(sSnackbarDurationMs);
    snackbarManager.showSnackbar(snackbar);
}
 
Example 8
Source File: LocaleManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
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);
}