version:1.2.3

fix:
update:修复管控跨天失效
This commit is contained in:
2024-04-15 09:41:08 +08:00
parent 86986c8d58
commit 27a85402c9
3 changed files with 26 additions and 12 deletions

View File

@@ -50,8 +50,8 @@ android {
minSdkVersion 26 minSdkVersion 26
targetSdkVersion 28 targetSdkVersion 28
versionCode 23 versionCode 24
versionName "1.2.2" versionName "1.2.3"
ndk { ndk {
//选择要添加的对应 cpu 类型的 .so 库。 //选择要添加的对应 cpu 类型的 .so 库。

View File

@@ -765,19 +765,19 @@ public class RunningAppManager {
if (getDayType() != partTime.getDay_type()) { if (getDayType() != partTime.getDay_type()) {
continue; continue;
} }
if (stringBuilder.length() == 0) { // if (stringBuilder.length() == 0) {
if (appTimeControl.getTime_part() != null && appTimeControl.getTime_part().size() != 0) { // if (appTimeControl.getTime_part() != null && appTimeControl.getTime_part().size() != 0) {
stringBuilder.append("仅限"); // stringBuilder.append("仅限");
} // }
} else { // } else {
stringBuilder.append(";"); // stringBuilder.append(";");
} // }
stringBuilder.append(partTime.getStart_time()) stringBuilder.append(partTime.getStart_time())
.append("-").append(partTime.getEnd_time()); .append("-").append(partTime.getEnd_time());
} }
if (appTimeControl.getTime_part() != null && appTimeControl.getTime_part().size() != 0) { if (appTimeControl.getTime_part() != null && appTimeControl.getTime_part().size() != 0) {
stringBuilder.append("使用"); // stringBuilder.append("使用");
} else { // } else {
stringBuilder.append("禁止使用"); stringBuilder.append("禁止使用");
} }
return stringBuilder.toString(); return stringBuilder.toString();
@@ -1222,12 +1222,20 @@ public class RunningAppManager {
Date startDate = dateFormat.parse(startTime); Date startDate = dateFormat.parse(startTime);
Date endDate = dateFormat.parse(endTime); Date endDate = dateFormat.parse(endTime);
Date nowDate = dateFormat.parse(time); Date nowDate = dateFormat.parse(time);
if (startDate.getTime() == endDate.getTime()) {
//相等返回不可用
return true;
}
if (startDate.getTime() > endDate.getTime()) { if (startDate.getTime() > endDate.getTime()) {
if (nowDate.getTime() < endDate.getTime()) {
nowDate.setTime(nowDate.getTime() + dayTime);
}
//开始时间大于结束时间 列 1600-0100 //开始时间大于结束时间 列 1600-0100
endDate.setTime(endDate.getTime() + dayTime); endDate.setTime(endDate.getTime() + dayTime);
} }
Log.i(TAG, "inControlTime: " + (startDate.getTime() - minuteTime)); Log.i(TAG, "inControlTime: " + (startDate.getTime() - minuteTime));
assert nowDate != null; assert nowDate != null;
// if (nowDate.getTime() <= startDate.getTime() - minuteTime || nowDate.getTime() >= endDate.getTime()) { // if (nowDate.getTime() <= startDate.getTime() - minuteTime || nowDate.getTime() >= endDate.getTime()) {
if (nowDate.getTime() >= startDate.getTime() && nowDate.getTime() <= endDate.getTime()) { if (nowDate.getTime() >= startDate.getTime() && nowDate.getTime() <= endDate.getTime()) {
return true; return true;

View File

@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Binder; import android.os.Binder;
import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@@ -240,7 +241,12 @@ public class MainService extends Service implements MainSContact.MainView, Lifec
String action = intent.getAction(); String action = intent.getAction();
Log.e("RefreshReceiver", "onReceive: " + action); Log.e("RefreshReceiver", "onReceive: " + action);
if (REFRESH_ACTION.equals(action)) { if (REFRESH_ACTION.equals(action)) {
mPresenter.getTimeManageSn(); Handler.getMain().postDelayed(new Runnable() {
@Override
public void run() {
mPresenter.getTimeManageSn();
}
}, 4321);
} }
} }
} }