/**
  * 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);
   Resources resources = tab.getWindowAndroid().getActivity().get().getResources();
   int backgroundColor =
       ApiCompatibilityUtils.getColor(
           resources, R.color.smart_lock_auto_signin_snackbar_background_color);
   Bitmap icon = BitmapFactory.decodeResource(resources, R.drawable.account_management_no_picture);
   snackbar.setSingleLine(false).setBackgroundColor(backgroundColor).setProfileImage(icon);
   snackbarManager.showSnackbar(snackbar);
 }
Ejemplo n.º 2
0
 /**
  * Creates and returns a snackbar to display the given text.
  *
  * @param text The text to show on the snackbar.
  * @param controller The SnackbarController to receive callbacks about the snackbar's state.
  */
 public static Snackbar make(CharSequence text, SnackbarController controller) {
   Snackbar s = new Snackbar();
   s.mText = text;
   s.mController = controller;
   return s;
 }