2 Ревизии d2f58c36ce ... b4bd7b26f1

Автор SHA1 Съобщение Дата
  guilin b4bd7b26f1 Merge remote-tracking branch 'remotes/origin/master' into master_925 преди 1 месец
  guilin 0c916bf05d 异步上传优化 преди 1 месец
променени са 2 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 3 0
      app/src/main/java/com/fxy/main/MainActivity.java
  2. 1 2
      app/src/main/java/com/fxy/utils/UploadUtils.java

+ 3 - 0
app/src/main/java/com/fxy/main/MainActivity.java

@@ -122,6 +122,9 @@ public class MainActivity extends BaseActivity implements BadgeDismissListener,
         receiver = new DeviceStatusReceiver();
         // 创建 IntentFilter
         filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
+        filter.addAction(Intent.ACTION_BATTERY_CHANGED);
+        filter.addAction(Intent.ACTION_SCREEN_OFF);
+        filter.addAction(Intent.ACTION_SCREEN_OFF);
         // 注册 BroadcastReceiver
         registerReceiver(receiver, filter);
     }

+ 1 - 2
app/src/main/java/com/fxy/utils/UploadUtils.java

@@ -32,7 +32,7 @@ public class UploadUtils {
     }
     public static long getCurrentTime(){
         Calendar calendar = Calendar.getInstance();
-        calendar.set(Calendar.MILLISECOND, 0);
+
         return calendar.getTimeInMillis();
     }
 
@@ -46,7 +46,6 @@ public class UploadUtils {
     public static long calculateDifferenceInSeconds(long timestamp1, long timestamp2) {
         // 计算两个时间戳之间的差异(毫秒)
         long differenceInMillis = Math.abs(timestamp1 - timestamp2);
-
         // 将差异转换为秒
         return differenceInMillis / 1000;
     }