1.4.0318 修复升级后设置默认桌面,对接小程序管控,增加专注模式,接管系统打开app
This commit is contained in:
@@ -142,6 +142,33 @@ public class TimeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否在管控时间内
|
||||
*
|
||||
* @param context
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public static ContralTime getContralTime(Context context, String startTime, String endTime) {
|
||||
if (null == startTime || null == endTime || ("00:00".equals(startTime) && "00:00".equals(endTime))) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
Date startDate = df.parse(startTime.trim());
|
||||
Date endDate = df.parse(endTime.trim());
|
||||
ContralTime contralTime = new ContralTime();
|
||||
contralTime.setStartTime(df.format(startDate));
|
||||
contralTime.setEndTime(df.format(endDate));
|
||||
return contralTime;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ContralTime String2ContralTime(Context context, @NonNull String timeText) {
|
||||
DateFormat df = ContralTime.getDf();
|
||||
String[] time = timeText.trim().split("-");
|
||||
@@ -241,6 +268,14 @@ public class TimeUtils {
|
||||
return df.format(new Date(time));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 这个时反的,为了对接专注模式
|
||||
*/
|
||||
public boolean inControlTime() {
|
||||
long time = System.currentTimeMillis();
|
||||
return !inControlTime(time);
|
||||
}
|
||||
|
||||
public boolean inControlTime(long time) {
|
||||
return inControlTime(df.format(new Date(time)));
|
||||
}
|
||||
@@ -256,6 +291,11 @@ public class TimeUtils {
|
||||
try {
|
||||
Date startDate = df.parse(startTime);
|
||||
Date endDate = df.parse(endTime);
|
||||
Log.e(TAG, "inControlTime: startDate time = " +startDate.getTime());
|
||||
Log.e(TAG, "inControlTime: endDate time = " +endDate.getTime());
|
||||
if (startDate.getTime() == endDate.getTime()) {
|
||||
return false;
|
||||
}
|
||||
Date nowDate = df.parse(time);
|
||||
if (startDate.getTime() > endDate.getTime()) {
|
||||
//开始时间大于结束时间 列 16:00-01:00
|
||||
|
||||
Reference in New Issue
Block a user