Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StatInfo
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
Commits
9dbc275a
Commit
9dbc275a
authored
Aug 03, 2023
by
chenyuling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改弹窗
parent
a9b5d040
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
274 additions
and
21 deletions
+274
-21
vcs.xml
.idea/vcs.xml
+6
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+12
-1
OkhttpInterruptDownImpl.java
.../srthinker/statinfo/download/OkhttpInterruptDownImpl.java
+1
-0
MainActivity.java
...rc/main/java/com/srthinker/statinfo/uis/MainActivity.java
+23
-9
Utils.java
...c/main/java/com/srthinker/statinfo/util/common/Utils.java
+223
-1
LoadDialog.java
...c/main/java/com/srthinker/statinfo/wedget/LoadDialog.java
+5
-10
file_paths.xml
app/src/main/res/xml/file_paths.xml
+4
-0
No files found.
.idea/vcs.xml
0 → 100644
View file @
9dbc275a
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
9dbc275a
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- 安装APK权限,需要在程序中动态申请,并且不同于外部存储读写权限申请 -->
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- 安装APK权限,需要在程序中动态申请,并且不同于外部存储读写权限申请 -->
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<application
<application
android:name=
".uis.MyApplication"
android:name=
".uis.MyApplication"
android:allowBackup=
"true"
android:allowBackup=
"true"
...
@@ -29,7 +30,7 @@
...
@@ -29,7 +30,7 @@
<meta-data
<meta-data
android:name=
"design_height_in_dp"
android:name=
"design_height_in_dp"
android:value=
"540"
/>
<!-- fileprovider名称在安装时传递给系统安装程序 -->
android:value=
"540"
/>
<!-- fileprovider名称在安装时传递给系统安装程序 -->
<provider
<
!--<
provider
android:name="androidx.core.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:exported="false"
...
@@ -37,8 +38,18 @@
...
@@ -37,8 +38,18 @@
<meta-data
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/autoupdate" />
android:resource="@xml/autoupdate" />
</provider>-->
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"${applicationId}.fileProvider"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/file_paths"
/>
</provider>
</provider>
<activity
<activity
android:name=
".uis.MainActivity"
android:name=
".uis.MainActivity"
android:configChanges=
"keyboardHidden|orientation"
android:configChanges=
"keyboardHidden|orientation"
...
...
app/src/main/java/com/srthinker/statinfo/download/OkhttpInterruptDownImpl.java
View file @
9dbc275a
...
@@ -18,6 +18,7 @@ public class OkhttpInterruptDownImpl extends BaseDownloadImpl{
...
@@ -18,6 +18,7 @@ public class OkhttpInterruptDownImpl extends BaseDownloadImpl{
private
FileOutputStream
fos
;
private
FileOutputStream
fos
;
private
InputStream
inputStream
;
private
InputStream
inputStream
;
private
Call
call
;
private
Call
call
;
private
String
TAG
=
"OkhttpInterruptDownImpl"
;
public
static
OkhttpInterruptDownImpl
getInstance
(){
public
static
OkhttpInterruptDownImpl
getInstance
(){
if
(
down
==
null
)
{
if
(
down
==
null
)
{
...
...
app/src/main/java/com/srthinker/statinfo/uis/MainActivity.java
View file @
9dbc275a
...
@@ -97,6 +97,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -97,6 +97,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
private
HashMap
<
Integer
,
Integer
>
groupEnterHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupEnterHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupLeaveHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupPresentHashMap
=
null
;
private
HashMap
<
Integer
,
Integer
>
groupPresentHashMap
=
null
;
private
boolean
isPermission
;
@Override
@Override
...
@@ -139,7 +140,8 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -139,7 +140,8 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
updateTime
();
updateTime
();
initGroup
();
initGroup
();
initPeopleList
();
initPeopleList
();
mLoadDialog
=
LoadDialog
.
getInstance
(
this
);
//mLoadDialog = LoadDialog.getInstance(this);
mLoadDialog
=
new
LoadDialog
(
this
);
//Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this));
//Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this));
mBinding
.
tvDeviceDesc
.
setText
(
DEVICE_TYPE
+
" "
+
deviceSn
+
" V"
+
Utils
.
getVersionName
(
this
));
mBinding
.
tvDeviceDesc
.
setText
(
DEVICE_TYPE
+
" "
+
deviceSn
+
" V"
+
Utils
.
getVersionName
(
this
));
//getResp();
//getResp();
...
@@ -202,7 +204,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -202,7 +204,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
}
}
private
void
checkAllPermission
()
{
private
void
checkAllPermission
()
{
boolean
isPermission
=
PermissionUtil
.
checkMultiPermission
(
this
,
new
String
[]{
isPermission
=
PermissionUtil
.
checkMultiPermission
(
this
,
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
INTERNET
Manifest
.
permission
.
INTERNET
...
@@ -301,7 +303,9 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -301,7 +303,9 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
runOnUiThread
(()->{
runOnUiThread
(()->{
//Log.i(TAG, "onProgress: progress="+progress);
//Log.i(TAG, "onProgress: progress="+progress);
String
desc
=
"下载更新中..."
+
progress
;
String
desc
=
"下载更新中..."
+
progress
;
if
(
mLoadDialog
!=
null
)
{
mLoadDialog
.
setContent
(
desc
);
mLoadDialog
.
setContent
(
desc
);
}
});
});
}
}
...
@@ -310,16 +314,26 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -310,16 +314,26 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
if
(
downStatus
==
DOWN_START
){
if
(
downStatus
==
DOWN_START
){
runOnUiThread
(()->{
runOnUiThread
(()->{
String
desc
=
"准备下载更新"
;
String
desc
=
"准备下载更新"
;
if
(
mLoadDialog
!=
null
)
{
mLoadDialog
.
setContent
(
desc
);
mLoadDialog
.
setContent
(
desc
);
mLoadDialog
.
show
();
mLoadDialog
.
show
();
}
});
});
}
else
if
(
downStatus
==
DOWN_FINISH
){
}
else
if
(
downStatus
==
DOWN_FINISH
){
//安装更新
//安装更新
//Log.i(TAG, "onResult:进来多少次");
runOnUiThread
(()->{
runOnUiThread
(()->{
if
(
mLoadDialog
!=
null
)
{
mLoadDialog
.
dismiss
();
mLoadDialog
.
dismiss
();
showTips
(
"更新版本,请进行安装"
);
}
showTips
(
"更新版本,将进行安装"
);
boolean
restricted
=
Utils
.
isRootPermissionRestricted
();
if
(!
restricted
){
Utils
.
clientInstall
(
installPath
,
MainActivity
.
this
);
}
else
{
Utils
.
installApp
(
getApplicationContext
(),
new
File
(
installPath
));
Utils
.
installApp
(
getApplicationContext
(),
new
File
(
installPath
));
}
});
});
...
@@ -489,7 +503,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -489,7 +503,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
@Override
@Override
public
void
onQueryStatus
(
String
desc
,
boolean
status
)
{
public
void
onQueryStatus
(
String
desc
,
boolean
status
)
{
runOnUiThread
(()->{
runOnUiThread
(()->{
if
(
status
==
false
){
if
(
!
status
){
showTips
(
desc
);
showTips
(
desc
);
}
}
});
});
...
...
app/src/main/java/com/srthinker/statinfo/util/common/Utils.java
View file @
9dbc275a
This diff is collapsed.
Click to expand it.
app/src/main/java/com/srthinker/statinfo/wedget/LoadDialog.java
View file @
9dbc275a
...
@@ -27,14 +27,14 @@ public class LoadDialog extends Dialog {
...
@@ -27,14 +27,14 @@ public class LoadDialog extends Dialog {
initWindow
();
initWindow
();
}
}
public
static
LoadDialog
getInstance
(
Context
context
){
/*
public static LoadDialog getInstance(Context context){
if (loadDialog == null) {
if (loadDialog == null) {
synchronized (LoadDialog.class){
synchronized (LoadDialog.class){
loadDialog = new LoadDialog(context);
loadDialog = new LoadDialog(context);
}
}
}
}
return loadDialog;
return loadDialog;
}
}
*/
private
void
initWindow
()
{
private
void
initWindow
()
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
...
@@ -47,15 +47,10 @@ public class LoadDialog extends Dialog {
...
@@ -47,15 +47,10 @@ public class LoadDialog extends Dialog {
setCanceledOnTouchOutside
(
false
);
setCanceledOnTouchOutside
(
false
);
}
}
/*public void showDialog(){
show();
}
public void closeDialog(){
dismiss();
}*/
public
void
setContent
(
String
content
){
public
void
setContent
(
String
content
){
binding
.
tvLoadInfo
.
setText
(
content
);
binding
.
tvLoadInfo
.
setText
(
content
);
}
}
}
}
app/src/main/res/xml/file_paths.xml
0 → 100644
View file @
9dbc275a
<?xml version="1.0" encoding="utf-8"?>
<paths
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<external-path
name=
"external_files"
path=
"."
/>
</paths>
\ 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