version:2.6

fix:更新retrofit,优化请求次数
update:
This commit is contained in:
2022-02-24 18:44:56 +08:00
parent 7d50cb709b
commit 3c45ccc7b1
76 changed files with 1130 additions and 1705 deletions

View File

@@ -4,7 +4,9 @@ import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
@@ -15,6 +17,9 @@ import com.aoleyun.sn.service.main.MainService;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
/**
@@ -52,6 +57,10 @@ public class TimeUtils {
return false;
}
/**
* @return 获取今日0点时间戳
* 没有管时区问题
*/
private static long getZeroTiemstamp() {
long nowTime = System.currentTimeMillis();
long dayMillisecond = 60 * 60 * 24 * 1000;
@@ -60,6 +69,22 @@ public class TimeUtils {
return zeroTime;
}
@RequiresApi(api = Build.VERSION_CODES.O)
public static boolean isTodayTime(long timeStamp) {
String time = transferLongToDate(timeStamp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime localTime = LocalDateTime.parse(time, dtf);
LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
return localTime.isAfter(startTime) && localTime.isBefore(endTime);
}
public static String transferLongToDate(Long millSec) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date(millSec);
return sdf.format(date);
}
private static long getLoopTime(String timestamp) {
//"15:34:39"
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");