Search in sources :

Example 61 with Snackbar

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();
}
Also used : Snackbar(com.google.android.material.snackbar.Snackbar)

Example 62 with Snackbar

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());
    }
}
Also used : Snackbar(com.google.android.material.snackbar.Snackbar) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 63 with Snackbar

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();
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) Snackbar(com.google.android.material.snackbar.Snackbar)

Example 64 with Snackbar

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);
        }));
    }
}
Also used : Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) NoteDelete(com.orgzly.android.usecase.NoteDelete) UseCase(com.orgzly.android.usecase.UseCase) ActivityUtils(com.orgzly.android.ui.util.ActivityUtils) Query(com.orgzly.android.query.Query) Handler(android.os.Handler) Fragment(androidx.fragment.app.Fragment) BookFormat(com.orgzly.android.BookFormat) DrawerNavigationView(com.orgzly.android.ui.drawer.DrawerNavigationView) NoteUpdateState(com.orgzly.android.usecase.NoteUpdateState) NoteFindWithProperty(com.orgzly.android.usecase.NoteFindWithProperty) IntentFilter(android.content.IntentFilter) Set(java.util.Set) SearchView(androidx.appcompat.widget.SearchView) Book(com.orgzly.android.db.entity.Book) BuildConfig(com.orgzly.BuildConfig) CommonActivity(com.orgzly.android.ui.CommonActivity) Note(com.orgzly.android.db.entity.Note) BookImportFromUri(com.orgzly.android.usecase.BookImportFromUri) DottedQueryBuilder(com.orgzly.android.query.user.DottedQueryBuilder) DrawerLayout(androidx.drawerlayout.widget.DrawerLayout) NotePaste(com.orgzly.android.usecase.NotePaste) BookExportToUri(com.orgzly.android.usecase.BookExportToUri) SavedSearchUpdate(com.orgzly.android.usecase.SavedSearchUpdate) NoteDao(com.orgzly.android.db.dao.NoteDao) SavedSearchFragment(com.orgzly.android.ui.savedsearch.SavedSearchFragment) R(com.orgzly.R) SyncService(com.orgzly.android.sync.SyncService) Menu(android.view.Menu) NoteFragment(com.orgzly.android.ui.note.NoteFragment) ActionModeListener(com.orgzly.android.ui.ActionModeListener) BookFragment(com.orgzly.android.ui.notes.book.BookFragment) ViewModelProvider(androidx.lifecycle.ViewModelProvider) NoteDemote(com.orgzly.android.usecase.NoteDemote) IOException(java.io.IOException) SavedSearchMoveUp(com.orgzly.android.usecase.SavedSearchMoveUp) File(java.io.File) ArrayAdapter(android.widget.ArrayAdapter) NotePromote(com.orgzly.android.usecase.NotePromote) Configuration(android.content.res.Configuration) BottomActionBar(com.orgzly.android.ui.BottomActionBar) Notifications(com.orgzly.android.ui.notifications.Notifications) LogUtils(com.orgzly.android.util.LogUtils) SavedSearchCreate(com.orgzly.android.usecase.SavedSearchCreate) BookForceSave(com.orgzly.android.usecase.BookForceSave) NoteUpdateDeadlineTime(com.orgzly.android.usecase.NoteUpdateDeadlineTime) SavedSearchExport(com.orgzly.android.usecase.SavedSearchExport) BookSparseTreeForNote(com.orgzly.android.usecase.BookSparseTreeForNote) ActionBarDrawerToggle(androidx.appcompat.app.ActionBarDrawerToggle) View(android.view.View) NoteMove(com.orgzly.android.usecase.NoteMove) NoteUpdateStateToggle(com.orgzly.android.usecase.NoteUpdateStateToggle) BroadcastReceiver(android.content.BroadcastReceiver) ViewGroup(android.view.ViewGroup) AlertDialog(android.app.AlertDialog) Nullable(org.jetbrains.annotations.Nullable) Repo(com.orgzly.android.db.entity.Repo) List(java.util.List) App(com.orgzly.android.App) BookCreate(com.orgzly.android.usecase.BookCreate) Toolbar(androidx.appcompat.widget.Toolbar) BookPrefaceFragment(com.orgzly.android.ui.notes.book.BookPrefaceFragment) BookImportGettingStarted(com.orgzly.android.usecase.BookImportGettingStarted) SimpleOneLinerDialog(com.orgzly.android.ui.dialogs.SimpleOneLinerDialog) BooksFragment(com.orgzly.android.ui.books.BooksFragment) ReposActivity(com.orgzly.android.ui.repos.ReposActivity) NotNull(org.jetbrains.annotations.NotNull) Snackbar(com.google.android.material.snackbar.Snackbar) OrgDateTime(com.orgzly.org.datetime.OrgDateTime) AutoSync(com.orgzly.android.sync.AutoSync) BookExport(com.orgzly.android.usecase.BookExport) Context(android.content.Context) UseCaseRunner(com.orgzly.android.usecase.UseCaseRunner) SavedSearchMoveDown(com.orgzly.android.usecase.SavedSearchMoveDown) NavigationView(com.google.android.material.navigation.NavigationView) Intent(android.content.Intent) LocalBroadcastManager(androidx.localbroadcastmanager.content.LocalBroadcastManager) DisplayManager(com.orgzly.android.ui.DisplayManager) AppPermissions(com.orgzly.android.util.AppPermissions) MenuItem(android.view.MenuItem) SettingsActivity(com.orgzly.android.ui.settings.SettingsActivity) Lifecycle(androidx.lifecycle.Lifecycle) NoteCut(com.orgzly.android.usecase.NoteCut) AppPreferences(com.orgzly.android.prefs.AppPreferences) LifecycleOwner(androidx.lifecycle.LifecycleOwner) AppIntent(com.orgzly.android.AppIntent) SavedSearchDelete(com.orgzly.android.usecase.SavedSearchDelete) Place(com.orgzly.android.ui.Place) OutputStream(java.io.OutputStream) SavedSearchesFragment(com.orgzly.android.ui.savedsearches.SavedSearchesFragment) NotesClipboard(com.orgzly.android.db.NotesClipboard) BookLinkUpdate(com.orgzly.android.usecase.BookLinkUpdate) GravityCompat(androidx.core.view.GravityCompat) SavedSearch(com.orgzly.android.db.entity.SavedSearch) ActionMode(androidx.appcompat.view.ActionMode) NotePlace(com.orgzly.android.ui.NotePlace) NoteCopy(com.orgzly.android.usecase.NoteCopy) UseCaseResult(com.orgzly.android.usecase.UseCaseResult) BookForceLoad(com.orgzly.android.usecase.BookForceLoad) Condition(com.orgzly.android.query.Condition) BookUpdatePreface(com.orgzly.android.usecase.BookUpdatePreface) NoteUpdateScheduledTime(com.orgzly.android.usecase.NoteUpdateScheduledTime) BookName(com.orgzly.android.BookName) NotePlace(com.orgzly.android.ui.NotePlace) DrawerNavigationView(com.orgzly.android.ui.drawer.DrawerNavigationView) SearchView(androidx.appcompat.widget.SearchView) View(android.view.View) NavigationView(com.google.android.material.navigation.NavigationView)

Example 65 with Snackbar

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();
}
Also used : Field(java.lang.reflect.Field) AccessibilityManager(android.view.accessibility.AccessibilityManager) Snackbar(com.google.android.material.snackbar.Snackbar)

Aggregations

Snackbar (com.google.android.material.snackbar.Snackbar)110 View (android.view.View)61 Intent (android.content.Intent)46 TextView (android.widget.TextView)41 AlertDialog (androidx.appcompat.app.AlertDialog)29 Context (android.content.Context)28 ImageView (android.widget.ImageView)28 LayoutInflater (android.view.LayoutInflater)24 ArrayList (java.util.ArrayList)23 RecyclerView (androidx.recyclerview.widget.RecyclerView)22 Bundle (android.os.Bundle)20 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)20 DialogInterface (android.content.DialogInterface)19 List (java.util.List)19 CreateCardView (me.ccrama.redditslide.Views.CreateCardView)18 Submission (net.dean.jraw.models.Submission)18 SubredditView (me.ccrama.redditslide.Activities.SubredditView)17 ApiException (net.dean.jraw.ApiException)17 Activity (android.app.Activity)16 OnSingleClickListener (me.ccrama.redditslide.util.OnSingleClickListener)16