use of android.support.design.widget.Snackbar in project android-advancedrecyclerview by h6ah4i.
the class SwipeableExampleActivity method onItemRemoved.
/**
* This method will be called when a list item is removed
*
* @param position The position of the item within data set
*/
public void onItemRemoved(int position) {
Snackbar snackbar = Snackbar.make(findViewById(R.id.container), R.string.snack_bar_text_item_removed, Snackbar.LENGTH_LONG);
snackbar.setAction(R.string.snack_bar_action_undo, new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemUndoActionClicked();
}
});
snackbar.setActionTextColor(ContextCompat.getColor(this, R.color.snackbar_action_color_done));
snackbar.show();
}
use of android.support.design.widget.Snackbar in project iosched by google.
the class PermissionsUtils method displayPermissionDeniedAppInfoResolutionSnackbar.
private static Snackbar displayPermissionDeniedAppInfoResolutionSnackbar(@NonNull final Activity activity, final int messageResId, final boolean isPersistent) {
View view = UIUtils.getRootView(activity);
final int length = isPersistent ? Snackbar.LENGTH_INDEFINITE : Snackbar.LENGTH_LONG;
Snackbar snackbar = Snackbar.make(view, messageResId, length).setAction(R.string.ok, new View.OnClickListener() {
@Override
public void onClick(final View v) {
LOGI(TAG, "Invoking App Info screen");
final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", BuildConfig.APPLICATION_ID, null);
intent.setData(uri);
activity.startActivity(intent);
}
});
snackbar.show();
return snackbar;
}
use of android.support.design.widget.Snackbar in project WordPress-Android by wordpress-mobile.
the class WPSwipeSnackbar method show.
private static Snackbar show(@NonNull ViewPager viewPager, @NonNull SwipeArrows arrows) {
Context context = viewPager.getContext();
String swipeText = context.getResources().getString(R.string.swipe_for_more);
String arrowLeft = context.getResources().getString(R.string.previous_button);
String arrowRight = context.getResources().getString(R.string.next_button);
String text;
switch(arrows) {
case LEFT:
text = arrowLeft + " " + swipeText;
break;
case RIGHT:
text = swipeText + " " + arrowRight;
break;
case BOTH:
text = arrowLeft + " " + swipeText + " " + arrowRight;
break;
default:
text = swipeText;
break;
}
Snackbar snackbar = Snackbar.make(viewPager, text, Snackbar.LENGTH_LONG);
centerSnackbarText(snackbar);
snackbar.show();
return snackbar;
}
use of android.support.design.widget.Snackbar in project AgentWeb by Justson.
the class AgentWebUtils method show.
public static void show(View parent, CharSequence text, int duration, @ColorInt int textColor, @ColorInt int bgColor, CharSequence actionText, @ColorInt int actionTextColor, View.OnClickListener listener) {
SpannableString spannableString = new SpannableString(text);
ForegroundColorSpan colorSpan = new ForegroundColorSpan(textColor);
spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
snackbarWeakReference = new WeakReference<>(Snackbar.make(parent, spannableString, duration));
Snackbar snackbar = snackbarWeakReference.get();
View view = snackbar.getView();
view.setBackgroundColor(bgColor);
if (actionText != null && actionText.length() > 0 && listener != null) {
snackbar.setActionTextColor(actionTextColor);
snackbar.setAction(actionText, listener);
}
snackbar.show();
}
use of android.support.design.widget.Snackbar in project YourAppIdea by Michenux.
the class SnackbarHelper method showInfoLongMessage.
public static void showInfoLongMessage(View view, @StringRes int message) {
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
View sbView = snackbar.getView();
TextView textView = (TextView) sbView.findViewById(org.michenux.drodrolib.R.id.snackbar_text);
textView.setTextColor(Color.YELLOW);
snackbar.show();
}
Aggregations