Browse Source

优化部分代码判断

Pq 1 năm trước cách đây
mục cha
commit
747643feed

+ 4 - 2
BaseLibrary/src/main/java/com/cooleshow/base/utils/helper/DownloadHelper.java

@@ -207,8 +207,10 @@ public class DownloadHelper {
                 if (task.getListener() != downloadListener) {
                     return;
                 }
-                Log.d(TAG, "paused taskId:" + task.getId() + ",soFarBytes:" + soFarBytes + ",totalBytes:" + totalBytes + ",percent:" + soFarBytes * 1.0 / totalBytes);
-                Log.d(TAG, "paused taskId:" + task.getId() + ",soFarBytes:" + soFarBytes + ",totalBytes:" + totalBytes + ",percent:" + soFarBytes * 1.0 / totalBytes);
+                if(totalBytes>0){
+                    Log.d(TAG, "paused taskId:" + task.getId() + ",soFarBytes:" + soFarBytes + ",totalBytes:" + totalBytes + ",percent:" + soFarBytes * 1.0 / totalBytes);
+                    Log.d(TAG, "paused taskId:" + task.getId() + ",soFarBytes:" + soFarBytes + ",totalBytes:" + totalBytes + ",percent:" + soFarBytes * 1.0 / totalBytes);
+                }
                 if (mEventListener != null) {
                     HashMap<String, ArrayList<String>> downloadTaskInfos = getDownloadTaskInfos();
                     Iterator<String> iterator = downloadTaskInfos.keySet().iterator();