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
da66d469
Commit
da66d469
authored
Sep 19, 2023
by
chenyuling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"设置设备型号为RC500"
parent
5a9a0890
Pipeline
#1567
canceled with stages
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
21 deletions
+96
-21
Const.java
app/src/main/java/com/srthinker/statinfo/constant/Const.java
+2
-1
BaseActivity.java
...rc/main/java/com/srthinker/statinfo/uis/BaseActivity.java
+2
-1
MainActivity.java
...rc/main/java/com/srthinker/statinfo/uis/MainActivity.java
+2
-1
ConfigDlgFragment.java
...om/srthinker/statinfo/uis/fragment/ConfigDlgFragment.java
+13
-11
StatusBarUtil.java
...ava/com/srthinker/statinfo/util/common/StatusBarUtil.java
+77
-7
No files found.
app/src/main/java/com/srthinker/statinfo/constant/Const.java
View file @
da66d469
package
com
.
srthinker
.
statinfo
.
constant
;
package
com
.
srthinker
.
statinfo
.
constant
;
public
class
Const
{
public
class
Const
{
public
static
final
String
DEVICE_TYPE
=
"RC13"
;
public
static
final
String
DEVICE_TYPE
=
"RC500"
;
public
static
final
String
SN_PATH
=
"/sdcard/devicesn/deviceSn.txt"
;
}
}
app/src/main/java/com/srthinker/statinfo/uis/BaseActivity.java
View file @
da66d469
...
@@ -29,7 +29,8 @@ public abstract class BaseActivity extends AppCompatActivity {
...
@@ -29,7 +29,8 @@ public abstract class BaseActivity extends AppCompatActivity {
Utils
.
autoSizeSwitch
(
this
);
Utils
.
autoSizeSwitch
(
this
);
}
}
protected
void
setStatusBar
()
{
protected
void
setStatusBar
()
{
StatusBarUtil
.
hideSystemUI
(
this
);
//StatusBarUtil.hideSystemUI(this);
StatusBarUtil
.
hideSystemNeverUI
(
this
,
1000
);
}
}
protected
abstract
void
initData
();
protected
abstract
void
initData
();
protected
abstract
void
initView
();
protected
abstract
void
initView
();
...
...
app/src/main/java/com/srthinker/statinfo/uis/MainActivity.java
View file @
da66d469
package
com
.
srthinker
.
statinfo
.
uis
;
package
com
.
srthinker
.
statinfo
.
uis
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
Const
.
DEVICE_TYPE
;
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
;
import
static
com
.
srthinker
.
statinfo
.
constant
.
GroupConst
.
BUILD_ID
;
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
;
...
@@ -121,7 +122,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -121,7 +122,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
@Override
@Override
protected
void
initData
()
{
protected
void
initData
()
{
//获取Sn
//获取Sn
deviceSn
=
FileUtil
.
readTextFromFile
(
"/sdcard/devicesn/deviceSn.txt"
);
deviceSn
=
FileUtil
.
readTextFromFile
(
SN_PATH
);
networkIPMonitor
=
new
NetworkIPMonitor
(
this
);
networkIPMonitor
=
new
NetworkIPMonitor
(
this
);
enterBeans
=
new
ArrayList
<>();
enterBeans
=
new
ArrayList
<>();
leaveBeans
=
new
ArrayList
<>();
leaveBeans
=
new
ArrayList
<>();
...
...
app/src/main/java/com/srthinker/statinfo/uis/fragment/ConfigDlgFragment.java
View file @
da66d469
...
@@ -129,6 +129,7 @@ public class ConfigDlgFragment extends DialogFragment {
...
@@ -129,6 +129,7 @@ public class ConfigDlgFragment extends DialogFragment {
String
account
=
mBinding
.
evAccount
.
getContent
();
String
account
=
mBinding
.
evAccount
.
getContent
();
String
password
=
mBinding
.
evPassword
.
getContent
();
String
password
=
mBinding
.
evPassword
.
getContent
();
String
serverIp
=
mBinding
.
evServerip
.
getContent
();
String
serverIp
=
mBinding
.
evServerip
.
getContent
();
if
(!
TextUtils
.
isEmpty
(
account
)||
!
TextUtils
.
isEmpty
(
password
)
||
checkAtLeastOneIp
()){
if
(
TextUtils
.
isEmpty
(
account
)){
if
(
TextUtils
.
isEmpty
(
account
)){
Utils
.
showTips
(
context
,
"请输入账号名!"
);
Utils
.
showTips
(
context
,
"请输入账号名!"
);
return
;
return
;
...
@@ -145,6 +146,7 @@ public class ConfigDlgFragment extends DialogFragment {
...
@@ -145,6 +146,7 @@ public class ConfigDlgFragment extends DialogFragment {
Utils
.
showTips
(
context
,
"请输入IP!"
);
Utils
.
showTips
(
context
,
"请输入IP!"
);
return
;
return
;
}
}
}
//List<ConfigBean> configBeanList = new ArrayList<>();
//List<ConfigBean> configBeanList = new ArrayList<>();
List
<
ConfigEntity
>
configEntities
=
new
ArrayList
<>();
List
<
ConfigEntity
>
configEntities
=
new
ArrayList
<>();
List
<
String
>
allDeviceIps
=
getAllDeviceIps
();
List
<
String
>
allDeviceIps
=
getAllDeviceIps
();
...
...
app/src/main/java/com/srthinker/statinfo/util/common/StatusBarUtil.java
View file @
da66d469
...
@@ -3,6 +3,7 @@ package com.srthinker.statinfo.util.common;
...
@@ -3,6 +3,7 @@ package com.srthinker.statinfo.util.common;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.view.Window
;
...
@@ -86,6 +87,8 @@ public class StatusBarUtil {
...
@@ -86,6 +87,8 @@ public class StatusBarUtil {
}
}
}
}
/**
/**
* 隐藏导航栏和状态栏
* 隐藏导航栏和状态栏
*
*
...
@@ -94,20 +97,87 @@ public class StatusBarUtil {
...
@@ -94,20 +97,87 @@ public class StatusBarUtil {
public
static
void
hideSystemUI
(
Activity
activity
)
{
public
static
void
hideSystemUI
(
Activity
activity
)
{
// 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏和状态栏
// 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏和状态栏
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
View
decorView
=
activity
.
getWindow
().
getDecorView
();
int
flags
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE
;
// 如果导航栏和状态栏已经可见,则隐藏它们
if
((
decorView
.
getSystemUiVisibility
()
&
flags
)
==
0
)
{
decorView
.
setSystemUiVisibility
(
flags
);
}
}
else
{
// 对于Android 4.0以下的设备,只隐藏标题栏
activity
.
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
}
}
/**
* 隐藏导航栏和状态栏,如果想随时都不显示的
*
* @param activity 当前活动
*/
public
static
void
hideSystemNeverUI
(
final
Activity
activity
,
long
delayMillis
)
{
// 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏和状态栏
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
final
View
decorView
=
activity
.
getWindow
().
getDecorView
();
final
int
flags
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE
;
decorView
.
setOnSystemUiVisibilityChangeListener
(
new
View
.
OnSystemUiVisibilityChangeListener
()
{
@Override
public
void
onSystemUiVisibilityChange
(
int
visibility
)
{
if
((
visibility
&
View
.
SYSTEM_UI_FLAG_FULLSCREEN
)
==
0
)
{
// 如果可见,则延迟隐藏状态栏和导航栏
//decorView.setSystemUiVisibility(flags);
new
Handler
().
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
decorView
.
setSystemUiVisibility
(
flags
);
}
},
delayMillis
);
}
}
});
// 设置全屏标志
// 设置全屏标志
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
decorView
.
setSystemUiVisibility
(
flags
);
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE
);
}
else
{
}
else
{
// 对于Android 4.0以下的设备,只隐藏标题栏
// 对于Android 4.0以下的设备,只隐藏标题栏
activity
.
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
activity
.
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
}
}
}
}
/**
* 只隐藏导航栏
*
* @param activity 当前活动
*/
public
static
void
hideNavigationBar
(
Activity
activity
)
{
// 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
View
decorView
=
activity
.
getWindow
().
getDecorView
();
int
flags
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE
;
// 如果导航栏已经可见,则隐藏它
if
((
decorView
.
getSystemUiVisibility
()
&
View
.
SYSTEM_UI_FLAG_HIDE_NAVIGATION
)
==
0
)
{
decorView
.
setSystemUiVisibility
(
flags
);
}
}
}
/**
/**
* 显示导航栏和状态栏
* 显示导航栏和状态栏
*
*
...
...
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