/** * 设定View和与之对应的资源文件 * * @param view * @param res * @return */ public ToastUtils setView(View view, int res) { if (mBuilder != null) { mBuilder.setView(view, res); } else { mBuilder = new Builder(); mBuilder.setView(view, res); } return this; }
public ToastUtils setTextColor(int color) { if (mBuilder != null) { mBuilder.setTextColor(color); } else { mBuilder = new Builder(); mBuilder.setTextColor(color); } return this; }
public ToastUtils setDuration(int duration) { if (mBuilder != null) { mBuilder.setDuration(duration); } else { mBuilder = new Builder(); mBuilder.setDuration(duration); } return this; }
public ToastUtils setGravity(int gravity, int xOffset, int yOffset) { if (mBuilder != null) { mBuilder.setGravity(gravity, xOffset, yOffset); } else { mBuilder = new Builder(); mBuilder.setGravity(gravity, xOffset, yOffset); } return this; }
public ToastUtils setText(String text) { if (mBuilder != null) { mBuilder.setText(text); } else { mBuilder = new Builder(); mBuilder.setText(text); } return this; }
public ToastUtils setBackground(int resId) { mBackgroundResId = resId; if (mBuilder != null) { mBuilder.setBackground(resId); } else { mBuilder = new Builder(); mBuilder.setBackground(resId); } return this; }
public ToastUtils setBackground(Drawable drawable) { mBackgroundDrawable = drawable; if (mBuilder != null) { mBuilder.setBackground(mBackgroundDrawable); } else { mBuilder = new Builder(); mBuilder.setBackground(mBackgroundDrawable); } return this; }