use of com.google.android.material.snackbar.Snackbar in project Dexter by Karumi.
the class SnackbarUtils method show.
public static void show(View view, String text, int duration, String buttonText, View.OnClickListener onButtonClickListener, BaseTransientBottomBar.BaseCallback<Snackbar> snackbarCallback) {
Snackbar snackbar = Snackbar.make(view, text, duration);
if (buttonText != null && onButtonClickListener != null) {
snackbar.setAction(buttonText, onButtonClickListener);
}
if (snackbarCallback != null) {
snackbar.addCallback(snackbarCallback);
}
snackbar.show();
}
use of com.google.android.material.snackbar.Snackbar in project AntennaPod by AntennaPod.
the class MainActivity method onEventMainThread.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(MessageEvent event) {
Log.d(TAG, "onEvent(" + event + ")");
Snackbar snackbar = showSnackbarAbovePlayer(event.message, Snackbar.LENGTH_SHORT);
if (event.action != null) {
snackbar.setAction(getString(R.string.undo), v -> event.action.run());
}
}
use of com.google.android.material.snackbar.Snackbar in project zype-android by zype.
the class UiUtils method showPositiveSnackbar.
public static void showPositiveSnackbar(View view, String text) {
if (view == null) {
return;
}
Snackbar snackbar = Snackbar.make(view, text, Snackbar.LENGTH_LONG);
View snackView = snackbar.getView();
snackView.setBackgroundColor(view.getContext().getResources().getColor(R.color.snackbar_positive));
snackbar.show();
}
use of com.google.android.material.snackbar.Snackbar in project orgzly-android by orgzly.
the class MainActivity method onNoteCreated.
@Override
public void onNoteCreated(Note note) {
finishActionMode();
popBackStackAndCloseKeyboard();
// Display Snackbar with an action (create new note below just created one)
View view = findViewById(R.id.main_content);
if (view != null) {
showSnackbar(Snackbar.make(view, R.string.message_note_created, Snackbar.LENGTH_LONG).setAction(R.string.new_below, v -> {
NotePlace notePlace = new NotePlace(note.getPosition().getBookId(), note.getId(), Place.BELOW);
DisplayManager.displayNewNote(getSupportFragmentManager(), notePlace);
}));
}
}
use of com.google.android.material.snackbar.Snackbar in project Weather by Sparker0i.
the class Snack method make.
public static void make(View view, String text, int duration) {
Snackbar snackbar = Snackbar.make(view, text, duration);
try {
Field mAccessibilityManagerField = BaseTransientBottomBar.class.getDeclaredField("mAccessibilityManager");
mAccessibilityManagerField.setAccessible(true);
AccessibilityManager accessibilityManager = (AccessibilityManager) mAccessibilityManagerField.get(snackbar);
Field mIsEnabledField = AccessibilityManager.class.getDeclaredField("mIsEnabled");
mIsEnabledField.setAccessible(true);
mIsEnabledField.setBoolean(accessibilityManager, false);
mAccessibilityManagerField.set(snackbar, accessibilityManager);
} catch (Exception e) {
Log.d("Snackbar", "Reflection error: " + e.toString());
}
snackbar.show();
}
Aggregations