Java Code Examples for com.google.android.material.snackbar.Snackbar#Callback
The following examples show how to use
com.google.android.material.snackbar.Snackbar#Callback .
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: SnackbarUtils.java From GeometricWeather with GNU Lesser General Public License v3.0 | 6 votes |
public static void showSnackbar(@NonNull GeoActivity activity, String txt, String action, @NonNull View.OnClickListener l, @Nullable Snackbar.Callback callback) { if (callback == null) { callback = new Snackbar.Callback(); } Snackbar.make( activity.getSnackbarContainer(), txt, Snackbar.LENGTH_LONG ).setAction(action, l) .setActionTextColor(ContextCompat.getColor(activity, R.color.colorTextAlert)) .addCallback(callback) .show(); }
Example 2
Source File: MainActivity.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void showInstallationError(int numberOfErrors) { String title; if (numberOfErrors == 1) { title = getString(R.string.generalscreen_short_root_install_single_app_timeout_error_message); } else { title = getString(R.string.generalscreen_short_root_install_timeout_error_message, numberOfErrors); } Snackbar.Callback snackbarCallback = new Snackbar.Callback() { @Override public void onDismissed(Snackbar snackbar, int event) { super.onDismissed(snackbar, event); if (event == DISMISS_EVENT_SWIPE) { installErrorsDismissEvent.call(null); } } }; snackbar = Snackbar.make(snackBarLayout, title, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.generalscreen_short_root_install_timeout_error_action, view -> installManager.retryTimedOutInstallations() .andThen(installManager.cleanTimedOutInstalls()) .subscribe()) .addCallback(snackbarCallback); snackbar.show(); }
Example 3
Source File: SnackbarUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 设置 Snackbar 展示完成、隐藏完成 的监听 * @param callback {@link Snackbar.Callback} * @return {@link SnackbarUtils} */ public SnackbarUtils setCallback(final Snackbar.Callback callback) { Snackbar snackbar = getSnackbar(); if (snackbar != null) { snackbar.addCallback(callback); } return this; }
Example 4
Source File: SnackbarOnPermanentlyDeniedPermissionListener.java From Dexter with Apache License 2.0 | 5 votes |
/** * @param view The view to find a parent from * @param text Message displayed in the snackbar * @param buttonText Message displayed in the snackbar button * @param onButtonClickListener Action performed when the user clicks the snackbar button */ private SnackbarOnPermanentlyDeniedPermissionListener(View view, String text, String buttonText, View.OnClickListener onButtonClickListener, Snackbar.Callback snackbarCallback, int duration) { this.view = view; this.text = text; this.buttonText = buttonText; this.onButtonClickListener = onButtonClickListener; this.snackbarCallback = snackbarCallback; this.duration = duration; }
Example 5
Source File: SnackbarOnDeniedPermissionListener.java From Dexter with Apache License 2.0 | 5 votes |
/** * @param view The view to find a parent from * @param text Message displayed in the snackbar * @param buttonText Message displayed in the snackbar button * @param onButtonClickListener Action performed when the user clicks the snackbar button */ private SnackbarOnDeniedPermissionListener(View view, String text, String buttonText, View.OnClickListener onButtonClickListener, Snackbar.Callback snackbarCallback, int duration) { this.view = view; this.text = text; this.buttonText = buttonText; this.onButtonClickListener = onButtonClickListener; this.snackbarCallback = snackbarCallback; this.duration = duration; }
Example 6
Source File: SnackbarOnAnyDeniedMultiplePermissionsListener.java From Dexter with Apache License 2.0 | 5 votes |
/** * @param view The view to find a parent from * @param text Message displayed in the snackbar * @param buttonText Message displayed in the snackbar button * @param onButtonClickListener Action performed when the user clicks the snackbar button */ private SnackbarOnAnyDeniedMultiplePermissionsListener(View view, String text, String buttonText, View.OnClickListener onButtonClickListener, Snackbar.Callback snackbarCallback, int duration) { this.view = view; this.text = text; this.buttonText = buttonText; this.onButtonClickListener = onButtonClickListener; this.snackbarCallback = snackbarCallback; this.duration = duration; }
Example 7
Source File: SnackbarOnAnyPermanentlyDeniedMultiplePermissionsListener.java From Dexter with Apache License 2.0 | 5 votes |
/** * @param view The view to find a parent from * @param text Message displayed in the snackbar * @param buttonText Message displayed in the snackbar button * @param onButtonClickListener Action performed when the user clicks the snackbar button */ private SnackbarOnAnyPermanentlyDeniedMultiplePermissionsListener(View view, String text, String buttonText, View.OnClickListener onButtonClickListener, Snackbar.Callback snackbarCallback, int duration) { this.view = view; this.text = text; this.buttonText = buttonText; this.onButtonClickListener = onButtonClickListener; this.snackbarCallback = snackbarCallback; this.duration = duration; }
Example 8
Source File: SnackbarOnPermanentlyDeniedPermissionListener.java From Dexter with Apache License 2.0 | 4 votes |
/** * Adds a callback to handle the snackbar {@code onDismissed} and {@code onShown} events */ public Builder withCallback(Snackbar.Callback callback) { this.snackbarCallback = callback; return this; }
Example 9
Source File: SnackbarOnDeniedPermissionListener.java From Dexter with Apache License 2.0 | 4 votes |
/** * Adds a callback to handle the snackbar {@code onDismissed} and {@code onShown} events */ public Builder withCallback(Snackbar.Callback callback) { this.snackbarCallback = callback; return this; }
Example 10
Source File: SnackbarOnAnyDeniedMultiplePermissionsListener.java From Dexter with Apache License 2.0 | 4 votes |
/** * Adds a callback to handle the snackbar {@code onDismissed} and {@code onShown} events. */ public Builder withCallback(Snackbar.Callback callback) { this.snackbarCallback = callback; return this; }
Example 11
Source File: SnackbarOnAnyPermanentlyDeniedMultiplePermissionsListener.java From Dexter with Apache License 2.0 | 4 votes |
/** * Adds a callback to handle the snackbar {@code onDismissed} and {@code onShown} events. */ public Builder withCallback(Snackbar.Callback callback) { this.snackbarCallback = callback; return this; }