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
8e25ba8f
Commit
8e25ba8f
authored
Oct 30, 2023
by
chenyuling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"将比对id改成转化为名字"
parent
9931be08
Pipeline
#1848
canceled with stages
Changes
17
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
455 additions
and
299 deletions
+455
-299
DePortStatusAdapter.java
...a/com/srthinker/statinfo/adapter/DePortStatusAdapter.java
+62
-0
StatusInfoBean.java
...main/java/com/srthinker/statinfo/bean/StatusInfoBean.java
+71
-0
PersonMgr.java
.../main/java/com/srthinker/statinfo/database/PersonMgr.java
+26
-6
DevicePortCallback.java
...a/com/srthinker/statinfo/listener/DevicePortCallback.java
+5
-0
UpperDevicesPortCallback.java
...ker/statinfo/listener/upper/UpperDevicesPortCallback.java
+7
-0
ApiManager.java
...ain/java/com/srthinker/statinfo/presenter/ApiManager.java
+26
-2
ApiQuest.java
.../main/java/com/srthinker/statinfo/presenter/ApiQuest.java
+22
-1
StatSize.java
.../main/java/com/srthinker/statinfo/presenter/StatSize.java
+2
-2
MainActivity.java
...rc/main/java/com/srthinker/statinfo/uis/MainActivity.java
+35
-7
MyApplication.java
...c/main/java/com/srthinker/statinfo/uis/MyApplication.java
+0
-1
ConfigDlgFragment.java
...om/srthinker/statinfo/uis/fragment/ConfigDlgFragment.java
+1
-1
DePortStatusDlgFragment.java
.../srthinker/statinfo/uis/news/DePortStatusDlgFragment.java
+106
-0
SettingActivity.java
...java/com/srthinker/statinfo/uis/news/SettingActivity.java
+44
-275
EditView.java
...src/main/java/com/srthinker/statinfo/wedget/EditView.java
+11
-1
activity_setting.xml
app/src/main/res/layout/activity_setting.xml
+5
-3
dialog_port_status.xml
app/src/main/res/layout/dialog_port_status.xml
+20
-0
item_port_status.xml
app/src/main/res/layout/item_port_status.xml
+12
-0
No files found.
app/src/main/java/com/srthinker/statinfo/adapter/DePortStatusAdapter.java
0 → 100644
View file @
8e25ba8f
package
com
.
srthinker
.
statinfo
.
adapter
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.ViewGroup
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.srthinker.statinfo.bean.StatusInfoBean
;
import
com.srthinker.statinfo.constant.InOutType
;
import
com.srthinker.statinfo.databinding.ItemPortStatusBinding
;
import
java.util.List
;
public
class
DePortStatusAdapter
extends
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>
{
private
final
Context
context
;
private
final
List
<
StatusInfoBean
>
statusInfoBeans
;
private
String
deviceType
;
public
DePortStatusAdapter
(
Context
context
,
List
<
StatusInfoBean
>
statusInfoBeans
){
this
.
context
=
context
;
this
.
statusInfoBeans
=
statusInfoBeans
;
}
@NonNull
@Override
public
RecyclerView
.
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
ItemPortStatusBinding
binding
=
ItemPortStatusBinding
.
inflate
(
LayoutInflater
.
from
(
context
),
parent
,
false
);
return
new
ItemHolder
(
binding
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
RecyclerView
.
ViewHolder
holder
,
int
position
)
{
ItemHolder
itemHolder
=
(
ItemHolder
)
holder
;
StatusInfoBean
statusInfoBean
=
statusInfoBeans
.
get
(
position
);
if
(
statusInfoBean
!=
null
)
{
if
(
statusInfoBean
.
getDevice_type
()==
InOutType
.
ENTER_TYPE
){
deviceType
=
"进入的设备--"
;
}
else
if
(
statusInfoBean
.
getDevice_type
()
==
InOutType
.
LEAVE_TYPE
){
deviceType
=
"出去的设备--"
;
}
String
desc
=
statusInfoBean
.
getTime
()+
" "
+
deviceType
+
statusInfoBean
.
getInfo
();
itemHolder
.
mBinding
.
tvStatusInfo
.
setText
(
desc
);
}
}
@Override
public
int
getItemCount
()
{
return
statusInfoBeans
!=
null
&&
statusInfoBeans
.
size
()>
0
?
statusInfoBeans
.
size
():
0
;
}
private
static
class
ItemHolder
extends
RecyclerView
.
ViewHolder
{
private
final
com
.
srthinker
.
statinfo
.
databinding
.
ItemPortStatusBinding
mBinding
;
public
ItemHolder
(
ItemPortStatusBinding
binding
)
{
super
(
binding
.
getRoot
());
mBinding
=
binding
;
}
}
}
app/src/main/java/com/srthinker/statinfo/bean/StatusInfoBean.java
0 → 100644
View file @
8e25ba8f
package
com
.
srthinker
.
statinfo
.
bean
;
import
java.util.Objects
;
public
class
StatusInfoBean
{
private
String
id
;
private
String
info
;
private
String
time
;
private
int
device_type
;
public
StatusInfoBean
(
String
time
,
String
info
,
int
device_type
)
{
this
.
info
=
info
;
this
.
time
=
time
;
this
.
device_type
=
device_type
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getInfo
()
{
return
info
;
}
public
void
setInfo
(
String
info
)
{
this
.
info
=
info
;
}
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
int
getDevice_type
()
{
return
device_type
;
}
public
void
setDevice_type
(
int
device_type
)
{
this
.
device_type
=
device_type
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
StatusInfoBean
that
=
(
StatusInfoBean
)
o
;
return
device_type
==
that
.
device_type
&&
Objects
.
equals
(
id
,
that
.
id
)
&&
Objects
.
equals
(
info
,
that
.
info
)
&&
Objects
.
equals
(
time
,
that
.
time
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
id
,
info
,
time
,
device_type
);
}
@Override
public
String
toString
()
{
return
"StatusInfoBean{"
+
"id='"
+
id
+
'\''
+
", info='"
+
info
+
'\''
+
", time='"
+
time
+
'\''
+
", device_type="
+
device_type
+
'}'
;
}
}
app/src/main/java/com/srthinker/statinfo/database/PersonMgr.java
View file @
8e25ba8f
...
@@ -51,25 +51,37 @@ public class PersonMgr {
...
@@ -51,25 +51,37 @@ public class PersonMgr {
//如果都有
//如果都有
//给从接口获取新的数据之前有分过组的数据写分组的信息,已经被删除的人员也要删除掉
//给从接口获取新的数据之前有分过组的数据写分组的信息,已经被删除的人员也要删除掉
ArrayList
<
PersonEntity
>
needDelPersons
=
new
ArrayList
<>();
ArrayList
<
PersonEntity
>
needDelPersons
=
new
ArrayList
<>();
int
equal_name
=
0
;
for
(
PersonEntity
queryPerson
:
queryPersons
)
{
for
(
PersonEntity
queryPerson
:
queryPersons
)
{
String
queryId
=
queryPerson
.
getId
();
String
queryId
=
queryPerson
.
getId
();
String
query_name
=
queryPerson
.
getPerson_name
();
boolean
isFound
=
false
;
boolean
isFound
=
false
;
for
(
PersonEntity
newPersonEntity
:
personEntities
)
{
for
(
PersonEntity
newPersonEntity
:
personEntities
)
{
String
newId
=
newPersonEntity
.
getId
();
String
newId
=
newPersonEntity
.
getId
();
if
(
TextUtils
.
equals
(
queryId
,
newId
)){
String
newPersonName
=
newPersonEntity
.
getPerson_name
();
/*if (TextUtils.equals(queryId,newId)){
newPersonEntity.setGroup(queryPerson.getGroup());
isFound = true;
break;
}*/
//根据名字进行分组
if
(
TextUtils
.
equals
(
query_name
,
newPersonName
)){
query_name
+=
1
;
newPersonEntity
.
setGroup
(
queryPerson
.
getGroup
());
newPersonEntity
.
setGroup
(
queryPerson
.
getGroup
());
isFound
=
true
;
isFound
=
true
;
break
;
break
;
}
}
}
}
if
(!
isFound
){
/*
if (!isFound){
needDelPersons.add(queryPerson);
needDelPersons.add(queryPerson);
}
}
*/
}
}
Log
.
i
(
TAG
,
"updatePerson: 和已分配的相同名字的总数="
+
equal_name
);
if
(
personHelper
!=
null
)
{
if
(
personHelper
!=
null
)
{
personHelper
.
delete
(
queryPersons
);
personHelper
.
save
(
personEntities
);
personHelper
.
save
(
personEntities
);
Log
.
i
(
TAG
,
"updatePerson: needDelPersons.size()="
+
needDelPersons
.
size
());
/*
Log.i(TAG, "updatePerson: needDelPersons.size()="+needDelPersons.size());
personHelper
.
delete
(
needDelPersons
);
personHelper.delete(needDelPersons);
*/
}
}
}
}
...
@@ -111,9 +123,17 @@ public class PersonMgr {
...
@@ -111,9 +123,17 @@ public class PersonMgr {
List
<
PersonEntity
>
needUpdate
=
new
ArrayList
<>();
List
<
PersonEntity
>
needUpdate
=
new
ArrayList
<>();
for
(
PersonEntity
personEntity
:
personEntities
)
{
for
(
PersonEntity
personEntity
:
personEntities
)
{
String
personId
=
personEntity
.
getId
();
String
personId
=
personEntity
.
getId
();
String
person_name
=
personEntity
.
getPerson_name
();
for
(
PersonEntity
queryPerson
:
queryPersons
)
{
for
(
PersonEntity
queryPerson
:
queryPersons
)
{
String
queryId
=
queryPerson
.
getId
();
String
queryId
=
queryPerson
.
getId
();
if
(
TextUtils
.
equals
(
personId
,
queryId
)){
String
queryName
=
queryPerson
.
getPerson_name
();
/*if (TextUtils.equals(personId,queryId)){
queryPerson.setGroup(personEntity.getGroup());
needUpdate.add(queryPerson);
break;
}*/
//根据名字进行分组
if
(
TextUtils
.
equals
(
person_name
,
queryName
)){
queryPerson
.
setGroup
(
personEntity
.
getGroup
());
queryPerson
.
setGroup
(
personEntity
.
getGroup
());
needUpdate
.
add
(
queryPerson
);
needUpdate
.
add
(
queryPerson
);
break
;
break
;
...
...
app/src/main/java/com/srthinker/statinfo/listener/DevicePortCallback.java
0 → 100644
View file @
8e25ba8f
package
com
.
srthinker
.
statinfo
.
listener
;
public
interface
DevicePortCallback
{
void
getDevicePortStatus
(
String
time
,
String
info
);
}
app/src/main/java/com/srthinker/statinfo/listener/upper/UpperDevicesPortCallback.java
0 → 100644
View file @
8e25ba8f
package
com
.
srthinker
.
statinfo
.
listener
.
upper
;
import
com.srthinker.statinfo.bean.StatusInfoBean
;
public
interface
UpperDevicesPortCallback
{
void
onDevicesPort
(
StatusInfoBean
statusInfoBean
);
}
app/src/main/java/com/srthinker/statinfo/presenter/ApiManager.java
View file @
8e25ba8f
...
@@ -16,6 +16,7 @@ import com.srthinker.statinfo.api.kuangshi.client.ApiClientException;
...
@@ -16,6 +16,7 @@ import com.srthinker.statinfo.api.kuangshi.client.ApiClientException;
import
com.srthinker.statinfo.api.kuangshi.client.DefaultApiClient
;
import
com.srthinker.statinfo.api.kuangshi.client.DefaultApiClient
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.listener.DeviceCallback
;
import
com.srthinker.statinfo.listener.DeviceCallback
;
import
com.srthinker.statinfo.listener.DevicePortCallback
;
import
com.srthinker.statinfo.listener.QueryPersonCallback
;
import
com.srthinker.statinfo.listener.QueryPersonCallback
;
import
com.srthinker.statinfo.util.common.DateUtil
;
import
com.srthinker.statinfo.util.common.DateUtil
;
import
com.srthinker.statinfo.util.common.ThreadPool
;
import
com.srthinker.statinfo.util.common.ThreadPool
;
...
@@ -48,6 +49,7 @@ public class ApiManager {
...
@@ -48,6 +49,7 @@ public class ApiManager {
private
PersonApiImpl
personApi
;
private
PersonApiImpl
personApi
;
private
boolean
lastConnect
=
false
;
private
boolean
lastConnect
=
false
;
private
QueryPersonCallback
queryPersonsCallback
;
private
QueryPersonCallback
queryPersonsCallback
;
private
DevicePortCallback
devicePortCallback
;
public
ApiManager
(
String
username
,
String
password
,
String
serverIp
,
int
type
){
public
ApiManager
(
String
username
,
String
password
,
String
serverIp
,
int
type
){
...
@@ -74,6 +76,10 @@ public class ApiManager {
...
@@ -74,6 +76,10 @@ public class ApiManager {
this
.
queryPersonsCallback
=
queryPersonsCallback
;
this
.
queryPersonsCallback
=
queryPersonsCallback
;
}
}
public
void
setOnDevicePortCallback
(
DevicePortCallback
devicePortCallback
){
this
.
devicePortCallback
=
devicePortCallback
;
}
public
void
start
(){
public
void
start
(){
isRunning
=
true
;
isRunning
=
true
;
isFirstStatus
=
true
;
isFirstStatus
=
true
;
...
@@ -100,6 +106,9 @@ public class ApiManager {
...
@@ -100,6 +106,9 @@ public class ApiManager {
//登录出错,打印错误信息
//登录出错,打印错误信息
System
.
out
.
println
(
JSONObject
.
toJSONString
(
loginResp
));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
loginResp
));
if
(
devicePortCallback
!=
null
)
{
devicePortCallback
.
getDevicePortStatus
(
DateUtil
.
getNowDateTimeFormat
(),
JSONObject
.
toJSONString
(
loginResp
));
}
return
;
return
;
}
}
sessionId
=
loginResp
.
getSessionId
();
sessionId
=
loginResp
.
getSessionId
();
...
@@ -114,13 +123,18 @@ public class ApiManager {
...
@@ -114,13 +123,18 @@ public class ApiManager {
}
}
}
catch
(
ApiClientException
e2
){
}
catch
(
ApiClientException
e2
){
updateLastConnect
(
false
);
updateLastConnect
(
false
);
if
(
devicePortCallback
!=
null
)
{
devicePortCallback
.
getDevicePortStatus
(
DateUtil
.
getNowDateTimeFormat
(),
"authRunnable:"
+
serverIp
+
"--e2-->"
+
e2
.
getMessage
());
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
updateLastConnect
(
false
);
updateLastConnect
(
false
);
if
(
devicePortCallback
!=
null
)
{
devicePortCallback
.
getDevicePortStatus
(
DateUtil
.
getNowDateTimeFormat
(),
"authRunnable:"
+
serverIp
+
"--e-->"
+
e
.
getMessage
());
}
Log
.
i
(
TAG
,
"run: authRunnable抛异常:ip="
+
serverIp
);
Log
.
i
(
TAG
,
"run: authRunnable抛异常:ip="
+
serverIp
);
if
(
isRunning
){
if
(
isRunning
){
handler
.
postDelayed
(
authThreadRunnable
,
2
000
);
handler
.
postDelayed
(
authThreadRunnable
,
10
000
);
}
}
}
}
}
}
...
@@ -229,6 +243,7 @@ public class ApiManager {
...
@@ -229,6 +243,7 @@ public class ApiManager {
PersonEntity
passBean
=
new
PersonEntity
();
PersonEntity
passBean
=
new
PersonEntity
();
passBean
.
setId
(
dataBean
.
getPerson_id
());
passBean
.
setId
(
dataBean
.
getPerson_id
());
passBean
.
setPerson_name
(
dataBean
.
getPerson_name
());
passBean
.
setPerson_name
(
dataBean
.
getPerson_name
());
//String id_number = dataBean.getId_number();
String
timestamp
=
dataBean
.
getTimestamp
();
String
timestamp
=
dataBean
.
getTimestamp
();
String
timeString
=
DateUtil
.
zoneToDateString
(
timestamp
,
"HH:mm"
);
String
timeString
=
DateUtil
.
zoneToDateString
(
timestamp
,
"HH:mm"
);
passBean
.
setTimestamp
(
timeString
);
passBean
.
setTimestamp
(
timeString
);
...
@@ -250,9 +265,15 @@ public class ApiManager {
...
@@ -250,9 +265,15 @@ public class ApiManager {
}
}
}
catch
(
ApiClientException
e2
){
}
catch
(
ApiClientException
e2
){
updateLastConnect
(
false
);
updateLastConnect
(
false
);
if
(
devicePortCallback
!=
null
)
{
devicePortCallback
.
getDevicePortStatus
(
DateUtil
.
getNowDateTimeFormat
(),
"passRecordRunnable:"
+
serverIp
+
"--e2-->"
+
e2
.
getMessage
());
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
i
(
TAG
,
"run: passRecordRunnable抛异常"
);
Log
.
i
(
TAG
,
"run: passRecordRunnable抛异常"
);
updateLastConnect
(
false
);
updateLastConnect
(
false
);
if
(
devicePortCallback
!=
null
)
{
devicePortCallback
.
getDevicePortStatus
(
DateUtil
.
getNowDateTimeFormat
(),
"passRecordRunnable:"
+
serverIp
+
"--e-->"
+
e
.
getMessage
());
}
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -301,6 +322,9 @@ public class ApiManager {
...
@@ -301,6 +322,9 @@ public class ApiManager {
PersonEntity
personEntity
=
new
PersonEntity
();
PersonEntity
personEntity
=
new
PersonEntity
();
personEntity
.
setId
(
personData
.
getId
());
personEntity
.
setId
(
personData
.
getId
());
personEntity
.
setPerson_name
(
personData
.
getPerson_name
());
personEntity
.
setPerson_name
(
personData
.
getPerson_name
());
//String id_number = DigestUtils.aesDecrypt(personData.getId_number(), sessionId);
//Log.i(TAG, "queryPerson: id_number="+id_number);
//personEntity.setId_number(id_number);
personEntities
.
add
(
personEntity
);
personEntities
.
add
(
personEntity
);
}
}
totalPersonLists
.
addAll
(
personEntities
);
totalPersonLists
.
addAll
(
personEntities
);
...
...
app/src/main/java/com/srthinker/statinfo/presenter/ApiQuest.java
View file @
8e25ba8f
...
@@ -5,12 +5,14 @@ import static com.srthinker.statinfo.constant.InOutType.LEAVE_TYPE;
...
@@ -5,12 +5,14 @@ import static com.srthinker.statinfo.constant.InOutType.LEAVE_TYPE;
import
android.util.Log
;
import
android.util.Log
;
import
com.srthinker.statinfo.bean.StatusInfoBean
;
import
com.srthinker.statinfo.database.entity.ConfigEntity
;
import
com.srthinker.statinfo.database.entity.ConfigEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.database.helper.ConfigHelper
;
import
com.srthinker.statinfo.database.helper.ConfigHelper
;
import
com.srthinker.statinfo.listener.DeviceCallback
;
import
com.srthinker.statinfo.listener.DeviceCallback
;
import
com.srthinker.statinfo.listener.QueryPersonCallback
;
import
com.srthinker.statinfo.listener.QueryPersonCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesPortCallback
;
import
com.srthinker.statinfo.util.common.ThreadPool
;
import
com.srthinker.statinfo.util.common.ThreadPool
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -34,6 +36,7 @@ public class ApiQuest {
...
@@ -34,6 +36,7 @@ public class ApiQuest {
private
static
LinkedHashMap
<
String
,
ApiManager
>
enterMgrHashMap
=
new
LinkedHashMap
<>();
private
static
LinkedHashMap
<
String
,
ApiManager
>
enterMgrHashMap
=
new
LinkedHashMap
<>();
private
static
LinkedHashMap
<
String
,
ApiManager
>
leaveMgrHashMap
=
new
LinkedHashMap
<>();
private
static
LinkedHashMap
<
String
,
ApiManager
>
leaveMgrHashMap
=
new
LinkedHashMap
<>();
private
String
oneEnterIp
;
private
String
oneEnterIp
;
private
UpperDevicesPortCallback
upperDevicesPortCallback
;
public
static
ApiQuest
getInstance
(){
public
static
ApiQuest
getInstance
(){
if
(
apiQuest
==
null
)
{
if
(
apiQuest
==
null
)
{
...
@@ -48,6 +51,10 @@ public class ApiQuest {
...
@@ -48,6 +51,10 @@ public class ApiQuest {
this
.
upperDevicesCallback
=
upperDevicesCallback
;
this
.
upperDevicesCallback
=
upperDevicesCallback
;
}
}
public
void
setOnUpperDevicesPortCallback
(
UpperDevicesPortCallback
upperDevicesPortCallback
){
this
.
upperDevicesPortCallback
=
upperDevicesPortCallback
;
}
private
void
initData
(
int
type
){
private
void
initData
(
int
type
){
if
(
type
==
ENTER_TYPE
){
if
(
type
==
ENTER_TYPE
){
isEnterAllConnect
=
false
;
isEnterAllConnect
=
false
;
...
@@ -96,6 +103,12 @@ public class ApiQuest {
...
@@ -96,6 +103,12 @@ public class ApiQuest {
ApiManager
enterMgr
=
new
ApiManager
(
username
,
password
,
ip
,
ENTER_TYPE
);
ApiManager
enterMgr
=
new
ApiManager
(
username
,
password
,
ip
,
ENTER_TYPE
);
enterMgrHashMap
.
put
(
ip
,
enterMgr
);
enterMgrHashMap
.
put
(
ip
,
enterMgr
);
enterMgr
.
start
();
enterMgr
.
start
();
enterMgr
.
setOnDevicePortCallback
((
time
,
info
)
->
{
StatusInfoBean
statusInfoBean
=
new
StatusInfoBean
(
time
,
info
,
ENTER_TYPE
);
if
(
upperDevicesPortCallback
!=
null
)
{
upperDevicesPortCallback
.
onDevicesPort
(
statusInfoBean
);
}
});
enterMgr
.
setOnDeviceCallback
(
new
DeviceCallback
()
{
enterMgr
.
setOnDeviceCallback
(
new
DeviceCallback
()
{
@Override
@Override
public
void
getPassInfo
(
List
<
PersonEntity
>
passEntities
,
int
type
)
{
public
void
getPassInfo
(
List
<
PersonEntity
>
passEntities
,
int
type
)
{
...
@@ -137,13 +150,14 @@ public class ApiQuest {
...
@@ -137,13 +150,14 @@ public class ApiQuest {
isEnterAllConnect
=
true
;
isEnterAllConnect
=
true
;
synchronized
(
enterList
){
synchronized
(
enterList
){
for
(
ConfigEntity
config
:
enterList
)
{
for
(
ConfigEntity
config
:
enterList
)
{
//Log.i(TAG, "onConnectStatus: 数据库里面的数据:ip="+config.getServerIp()+",isConnect="+config.isConnect());
//Log.i(TAG, "onConnectStatus: 数据库里面的数据:ip="+config.getServerIp()+",isConnect="+config.isConnect()
+",id="+config.getId()+",type="+config.getType()
);
boolean
connect
=
config
.
isConnect
();
boolean
connect
=
config
.
isConnect
();
if
(!
connect
){
if
(!
connect
){
isEnterAllConnect
=
false
;
isEnterAllConnect
=
false
;
break
;
break
;
}
}
}
}
//Log.i(TAG, "onConnectStatus: isEnterAllConnect="+isEnterAllConnect);
if
(
upperDevicesCallback
!=
null
)
{
if
(
upperDevicesCallback
!=
null
)
{
upperDevicesCallback
.
onAllConnectStatus
(
isEnterAllConnect
,
type
);
upperDevicesCallback
.
onAllConnectStatus
(
isEnterAllConnect
,
type
);
}
}
...
@@ -165,6 +179,12 @@ public class ApiQuest {
...
@@ -165,6 +179,12 @@ public class ApiQuest {
ApiManager
leaveMgr
=
new
ApiManager
(
username
,
password
,
ip
,
LEAVE_TYPE
);
ApiManager
leaveMgr
=
new
ApiManager
(
username
,
password
,
ip
,
LEAVE_TYPE
);
leaveMgrHashMap
.
put
(
ip
,
leaveMgr
);
leaveMgrHashMap
.
put
(
ip
,
leaveMgr
);
leaveMgr
.
start
();
leaveMgr
.
start
();
leaveMgr
.
setOnDevicePortCallback
((
time
,
info
)
->
{
StatusInfoBean
statusInfoBean
=
new
StatusInfoBean
(
time
,
info
,
LEAVE_TYPE
);
if
(
upperDevicesPortCallback
!=
null
)
{
upperDevicesPortCallback
.
onDevicesPort
(
statusInfoBean
);
}
});
leaveMgr
.
setOnDeviceCallback
(
new
DeviceCallback
()
{
leaveMgr
.
setOnDeviceCallback
(
new
DeviceCallback
()
{
@Override
@Override
public
void
getPassInfo
(
List
<
PersonEntity
>
passEntities
,
int
type
)
{
public
void
getPassInfo
(
List
<
PersonEntity
>
passEntities
,
int
type
)
{
...
@@ -236,6 +256,7 @@ public class ApiQuest {
...
@@ -236,6 +256,7 @@ public class ApiQuest {
}
}
public
boolean
queryPersons
(
QueryPersonCallback
callback
){
public
boolean
queryPersons
(
QueryPersonCallback
callback
){
Log
.
i
(
TAG
,
"queryPersons: enterMgrHashMap.size="
+
enterMgrHashMap
.
size
());
if
(
enterMgrHashMap
.
size
()>
0
){
if
(
enterMgrHashMap
.
size
()>
0
){
ApiManager
oneEnterMgr
=
enterMgrHashMap
.
get
(
oneEnterIp
);
ApiManager
oneEnterMgr
=
enterMgrHashMap
.
get
(
oneEnterIp
);
if
(
oneEnterMgr
!=
null
)
{
if
(
oneEnterMgr
!=
null
)
{
...
...
app/src/main/java/com/srthinker/statinfo/presenter/StatSize.java
View file @
8e25ba8f
...
@@ -6,14 +6,14 @@ import java.util.ArrayList;
...
@@ -6,14 +6,14 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
public
class
StatSize
{
public
class
StatSize
{
//
id
和时间相同的进行去重过滤
//
名字
和时间相同的进行去重过滤
public
static
List
<
PersonEntity
>
filterList
(
List
<
PersonEntity
>
personEntityList
){
public
static
List
<
PersonEntity
>
filterList
(
List
<
PersonEntity
>
personEntityList
){
List
<
PersonEntity
>
filterPersonList
=
new
ArrayList
<>();
List
<
PersonEntity
>
filterPersonList
=
new
ArrayList
<>();
if
(
personEntityList
!=
null
)
{
if
(
personEntityList
!=
null
)
{
for
(
PersonEntity
personEntity
:
personEntityList
)
{
for
(
PersonEntity
personEntity
:
personEntityList
)
{
boolean
shouldAdd
=
true
;
boolean
shouldAdd
=
true
;
for
(
PersonEntity
entity
:
filterPersonList
)
{
for
(
PersonEntity
entity
:
filterPersonList
)
{
if
(
equals
(
personEntity
.
get
Id
(),
entity
.
getId
())&&
equals
(
personEntity
.
getTimestamp
(),
entity
.
getTimestamp
())){
if
(
equals
(
personEntity
.
get
Person_name
(),
entity
.
getPerson_name
())&&
equals
(
personEntity
.
getTimestamp
(),
entity
.
getTimestamp
())){
shouldAdd
=
false
;
shouldAdd
=
false
;
break
;
break
;
}
}
...
...
app/src/main/java/com/srthinker/statinfo/uis/MainActivity.java
View file @
8e25ba8f
...
@@ -22,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView;
...
@@ -22,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView;
import
com.srthinker.statinfo.adapter.GroupShowAdapter
;
import
com.srthinker.statinfo.adapter.GroupShowAdapter
;
import
com.srthinker.statinfo.bean.Group2Bean
;
import
com.srthinker.statinfo.bean.Group2Bean
;
import
com.srthinker.statinfo.bean.StatusInfoBean
;
import
com.srthinker.statinfo.constant.GroupConst
;
import
com.srthinker.statinfo.constant.GroupConst
;
import
com.srthinker.statinfo.database.entity.ConfigEntity
;
import
com.srthinker.statinfo.database.entity.ConfigEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
import
com.srthinker.statinfo.database.entity.PersonEntity
;
...
@@ -31,6 +32,7 @@ import com.srthinker.statinfo.databinding.ActivityNewMainBinding;
...
@@ -31,6 +32,7 @@ import com.srthinker.statinfo.databinding.ActivityNewMainBinding;
import
com.srthinker.statinfo.download.upper.DownloadViewModel
;
import
com.srthinker.statinfo.download.upper.DownloadViewModel
;
import
com.srthinker.statinfo.download.upper.UpperDownloadCallback
;
import
com.srthinker.statinfo.download.upper.UpperDownloadCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesCallback
;
import
com.srthinker.statinfo.listener.upper.UpperDevicesPortCallback
;
import
com.srthinker.statinfo.presenter.ApiQuest
;
import
com.srthinker.statinfo.presenter.ApiQuest
;
import
com.srthinker.statinfo.presenter.StatSize
;
import
com.srthinker.statinfo.presenter.StatSize
;
import
com.srthinker.statinfo.uis.news.SettingActivity
;
import
com.srthinker.statinfo.uis.news.SettingActivity
;
...
@@ -52,7 +54,7 @@ import java.util.HashMap;
...
@@ -52,7 +54,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
class
MainActivity
extends
BaseActivity
implements
NetworkIPMonitor
.
OnIPChangeCallback
,
UpperDevicesCallback
,
MDownloadCallBack
,
UpperDownloadCallback
{
public
class
MainActivity
extends
BaseActivity
implements
NetworkIPMonitor
.
OnIPChangeCallback
,
UpperDevicesCallback
,
MDownloadCallBack
,
UpperDownloadCallback
,
UpperDevicesPortCallback
{
private
static
final
String
TAG
=
"NewMainActivity"
;
private
static
final
String
TAG
=
"NewMainActivity"
;
private
com
.
srthinker
.
statinfo
.
databinding
.
ActivityNewMainBinding
mBinding
;
private
com
.
srthinker
.
statinfo
.
databinding
.
ActivityNewMainBinding
mBinding
;
...
@@ -104,6 +106,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -104,6 +106,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
Intent
intent
=
new
Intent
(
this
,
SettingActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
SettingActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
});
});
mLoadDialog
=
new
LoadDialog
(
this
);
//1.0.2版本把这个漏了
}
}
/*private void initGroup() {
/*private void initGroup() {
...
@@ -186,6 +189,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -186,6 +189,7 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
Log
.
i
(
TAG
,
"onDestroy: Main--destroy"
);
Log
.
i
(
TAG
,
"onDestroy: Main--destroy"
);
networkIPMonitor
.
stopMonitoring
();
networkIPMonitor
.
stopMonitoring
();
ApiQuest
.
getInstance
().
stopApi
();
ApiQuest
.
getInstance
().
stopApi
();
clearStatusInfoBeans
();
super
.
onDestroy
();
super
.
onDestroy
();
}
}
...
@@ -199,15 +203,22 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -199,15 +203,22 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
private
void
questApi
()
{
private
void
questApi
()
{
List
<
ConfigEntity
>
enterConfigList
=
ConfigHelper
.
getInstance
().
queryByType
(
ENTER_TYPE
);
List
<
ConfigEntity
>
enterConfigList
=
ConfigHelper
.
getInstance
().
queryByType
(
ENTER_TYPE
);
ApiQuest
.
getInstance
().
startApi
(
enterConfigList
,
ENTER_TYPE
);
ApiQuest
.
getInstance
().
startApi
(
enterConfigList
,
ENTER_TYPE
);
ApiQuest
.
getInstance
().
setOnUpperDevicesCallback
(
this
);
List
<
ConfigEntity
>
leaveConfigList
=
ConfigHelper
.
getInstance
().
queryByType
(
LEAVE_TYPE
);
List
<
ConfigEntity
>
leaveConfigList
=
ConfigHelper
.
getInstance
().
queryByType
(
LEAVE_TYPE
);
ApiQuest
.
getInstance
().
startApi
(
leaveConfigList
,
LEAVE_TYPE
);
ApiQuest
.
getInstance
().
startApi
(
leaveConfigList
,
LEAVE_TYPE
);
ApiQuest
.
getInstance
().
setOnUpperDevicesCallback
(
this
);
ApiQuest
.
getInstance
().
setOnUpperDevicesCallback
(
this
);
ApiQuest
.
getInstance
().
setOnUpperDevicesPortCallback
(
this
);
}
}
@Override
@Override
public
void
OnIPLost
(
String
error
)
{
public
void
OnIPLost
(
String
error
)
{
ApiQuest
.
getInstance
().
stopApi
();
ApiQuest
.
getInstance
().
stopApi
();
//修改状态
List
<
ConfigEntity
>
configEntities
=
ConfigHelper
.
getInstance
().
queryAll
();
for
(
ConfigEntity
configEntity
:
configEntities
)
{
configEntity
.
setConnect
(
false
);
//更新ip接口状态
ConfigHelper
.
getInstance
().
update
(
configEntity
);
}
}
}
@Override
@Override
...
@@ -219,21 +230,22 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -219,21 +230,22 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
@Override
@Override
public
void
onAllConnectStatus
(
boolean
hasConnect
,
int
type
)
{
public
void
onAllConnectStatus
(
boolean
hasConnect
,
int
type
)
{
HashMap
<
String
,
Boolean
>
devicesConnect
=
MyApplication
.
getInstance
().
devicesConnect
;
/*
HashMap<String, Boolean> devicesConnect = MyApplication.getInstance().devicesConnect;
if (type==ENTER_TYPE){
if (type==ENTER_TYPE){
devicesConnect.put("enter_connect",hasConnect);
devicesConnect.put("enter_connect",hasConnect);
// SharedUtil.getInstance(this).writeShared("enter_connect",hasConnect);
// SharedUtil.getInstance(this).writeShared("enter_connect",hasConnect);
}else if (type==LEAVE_TYPE){
}else if (type==LEAVE_TYPE){
// SharedUtil.getInstance(this).writeShared("leave_connect",hasConnect);
// SharedUtil.getInstance(this).writeShared("leave_connect",hasConnect);
devicesConnect.put("leave_connect",hasConnect);
devicesConnect.put("leave_connect",hasConnect);
}
}
*/
}
}
private
void
updatePassInfo
(
List
<
PersonEntity
>
passEntities
,
int
type
)
{
private
void
updatePassInfo
(
List
<
PersonEntity
>
passEntities
,
int
type
)
{
Log
.
i
(
TAG
,
"updatePassInfo: 获取的总数="
+
passEntities
.
size
());
Log
.
i
(
TAG
,
"updatePassInfo: 获取的总数="
+
passEntities
.
size
());
/*for (PersonEntity passEntity : passEntities) {
Log
.
i
(
TAG
,
"updatePassInfo: 进还是出="
+
type
);
for
(
PersonEntity
passEntity
:
passEntities
)
{
Log
.
i
(
TAG
,
"updatePassInfo: 获取到的name="
+
passEntity
.
getPerson_name
());
Log
.
i
(
TAG
,
"updatePassInfo: 获取到的name="
+
passEntity
.
getPerson_name
());
}
*/
}
if
(
type
==
ENTER_TYPE
){
if
(
type
==
ENTER_TYPE
){
if
(
passEntities
!=
null
)
{
if
(
passEntities
!=
null
)
{
int
size
=
passEntities
.
size
();
int
size
=
passEntities
.
size
();
...
@@ -312,10 +324,13 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -312,10 +324,13 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
}
}
for
(
PersonEntity
personEntity
:
personEntityList
)
{
for
(
PersonEntity
personEntity
:
personEntityList
)
{
String
personId
=
personEntity
.
getId
();
String
personId
=
personEntity
.
getId
();
String
personName
=
personEntity
.
getPerson_name
();
for
(
PersonEntity
queryPerson
:
mQueryPersonList
)
{
for
(
PersonEntity
queryPerson
:
mQueryPersonList
)
{
String
queryId
=
queryPerson
.
getId
();
String
queryId
=
queryPerson
.
getId
();
String
queryName
=
queryPerson
.
getPerson_name
();
int
group
=
queryPerson
.
getGroup
();
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
);
int
totalSize
=
groupSizeHashMap
.
get
(
group
);
groupSizeHashMap
.
put
(
group
,
totalSize
+
1
);
groupSizeHashMap
.
put
(
group
,
totalSize
+
1
);
}
}
...
@@ -467,4 +482,17 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
...
@@ -467,4 +482,17 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
}
}
});
});
}
}
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
app/src/main/java/com/srthinker/statinfo/uis/MyApplication.java
View file @
8e25ba8f
...
@@ -10,7 +10,6 @@ public class MyApplication extends Application {
...
@@ -10,7 +10,6 @@ public class MyApplication extends Application {
private
static
MyApplication
application
;
private
static
MyApplication
application
;
//声明一个公共的变量,存储网络状态
//声明一个公共的变量,存储网络状态
public
HashMap
<
String
,
Boolean
>
devicesConnect
=
new
HashMap
<>();
public
HashMap
<
String
,
Boolean
>
devicesConnect
=
new
HashMap
<>();
// 1秒钟后重启应用
// 1秒钟后重启应用
private
int
time
=
1000
;
private
int
time
=
1000
;
...
...
app/src/main/java/com/srthinker/statinfo/uis/fragment/ConfigDlgFragment.java
View file @
8e25ba8f
...
@@ -291,7 +291,7 @@ public class ConfigDlgFragment extends DialogFragment {
...
@@ -291,7 +291,7 @@ public class ConfigDlgFragment extends DialogFragment {
Window
window
=
getDialog
().
getWindow
();
Window
window
=
getDialog
().
getWindow
();
window
.
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
window
.
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
//window.setLayout(Utils.dip2px(context,280),ViewGroup.LayoutParams.WRAP_CONTENT);
//window.setLayout(Utils.dip2px(context,280),ViewGroup.LayoutParams.WRAP_CONTENT);
window
.
setLayout
(
Utils
.
dip2px
(
context
,
28
0
),
(
int
)
(
Utils
.
getScreenHeight
(
context
)*
0.6
));
window
.
setLayout
(
Utils
.
dip2px
(
context
,
32
0
),
(
int
)
(
Utils
.
getScreenHeight
(
context
)*
0.6
));
window
.
setGravity
(
Gravity
.
CENTER
);
window
.
setGravity
(
Gravity
.
CENTER
);
KeyBoardUtil
.
initSoftInputListener
(
getDialog
());
KeyBoardUtil
.
initSoftInputListener
(
getDialog
());
}
}
...
...
app/src/main/java/com/srthinker/statinfo/uis/news/DePortStatusDlgFragment.java
0 → 100644
View file @
8e25ba8f
package
com
.
srthinker
.
statinfo
.
uis
.
news
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.DialogFragment
;
import
androidx.fragment.app.FragmentActivity
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
com.srthinker.statinfo.adapter.DePortStatusAdapter
;
import
com.srthinker.statinfo.bean.StatusInfoBean
;
import
com.srthinker.statinfo.databinding.DialogPortStatusBinding
;
import
com.srthinker.statinfo.util.common.KeyBoardUtil
;
import
com.srthinker.statinfo.util.common.SharedUtil
;
import
com.srthinker.statinfo.util.common.Utils
;
import
java.util.List
;
public
class
DePortStatusDlgFragment
extends
DialogFragment
{
private
Context
context
;
private
com
.
srthinker
.
statinfo
.
databinding
.
DialogPortStatusBinding
mBinding
;
private
FragmentActivity
activity
;
private
DePortStatusAdapter
adapter
;
private
static
final
String
TAG
=
"dpsDlaFragment"
;
@Nullable
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
context
=
getContext
();
activity
=
getActivity
();
mBinding
=
DialogPortStatusBinding
.
inflate
(
inflater
,
container
,
false
);
initData
();
initView
();
return
mBinding
.
getRoot
();
}
private
void
initData
()
{
deHandler
.
post
(
DePortStatusRunnable
);
}
private
void
initView
()
{
mBinding
.
ivClose
.
setOnClickListener
(
v
->{
dismiss
();
});
LinearLayoutManager
layoutManager
=
new
LinearLayoutManager
(
context
);
mBinding
.
rvPortStatus
.
setLayoutManager
(
layoutManager
);
adapter
=
new
DePortStatusAdapter
(
context
,
statusInfoBeans
);
mBinding
.
rvPortStatus
.
setAdapter
(
adapter
);
}
@Override
public
void
onResume
()
{
super
.
onResume
();
initWindow
();
}
private
void
initWindow
()
{
Window
window
=
getDialog
().
getWindow
();
window
.
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
//window.setLayout(Utils.dip2px(context,280),ViewGroup.LayoutParams.WRAP_CONTENT);
window
.
setLayout
((
int
)
(
Utils
.
getScreenWidth
(
context
)*
0.7
),
(
int
)
(
Utils
.
getScreenHeight
(
context
)*
0.6
));
window
.
setGravity
(
Gravity
.
CENTER
);
KeyBoardUtil
.
initSoftInputListener
(
getDialog
());
}
private
Handler
deHandler
=
new
Handler
();
private
List
<
StatusInfoBean
>
statusInfoBeans
;
private
Runnable
DePortStatusRunnable
=
new
Runnable
(){
@Override
public
void
run
()
{
statusInfoBeans
=
SharedUtil
.
getInstance
(
context
).
readSharedList
(
"statusInfoBeans"
,
StatusInfoBean
.
class
,
null
);
for
(
StatusInfoBean
statusInfoBean
:
statusInfoBeans
)
{
Log
.
i
(
TAG
,
"run: statusInfoBean="
+
statusInfoBean
.
toString
());
}
updateStatus
();
deHandler
.
postDelayed
(
this
,
1000
);
}
};
private
void
updateStatus
()
{
activity
.
runOnUiThread
(()
->
{
if
(
adapter
!=
null
)
{
adapter
.
notifyDataSetChanged
();
}
});
}
@Override
public
void
onDestroyView
()
{
deHandler
.
removeCallbacks
(
DePortStatusRunnable
);
super
.
onDestroyView
();
}
}
app/src/main/java/com/srthinker/statinfo/uis/news/SettingActivity.java
View file @
8e25ba8f
This diff is collapsed.
Click to expand it.
app/src/main/java/com/srthinker/statinfo/wedget/EditView.java
View file @
8e25ba8f
...
@@ -2,6 +2,7 @@ package com.srthinker.statinfo.wedget;
...
@@ -2,6 +2,7 @@ package com.srthinker.statinfo.wedget;
import
android.content.Context
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.util.TypedValue
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
...
@@ -31,8 +32,17 @@ public class EditView extends LinearLayout {
...
@@ -31,8 +32,17 @@ public class EditView extends LinearLayout {
}
}
public
void
initItem
(
String
title
,
String
hint
){
public
void
initItem
(
String
title
,
String
hint
){
/*mBinding.tvTitle.setText(title);
mBinding.etContent.setHint(hint);*/
initItem
(
title
,
hint
,
18
);
}
public
void
initItem
(
String
title
,
String
hint
,
float
textSize
){
mBinding
.
tvTitle
.
setText
(
title
);
mBinding
.
tvTitle
.
setText
(
title
);
mBinding
.
etContent
.
setHint
(
hint
);
mBinding
.
etContent
.
setHint
(
hint
);
mBinding
.
tvTitle
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
mBinding
.
etContent
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
mBinding
.
tvStatus
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
textSize
);
}
}
public
void
setContent
(
String
content
){
public
void
setContent
(
String
content
){
...
@@ -54,7 +64,7 @@ public class EditView extends LinearLayout {
...
@@ -54,7 +64,7 @@ public class EditView extends LinearLayout {
}
}
public
String
getContent
(){
public
String
getContent
(){
return
mBinding
.
etContent
.
getText
().
toString
();
return
mBinding
.
etContent
.
getText
().
toString
()
.
trim
()
;
}
}
public
void
setInputType
(
int
type
){
public
void
setInputType
(
int
type
){
...
...
app/src/main/res/layout/activity_setting.xml
View file @
8e25ba8f
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
android:padding=
"15dp"
android:padding=
"15dp"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
<TextView
android:id=
"@+id/tv_device_config"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
...
@@ -56,7 +57,7 @@
...
@@ -56,7 +57,7 @@
android:textSize=
"@dimen/text_12_5"
android:textSize=
"@dimen/text_12_5"
android:layout_toRightOf=
"@+id/tv_enter_text"
android:layout_toRightOf=
"@+id/tv_enter_text"
android:layout_alignBottom=
"@+id/tv_enter_text"
android:layout_alignBottom=
"@+id/tv_enter_text"
android:visibility=
"
visibl
e"
android:visibility=
"
gon
e"
android:layout_marginLeft=
"5dp"
/>
android:layout_marginLeft=
"5dp"
/>
<TextView
<TextView
android:id=
"@+id/tv_leave_text"
android:id=
"@+id/tv_leave_text"
...
@@ -77,7 +78,7 @@
...
@@ -77,7 +78,7 @@
android:textSize=
"@dimen/text_12_5"
android:textSize=
"@dimen/text_12_5"
android:layout_toLeftOf=
"@+id/tv_leave_text"
android:layout_toLeftOf=
"@+id/tv_leave_text"
android:layout_alignBottom=
"@+id/tv_leave_text"
android:layout_alignBottom=
"@+id/tv_leave_text"
android:visibility=
"
visibl
e"
android:visibility=
"
gon
e"
android:layout_marginRight=
"5dp"
/>
android:layout_marginRight=
"5dp"
/>
</RelativeLayout>
</RelativeLayout>
...
@@ -91,6 +92,7 @@
...
@@ -91,6 +92,7 @@
android:layout_marginTop=
"15dp"
android:layout_marginTop=
"15dp"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
<TextView
android:id=
"@+id/tv_person_config"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
...
@@ -141,7 +143,7 @@
...
@@ -141,7 +143,7 @@
android:gravity=
"left|center"
android:gravity=
"left|center"
android:layout_marginTop=
"17dp"
android:layout_marginTop=
"17dp"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"@dimen/text_1
0
"
/>
android:textSize=
"@dimen/text_1
2_5
"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/dialog_port_status.xml
0 → 100644
View file @
8e25ba8f
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:background=
"@color/black"
>
<ImageView
android:id=
"@+id/iv_close"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/ic_close"
android:padding=
"10dp"
android:layout_gravity=
"right"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_port_status"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_margin=
"10dp"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/item_port_status.xml
0 → 100644
View file @
8e25ba8f
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_status_info"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"25sp"
android:textColor=
"@color/red"
/>
</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