Преглед на файлове

Merge remote-tracking branch 'remotes/origin/master' into master_925

guilin преди 1 месец
родител
ревизия
b4bd7b26f1
променени са 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;
     }