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();
}
});
}
}
}
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();
}
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;
}
}
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();
}
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();
}
Aggregations