|
|
|
@ -1,7 +1,6 @@
|
|
|
|
package com.bjzc.yfdxj.activity;
|
|
|
|
package com.bjzc.yfdxj.activity;
|
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
import android.app.ActivityManager;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.pm.PackageInfo;
|
|
|
|
import android.content.pm.PackageInfo;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
@ -10,7 +9,6 @@ import android.os.Build;
|
|
|
|
import android.provider.Settings;
|
|
|
|
import android.provider.Settings;
|
|
|
|
import android.telephony.TelephonyManager;
|
|
|
|
import android.telephony.TelephonyManager;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
@ -18,7 +16,6 @@ import android.widget.CheckBox;
|
|
|
|
import android.widget.EditText;
|
|
|
|
import android.widget.EditText;
|
|
|
|
import android.widget.RadioGroup;
|
|
|
|
import android.widget.RadioGroup;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
|
|
import com.azhon.appupdate.listener.OnButtonClickListener;
|
|
|
|
import com.azhon.appupdate.listener.OnButtonClickListener;
|
|
|
|
import com.azhon.appupdate.listener.OnDownloadListener;
|
|
|
|
import com.azhon.appupdate.listener.OnDownloadListener;
|
|
|
|
import com.azhon.appupdate.manager.DownloadManager;
|
|
|
|
import com.azhon.appupdate.manager.DownloadManager;
|
|
|
|
@ -43,13 +40,10 @@ import com.bjzc.yfdxj.utils.UiUtlis;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.rinsun.mtdriver.MTnativeInterface;
|
|
|
|
import com.rinsun.mtdriver.MTnativeInterface;
|
|
|
|
import com.tencent.bugly.crashreport.CrashReport;
|
|
|
|
import com.tencent.bugly.crashreport.CrashReport;
|
|
|
|
import com.yanzhenjie.permission.AndPermission;
|
|
|
|
|
|
|
|
import com.yanzhenjie.permission.runtime.Permission;
|
|
|
|
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
import com.yolanda.nohttp.RequestMethod;
|
|
|
|
import com.yolanda.nohttp.RequestMethod;
|
|
|
|
import com.yolanda.nohttp.rest.Request;
|
|
|
|
import com.yolanda.nohttp.rest.Request;
|
|
|
|
import com.yolanda.nohttp.rest.Response;
|
|
|
|
import com.yolanda.nohttp.rest.Response;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
@ -59,7 +53,6 @@ import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.appcompat.widget.AppCompatTextView;
|
|
|
|
import androidx.appcompat.widget.AppCompatTextView;
|
|
|
|
|
|
|
|
|
|
|
|
@ -193,7 +186,7 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
etPwd.setText("lgy12345");
|
|
|
|
etPwd.setText("lgy12345");
|
|
|
|
|
|
|
|
|
|
|
|
// etUse.setText("161619");
|
|
|
|
// etUse.setText("161619");
|
|
|
|
// etPwd.setText("161619");
|
|
|
|
// etPwd.setText("161619");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//使用完一定记得关闭 电源
|
|
|
|
//使用完一定记得关闭 电源
|
|
|
|
mt.RFIDclose();
|
|
|
|
mt.RFIDclose();
|
|
|
|
@ -291,16 +284,15 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SetPermission() {
|
|
|
|
private void SetPermission() {
|
|
|
|
AndPermission.with(this).runtime().permission(
|
|
|
|
// AndPermission.with(this).runtime().permission(
|
|
|
|
Permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
// Permission.ACCESS_COARSE_LOCATION,
|
|
|
|
Permission.ACCESS_COARSE_LOCATION,
|
|
|
|
// Permission.READ_PHONE_STATE,
|
|
|
|
Permission.READ_PHONE_STATE,
|
|
|
|
// Permission.READ_EXTERNAL_STORAGE,
|
|
|
|
Permission.READ_EXTERNAL_STORAGE,
|
|
|
|
// Permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
Permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
// Permission.CAMERA
|
|
|
|
Permission.CAMERA
|
|
|
|
// ).onGranted(data -> {
|
|
|
|
).onGranted(data -> {
|
|
|
|
// }).onDenied(data -> {
|
|
|
|
}).onDenied(data -> {
|
|
|
|
// }).start();
|
|
|
|
}).start();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onclick() {
|
|
|
|
private void onclick() {
|
|
|
|
@ -355,15 +347,15 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onSucceed(int what, Response<String> response) throws ParseException {
|
|
|
|
public void onSucceed(int what, Response<String> response) throws ParseException {
|
|
|
|
String json = response.get();
|
|
|
|
String json = response.get();
|
|
|
|
// showLog("-----login-----");
|
|
|
|
showLog("-----login-----");
|
|
|
|
// showLog(json);
|
|
|
|
showLog(json);
|
|
|
|
|
|
|
|
|
|
|
|
String jsonDecode = RSAUtils.decryptBASE64StrClient(json);
|
|
|
|
String jsonDecode = RSAUtils.decryptBASE64StrClient(json);
|
|
|
|
if (TextUtils.isEmpty(jsonDecode)) {
|
|
|
|
if (TextUtils.isEmpty(jsonDecode)) {
|
|
|
|
showToast(UiUtlis.getString(context, R.string.data_error));
|
|
|
|
showToast(UiUtlis.getString(context, R.string.data_error));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
UserInfo userInfo = GsonUtils.GsonToBean(jsonDecode, UserInfo.class);
|
|
|
|
UserInfo userInfo = GsonUtils.GsonToBean(jsonDecode, UserInfo.class);
|
|
|
|
//showLog(jsonDecode);
|
|
|
|
showLog(jsonDecode);
|
|
|
|
|
|
|
|
|
|
|
|
if (userInfo != null) {
|
|
|
|
if (userInfo != null) {
|
|
|
|
UserInfo.User user = userInfo.getRows().get(0);
|
|
|
|
UserInfo.User user = userInfo.getRows().get(0);
|
|
|
|
@ -472,9 +464,9 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
info.setRows(list);
|
|
|
|
info.setRows(list);
|
|
|
|
String json = GsonUtils.GsonString(info);
|
|
|
|
String json = GsonUtils.GsonString(info);
|
|
|
|
String jsonEncrypt = RSAUtils.encryptBASE64Str(json);
|
|
|
|
String jsonEncrypt = RSAUtils.encryptBASE64Str(json);
|
|
|
|
// showLog(json);
|
|
|
|
showLog(json);
|
|
|
|
// showLog(jsonEncrypt);
|
|
|
|
showLog(jsonEncrypt);
|
|
|
|
// showLog(RSAUtils.decryptBASE64Str(jsonEncrypt));
|
|
|
|
showLog(RSAUtils.decryptBASE64Str(jsonEncrypt));
|
|
|
|
return jsonEncrypt;
|
|
|
|
return jsonEncrypt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -517,6 +509,7 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Call<ApkUpdateBean> call, retrofit2.Response<ApkUpdateBean> response) {
|
|
|
|
public void onSuccess(Call<ApkUpdateBean> call, retrofit2.Response<ApkUpdateBean> response) {
|
|
|
|
ApkUpdateBean appUploadInfo = response.body();
|
|
|
|
ApkUpdateBean appUploadInfo = response.body();
|
|
|
|
|
|
|
|
//showLog(new Gson().toJson(appUploadInfo));
|
|
|
|
if (appUploadInfo != null) {
|
|
|
|
if (appUploadInfo != null) {
|
|
|
|
if (appUploadInfo.getTotal().equals("1")) {
|
|
|
|
if (appUploadInfo.getTotal().equals("1")) {
|
|
|
|
String appURL = appUploadInfo.getRows().get(0).getApkurl();
|
|
|
|
String appURL = appUploadInfo.getRows().get(0).getApkurl();
|
|
|
|
@ -684,6 +677,7 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
//System.out.println("登录已失效: "+String.valueOf(Calendar.getInstance().after(calendarOne)));
|
|
|
|
//System.out.println("登录已失效: "+String.valueOf(Calendar.getInstance().after(calendarOne)));
|
|
|
|
|
|
|
|
|
|
|
|
Intent intent = new Intent(context, MainActivity.class);
|
|
|
|
Intent intent = new Intent(context, MainActivity.class);
|
|
|
|
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
|
|
startActivity(intent);
|
|
|
|
startActivity(intent);
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -764,4 +758,10 @@ public class LoginActivity extends BaseActivity {
|
|
|
|
nfcValue = result;
|
|
|
|
nfcValue = result;
|
|
|
|
nfcOnlineLogin(result);
|
|
|
|
nfcOnlineLogin(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//登录
|
|
|
|
|
|
|
|
//AppLogin/GetData.aspx
|
|
|
|
|
|
|
|
//软件自动更新
|
|
|
|
|
|
|
|
//ApkUpdate/Update.ashx
|
|
|
|
|
|
|
|
//Apps/APP_GX.ashx
|
|
|
|
|
|
|
|
//ApkUpdate/GetData.aspx
|
|
|
|
|