예제 #1
0
 /**
  * 设定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;
 }
예제 #2
0
 public ToastUtils setTextColor(int color) {
   if (mBuilder != null) {
     mBuilder.setTextColor(color);
   } else {
     mBuilder = new Builder();
     mBuilder.setTextColor(color);
   }
   return this;
 }
예제 #3
0
 public ToastUtils setDuration(int duration) {
   if (mBuilder != null) {
     mBuilder.setDuration(duration);
   } else {
     mBuilder = new Builder();
     mBuilder.setDuration(duration);
   }
   return this;
 }
예제 #4
0
 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;
 }
예제 #5
0
 public ToastUtils setText(String text) {
   if (mBuilder != null) {
     mBuilder.setText(text);
   } else {
     mBuilder = new Builder();
     mBuilder.setText(text);
   }
   return this;
 }
예제 #6
0
 public ToastUtils setBackground(int resId) {
   mBackgroundResId = resId;
   if (mBuilder != null) {
     mBuilder.setBackground(resId);
   } else {
     mBuilder = new Builder();
     mBuilder.setBackground(resId);
   }
   return this;
 }
예제 #7
0
 public ToastUtils setBackground(Drawable drawable) {
   mBackgroundDrawable = drawable;
   if (mBuilder != null) {
     mBuilder.setBackground(mBackgroundDrawable);
   } else {
     mBuilder = new Builder();
     mBuilder.setBackground(mBackgroundDrawable);
   }
   return this;
 }