Search in sources :

Example 56 with Snackbar

use of com.google.android.material.snackbar.Snackbar in project MiMangaNu by raulhaag.

the class Util method showTimeSnackBar.

public void showTimeSnackBar(final String message, View view, final Context context, final int duration) {
    if (view != null) {
        Snackbar snackbar = Snackbar.make(view, message, duration);
        if (MainActivity.colors != null)
            snackbar.getView().setBackgroundColor(MainActivity.colors[0]);
        snackbar.show();
    } else {
        if (context != null) {
            new Handler(Looper.getMainLooper()).post(new Runnable() {

                @Override
                public void run() {
                    Toast.makeText(context, message, duration).show();
                }
            });
        }
    }
}
Also used : Handler(android.os.Handler) Snackbar(com.google.android.material.snackbar.Snackbar)

Example 57 with Snackbar

use of com.google.android.material.snackbar.Snackbar in project SQLPractice by Gear61.

the class Utils method showSnackbar.

public static void showSnackbar(View parent, String content) {
    Context context = parent.getContext();
    SpannableStringBuilder spannableString = new SpannableStringBuilder(content);
    spannableString.setSpan(new ForegroundColorSpan(Color.WHITE), 0, content.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    Snackbar snackbar = Snackbar.make(parent, spannableString, Snackbar.LENGTH_LONG);
    View view = snackbar.getView();
    view.setBackgroundColor(context.getResources().getColor(R.color.app_turquoise));
    snackbar.show();
}
Also used : Context(android.content.Context) ForegroundColorSpan(android.text.style.ForegroundColorSpan) View(android.view.View) SpannableStringBuilder(android.text.SpannableStringBuilder) Snackbar(com.google.android.material.snackbar.Snackbar)

Example 58 with Snackbar

use of com.google.android.material.snackbar.Snackbar in project BottomNavigation by Ashok-Varma.

the class HomeActivityJava method onClick.

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.toggle_hide:
            if (bottomNavigationBar != null) {
                bottomNavigationBar.toggle();
            }
            break;
        case R.id.toggle_badge:
            if (numberBadgeItem != null) {
                numberBadgeItem.toggle();
            }
            if (shapeBadgeItem != null) {
                shapeBadgeItem.toggle();
            }
            break;
        case R.id.fab_home:
            final Snackbar snackbar = Snackbar.make(message, "Fab Clicked", Snackbar.LENGTH_LONG);
            snackbar.setAction("dismiss", new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    snackbar.dismiss();
                }
            });
            snackbar.show();
            break;
    }
}
Also used : TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) Snackbar(com.google.android.material.snackbar.Snackbar)

Example 59 with Snackbar

use of com.google.android.material.snackbar.Snackbar in project Gadgetbridge by Freeyourgadget.

the class GBDeviceAdapterv2 method showTransientSnackbar.

private void showTransientSnackbar(int resource) {
    Snackbar snackbar = Snackbar.make(parent, resource, Snackbar.LENGTH_SHORT);
    // View snackbarView = snackbar.getView();
    // change snackbar text color
    // int snackbarTextId = android.support.design.R.id.snackbar_text;
    // TextView textView = snackbarView.findViewById(snackbarTextId);
    // textView.setTextColor();
    // snackbarView.setBackgroundColor(Color.MAGENTA);
    snackbar.show();
}
Also used : Snackbar(com.google.android.material.snackbar.Snackbar)

Example 60 with Snackbar

use of com.google.android.material.snackbar.Snackbar in project Gadgetbridge by Freeyourgadget.

the class ActivityListingChartFragment method showOngoingActivitySnackbar.

private void showOngoingActivitySnackbar(ActivitySession ongoingSession) {
    String distanceLabel = stepListAdapter.getDistanceLabel(ongoingSession);
    String stepLabel = stepListAdapter.getStepLabel(ongoingSession);
    String durationLabel = stepListAdapter.getDurationLabel(ongoingSession);
    String hrLabel = stepListAdapter.getHrLabel(ongoingSession);
    String activityName = stepListAdapter.getActivityName(ongoingSession);
    int icon = stepListAdapter.getIcon(ongoingSession);
    String text = String.format("%s:\u00A0%s, %s:\u00A0%s, %s:\u00A0%s, %s:\u00A0%s", activityName, durationLabel, getString(R.string.heart_rate), hrLabel, getString(R.string.steps), stepLabel, getString(R.string.distance), distanceLabel);
    final Snackbar snackbar = Snackbar.make(rootView, text, 1000 * 8);
    View snackbarView = snackbar.getView();
    snackbarView.setBackgroundColor(getContext().getResources().getColor(R.color.accent));
    snackbar.setActionTextColor(Color.WHITE);
    snackbar.setAction(getString(R.string.dialog_hide).toUpperCase(), new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            snackbar.dismiss();
        }
    });
    snackbar.show();
}
Also used : View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) 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