version:beta
fix: update:增加锁屏密码
This commit is contained in:
@@ -17,20 +17,23 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.fuying.sn.R;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.config.CommonConfig;
|
||||
import com.fuying.sn.gson.GsonUtils;
|
||||
import com.fuying.sn.network.NetInterfaceManager;
|
||||
import com.fuying.sn.network.UrlAddress;
|
||||
import com.fuying.sn.receiver.APKinstallReceiver;
|
||||
import com.fuying.sn.receiver.BootReceiver;
|
||||
import com.fuying.sn.gson.GsonUtils;
|
||||
import com.fuying.sn.utils.SPUtils;
|
||||
import com.fuying.sn.utils.TimeUtils;
|
||||
import com.fuying.sn.utils.ToastUtil;
|
||||
import com.fuying.sn.utils.Utils;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -49,9 +52,9 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
public class ManagerService extends Service implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private String TAG = ManagerService.class.getSimpleName();
|
||||
|
||||
public static String ACTION_LOCK = "LockScreenReceiver_lockscreen";
|
||||
public static String ACTION_UNLOCK = "LockScreenReceiver_unlockscreen";
|
||||
public static String ACTION_UPDATE = "TimeChangedReceiver_update";
|
||||
public static final String ACTION_LOCK = "LockScreenReceiver_lockscreen";
|
||||
public static final String ACTION_UNLOCK = "LockScreenReceiver_unlockscreen";
|
||||
public static final String ACTION_UPDATE = "TimeChangedReceiver_update";
|
||||
private WindowManager windowManager;
|
||||
private View topView;
|
||||
private boolean screenlocked = false;
|
||||
@@ -196,7 +199,7 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
}
|
||||
}
|
||||
|
||||
public static String LOCK_STATE = "SCRENN_LOOCKED_STATE";
|
||||
public static final String LOCK_STATE = "SCRENN_LOOCKED_STATE";
|
||||
|
||||
private void showFloatingWindow(String name) {
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
@@ -223,10 +226,39 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
topView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.activity_screen_lock, null);
|
||||
TextView textView = topView.findViewById(R.id.textView);
|
||||
textView.setText(name);
|
||||
EditText et_password = topView.findViewById(R.id.et_password);
|
||||
TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
||||
tv_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
||||
String pwd = et_password.getText().toString();
|
||||
if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
||||
hideFloatingWindow();
|
||||
}else {
|
||||
ToastUtil.show("密码错误");
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if ("added".equals(topView.getTag())) {
|
||||
TextView textView = topView.findViewById(R.id.textView);
|
||||
textView.setText(name);
|
||||
EditText et_password = topView.findViewById(R.id.et_password);
|
||||
TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
||||
tv_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
||||
String pwd = et_password.getText().toString();
|
||||
if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
||||
hideFloatingWindow();
|
||||
}else {
|
||||
ToastUtil.show("密码错误");
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -286,6 +318,7 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e("LockScreenReceiver", "onReceive: " + action);
|
||||
if (TextUtils.isEmpty(action)) {
|
||||
getScreenLockState();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user