use of android.support.design.widget.Snackbar in project teaTime by ancfdy.
the class SnackbarUtils method IndefiniteSnackbar.
/**
* 自定义时常显示Snackbar,可选预设类型
* @param view
* @param message
* @param type
* @return
*/
public static Snackbar IndefiniteSnackbar(View view, String message, int duration, int type) {
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_INDEFINITE).setDuration(duration);
switchType(snackbar, type);
return snackbar;
}
use of android.support.design.widget.Snackbar in project JustAndroid by chinaltz.
the class AbSnackbarUtil method ShortSnackbar.
/**
* 短显示Snackbar,自定义颜色
*
* @param view
* @param message
* @param messageColor
* @param backgroundColor
* @return
*/
public static Snackbar ShortSnackbar(View view, String message, int messageColor, int backgroundColor) {
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_SHORT);
setSnackbarColor(snackbar, messageColor, backgroundColor);
return snackbar;
}
use of android.support.design.widget.Snackbar in project JustAndroid by chinaltz.
the class AbSnackbarUtil method IndefiniteSnackbar.
/**
* 自定义时常显示Snackbar,可选预设类型
*
* @param view
* @param message
* @param type
* @return
*/
public static Snackbar IndefiniteSnackbar(View view, String message, int duration, int type) {
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_INDEFINITE).setDuration(duration);
switchType(snackbar, type);
return snackbar;
}
use of android.support.design.widget.Snackbar in project JustAndroid by chinaltz.
the class AbSnackbarUtil method LongSnackbar.
/**
* 长显示Snackbar,可选预设类型
*
* @param view
* @param message
* @param type
* @return
*/
public static Snackbar LongSnackbar(View view, String message, int type) {
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
switchType(snackbar, type);
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();
}
Aggregations