Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StatInfo_1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenyuling
StatInfo_1
Commits
d2ea35d7
Commit
d2ea35d7
authored
Sep 26, 2023
by
chenyuling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"更换UI-1"
parent
1212e6be
Pipeline
#1621
canceled with stages
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1185 additions
and
0 deletions
+1185
-0
MainActivity.java
...rc/main/java/com/srthinker/statinfo/uis/MainActivity.java
+451
-0
SettingActivity.java
...java/com/srthinker/statinfo/uis/news/SettingActivity.java
+471
-0
NewGroupView.java
...main/java/com/srthinker/statinfo/wedget/NewGroupView.java
+50
-0
activity_new_main.xml
app/src/main/res/layout/activity_new_main.xml
+41
-0
activity_setting.xml
app/src/main/res/layout/activity_setting.xml
+148
-0
item_group_new.xml
app/src/main/res/layout/item_group_new.xml
+24
-0
No files found.
app/src/main/java/com/srthinker/statinfo/uis/MainActivity.java
0 → 100644
View file @
d2ea35d7
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
.
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
;
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.content.Intent
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
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.download.upper.DownloadViewModel
;
import
com.srthinker.statinfo.download.upper.UpperDownloadCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesCallback
;
import
com.srthinker.statinfo.presenter.ApiQuest
;
import
com.srthinker.statinfo.presenter.StatSize
;
import
com.srthinker.statinfo.uis.news.SettingActivity
;
import
com.srthinker.statinfo.update.MDownloadCallBack
;
import
com.srthinker.statinfo.update.NetworkViewModel
;
import
com.srthinker.statinfo.update.UpdateInfo
;
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
;
import
com.srthinker.statinfo.wedget.LoadDialog
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
MainActivity
extends
BaseActivity
implements
NetworkIPMonitor
.
OnIPChangeCallback
,
UpperDevicesCallback
,
MDownloadCallBack
,
UpperDownloadCallback
{
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
String
installPath
=
""
;
private
LoadDialog
mLoadDialog
;
//private String savePath = "/sdcard/update/StatInfo.apk";
//getFilesDir() + "/update", "StatInfo.apk"
private
String
savePath
=
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/update"
;
private
int
lastEnterSize
=
0
;
private
int
lastLeaveSize
=
0
;
private
int
lastPresentSize
=
0
;
private
List
<
PersonEntity
>
mQueryPersonList
;
private
HashMap
<
Integer
,
Integer
>
groupEnterHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupPresentHashMap
=
null
;
public
static
boolean
NEED_NO_REPET
=
true
;
//是否需要去重,false:不需要,true:需要
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
//setContentView(R.layout.activity_new_main);
mBinding
=
ActivityNewMainBinding
.
inflate
(
getLayoutInflater
());
setContentView
(
mBinding
.
getRoot
());
checkAllPermission
();
initData
();
initView
();
}
@Override
protected
void
initData
()
{
networkIPMonitor
=
new
NetworkIPMonitor
(
this
);
networkIPMonitor
.
startMonitoring
();
networkIPMonitor
.
setOnIPChangeCallback
(
this
);
enterBeans
=
new
ArrayList
<>();
leaveBeans
=
new
ArrayList
<>();
}
@Override
protected
void
initView
()
{
initGroup
();
mBinding
.
tvSetting
.
setOnClickListener
(
v
->{
Intent
intent
=
new
Intent
(
this
,
SettingActivity
.
class
);
startActivity
(
intent
);
});
}
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
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
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
();
//更新分组情况
groupEnterHashMap
=
getGroupSizeHashMap
(
enterBeans
);
groupLeaveHashMap
=
getGroupSizeHashMap
(
leaveBeans
);
updatePresentSize
(
groupEnterHashMap
,
groupLeaveHashMap
);
detectUpgrade
();
//检测版本升级
}
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
(
DEVICE_SN
,
DEVICE_TYPE
);
}
@Override
protected
void
onDestroy
()
{
Log
.
i
(
TAG
,
"onDestroy: Main--destroy"
);
networkIPMonitor
.
stopMonitoring
();
ApiQuest
.
getInstance
().
stopApi
();
super
.
onDestroy
();
}
@Override
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
);
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
getAllPassInfo
(
List
<
PersonEntity
>
passAllEntities
,
int
type
)
{
runOnUiThread
(()->{
updatePassInfo
(
passAllEntities
,
type
);
});
}
@Override
public
void
onAllConnectStatus
(
boolean
hasConnect
,
int
type
)
{
if
(
type
==
ENTER_TYPE
){
SharedUtil
.
getInstance
(
this
).
writeShared
(
"enter_connect"
,
hasConnect
);
}
else
if
(
type
==
LEAVE_TYPE
){
SharedUtil
.
getInstance
(
this
).
writeShared
(
"leave_connect"
,
hasConnect
);
}
}
private
void
updatePassInfo
(
List
<
PersonEntity
>
passEntities
,
int
type
)
{
Log
.
i
(
TAG
,
"updatePassInfo: 获取的总数="
+
passEntities
.
size
());
/*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;
}
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
)
{
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;
}
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
);
}
}
}
}
@NonNull
private
HashMap
<
Integer
,
Integer
>
getGroupSizeHashMap
(
List
<
PersonEntity
>
personEntityList
)
{
HashMap
<
Integer
,
Integer
>
groupSizeHashMap
=
new
HashMap
<>();
if
(
NEED_NO_REPET
)
{
personEntityList
=
StatSize
.
filterList
(
personEntityList
);
}
if
(
mQueryPersonList
!=
null
)
{
for
(
PersonEntity
entity
:
mQueryPersonList
)
{
int
group
=
entity
.
getGroup
();
if
(!
groupSizeHashMap
.
containsKey
(
group
)){
groupSizeHashMap
.
put
(
group
,
0
);
}
}
for
(
PersonEntity
personEntity
:
personEntityList
)
{
String
personId
=
personEntity
.
getId
();
for
(
PersonEntity
queryPerson
:
mQueryPersonList
)
{
String
queryId
=
queryPerson
.
getId
();
int
group
=
queryPerson
.
getGroup
();
if
(
TextUtils
.
equals
(
personId
,
queryId
)&&
groupSizeHashMap
.
containsKey
(
group
)){
int
totalSize
=
groupSizeHashMap
.
get
(
group
);
groupSizeHashMap
.
put
(
group
,
totalSize
+
1
);
}
}
}
}
return
groupSizeHashMap
;
}
private
void
updatePresentSize
(
HashMap
<
Integer
,
Integer
>
groupEnterHashMap
,
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
){
groupPresentHashMap
=
new
HashMap
<>();
if
(
mQueryPersonList
!=
null
)
{
for
(
PersonEntity
entity
:
mQueryPersonList
)
{
int
group
=
entity
.
getGroup
();
if
(!
groupPresentHashMap
.
containsKey
(
group
))
{
groupPresentHashMap
.
put
(
group
,
0
);
}
}
}
//更新分组情况
if
(
groupEnterHashMap
!=
null
)
{
for
(
Map
.
Entry
<
Integer
,
Integer
>
enterEntry
:
groupEnterHashMap
.
entrySet
())
{
int
group
=
enterEntry
.
getKey
();
int
enterSize
=
enterEntry
.
getValue
();
groupPresentHashMap
.
put
(
group
,
enterSize
);
}
}
if
(
groupLeaveHashMap
!=
null
)
{
for
(
Map
.
Entry
<
Integer
,
Integer
>
leaveEntry
:
groupLeaveHashMap
.
entrySet
())
{
int
group
=
leaveEntry
.
getKey
();
int
leaveSize
=
leaveEntry
.
getValue
();
groupPresentHashMap
.
put
(
group
,
groupPresentHashMap
.
get
(
group
)-
leaveSize
);
}
}
//如果只有一个人,从一个组换到另一个组,之前的数据没有清空,需要先进行清空,置空为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
);
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
){
case
WATERPROOF_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
WATERPROOF
,
presentSize
);
break
;
case
OUTRIGGER_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
OUTRIGGER
,
presentSize
);
break
;
case
BUILD_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
BUILD
,
presentSize
);
break
;
case
SUPERVISOR_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
SUPERVISOR
,
presentSize
);
break
;
}
}
//要更新演示页面的分组请求
updateGroup
();
}
@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
);
}
}
}
}
@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
();
}
});
}
@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
,
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
);
}
});
}
}
\ No newline at end of file
app/src/main/java/com/srthinker/statinfo/uis/news/SettingActivity.java
0 → 100644
View file @
d2ea35d7
package
com
.
srthinker
.
statinfo
.
uis
.
news
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
Const
.
DEVICE_SN
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
Const
.
DEVICE_TYPE
;
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
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
androidx.annotation.NonNull
;
import
com.srthinker.statinfo.database.PersonMgr
;
import
com.srthinker.statinfo.database.entity.ConfigEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.databinding.ActivitySettingBinding
;
import
com.srthinker.statinfo.listener.ConfigCallback
;
import
com.srthinker.statinfo.listener.QueryPersonCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesCallback
;
import
com.srthinker.statinfo.presenter.ApiQuest
;
import
com.srthinker.statinfo.presenter.StatSize
;
import
com.srthinker.statinfo.uis.BaseActivity
;
import
com.srthinker.statinfo.uis.GroupActivity
;
import
com.srthinker.statinfo.uis.fragment.ConfigDlgFragment
;
import
com.srthinker.statinfo.util.common.ClickUtil
;
import
com.srthinker.statinfo.util.common.SharedUtil
;
import
com.srthinker.statinfo.util.common.Utils
;
import
com.srthinker.statinfo.util.other.NetworkIPMonitor
;
import
com.srthinker.statinfo.wedget.LoadDialog
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
SettingActivity
extends
BaseActivity
implements
ConfigCallback
,
QueryPersonCallback
,
UpperDevicesCallback
{
private
static
final
String
TAG
=
"SettingActivity"
;
private
com
.
srthinker
.
statinfo
.
databinding
.
ActivitySettingBinding
mBinding
;
private
List
<
PersonEntity
>
enterBeans
;
private
List
<
PersonEntity
>
leaveBeans
;
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
int
lastEnterSize
=
0
;
private
int
lastLeaveSize
=
0
;
private
int
lastPresentSize
=
0
;
private
List
<
PersonEntity
>
mQueryPersonList
;
private
HashMap
<
Integer
,
Integer
>
groupEnterHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupPresentHashMap
=
null
;
public
static
boolean
NEED_NO_REPET
=
true
;
//是否需要去重,false:不需要,true:需要
private
boolean
leave_connect
;
private
boolean
enter_connect
;
private
boolean
isModified
=
false
;
// 设置标志位表示有进行了修改
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
//setContentView(R.layout.activity_setting);
mBinding
=
ActivitySettingBinding
.
inflate
(
getLayoutInflater
());
setContentView
(
mBinding
.
getRoot
());
initData
();
initView
();
}
@Override
protected
void
initData
()
{
Log
.
i
(
TAG
,
"initData: Setting-init"
);
SharedUtil
.
getInstance
(
this
).
writeShared
(
"isModified"
,
isModified
);
/*networkIPMonitor = new NetworkIPMonitor(this);
enterBeans = new ArrayList<>();
leaveBeans = new ArrayList<>();
networkIPMonitor.startMonitoring();
networkIPMonitor.setOnIPChangeCallback(this);*/
}
@Override
protected
void
initView
()
{
//mLoadDialog = LoadDialog.getInstance(this);
mLoadDialog
=
new
LoadDialog
(
this
);
//Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this));
mBinding
.
tvDeviceDesc
.
setText
(
DEVICE_TYPE
+
" "
+
DEVICE_SN
+
" V"
+
Utils
.
getVersionName
(
this
));
//getResp();
mBinding
.
tvEnterText
.
setOnClickListener
(
v
->{
showConfigDialog
(
ENTER_TYPE
);
});
mBinding
.
tvLeaveText
.
setOnClickListener
(
v
->{
showConfigDialog
(
LEAVE_TYPE
);
});
mBinding
.
btnGroupDetail
.
setOnClickListener
(
v
->{
boolean
isQueryPersons
=
ApiQuest
.
getInstance
().
queryPersons
(
this
);
//Log.i(TAG, "initView: isQueryPersons="+isQueryPersons);
if
(!
isQueryPersons
)
{
showTips
(
"请先配置设备信息"
);
}
else
{
ClickUtil
.
disableClick
(
mBinding
.
btnGroupDetail
);
}
});
mBinding
.
ivBack
.
setOnClickListener
(
v
->{
onBackPressed
();
});
}
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
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
updateDeviceConnect
();
/*//获取最新的人员信息列表
mQueryPersonList = PersonHelper.getInstance().queryAll();
//更新分组情况
groupEnterHashMap = getGroupSizeHashMap(enterBeans);
groupLeaveHashMap = getGroupSizeHashMap(leaveBeans);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);*/
// detectUpgrade(); //检测版本升级
}
private
void
updateDeviceConnect
()
{
enter_connect
=
SharedUtil
.
getInstance
(
this
).
readShared
(
"enter_connect"
,
false
);
leave_connect
=
SharedUtil
.
getInstance
(
this
).
readShared
(
"leave_connect"
,
false
);
if
(
enter_connect
){
mBinding
.
tvEnterError
.
setVisibility
(
View
.
GONE
);
}
else
{
mBinding
.
tvEnterError
.
setVisibility
(
View
.
VISIBLE
);
}
if
(
leave_connect
){
mBinding
.
tvLeaveError
.
setVisibility
(
View
.
GONE
);
}
else
{
mBinding
.
tvLeaveError
.
setVisibility
(
View
.
VISIBLE
);
}
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
}
/* @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);
}
}
}
}
@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();
}
});
}
@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, SettingActivity.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
)
{
Log
.
i
(
TAG
,
"updatePassInfo: 获取的总数="
+
passEntities
.
size
());
/*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;
}
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
)
{
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;
}
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
);
}
}
}
}
@NonNull
private
HashMap
<
Integer
,
Integer
>
getGroupSizeHashMap
(
List
<
PersonEntity
>
personEntityList
)
{
HashMap
<
Integer
,
Integer
>
groupSizeHashMap
=
new
HashMap
<>();
if
(
NEED_NO_REPET
)
{
personEntityList
=
StatSize
.
filterList
(
personEntityList
);
}
if
(
mQueryPersonList
!=
null
)
{
for
(
PersonEntity
entity
:
mQueryPersonList
)
{
int
group
=
entity
.
getGroup
();
if
(!
groupSizeHashMap
.
containsKey
(
group
)){
groupSizeHashMap
.
put
(
group
,
0
);
}
}
for
(
PersonEntity
personEntity
:
personEntityList
)
{
String
personId
=
personEntity
.
getId
();
for
(
PersonEntity
queryPerson
:
mQueryPersonList
)
{
String
queryId
=
queryPerson
.
getId
();
int
group
=
queryPerson
.
getGroup
();
if
(
TextUtils
.
equals
(
personId
,
queryId
)&&
groupSizeHashMap
.
containsKey
(
group
)){
int
totalSize
=
groupSizeHashMap
.
get
(
group
);
groupSizeHashMap
.
put
(
group
,
totalSize
+
1
);
}
}
}
}
return
groupSizeHashMap
;
}
private
void
updatePresentSize
(
HashMap
<
Integer
,
Integer
>
groupEnterHashMap
,
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
){
groupPresentHashMap
=
new
HashMap
<>();
if
(
mQueryPersonList
!=
null
)
{
for
(
PersonEntity
entity
:
mQueryPersonList
)
{
int
group
=
entity
.
getGroup
();
if
(!
groupPresentHashMap
.
containsKey
(
group
))
{
groupPresentHashMap
.
put
(
group
,
0
);
}
}
}
//更新分组情况
if
(
groupEnterHashMap
!=
null
)
{
for
(
Map
.
Entry
<
Integer
,
Integer
>
enterEntry
:
groupEnterHashMap
.
entrySet
())
{
int
group
=
enterEntry
.
getKey
();
int
enterSize
=
enterEntry
.
getValue
();
groupPresentHashMap
.
put
(
group
,
enterSize
);
}
}
if
(
groupLeaveHashMap
!=
null
)
{
for
(
Map
.
Entry
<
Integer
,
Integer
>
leaveEntry
:
groupLeaveHashMap
.
entrySet
())
{
int
group
=
leaveEntry
.
getKey
();
int
leaveSize
=
leaveEntry
.
getValue
();
groupPresentHashMap
.
put
(
group
,
groupPresentHashMap
.
get
(
group
)-
leaveSize
);
}
}
//如果只有一个人,从一个组换到另一个组,之前的数据没有清空,需要先进行清空,置空为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
);
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
){
case
WATERPROOF_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
WATERPROOF
,
presentSize
);
break
;
case
OUTRIGGER_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
OUTRIGGER
,
presentSize
);
break
;
case
BUILD_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
BUILD
,
presentSize
);
break
;
case
SUPERVISOR_ID:
SharedUtil
.
getInstance
(
this
).
writeShared
(
SUPERVISOR
,
presentSize
);
break
;
}
}
//要更新演示页面的分组请求
/*ArrayList<GroupBean> groupBeans = updateGroup();
if (groupAdapter != null) {
groupAdapter.setDataList(groupBeans);
}*/
}
@Override
public
void
onQueryStatus
(
String
desc
,
boolean
status
)
{
runOnUiThread
(()->{
if
(!
status
){
showTips
(
desc
);
}
});
}
@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
(
SettingActivity
.
this
,
GroupActivity
.
class
);
startActivity
(
intent
);
});
}
@Override
public
void
onUpdateConfig
(
List
<
ConfigEntity
>
configList
,
int
type
)
{
//配置改变,更新接口
ApiQuest
.
getInstance
().
startApi
(
configList
,
type
);
ApiQuest
.
getInstance
().
setOnUpperDevicesCallback
(
this
);
//表示更新了配置
isModified
=
true
;
SharedUtil
.
getInstance
(
this
).
writeShared
(
"isModified"
,
isModified
);
}
@Override
public
void
getAllPassInfo
(
List
<
PersonEntity
>
passAllEntities
,
int
type
)
{
/* runOnUiThread(()->{
updatePassInfo(passAllEntities, type);
});*/
}
@Override
public
void
onAllConnectStatus
(
boolean
hasConnect
,
int
type
)
{
Log
.
i
(
TAG
,
"onAllConnectStatus: 接收到的连接状态 hasConnect="
+
hasConnect
);
Log
.
i
(
TAG
,
"onAllConnectStatus: type="
+
type
);
runOnUiThread
(()->{
if
(
type
==
ENTER_TYPE
){
SharedUtil
.
getInstance
(
this
).
writeShared
(
"enter_connect"
,
hasConnect
);
if
(!
hasConnect
)
{
mBinding
.
tvEnterError
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
mBinding
.
tvEnterError
.
setVisibility
(
View
.
GONE
);
}
}
else
if
(
type
==
LEAVE_TYPE
){
SharedUtil
.
getInstance
(
this
).
writeShared
(
"leave_connect"
,
hasConnect
);
if
(!
hasConnect
)
{
mBinding
.
tvLeaveError
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
mBinding
.
tvLeaveError
.
setVisibility
(
View
.
GONE
);
}
}
});
}
}
\ No newline at end of file
app/src/main/java/com/srthinker/statinfo/wedget/NewGroupView.java
0 → 100644
View file @
d2ea35d7
package
com
.
srthinker
.
statinfo
.
wedget
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.util.TypedValue
;
import
android.view.LayoutInflater
;
import
android.widget.LinearLayout
;
import
androidx.annotation.Nullable
;
import
com.srthinker.statinfo.databinding.ItemGroupNewBinding
;
public
class
NewGroupView
extends
LinearLayout
{
private
Context
context
;
private
com
.
srthinker
.
statinfo
.
databinding
.
ItemGroupNewBinding
mBinding
;
public
NewGroupView
(
Context
context
)
{
super
(
context
);
}
public
NewGroupView
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
this
.
context
=
context
;
initView
(
context
);
}
private
void
initView
(
Context
context
)
{
mBinding
=
ItemGroupNewBinding
.
inflate
(
LayoutInflater
.
from
(
context
),
this
,
true
);
}
@SuppressLint
(
"SetTextI18n"
)
public
void
initItem
(
String
name
,
int
number
,
float
textSize
){
mBinding
.
tvGroupName
.
setText
(
name
+
":"
);
mBinding
.
tvGroupNumber
.
setText
(
number
+
""
);
mBinding
.
tvGroupName
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
mBinding
.
tvGroupNumber
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
}
public
void
initItem
(
String
name
,
int
number
){
mBinding
.
tvGroupName
.
setText
(
name
+
":"
);
mBinding
.
tvGroupNumber
.
setText
(
number
+
""
);
}
public
void
setNumber
(
int
number
){
mBinding
.
tvGroupNumber
.
setText
(
number
+
""
);
}
}
app/src/main/res/layout/activity_new_main.xml
0 → 100644
View file @
d2ea35d7
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/black"
tools:context=
".uis.MainActivity"
>
<TextView
android:id=
"@+id/tv_setting"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" "
android:textColor=
"@color/white"
android:textSize=
"40sp"
android:layout_alignParentRight=
"true"
/>
<LinearLayout
android:orientation=
"vertical"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"20dp"
android:layout_centerVertical=
"true"
>
<com.srthinker.statinfo.wedget.NewGroupView
android:id=
"@+id/ngv_build"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.srthinker.statinfo.wedget.NewGroupView
android:id=
"@+id/ngv_waterproof"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.srthinker.statinfo.wedget.NewGroupView
android:id=
"@+id/ngv_outrigger"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.srthinker.statinfo.wedget.NewGroupView
android:id=
"@+id/ngv_supervisor"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/activity_setting.xml
0 → 100644
View file @
d2ea35d7
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:orientation=
"vertical"
android:background=
"@color/bg_070A2E"
tools:context=
".uis.news.SettingActivity"
>
<ImageView
android:id=
"@+id/iv_back"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/ic_back"
android:padding=
"10dp"
/>
<LinearLayout
android:layout_width=
"255.5dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_shape"
android:layout_marginLeft=
"15dp"
android:padding=
"15dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:text=
"进出配置"
android:textSize=
"@dimen/text_10"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/line_bottom"
android:layout_marginTop=
"5dp"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"17dp"
>
<TextView
android:id=
"@+id/tv_enter_text"
android:layout_width=
"60dp"
android:layout_height=
"22dp"
android:gravity=
"center"
android:text=
"进入设备"
android:textColor=
"@color/white"
android:textSize=
"@dimen/text_10"
android:background=
"@color/color_00A89C"
android:layout_alignParentLeft=
"true"
/>
<TextView
android:id=
"@+id/tv_enter_error"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"!"
android:textColor=
"@color/white"
android:textSize=
"@dimen/text_12_5"
android:layout_toRightOf=
"@+id/tv_enter_text"
android:layout_alignBottom=
"@+id/tv_enter_text"
android:visibility=
"visible"
android:layout_marginLeft=
"5dp"
/>
<TextView
android:id=
"@+id/tv_leave_text"
android:layout_width=
"60dp"
android:layout_height=
"22dp"
android:gravity=
"center"
android:text=
"出口设备"
android:textColor=
"@color/white"
android:textSize=
"@dimen/text_10"
android:background=
"@color/color_2D52E3"
android:layout_alignParentRight=
"true"
/>
<TextView
android:id=
"@+id/tv_leave_error"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"!"
android:textColor=
"@color/white"
android:textSize=
"@dimen/text_12_5"
android:layout_toLeftOf=
"@+id/tv_leave_text"
android:layout_alignBottom=
"@+id/tv_leave_text"
android:visibility=
"visible"
android:layout_marginRight=
"5dp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"255.5dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_shape"
android:layout_marginLeft=
"15dp"
android:padding=
"15dp"
android:layout_marginTop=
"15dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:text=
"人员信息"
android:textSize=
"@dimen/text_10"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/line_bottom"
android:layout_marginTop=
"5dp"
/>
<Button
android:id=
"@+id/btn_group_detail"
android:layout_width=
"60dp"
android:layout_height=
"22dp"
android:background=
"@color/color_2D52E3"
android:layout_alignParentRight=
"true"
android:layout_marginRight=
"8dp"
android:layout_marginTop=
"17dp"
android:gravity=
"center"
android:text=
"人员详情"
android:textColor=
"@color/white"
android:textSize=
"@dimen/text_10"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"255.5dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_shape"
android:layout_marginLeft=
"15dp"
android:padding=
"15dp"
android:layout_marginTop=
"15dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:text=
"设备信息"
android:textSize=
"@dimen/text_10"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/line_bottom"
android:layout_marginTop=
"5dp"
/>
<TextView
android:id=
"@+id/tv_device_desc"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"left|center"
android:layout_marginTop=
"17dp"
android:textColor=
"@color/white"
android:textSize=
"@dimen/text_10"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/item_group_new.xml
0 → 100644
View file @
d2ea35d7
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_group_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textStyle=
"bold"
android:text=
""
android:textColor=
"@color/red"
android:gravity=
"center|left"
android:textSize=
"@dimen/display_text"
/>
<TextView
android:id=
"@+id/tv_group_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textStyle=
"bold"
android:text=
""
android:textColor=
"@color/red"
android:gravity=
"center|left"
android:textSize=
"@dimen/display_text"
/>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment