瀏覽代碼

修复部分bug

Pq 2 年之前
父節點
當前提交
128c0b31a5
共有 1 個文件被更改,包括 16 次插入16 次删除
  1. 16 16
      BaseLibrary/src/main/java/com/cooleshow/base/utils/ToastUtil.java

+ 16 - 16
BaseLibrary/src/main/java/com/cooleshow/base/utils/ToastUtil.java

@@ -42,22 +42,22 @@ public class ToastUtil {
      * 创建自定义Toasts :
      */
     public void showShort(String toastStr) {
-        int dp26 = SizeUtils.dp2px(26);
-        int dp10 = SizeUtils.dp2px(10);
-        TextView mContentView = new TextView(Utils.getApp());
-        mContentView.setGravity(Gravity.CENTER);
-        mContentView.setBackgroundResource(R.drawable.shape_toast);
-        mContentView.setTextSize(15);
-        mContentView.setTextColor(Utils.getApp().getResources().getColor(R.color.white));
-        mContentView.setPadding(dp26, dp10, dp26, dp10);
-        mContentView.setText(toastStr);
-        ToastUtils.getDefaultMaker().setGravity(Gravity.CENTER, 0, 0).show(mContentView);
-//        if (init(toastStr, Toast.LENGTH_SHORT) == null) {
-//            toast = new Toast(Utils.getApp());
-//            toast.setText(toastStr);
-//            toast.setDuration(Toast.LENGTH_SHORT);
-//            toast.show();
-//        }
+//        int dp26 = SizeUtils.dp2px(26);
+//        int dp10 = SizeUtils.dp2px(10);
+//        TextView mContentView = new TextView(Utils.getApp());
+//        mContentView.setGravity(Gravity.CENTER);
+//        mContentView.setBackgroundResource(R.drawable.shape_toast);
+//        mContentView.setTextSize(15);
+//        mContentView.setTextColor(Utils.getApp().getResources().getColor(R.color.white));
+//        mContentView.setPadding(dp26, dp10, dp26, dp10);
+//        mContentView.setText(toastStr);
+//        ToastUtils.getDefaultMaker().setGravity(Gravity.CENTER, 0, 0).show(mContentView);
+        if (init(toastStr, Toast.LENGTH_SHORT) == null) {
+            toast = new Toast(Utils.getApp());
+            toast.setText(toastStr);
+            toast.setDuration(Toast.LENGTH_SHORT);
+            toast.show();
+        }
     }
 
     private Toast init(String message, int duration) {