Commit a4f49f09 authored by chenyuling's avatar chenyuling

"另外开分支,使用设计稿的UI显示,定制组名信息"

parent 86253c4b
......@@ -19,8 +19,8 @@ android {
applicationId "com.srthinker.statinfo"
minSdk 24
targetSdk 32
versionCode 1
versionName "1.0.4"
versionCode 2
versionName "2.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......
......@@ -33,19 +33,19 @@
android:value="" />
</activity>
<activity
android:name=".uis.MainActivity"
android:exported="true" >
<intent-filter>
android:name=".uis.MainActivity1"
android:exported="false" >
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!--
&lt;!&ndash;
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
-->
&ndash;&gt;
</intent-filter>
</intent-filter>-->
<meta-data
android:name="android.app.lib_name"
......@@ -80,10 +80,21 @@
</provider>
<activity
android:name=".uis.MainOldActivity"
android:name=".uis.MainActivity"
android:configChanges="keyboardHidden|orientation"
android:exported="false"
android:exported="true"
android:windowSoftInputMode="adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!--
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
-->
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
......
......@@ -19,16 +19,18 @@ public class GroupConst {
public static final int NO_GROUP = 100;
public static final int GROUPED = 200;
//钢筋班组,木工班组,泥工班组,水电班组,防水班组,外架班组,项目部,监理单位
//钢筋班组,木工班组,外架班组,防水班组,瓦工班组,安全文明施工,防水班组,众安管理人员,中交六公司管理人员,特种作业人员
public static ArrayList<Group2Bean> group2BeansConst = new ArrayList<>();
static {
group2BeansConst.add(new Group2Bean(5, "钢筋班组",0));
group2BeansConst.add(new Group2Bean(6, "木工班组",0));
group2BeansConst.add(new Group2Bean(7, "泥工班组",0));
group2BeansConst.add(new Group2Bean(8, "水电班组",0));
group2BeansConst.add(new Group2Bean(1, "防水班组",0));
group2BeansConst.add(new Group2Bean(2, "外架班组",0));
group2BeansConst.add(new Group2Bean(3, "项目部",0));
group2BeansConst.add(new Group2Bean(4, "监理单位",0));
group2BeansConst.add(new Group2Bean(1, "钢筋班组",0));
group2BeansConst.add(new Group2Bean(2, "木工班组",0));
group2BeansConst.add(new Group2Bean(3, "外架班组",0));
group2BeansConst.add(new Group2Bean(4, "防水班组",0));
group2BeansConst.add(new Group2Bean(5, "瓦工班组",0));
group2BeansConst.add(new Group2Bean(6, "安全文明施工",0));
group2BeansConst.add(new Group2Bean(7, "防水班组",0));
group2BeansConst.add(new Group2Bean(8, "众安管理人员",0));
group2BeansConst.add(new Group2Bean(9, "中交六公司管理人员",0));
group2BeansConst.add(new Group2Bean(10, "特种作业人员",0));
}
}
package com.srthinker.statinfo.uis;
import static com.srthinker.statinfo.constant.Const.DEVICE_SN;
import static com.srthinker.statinfo.constant.Const.DEVICE_TYPE;
import static com.srthinker.statinfo.constant.Const.SN_PATH;
import static com.srthinker.statinfo.constant.InOutType.ENTER_TYPE;
import static com.srthinker.statinfo.constant.InOutType.LEAVE_TYPE;
import static com.srthinker.statinfo.download.upper.DownStatus.DOWN_ERROR;
......@@ -9,6 +9,7 @@ import static com.srthinker.statinfo.download.upper.DownStatus.DOWN_FINISH;
import static com.srthinker.statinfo.download.upper.DownStatus.DOWN_START;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
......@@ -18,31 +19,41 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.srthinker.statinfo.adapter.GroupShowAdapter;
import com.srthinker.statinfo.R;
import com.srthinker.statinfo.adapter.EnterAdapter;
import com.srthinker.statinfo.adapter.GroupAdapter;
import com.srthinker.statinfo.adapter.GroupSmallAdapter;
import com.srthinker.statinfo.adapter.LeaveAdapter;
import com.srthinker.statinfo.bean.Group2Bean;
import com.srthinker.statinfo.bean.StatusInfoBean;
import com.srthinker.statinfo.bean.TimeBean;
import com.srthinker.statinfo.constant.GroupConst;
import com.srthinker.statinfo.database.PersonMgr;
import com.srthinker.statinfo.database.entity.ConfigEntity;
import com.srthinker.statinfo.database.entity.PersonEntity;
import com.srthinker.statinfo.database.helper.ConfigHelper;
import com.srthinker.statinfo.database.helper.PersonHelper;
import com.srthinker.statinfo.databinding.ActivityNewMainBinding;
import com.srthinker.statinfo.databinding.ActivityMainBinding;
import com.srthinker.statinfo.download.upper.DownloadViewModel;
import com.srthinker.statinfo.download.upper.UpperDownloadCallback;
import com.srthinker.statinfo.listener.ConfigCallback;
import com.srthinker.statinfo.listener.OnTimeUpdateListener;
import com.srthinker.statinfo.listener.QueryPersonCallback;
import com.srthinker.statinfo.listener.upper.UpperDevicesCallback;
import com.srthinker.statinfo.listener.upper.UpperDevicesPortCallback;
import com.srthinker.statinfo.presenter.ApiManager;
import com.srthinker.statinfo.presenter.ApiQuest;
import com.srthinker.statinfo.presenter.RealTimeClock;
import com.srthinker.statinfo.presenter.StatSize;
import com.srthinker.statinfo.uis.news.SettingActivity;
import com.srthinker.statinfo.uis.fragment.ConfigDlgFragment;
import com.srthinker.statinfo.update.MDownloadCallBack;
import com.srthinker.statinfo.update.NetworkViewModel;
import com.srthinker.statinfo.update.UpdateInfo;
import com.srthinker.statinfo.util.common.ClickUtil;
import com.srthinker.statinfo.util.common.FileUtil;
import com.srthinker.statinfo.util.common.GsonUtil;
import com.srthinker.statinfo.util.common.PermissionUtil;
import com.srthinker.statinfo.util.common.SharedUtil;
import com.srthinker.statinfo.util.common.ThreadPool;
import com.srthinker.statinfo.util.common.Utils;
import com.srthinker.statinfo.util.other.NetworkIPMonitor;
......@@ -53,113 +64,123 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPChangeCallback, UpperDevicesCallback, MDownloadCallBack, UpperDownloadCallback, UpperDevicesPortCallback {
public class MainActivity extends BaseActivity implements OnTimeUpdateListener, MDownloadCallBack, UpperDownloadCallback, NetworkIPMonitor.OnIPChangeCallback, ConfigCallback, QueryPersonCallback, UpperDevicesCallback {
private static final String TAG = "NewMainActivity";
private com.srthinker.statinfo.databinding.ActivityNewMainBinding mBinding;
private NetworkIPMonitor networkIPMonitor;
private float groupSize = 100;
private boolean isPermission;
private static final String TAG = "MainActivity";
private com.srthinker.statinfo.databinding.ActivityMainBinding mBinding;
private RealTimeClock mRealTimeClock;
private List<PersonEntity> enterBeans;
private List<PersonEntity> leaveBeans;
private EnterAdapter enterAdapter;
private LeaveAdapter leaveAdapter;
private NetworkIPMonitor networkIPMonitor;
private String installPath = "";
private LoadDialog mLoadDialog;
//private String savePath = "/sdcard/update/StatInfo.apk";
//getFilesDir() + "/update", "StatInfo.apk"
private String savePath = Environment.getExternalStorageDirectory().getPath() + "/update";
private String sessionId;
private ApiManager enterMgr;
private static ScheduledExecutorService executor;
private int lastEnterSize = 0;
private int lastLeaveSize = 0;
private int lastPresentSize = 0;
private String deviceSn;
private List<PersonEntity> mQueryPersonList;
private GroupAdapter groupAdapter;
private HashMap<Integer, Integer> groupEnterHashMap=null;
private HashMap<Integer, Integer> groupLeaveHashMap=null;
private HashMap<Integer,Integer> groupPresentHashMap=null;
private boolean isPermission;
public static boolean NEED_NO_REPET = true; //是否需要去重,false:不需要,true:需要
private int group;
private GroupShowAdapter showAdapter;
private String deviceDesc;
private GroupSmallAdapter groupSmallAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_new_main);
mBinding = ActivityNewMainBinding.inflate(getLayoutInflater());
//setContentView(R.layout.activity_main);
mBinding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(mBinding.getRoot());
checkAllPermission();
initData();
initView();
checkAllPermission();
}
@SuppressLint("SdCardPath")
@Override
protected void initData() {
//获取Sn
deviceSn = FileUtil.readTextFromFile(SN_PATH);
enterBeans = new ArrayList<>();
leaveBeans = new ArrayList<>();
/*for (int i = 0; i < 12; i++) {
enterBeans.add(new PeopleBean("08:14","王大锤"));
}
for (int i = 0; i < 5; i++) {
leaveBeans.add(new PeopleBean("08:04","赵美丽"));
}*/
//检测网络
networkIPMonitor = new NetworkIPMonitor(this);
networkIPMonitor.startMonitoring();
networkIPMonitor.setOnIPChangeCallback(this);
enterBeans = new ArrayList<>();
leaveBeans = new ArrayList<>();
}
@SuppressLint("SetTextI18n")
@Override
protected void initView() {
initNumber();
updateTime();
initGroup();
mBinding.tvSetting.setOnClickListener(v->{
Intent intent = new Intent(this, SettingActivity.class);
startActivity(intent);
initPeopleList();
//mLoadDialog = LoadDialog.getInstance(this);
mLoadDialog = new LoadDialog(this);
//Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this));
deviceDesc = DEVICE_TYPE+" "+deviceSn+" V"+ Utils.getVersionName(this)+" ";
mBinding.tvDeviceDesc.setText(deviceDesc+"网络未连接");
//getResp();
mBinding.tvEnterText.setOnClickListener(v->{
showConfigDialog(ENTER_TYPE);
});
mBinding.tvLeaveText.setOnClickListener(v->{
showConfigDialog(LEAVE_TYPE);
});
mBinding.btnGroupDetail.setOnClickListener(v->{
/*ApiQuest.getInstance().queryPersons(this);
ClickUtil.disableClick(mBinding.btnGroupDetail);*/
boolean isQueryPersons = ApiQuest.getInstance().queryPersons(this);
//Log.i(TAG, "initView: isQueryPersons="+isQueryPersons);
if (!isQueryPersons) {
showTips("请检查配置信息和检查网络");
}else{
ClickUtil.disableClick(mBinding.btnGroupDetail);
}
});
mLoadDialog = new LoadDialog(this); //1.0.2版本把这个漏了
}
/*private void initGroup() {
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
*//*mBinding.ngvBuild.initItem("工地班组",build,groupSize);
mBinding.ngvWaterproof.initItem("防水班组",waterproof,groupSize);
mBinding.ngvOutrigger.initItem("外架班组",outrigger,groupSize);
mBinding.ngvSupervisor.initItem("监理单位",supervisor,groupSize);*//*
mBinding.ngvBuild.initItem("工地班组",build);
mBinding.ngvWaterproof.initItem("防水班组",waterproof);
mBinding.ngvOutrigger.initItem("外架班组",outrigger);
mBinding.ngvSupervisor.initItem("监理单位",supervisor);
}*/
private void initGroup(){
GridLayoutManager gLM = new GridLayoutManager(this, 4, RecyclerView.HORIZONTAL, false);
mBinding.rvGroupTotal.setLayoutManager(gLM);
showAdapter = new GroupShowAdapter(this, GroupConst.group2BeansConst);
mBinding.rvGroupTotal.setAdapter(showAdapter);
}
private void checkAllPermission() {
isPermission = PermissionUtil.checkMultiPermission(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET
}, 4096);
if (!isPermission){
Toast.makeText(this, "需要允许权限才能正常使用哦", Toast.LENGTH_SHORT).show();
private void showConfigDialog(int type) {
ConfigDlgFragment configDlgFragment = ConfigDlgFragment.getInstance(type);
configDlgFragment.setUsername("admin");
configDlgFragment.setConfigCallback(this);
if (configDlgFragment.isResumed()){
return;
}
configDlgFragment.showNow(getSupportFragmentManager(),configDlgFragment.getClass().getSimpleName());
configDlgFragment.setCancelable(false);
}
/*private void updateGroup() {
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
mBinding.ngvBuild.setNumber(build);
mBinding.ngvWaterproof.setNumber(waterproof);
mBinding.ngvOutrigger.setNumber(outrigger);
mBinding.ngvSupervisor.setNumber(supervisor);
}*/
@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "onResume: Main-Resume");
//如果设置页面有更新,主页面也需要进行访问接口,绑定监听
updateApi();
//获取最新的人员信息列表
mQueryPersonList = PersonHelper.getInstance().queryAll();
//更新分组情况
......@@ -169,141 +190,251 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
detectUpgrade(); //检测版本升级
}
private void updateApi() {
boolean isModified = SharedUtil.getInstance(this).readShared("isModified", false);
if (isModified){
questApi();
SharedUtil.getInstance(this).writeShared("isModified",false);
}
@Override
protected void onDestroy() {
Log.i(TAG, "onDestroy: Main--destroy");
networkIPMonitor.stopMonitoring();
mRealTimeClock.stop();
//关闭循环拉取
//executor.shutdownNow();
/*if (enterMgr != null) {
enterMgr.stop();
}*/
ApiQuest.getInstance().stopApi();
super.onDestroy();
}
private void detectUpgrade() {
NetworkViewModel networkViewModel = new NetworkViewModel();
networkViewModel.init(this,this);
networkViewModel.setDownloadCallback(this);
networkViewModel.getLastestVersion(DEVICE_SN,DEVICE_TYPE);
networkViewModel.getLastestVersion(deviceSn,DEVICE_TYPE);
}
@Override
protected void onDestroy() {
Log.i(TAG, "onDestroy: Main--destroy");
networkIPMonitor.stopMonitoring();
ApiQuest.getInstance().stopApi();
clearStatusInfoBeans();
super.onDestroy();
private void checkAllPermission() {
isPermission = PermissionUtil.checkMultiPermission(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET
}, 4096);
if (!isPermission){
Toast.makeText(this, "需要允许权限才能正常使用哦", Toast.LENGTH_SHORT).show();
}
}
@Override
public void OnIPChange(String ipAddress, String networkType) {
Log.i(TAG, "OnIPChange: change==>");
//questApi();
questApi();
private void initNumber() {
mBinding.nvEnter.initItem(lastEnterSize,"进去人数", R.mipmap.enter_bg);
mBinding.nvLeave.initItem(lastLeaveSize,"离开人数", R.mipmap.leave_bg);
mBinding.nvPresent.initItem(lastPresentSize,"在场人数", R.mipmap.present_bg);
}
private void questApi() {
List<ConfigEntity> enterConfigList = ConfigHelper.getInstance().queryByType(ENTER_TYPE);
ApiQuest.getInstance().startApi(enterConfigList,ENTER_TYPE);
List<ConfigEntity> leaveConfigList = ConfigHelper.getInstance().queryByType(LEAVE_TYPE);
ApiQuest.getInstance().startApi(leaveConfigList,LEAVE_TYPE);
ApiQuest.getInstance().setOnUpperDevicesCallback(this);
ApiQuest.getInstance().setOnUpperDevicesPortCallback(this);
private void initPeopleList() {
LinearLayoutManager enterLLM = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
mBinding.rvEnterList.setLayoutManager(enterLLM);
enterAdapter = new EnterAdapter(this, enterBeans);
mBinding.rvEnterList.setAdapter(enterAdapter);
LinearLayoutManager leaveLLM = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
mBinding.rvLeaveList.setLayoutManager(leaveLLM);
leaveAdapter = new LeaveAdapter(this, leaveBeans);
mBinding.rvLeaveList.setAdapter(leaveAdapter);
}
/* private void initGroup() {
GridLayoutManager groupGLM = new GridLayoutManager(this, 4);
mBinding.rvGroup.setLayoutManager(groupGLM);
ArrayList<GroupBean> groupBeans = updateGroup();
groupAdapter = new GroupAdapter(this, groupBeans);
mBinding.rvGroup.setAdapter(groupAdapter);
*//*mBinding.gvWaterproof.initItem("防水班组",34,R.color.color_2D52E3);
mBinding.gvOutrigger.initItem("外架班组",12,R.color.color_694BFF);
mBinding.gvBuild.initItem("工地班组",26,R.color.color_8A34D5);
mBinding.gvSupervisor.initItem("监理单位",28,R.color.color_00A89C);*//*
}*/
private void initGroup(){
GridLayoutManager gLM = new GridLayoutManager(this, 5, RecyclerView.VERTICAL, false);
mBinding.rvGroup.setLayoutManager(gLM);
groupSmallAdapter = new GroupSmallAdapter(this, GroupConst.group2BeansConst);
mBinding.rvGroup.setAdapter(groupSmallAdapter);
}
/* private ArrayList<GroupBean> updateGroup() {
ArrayList<GroupBean> groupBeans = new ArrayList<>();
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
groupBeans.add(new GroupBean("防水班组",waterproof,R.color.color_2D52E3,WATERPROOF));
groupBeans.add(new GroupBean("外架班组",outrigger,R.color.color_694BFF,OUTRIGGER));
groupBeans.add(new GroupBean("工地班组",build,R.color.color_8A34D5,BUILD));
groupBeans.add(new GroupBean("监理单位",supervisor,R.color.color_00A89C,SUPERVISOR));
return groupBeans;
}*/
private void updateTime() {
mRealTimeClock = new RealTimeClock();
mRealTimeClock.setOnTimeUpdateListener(this);
mRealTimeClock.start();
}
@SuppressLint("SetTextI18n")
@Override
public void OnIPLost(String error) {
ApiQuest.getInstance().stopApi();
//修改状态
List<ConfigEntity> configEntities = ConfigHelper.getInstance().queryAll();
for (ConfigEntity configEntity : configEntities) {
configEntity.setConnect(false);
//更新ip接口状态
ConfigHelper.getInstance().update(configEntity);
public void OnTimeUpdate(TimeBean timeBean) {
if (timeBean != null) {
mBinding.tvTime.setText(timeBean.getyMD()+" "+timeBean.getWeek()+" "+timeBean.getHm());
}
}
@Override
public void getAllPassInfo(List<PersonEntity> passAllEntities, int type) {
public void checkResult(boolean needUpdate, boolean canInstall, UpdateInfo onlineInfo) {
if (needUpdate){
if (onlineInfo!=null){
Log.i(TAG, "checkResult: onlineInfo="+ GsonUtil.toJsonString(onlineInfo));
//Environment.getExternalStorageDirectory().getPath()=/storage/emulated/0
//getFilesDir()=installPath=/data/user/0/com.srthinker.statinfo/files
//String installPath = getFilesDir() + "/" + "StatInfo.apk";
//boolean isCreate = FileUtil.createFile(getFilesDir() + "/update", "StatInfo.apk");
FileUtil.deleteFile(savePath+File.separator+"StatInfo.apk");
boolean isCreate = FileUtil.createFile( savePath+File.separator, "StatInfo.apk");
if (isCreate){
//installPath = getFilesDir()+"/update/StatInfo.apk";
installPath = savePath+File.separator+"StatInfo.apk";
DownloadViewModel downloadViewModel = new DownloadViewModel(this);
downloadViewModel.initData();
downloadViewModel.startDownload(onlineInfo.getDownloadUrl(),installPath);
downloadViewModel.setOnUpperDownloadCallback(this);
}
}
}
}
@Override
public void onProgress(String progress, String filePath) {
runOnUiThread(()->{
updatePassInfo(passAllEntities, type);
//Log.i(TAG, "onProgress: progress="+progress);
String desc = "下载更新中..."+progress;
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
});
}
@Override
public void onAllConnectStatus(boolean hasConnect, int type) {
/*HashMap<String, Boolean> devicesConnect = MyApplication.getInstance().devicesConnect;
if (type==ENTER_TYPE){
devicesConnect.put("enter_connect",hasConnect);
// SharedUtil.getInstance(this).writeShared("enter_connect",hasConnect);
}else if (type==LEAVE_TYPE){
// SharedUtil.getInstance(this).writeShared("leave_connect",hasConnect);
devicesConnect.put("leave_connect",hasConnect);
}*/
public void onResult(int downStatus, String filePath) {
runOnUiThread(()->{
if (downStatus == DOWN_START){
String desc = "准备下载更新";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
} else if (downStatus== DOWN_FINISH){
//安装更新
//Log.i(TAG, "onResult:进来多少次");
//showTips("更新版本,将进行安装");
String desc = "进行安装,请稍等";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
//Utils.installApp(getApplicationContext(),new File(installPath));
//有静默安装的话需要开新线程,不然前面的弹框不进行显示
ThreadPool.getInstance().getThreadPoolExecutor().execute(() -> {
boolean restricted = Utils.isRootPermissionRestricted();
if (!restricted){
Utils.clientInstall(installPath, MainActivity.this,".uis.MainActivity");
}else{
Utils.installApp(getApplicationContext(),new File(installPath));
}
runOnUiThread(()->{
if (mLoadDialog != null) {
mLoadDialog.dismissDialog();
mLoadDialog=null;
}
});
});
}else if (downStatus==DOWN_ERROR){
showTips("下载更新失败");
FileUtil.deleteFile(installPath);
}
});
}
private void updatePassInfo(List<PersonEntity> passEntities, int type) {
if (passEntities != null) {
Log.i(TAG, "updatePassInfo: 获取的总数="+passEntities.size());
}
//Log.i(TAG, "updatePassInfo: 进还是出="+type);
/*for (PersonEntity passEntity : passEntities) {
Log.i(TAG, "updatePassInfo: 获取到的name="+passEntity.getPerson_name());
}*/
if (type ==ENTER_TYPE){
if (passEntities != null) {
int size = passEntities.size();
if (size!=lastEnterSize){
/*//更新进出情况
//enterBeans = passEntities; 全局变量直接赋值会出现问题
enterBeans.clear();
enterBeans.addAll(passEntities);
enterAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> enterListNo = StatSize.filterList(passEntities);
lastEnterSize = enterListNo.size();
}else{
lastEnterSize = size;
if (enterAdapter != null) {
int size = passEntities.size();
if (enterBeans!=null&&size!=enterBeans.size()){
//更新进出情况
//enterBeans = passEntities; 全局变量直接赋值会出现问题
enterBeans.clear();
enterBeans.addAll(passEntities);
enterAdapter.setDataList(passEntities);
//更新人员情况(是否要根据名字去重)
if (NEED_NO_REPET) {
List<PersonEntity> enterListNo = StatSize.filterList(passEntities);
lastEnterSize = enterListNo.size();
}else{
lastEnterSize = size;
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);
//更新分组情况(是否要根据名字去重)
groupEnterHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
enterBeans.clear();
enterBeans.addAll(passEntities);
lastEnterSize = size;
//更新分组情况(是否要根据id去重)
groupEnterHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
/* Log.i(TAG, "updatePassInfo: enterBeans.size="+enterBeans.size());
Log.i(TAG, "updatePassInfo: adapter.size="+enterAdapter.getDataList().size());*/
}
}
}else if (type == LEAVE_TYPE){
//leaveBeans = passEntities;
if (passEntities != null) {
int size = passEntities.size();
//进出有变化时才更新
if (size!=lastLeaveSize){
/*leaveBeans.clear();
leaveBeans.addAll(passEntities);
//更新进出情况
leaveAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> leaveListNo = StatSize.filterList(passEntities);
lastLeaveSize = leaveListNo.size();
}else{
lastLeaveSize = size;
if (leaveAdapter != null) {
int size = passEntities.size();
//进出有变化时才更新
if (leaveBeans!=null&&size!=leaveBeans.size()){
leaveBeans.clear();
leaveBeans.addAll(passEntities);
//更新进出情况
leaveAdapter.setDataList(passEntities);
//更新人员情况(是否要根据名字去重)
if (NEED_NO_REPET) {
List<PersonEntity> leaveListNo = StatSize.filterList(passEntities);
lastLeaveSize = leaveListNo.size();
}else{
lastLeaveSize = size;
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);
//更新分组情况(是否要根据名字去重)
groupLeaveHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
leaveBeans.clear();
leaveBeans.addAll(passEntities);
lastLeaveSize = size;
//更新分组情况(是否要根据id去重)
groupLeaveHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
/*Log.i(TAG, "updatePassInfo: leaveBeans.size="+leaveBeans.size());
Log.i(TAG, "updatePassInfo: adapter.size="+leaveAdapter.getDataList().size());*/
}
}
......@@ -403,98 +534,108 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
}
//要更新演示页面的分组请求
//updateGroup();
showAdapter.setDataList(GroupConst.group2BeansConst);
groupSmallAdapter.setDataList(GroupConst.group2BeansConst);
}
@Override
public void checkResult(boolean needUpdate, boolean canInstall, UpdateInfo onlineInfo) {
if (needUpdate){
if (onlineInfo!=null){
Log.i(TAG, "checkResult: onlineInfo="+ GsonUtil.toJsonString(onlineInfo));
//Environment.getExternalStorageDirectory().getPath()=/storage/emulated/0
//getFilesDir()=installPath=/data/user/0/com.srthinker.statinfo/files
//String installPath = getFilesDir() + "/" + "StatInfo.apk";
//boolean isCreate = FileUtil.createFile(getFilesDir() + "/update", "StatInfo.apk");
FileUtil.deleteFile(savePath+ File.separator+"StatInfo.apk");
boolean isCreate = FileUtil.createFile( savePath+File.separator, "StatInfo.apk");
if (isCreate){
//installPath = getFilesDir()+"/update/StatInfo.apk";
installPath = savePath+File.separator+"StatInfo.apk";
DownloadViewModel downloadViewModel = new DownloadViewModel(this);
downloadViewModel.initData();
downloadViewModel.startDownload(onlineInfo.getDownloadUrl(),installPath);
downloadViewModel.setOnUpperDownloadCallback(this);
}
public void onQueryStatus(String desc, boolean status) {
runOnUiThread(()->{
if (!status){
showTips(desc);
}
});
}
}
@Override
public void onProgress(String progress, String filePath) {
runOnUiThread(()->{
//Log.i(TAG, "onProgress: progress="+progress);
String desc = "下载更新中..."+progress;
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
public void getTotalPerson(List<PersonEntity> personEntities,int type) {
Log.i(TAG, "getTotalPerson: 已获取总数:personEntities.size="+personEntities.size());
PersonMgr.getInstance().updatePersonThread(personEntities, () -> {
runOnUiThread(()->{
ClickUtil.enableClick(mBinding.btnGroupDetail);
});
Intent intent = new Intent(MainActivity.this, GroupActivity.class);
startActivity(intent);
});
}
@Override
public void onResult(int downStatus, String filePath) {
runOnUiThread(()->{
if (downStatus == DOWN_START){
String desc = "准备下载更新";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
} else if (downStatus== DOWN_FINISH){
//安装更新
//Log.i(TAG, "onResult:进来多少次");
//showTips("更新版本,将进行安装");
public void OnIPChange(String ipAddress, String networkType) {
Log.i(TAG, "OnIPChange: change==>");
runOnUiThread(() -> mBinding.tvDeviceDesc.setText(deviceDesc+ipAddress));
//questApi();
/*List<ConfigBean> enterConfigList = SharedUtil.getInstance(this).readSharedList(ENTER_TYPE, ConfigBean.class, "");
ApiQuest.startEnterApi(enterConfigList,this);
List<ConfigBean> leaveConfigList = SharedUtil.getInstance(this).readSharedList(LEAVE_TYPE, ConfigBean.class, "");
ApiQuest.startLeaveApi(leaveConfigList,this);*/
List<ConfigEntity> enterConfigList = ConfigHelper.getInstance().queryByType(ENTER_TYPE);
ApiQuest.getInstance().startApi(enterConfigList,ENTER_TYPE);
//ApiQuest.getInstance().setOnUpperDevicesCallback(this);
List<ConfigEntity> leaveConfigList = ConfigHelper.getInstance().queryByType(LEAVE_TYPE);
ApiQuest.getInstance().startApi(leaveConfigList,LEAVE_TYPE);
ApiQuest.getInstance().setOnUpperDevicesCallback(this);
}
String desc = "进行安装,请稍等";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
//Utils.installApp(getApplicationContext(),new File(installPath));
//有静默安装的话需要开新线程,不然前面的弹框不进行显示
ThreadPool.getInstance().getThreadPoolExecutor().execute(() -> {
boolean restricted = Utils.isRootPermissionRestricted();
if (!restricted){
Utils.clientInstall(installPath, MainActivity.this,".uis.MainActivity");
}else{
Utils.installApp(getApplicationContext(),new File(installPath));
}
runOnUiThread(()->{
if (mLoadDialog != null) {
mLoadDialog.dismissDialog();
mLoadDialog=null;
}
});
});
@Override
public void OnIPLost(String error) {
runOnUiThread(() -> mBinding.tvDeviceDesc.setText(deviceDesc+"网络未连接"));
ApiQuest.getInstance().stopApi();
//修改网络状态
List<ConfigEntity> configEntities = ConfigHelper.getInstance().queryAll();
for (ConfigEntity configEntity : configEntities) {
configEntity.setConnect(false);
//更新ip接口状态
ConfigHelper.getInstance().update(configEntity);
}
}
}else if (downStatus==DOWN_ERROR){
showTips("下载更新失败");
FileUtil.deleteFile(installPath);
}
});
@Override
public void onUpdateConfig(List<ConfigEntity> configList, int type) {
//配置改变,更新接口
//Log.i(TAG, "onUpdateConfig: config="+configBean.toString()+",type="+type);
/*if (type==ENTER_TYPE){
ApiQuest.getInstance().startEnterApi(configList);
}else if (type == LEAVE_TYPE){
ApiQuest.getInstance().startLeaveApi(configList);
}*/
/*for (ConfigEntity config : configList) {
Log.i(TAG, "onUpdateConfig: pass="+config.getPassword());
Log.i(TAG, "onUpdateConfig: ip="+config.getServerIp());
}*/
ApiQuest.getInstance().startApi(configList,type);
ApiQuest.getInstance().setOnUpperDevicesCallback(this);
}
public List<StatusInfoBean> statusInfoBeans = new ArrayList<>();
@Override
public void onDevicesPort(StatusInfoBean statusInfoBean) {
//Log.i(TAG, "onDevicesPort: statusInfoBean="+statusInfoBean.toString());
statusInfoBeans.add(0,statusInfoBean);
SharedUtil.getInstance(this).writeShared("statusInfoBeans",statusInfoBeans);
public void getAllPassInfo(List<PersonEntity> passAllEntities, int type) {
runOnUiThread(()->{
updatePassInfo(passAllEntities, type);
});
}
private void clearStatusInfoBeans(){
statusInfoBeans.clear();
SharedUtil.getInstance(this).writeShared("statusInfoBeans",statusInfoBeans);
@Override
public void onAllConnectStatus(boolean hasConnect, int type) {
/*Log.i(TAG, "onAllConnectStatus: 接收到的连接状态 hasConnect="+hasConnect);
runOnUiThread(()->{
if (type==ENTER_TYPE){
if (!hasConnect) {
mBinding.tvEnterError.setVisibility(View.VISIBLE);
}else{
mBinding.tvEnterError.setVisibility(View.GONE);
}
}else if (type == LEAVE_TYPE){
if (!hasConnect) {
mBinding.tvLeaveError.setVisibility(View.VISIBLE);
}else{
mBinding.tvLeaveError.setVisibility(View.GONE);
}
}
});*/
}
}
\ No newline at end of file
package com.srthinker.statinfo.uis;
import static com.srthinker.statinfo.constant.Const.DEVICE_TYPE;
import static com.srthinker.statinfo.constant.Const.SN_PATH;
import static com.srthinker.statinfo.constant.GroupConst.BUILD;
import static com.srthinker.statinfo.constant.GroupConst.BUILD_ID;
import static com.srthinker.statinfo.constant.GroupConst.OUTRIGGER;
import static com.srthinker.statinfo.constant.GroupConst.OUTRIGGER_ID;
import static com.srthinker.statinfo.constant.GroupConst.SUPERVISOR;
import static com.srthinker.statinfo.constant.GroupConst.SUPERVISOR_ID;
import static com.srthinker.statinfo.constant.GroupConst.WATERPROOF;
import static com.srthinker.statinfo.constant.GroupConst.WATERPROOF_ID;
import static com.srthinker.statinfo.constant.InOutType.ENTER_TYPE;
import static com.srthinker.statinfo.constant.InOutType.LEAVE_TYPE;
import static com.srthinker.statinfo.download.upper.DownStatus.DOWN_ERROR;
......@@ -17,46 +7,35 @@ import static com.srthinker.statinfo.download.upper.DownStatus.DOWN_FINISH;
import static com.srthinker.statinfo.download.upper.DownStatus.DOWN_START;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.srthinker.statinfo.R;
import com.srthinker.statinfo.adapter.EnterAdapter;
import com.srthinker.statinfo.adapter.GroupAdapter;
import com.srthinker.statinfo.adapter.LeaveAdapter;
import com.srthinker.statinfo.bean.GroupBean;
import com.srthinker.statinfo.bean.TimeBean;
import com.srthinker.statinfo.database.PersonMgr;
import com.srthinker.statinfo.adapter.GroupShowAdapter;
import com.srthinker.statinfo.bean.Group2Bean;
import com.srthinker.statinfo.bean.StatusInfoBean;
import com.srthinker.statinfo.constant.GroupConst;
import com.srthinker.statinfo.database.entity.ConfigEntity;
import com.srthinker.statinfo.database.entity.PersonEntity;
import com.srthinker.statinfo.database.helper.ConfigHelper;
import com.srthinker.statinfo.database.helper.PersonHelper;
import com.srthinker.statinfo.databinding.ActivityMainBinding;
import com.srthinker.statinfo.databinding.ActivityNewMainBinding;
import com.srthinker.statinfo.download.upper.DownloadViewModel;
import com.srthinker.statinfo.download.upper.UpperDownloadCallback;
import com.srthinker.statinfo.listener.ConfigCallback;
import com.srthinker.statinfo.listener.OnTimeUpdateListener;
import com.srthinker.statinfo.listener.QueryPersonCallback;
import com.srthinker.statinfo.listener.upper.UpperDevicesCallback;
import com.srthinker.statinfo.presenter.ApiManager;
import com.srthinker.statinfo.listener.upper.UpperDevicesPortCallback;
import com.srthinker.statinfo.presenter.ApiQuest;
import com.srthinker.statinfo.presenter.RealTimeClock;
import com.srthinker.statinfo.presenter.StatSize;
import com.srthinker.statinfo.uis.fragment.ConfigDlgFragment;
import com.srthinker.statinfo.uis.news.SettingActivity;
import com.srthinker.statinfo.update.MDownloadCallBack;
import com.srthinker.statinfo.update.UpdateInfo;
import com.srthinker.statinfo.util.common.ClickUtil;
import com.srthinker.statinfo.util.common.FileUtil;
import com.srthinker.statinfo.util.common.GsonUtil;
import com.srthinker.statinfo.util.common.PermissionUtil;
......@@ -71,113 +50,113 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
public class MainOldActivity extends BaseActivity implements OnTimeUpdateListener, MDownloadCallBack, UpperDownloadCallback, NetworkIPMonitor.OnIPChangeCallback, ConfigCallback, QueryPersonCallback, UpperDevicesCallback {
public class MainActivity1 extends BaseActivity implements NetworkIPMonitor.OnIPChangeCallback, UpperDevicesCallback, MDownloadCallBack, UpperDownloadCallback, UpperDevicesPortCallback {
private static final String TAG = "MainActivity";
private com.srthinker.statinfo.databinding.ActivityMainBinding mBinding;
private RealTimeClock mRealTimeClock;
private static final String TAG = "NewMainActivity";
private com.srthinker.statinfo.databinding.ActivityNewMainBinding mBinding;
private NetworkIPMonitor networkIPMonitor;
private float groupSize = 100;
private boolean isPermission;
private List<PersonEntity> enterBeans;
private List<PersonEntity> leaveBeans;
private EnterAdapter enterAdapter;
private LeaveAdapter leaveAdapter;
private NetworkIPMonitor networkIPMonitor;
private String installPath = "";
private LoadDialog mLoadDialog;
//private String savePath = "/sdcard/update/StatInfo.apk";
//getFilesDir() + "/update", "StatInfo.apk"
private String savePath = Environment.getExternalStorageDirectory().getPath() + "/update";
private String sessionId;
private ApiManager enterMgr;
private static ScheduledExecutorService executor;
private int lastEnterSize = 0;
private int lastLeaveSize = 0;
private int lastPresentSize = 0;
private String deviceSn;
private List<PersonEntity> mQueryPersonList;
private GroupAdapter groupAdapter;
private HashMap<Integer, Integer> groupEnterHashMap=null;
private HashMap<Integer, Integer> groupLeaveHashMap=null;
private HashMap<Integer,Integer> groupPresentHashMap=null;
private boolean isPermission;
public static boolean NEED_NO_REPET = true; //是否需要去重,false:不需要,true:需要
private int group;
private GroupShowAdapter showAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
mBinding = ActivityMainBinding.inflate(getLayoutInflater());
//setContentView(R.layout.activity_new_main);
mBinding = ActivityNewMainBinding.inflate(getLayoutInflater());
setContentView(mBinding.getRoot());
checkAllPermission();
initData();
initView();
checkAllPermission();
}
@SuppressLint("SdCardPath")
@Override
protected void initData() {
//获取Sn
deviceSn = FileUtil.readTextFromFile(SN_PATH);
networkIPMonitor = new NetworkIPMonitor(this);
enterBeans = new ArrayList<>();
leaveBeans = new ArrayList<>();
/*for (int i = 0; i < 12; i++) {
enterBeans.add(new PeopleBean("08:14","王大锤"));
}
for (int i = 0; i < 5; i++) {
leaveBeans.add(new PeopleBean("08:04","赵美丽"));
}*/
networkIPMonitor.startMonitoring();
networkIPMonitor.setOnIPChangeCallback(this);
enterBeans = new ArrayList<>();
leaveBeans = new ArrayList<>();
}
@SuppressLint("SetTextI18n")
@Override
protected void initView() {
initNumber();
updateTime();
initGroup();
initPeopleList();
//mLoadDialog = LoadDialog.getInstance(this);
mLoadDialog = new LoadDialog(this);
//Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this));
mBinding.tvDeviceDesc.setText(DEVICE_TYPE+" "+deviceSn+" V"+ Utils.getVersionName(this));
//getResp();
mBinding.tvEnterText.setOnClickListener(v->{
showConfigDialog(ENTER_TYPE);
});
mBinding.tvLeaveText.setOnClickListener(v->{
showConfigDialog(LEAVE_TYPE);
});
mBinding.btnGroupDetail.setOnClickListener(v->{
ApiQuest.getInstance().queryPersons(this);
ClickUtil.disableClick(mBinding.btnGroupDetail);
mBinding.tvSetting.setOnClickListener(v->{
Intent intent = new Intent(this, SettingActivity.class);
startActivity(intent);
});
mLoadDialog = new LoadDialog(this); //1.0.2版本把这个漏了
}
private void showConfigDialog(int type) {
ConfigDlgFragment configDlgFragment = ConfigDlgFragment.getInstance(type);
configDlgFragment.setUsername("admin");
configDlgFragment.setConfigCallback(this);
if (configDlgFragment.isResumed()){
return;
/*private void initGroup() {
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
*//*mBinding.ngvBuild.initItem("工地班组",build,groupSize);
mBinding.ngvWaterproof.initItem("防水班组",waterproof,groupSize);
mBinding.ngvOutrigger.initItem("外架班组",outrigger,groupSize);
mBinding.ngvSupervisor.initItem("监理单位",supervisor,groupSize);*//*
mBinding.ngvBuild.initItem("工地班组",build);
mBinding.ngvWaterproof.initItem("防水班组",waterproof);
mBinding.ngvOutrigger.initItem("外架班组",outrigger);
mBinding.ngvSupervisor.initItem("监理单位",supervisor);
}*/
private void initGroup(){
GridLayoutManager gLM = new GridLayoutManager(this, 4, RecyclerView.HORIZONTAL, false);
mBinding.rvGroupTotal.setLayoutManager(gLM);
showAdapter = new GroupShowAdapter(this, GroupConst.group2BeansConst);
mBinding.rvGroupTotal.setAdapter(showAdapter);
}
private void checkAllPermission() {
isPermission = PermissionUtil.checkMultiPermission(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET
}, 4096);
if (!isPermission){
Toast.makeText(this, "需要允许权限才能正常使用哦", Toast.LENGTH_SHORT).show();
}
configDlgFragment.showNow(getSupportFragmentManager(),configDlgFragment.getClass().getSimpleName());
configDlgFragment.setCancelable(false);
}
/*private void updateGroup() {
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
mBinding.ngvBuild.setNumber(build);
mBinding.ngvWaterproof.setNumber(waterproof);
mBinding.ngvOutrigger.setNumber(outrigger);
mBinding.ngvSupervisor.setNumber(supervisor);
}*/
@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "onResume: Main-Resume");
//如果设置页面有更新,主页面也需要进行访问接口,绑定监听
updateApi();
//获取最新的人员信息列表
mQueryPersonList = PersonHelper.getInstance().queryAll();
//更新分组情况
......@@ -187,242 +166,141 @@ public class MainOldActivity extends BaseActivity implements OnTimeUpdateListene
detectUpgrade(); //检测版本升级
}
@Override
protected void onDestroy() {
Log.i(TAG, "onDestroy: Main--destroy");
networkIPMonitor.stopMonitoring();
mRealTimeClock.stop();
//关闭循环拉取
//executor.shutdownNow();
/*if (enterMgr != null) {
enterMgr.stop();
}*/
ApiQuest.getInstance().stopApi();
super.onDestroy();
private void updateApi() {
boolean isModified = SharedUtil.getInstance(this).readShared("isModified", false);
if (isModified){
questApi();
SharedUtil.getInstance(this).writeShared("isModified",false);
}
}
private void detectUpgrade() {
/*NetworkViewModel networkViewModel = new NetworkViewModel();
networkViewModel.init(this,this);
networkViewModel.setDownloadCallback(this);
networkViewModel.getLastestVersion(deviceSn,DEVICE_TYPE);*/
}
private void checkAllPermission() {
isPermission = PermissionUtil.checkMultiPermission(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET
}, 4096);
if (!isPermission){
Toast.makeText(this, "需要允许权限才能正常使用哦", Toast.LENGTH_SHORT).show();
}
}
private void initNumber() {
mBinding.nvEnter.initItem(lastEnterSize,"进去人数", R.mipmap.enter_bg);
mBinding.nvLeave.initItem(lastLeaveSize,"离开人数", R.mipmap.leave_bg);
mBinding.nvPresent.initItem(lastPresentSize,"在场人数", R.mipmap.present_bg);
networkViewModel.getLastestVersion(DEVICE_SN,DEVICE_TYPE);*/
}
private void initPeopleList() {
LinearLayoutManager enterLLM = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
mBinding.rvEnterList.setLayoutManager(enterLLM);
enterAdapter = new EnterAdapter(this, enterBeans);
mBinding.rvEnterList.setAdapter(enterAdapter);
LinearLayoutManager leaveLLM = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
mBinding.rvLeaveList.setLayoutManager(leaveLLM);
leaveAdapter = new LeaveAdapter(this, leaveBeans);
mBinding.rvLeaveList.setAdapter(leaveAdapter);
}
private void initGroup() {
GridLayoutManager groupGLM = new GridLayoutManager(this, 4);
mBinding.rvGroup.setLayoutManager(groupGLM);
ArrayList<GroupBean> groupBeans = updateGroup();
groupAdapter = new GroupAdapter(this, groupBeans);
mBinding.rvGroup.setAdapter(groupAdapter);
/*mBinding.gvWaterproof.initItem("防水班组",34,R.color.color_2D52E3);
mBinding.gvOutrigger.initItem("外架班组",12,R.color.color_694BFF);
mBinding.gvBuild.initItem("工地班组",26,R.color.color_8A34D5);
mBinding.gvSupervisor.initItem("监理单位",28,R.color.color_00A89C);*/
}
private ArrayList<GroupBean> updateGroup() {
ArrayList<GroupBean> groupBeans = new ArrayList<>();
int waterproof = SharedUtil.getInstance(this).readShared(WATERPROOF, 0);
int outrigger = SharedUtil.getInstance(this).readShared(OUTRIGGER, 0);
int build = SharedUtil.getInstance(this).readShared(BUILD, 0);
int supervisor = SharedUtil.getInstance(this).readShared(SUPERVISOR, 0);
groupBeans.add(new GroupBean("防水班组",waterproof,R.color.color_2D52E3,WATERPROOF));
groupBeans.add(new GroupBean("外架班组",outrigger,R.color.color_694BFF,OUTRIGGER));
groupBeans.add(new GroupBean("工地班组",build,R.color.color_8A34D5,BUILD));
groupBeans.add(new GroupBean("监理单位",supervisor,R.color.color_00A89C,SUPERVISOR));
return groupBeans;
}
private void updateTime() {
mRealTimeClock = new RealTimeClock();
mRealTimeClock.setOnTimeUpdateListener(this);
mRealTimeClock.start();
@Override
protected void onDestroy() {
Log.i(TAG, "onDestroy: Main--destroy");
networkIPMonitor.stopMonitoring();
ApiQuest.getInstance().stopApi();
clearStatusInfoBeans();
super.onDestroy();
}
@SuppressLint("SetTextI18n")
@Override
public void OnTimeUpdate(TimeBean timeBean) {
if (timeBean != null) {
mBinding.tvTime.setText(timeBean.getyMD()+" "+timeBean.getWeek()+" "+timeBean.getHm());
}
public void OnIPChange(String ipAddress, String networkType) {
Log.i(TAG, "OnIPChange: change==>");
//questApi();
questApi();
}
private void questApi() {
List<ConfigEntity> enterConfigList = ConfigHelper.getInstance().queryByType(ENTER_TYPE);
ApiQuest.getInstance().startApi(enterConfigList,ENTER_TYPE);
List<ConfigEntity> leaveConfigList = ConfigHelper.getInstance().queryByType(LEAVE_TYPE);
ApiQuest.getInstance().startApi(leaveConfigList,LEAVE_TYPE);
ApiQuest.getInstance().setOnUpperDevicesCallback(this);
ApiQuest.getInstance().setOnUpperDevicesPortCallback(this);
}
@Override
public void checkResult(boolean needUpdate, boolean canInstall, UpdateInfo onlineInfo) {
if (needUpdate){
if (onlineInfo!=null){
Log.i(TAG, "checkResult: onlineInfo="+ GsonUtil.toJsonString(onlineInfo));
//Environment.getExternalStorageDirectory().getPath()=/storage/emulated/0
//getFilesDir()=installPath=/data/user/0/com.srthinker.statinfo/files
//String installPath = getFilesDir() + "/" + "StatInfo.apk";
//boolean isCreate = FileUtil.createFile(getFilesDir() + "/update", "StatInfo.apk");
FileUtil.deleteFile(savePath+File.separator+"StatInfo.apk");
boolean isCreate = FileUtil.createFile( savePath+File.separator, "StatInfo.apk");
if (isCreate){
//installPath = getFilesDir()+"/update/StatInfo.apk";
installPath = savePath+File.separator+"StatInfo.apk";
DownloadViewModel downloadViewModel = new DownloadViewModel(this);
downloadViewModel.initData();
downloadViewModel.startDownload(onlineInfo.getDownloadUrl(),installPath);
downloadViewModel.setOnUpperDownloadCallback(this);
}
}
public void OnIPLost(String error) {
ApiQuest.getInstance().stopApi();
//修改状态
List<ConfigEntity> configEntities = ConfigHelper.getInstance().queryAll();
for (ConfigEntity configEntity : configEntities) {
configEntity.setConnect(false);
//更新ip接口状态
ConfigHelper.getInstance().update(configEntity);
}
}
@Override
public void onProgress(String progress, String filePath) {
public void getAllPassInfo(List<PersonEntity> passAllEntities, int type) {
runOnUiThread(()->{
//Log.i(TAG, "onProgress: progress="+progress);
String desc = "下载更新中..."+progress;
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
updatePassInfo(passAllEntities, type);
});
}
@Override
public void onResult(int downStatus, String filePath) {
runOnUiThread(()->{
if (downStatus == DOWN_START){
String desc = "准备下载更新";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
} else if (downStatus== DOWN_FINISH){
//安装更新
//Log.i(TAG, "onResult:进来多少次");
//showTips("更新版本,将进行安装");
String desc = "进行安装,请稍等";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
//Utils.installApp(getApplicationContext(),new File(installPath));
//有静默安装的话需要开新线程,不然前面的弹框不进行显示
ThreadPool.getInstance().getThreadPoolExecutor().execute(() -> {
boolean restricted = Utils.isRootPermissionRestricted();
if (!restricted){
Utils.clientInstall(installPath, MainOldActivity.this,".uis.MainActivity");
}else{
Utils.installApp(getApplicationContext(),new File(installPath));
}
runOnUiThread(()->{
if (mLoadDialog != null) {
mLoadDialog.dismissDialog();
mLoadDialog=null;
}
});
});
}else if (downStatus==DOWN_ERROR){
showTips("下载更新失败");
FileUtil.deleteFile(installPath);
}
});
public void onAllConnectStatus(boolean hasConnect, int type) {
/*HashMap<String, Boolean> devicesConnect = MyApplication.getInstance().devicesConnect;
if (type==ENTER_TYPE){
devicesConnect.put("enter_connect",hasConnect);
// SharedUtil.getInstance(this).writeShared("enter_connect",hasConnect);
}else if (type==LEAVE_TYPE){
// SharedUtil.getInstance(this).writeShared("leave_connect",hasConnect);
devicesConnect.put("leave_connect",hasConnect);
}*/
}
private void updatePassInfo(List<PersonEntity> passEntities, int type) {
Log.i(TAG, "updatePassInfo: 获取的总数="+passEntities.size());
if (passEntities != null) {
Log.i(TAG, "updatePassInfo: 获取的总数="+passEntities.size());
}
//Log.i(TAG, "updatePassInfo: 进还是出="+type);
/*for (PersonEntity passEntity : passEntities) {
Log.i(TAG, "updatePassInfo: 获取到的name="+passEntity.getPerson_name());
}*/
if (type ==ENTER_TYPE){
if (passEntities != null) {
if (enterAdapter != null) {
int size = passEntities.size();
if (enterBeans!=null&&size!=enterBeans.size()){
//更新进出情况
//enterBeans = passEntities; 全局变量直接赋值会出现问题
enterBeans.clear();
enterBeans.addAll(passEntities);
enterAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> enterListNo = StatSize.filterList(passEntities);
lastEnterSize = enterListNo.size();
}else{
lastEnterSize = size;
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);
//更新分组情况(是否要根据id去重)
groupEnterHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
int size = passEntities.size();
if (size!=lastEnterSize){
/*//更新进出情况
//enterBeans = passEntities; 全局变量直接赋值会出现问题
enterBeans.clear();
enterBeans.addAll(passEntities);
enterAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> enterListNo = StatSize.filterList(passEntities);
lastEnterSize = enterListNo.size();
}else{
lastEnterSize = size;
}
/* Log.i(TAG, "updatePassInfo: enterBeans.size="+enterBeans.size());
Log.i(TAG, "updatePassInfo: adapter.size="+enterAdapter.getDataList().size());*/
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
enterBeans.clear();
enterBeans.addAll(passEntities);
lastEnterSize = size;
//更新分组情况(是否要根据id去重)
groupEnterHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
}
}else if (type == LEAVE_TYPE){
//leaveBeans = passEntities;
if (passEntities != null) {
if (leaveAdapter != null) {
int size = passEntities.size();
//进出有变化时才更新
if (leaveBeans!=null&&size!=leaveBeans.size()){
leaveBeans.clear();
leaveBeans.addAll(passEntities);
//更新进出情况
leaveAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> leaveListNo = StatSize.filterList(passEntities);
lastLeaveSize = leaveListNo.size();
}else{
lastLeaveSize = size;
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);
//更新分组情况(是否要根据id去重)
groupLeaveHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
int size = passEntities.size();
//进出有变化时才更新
if (size!=lastLeaveSize){
/*leaveBeans.clear();
leaveBeans.addAll(passEntities);
//更新进出情况
leaveAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> leaveListNo = StatSize.filterList(passEntities);
lastLeaveSize = leaveListNo.size();
}else{
lastLeaveSize = size;
}
/*Log.i(TAG, "updatePassInfo: leaveBeans.size="+leaveBeans.size());
Log.i(TAG, "updatePassInfo: adapter.size="+leaveAdapter.getDataList().size());*/
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
leaveBeans.clear();
leaveBeans.addAll(passEntities);
lastLeaveSize = size;
//更新分组情况(是否要根据id去重)
groupLeaveHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
}
......@@ -445,10 +323,13 @@ public class MainOldActivity extends BaseActivity implements OnTimeUpdateListene
}
for (PersonEntity personEntity : personEntityList) {
String personId = personEntity.getId();
String personName = personEntity.getPerson_name();
for (PersonEntity queryPerson : mQueryPersonList) {
String queryId = queryPerson.getId();
String queryName = queryPerson.getPerson_name();
int group = queryPerson.getGroup();
if (TextUtils.equals(personId,queryId)&& groupSizeHashMap.containsKey(group)){
//改成对比名字
if (TextUtils.equals(personName,queryName)&& groupSizeHashMap.containsKey(group)){
int totalSize = groupSizeHashMap.get(group);
groupSizeHashMap.put(group,totalSize+1);
}
......@@ -484,15 +365,25 @@ public class MainOldActivity extends BaseActivity implements OnTimeUpdateListene
}
}
//如果只有一个人,从一个组换到另一个组,之前的数据没有清空,需要先进行清空,置空为0
SharedUtil.getInstance(this).writeShared(WATERPROOF,0);
/*SharedUtil.getInstance(this).writeShared(WATERPROOF,0);
SharedUtil.getInstance(this).writeShared(OUTRIGGER,0);
SharedUtil.getInstance(this).writeShared(BUILD,0);
SharedUtil.getInstance(this).writeShared(SUPERVISOR,0);
SharedUtil.getInstance(this).writeShared(SUPERVISOR,0);*/
//清空
for (Group2Bean group2Bean : GroupConst.group2BeansConst) {
group2Bean.setNumber(0);
}
for (Map.Entry<Integer, Integer> presentEntry : groupPresentHashMap.entrySet()) {
int group = presentEntry.getKey();
int presentSize = presentEntry.getValue();
Log.i(TAG, "updatePresentSize: group="+group+",presentSize="+presentSize);
switch (group){
for (Group2Bean group2Bean : GroupConst.group2BeansConst) {
if (group2Bean.getGroup_id()==group){
group2Bean.setNumber(presentSize);
break;
}
}
/* switch (group){
case WATERPROOF_ID:
SharedUtil.getInstance(this).writeShared(WATERPROOF,presentSize);
break;
......@@ -505,104 +396,102 @@ public class MainOldActivity extends BaseActivity implements OnTimeUpdateListene
case SUPERVISOR_ID:
SharedUtil.getInstance(this).writeShared(SUPERVISOR,presentSize);
break;
}
}
ArrayList<GroupBean> groupBeans = updateGroup();
if (groupAdapter != null) {
groupAdapter.setDataList(groupBeans);
}*/
}
//要更新演示页面的分组请求
//updateGroup();
showAdapter.setDataList(GroupConst.group2BeansConst);
}
@Override
public void onQueryStatus(String desc, boolean status) {
runOnUiThread(()->{
if (!status){
showTips(desc);
public void checkResult(boolean needUpdate, boolean canInstall, UpdateInfo onlineInfo) {
if (needUpdate){
if (onlineInfo!=null){
Log.i(TAG, "checkResult: onlineInfo="+ GsonUtil.toJsonString(onlineInfo));
//Environment.getExternalStorageDirectory().getPath()=/storage/emulated/0
//getFilesDir()=installPath=/data/user/0/com.srthinker.statinfo/files
//String installPath = getFilesDir() + "/" + "StatInfo.apk";
//boolean isCreate = FileUtil.createFile(getFilesDir() + "/update", "StatInfo.apk");
FileUtil.deleteFile(savePath+ File.separator+"StatInfo.apk");
boolean isCreate = FileUtil.createFile( savePath+File.separator, "StatInfo.apk");
if (isCreate){
//installPath = getFilesDir()+"/update/StatInfo.apk";
installPath = savePath+File.separator+"StatInfo.apk";
DownloadViewModel downloadViewModel = new DownloadViewModel(this);
downloadViewModel.initData();
downloadViewModel.startDownload(onlineInfo.getDownloadUrl(),installPath);
downloadViewModel.setOnUpperDownloadCallback(this);
}
}
});
}
}
@Override
public void getTotalPerson(List<PersonEntity> personEntities,int type) {
Log.i(TAG, "getTotalPerson: 已获取总数:personEntities.size="+personEntities.size());
PersonMgr.getInstance().updatePersonThread(personEntities, () -> {
runOnUiThread(()->{
ClickUtil.enableClick(mBinding.btnGroupDetail);
});
Intent intent = new Intent(MainOldActivity.this, GroupActivity.class);
startActivity(intent);
});
}
@Override
public void OnIPChange(String ipAddress, String networkType) {
Log.i(TAG, "OnIPChange: change==>");
//questApi();
/*List<ConfigBean> enterConfigList = SharedUtil.getInstance(this).readSharedList(ENTER_TYPE, ConfigBean.class, "");
ApiQuest.startEnterApi(enterConfigList,this);
List<ConfigBean> leaveConfigList = SharedUtil.getInstance(this).readSharedList(LEAVE_TYPE, ConfigBean.class, "");
ApiQuest.startLeaveApi(leaveConfigList,this);*/
List<ConfigEntity> enterConfigList = ConfigHelper.getInstance().queryByType(ENTER_TYPE);
ApiQuest.getInstance().startApi(enterConfigList,ENTER_TYPE);
ApiQuest.getInstance().setOnUpperDevicesCallback(this);
List<ConfigEntity> leaveConfigList = ConfigHelper.getInstance().queryByType(LEAVE_TYPE);
ApiQuest.getInstance().startApi(leaveConfigList,LEAVE_TYPE);
ApiQuest.getInstance().setOnUpperDevicesCallback(this);
}
@Override
public void OnIPLost(String error) {
ApiQuest.getInstance().stopApi();
}
@Override
public void onUpdateConfig(List<ConfigEntity> configList, int type) {
//配置改变,更新接口
//Log.i(TAG, "onUpdateConfig: config="+configBean.toString()+",type="+type);
/*if (type==ENTER_TYPE){
ApiQuest.getInstance().startEnterApi(configList);
}else if (type == LEAVE_TYPE){
ApiQuest.getInstance().startLeaveApi(configList);
}*/
/*for (ConfigEntity config : configList) {
Log.i(TAG, "onUpdateConfig: pass="+config.getPassword());
Log.i(TAG, "onUpdateConfig: ip="+config.getServerIp());
}*/
ApiQuest.getInstance().startApi(configList,type);
ApiQuest.getInstance().setOnUpperDevicesCallback(this);
}
@Override
public void getAllPassInfo(List<PersonEntity> passAllEntities, int type) {
public void onProgress(String progress, String filePath) {
runOnUiThread(()->{
updatePassInfo(passAllEntities, type);
//Log.i(TAG, "onProgress: progress="+progress);
String desc = "下载更新中..."+progress;
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
});
}
@Override
public void onAllConnectStatus(boolean hasConnect, int type) {
Log.i(TAG, "onAllConnectStatus: 接收到的连接状态 hasConnect="+hasConnect);
public void onResult(int downStatus, String filePath) {
runOnUiThread(()->{
if (type==ENTER_TYPE){
if (!hasConnect) {
mBinding.tvEnterError.setVisibility(View.VISIBLE);
}else{
mBinding.tvEnterError.setVisibility(View.GONE);
if (downStatus == DOWN_START){
String desc = "准备下载更新";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
} else if (downStatus== DOWN_FINISH){
//安装更新
//Log.i(TAG, "onResult:进来多少次");
//showTips("更新版本,将进行安装");
}else if (type == LEAVE_TYPE){
if (!hasConnect) {
mBinding.tvLeaveError.setVisibility(View.VISIBLE);
}else{
mBinding.tvLeaveError.setVisibility(View.GONE);
String desc = "进行安装,请稍等";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.showDialog();
}
//Utils.installApp(getApplicationContext(),new File(installPath));
//有静默安装的话需要开新线程,不然前面的弹框不进行显示
ThreadPool.getInstance().getThreadPoolExecutor().execute(() -> {
boolean restricted = Utils.isRootPermissionRestricted();
if (!restricted){
Utils.clientInstall(installPath, MainActivity1.this,".uis.MainActivity");
}else{
Utils.installApp(getApplicationContext(),new File(installPath));
}
runOnUiThread(()->{
if (mLoadDialog != null) {
mLoadDialog.dismissDialog();
mLoadDialog=null;
}
});
});
}else if (downStatus==DOWN_ERROR){
showTips("下载更新失败");
FileUtil.deleteFile(installPath);
}
});
}
public List<StatusInfoBean> statusInfoBeans = new ArrayList<>();
@Override
public void onDevicesPort(StatusInfoBean statusInfoBean) {
//Log.i(TAG, "onDevicesPort: statusInfoBean="+statusInfoBean.toString());
statusInfoBeans.add(0,statusInfoBean);
SharedUtil.getInstance(this).writeShared("statusInfoBeans",statusInfoBeans);
}
private void clearStatusInfoBeans(){
statusInfoBeans.clear();
SharedUtil.getInstance(this).writeShared("statusInfoBeans",statusInfoBeans);
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@
android:focusableInTouchMode="true"
android:orientation="vertical"
android:background="@color/bg_070A2E"
tools:context=".uis.MainOldActivity">
tools:context=".uis.MainActivity">
<RelativeLayout
android:layout_width="939.59dp"
......@@ -109,8 +109,9 @@
android:id="@+id/rv_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginLeft="10dp"/>
android:layout_gravity="center"
android:layout_marginTop="15dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="653dp"
......@@ -195,7 +196,7 @@
android:textSize="@dimen/text_10"
android:layout_toRightOf="@+id/tv_enter_text"
android:layout_alignBottom="@+id/tv_enter_text"
android:visibility="visible"
android:visibility="invisible"
android:layout_marginLeft="5dp"/>
<TextView
android:id="@+id/tv_leave_text"
......@@ -216,7 +217,7 @@
android:textSize="@dimen/text_10"
android:layout_toLeftOf="@+id/tv_leave_text"
android:layout_alignBottom="@+id/tv_leave_text"
android:visibility="visible"
android:visibility="invisible"
android:layout_marginRight="5dp"/>
<LinearLayout
android:layout_width="match_parent"
......@@ -245,5 +246,6 @@
android:layout_height="wrap_content"
android:gravity="left|center"
android:textColor="@color/white"
android:layout_marginLeft="15dp"
android:textSize="@dimen/text_10"/>
</LinearLayout>
\ No newline at end of file
......@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".uis.MainActivity">
tools:context=".uis.MainActivity1">
<TextView
android:id="@+id/tv_setting"
android:layout_width="wrap_content"
......
......@@ -7,7 +7,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_marginBottom="32dp"
android:layout_marginBottom="22dp"
android:background="@color/color_2D52E3">
<TextView
android:id="@+id/tv_title"
......@@ -66,6 +66,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp"
android:gravity="center">
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
......
......@@ -11,5 +11,7 @@
<dimen name="text_15">15sp</dimen>
<dimen name="text_11">11sp</dimen>
<dimen name="dlg_margin">10dp</dimen>
<dimen name="display_text">77sp</dimen> //一列:95sp
<dimen name="display_text">77sp</dimen>
<dimen name="text_30">30sp</dimen>
//一列:95sp
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment