Skip to content

Commit e9933df

Browse files
committed
关闭注释输出
1 parent 756eafa commit e9933df

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

toast/src/main/java/com/lopez/toast/ToastUtils.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
public class ToastUtils {
2727

28+
private MyHandler mHandler;
2829
private static Toast mToast;
2930
private static ToastUtils instance;
30-
private MyHandler mHandler;
3131
private static WeakReference<Context> weakContext;
3232

3333
public static ToastUtils initToast(Context context) {
@@ -38,9 +38,9 @@ public static ToastUtils initToast(Context context) {
3838
private static ToastUtils getInstance(Context context) {
3939
if (instance == null) {
4040
synchronized (ToastUtils.class) {
41-
Log.d("==w", "instance为空 > 1 again");
41+
//Log.d("==w", "instance为空 > 1 again");
4242
if (instance == null) {
43-
Log.d("==w", "instance为空 > 2 实例化");
43+
//Log.d("==w", "instance为空 > 2 实例化");
4444
instance = new ToastUtils(context);
4545
}
4646
}
@@ -88,7 +88,7 @@ public void handleMessage(Message msg) {
8888
switch (msg.what) {
8989
case 0:
9090
if (mToast != null) {
91-
Log.d("==w", "handleMessage: mToast不为空");
91+
//Log.d("==w", "handleMessage: mToast不为空");
9292
toastShow();
9393

9494
ThreadPoolManager.execute(new Runnable() {
@@ -98,10 +98,10 @@ public void run() {
9898

9999
if (count <= time) {
100100
SystemClock.sleep(100);
101-
Log.d("==w", ">> handleMessage: count: " + count + "\t\tVS\t\ttime: " + time);
101+
//Log.d("==w", ">> handleMessage: count: " + count + "\t\tVS\t\ttime: " + time);
102102
getInstance(weakContext.get()).getHandler().sendEmptyMessage(0);
103103
} else {
104-
Log.d("==w", "handleMessage: 结束了。。。");
104+
//Log.d("==w", "handleMessage: 结束了。。。");
105105
//重置
106106
count = 0;
107107
if (mToast != null) {
@@ -110,8 +110,8 @@ public void run() {
110110
}
111111
}
112112

113-
String threadName = Thread.currentThread().getName();
114-
Log.d("==w", "run: 当前线程名: " + threadName + "\n");
113+
//String threadName = Thread.currentThread().getName();
114+
//Log.d("==w", "run: 当前线程名: " + threadName + "\n");
115115
}
116116
});
117117
}
@@ -150,7 +150,7 @@ private void showMyToast(String msg, final long millisecond) {
150150
View mToastView = mToast.getView();
151151
TextView mtv = (TextView) mToastView.findViewById(R.id.toast_message);
152152
if (!mtv.getText().equals(msg)) {
153-
Log.d("==w", "showMyToast: 与之前的值不相等: " + mtv.getText());
153+
//Log.d("==w", "showMyToast: 与之前的值不相等: " + mtv.getText());
154154
//不相等就表示可以更新Toast了
155155
mtv.setText(msg);
156156
}
@@ -182,7 +182,7 @@ private void showMyToast(String msg, final long millisecond) {
182182
public void run() {
183183
//表示0.1秒跑一次
184184
SystemClock.sleep(100);
185-
Log.d("==w", "run: 发送 0 !!");
185+
//Log.d("==w", "run: 发送 0 !!");
186186
getInstance(weakContext.get()).getHandler().sendEmptyMessage(0);
187187
}
188188
});
@@ -209,19 +209,19 @@ private String getResourceString(int strId) {
209209
//主线、子线程中的封装Toast
210210
private static void toastShow() {
211211
if (isInMainThread) {
212-
Log.d("==w", "主线程 --- Toast");
212+
//Log.d("==w", "主线程 --- Toast");
213213
mToast.show();
214214
} else {
215215
try {
216-
Log.d("==w", "如果处在子线程,那么需要换到主线程中再Toast");
216+
//Log.d("==w", "如果处在子线程,那么需要换到主线程中再Toast");
217217
ThreadUtils.runInUIThread(new Runnable() {
218218
@Override
219219
public void run() {
220220
mToast.show();
221221
}
222222
});
223223
} catch (Exception e) {
224-
Log.d("==w", "Toast错误...");
224+
//Log.d("==w", "Toast错误...");
225225
e.printStackTrace();
226226
}
227227
}
@@ -275,7 +275,7 @@ public static void showToast(String msg) {
275275
*/
276276
public static void showToastLong(String msg) {
277277
//不能直接填标识符,不然会失效(那些表示0、1)
278-
Log.d("==w", "toast: " + msg);
278+
//Log.d("==w", "toast: " + msg);
279279
getInstance(weakContext.get()).getHandler().showMyToast(msg, 3500);
280280
}
281281

0 commit comments

Comments
 (0)