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
1212e6be
Commit
1212e6be
authored
Sep 26, 2023
by
chenyuling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"更换UI"
parent
da66d469
Pipeline
#1619
canceled with stages
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
91 additions
and
30 deletions
+91
-30
build.gradle
app/build.gradle
+1
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+41
-21
Const.java
app/src/main/java/com/srthinker/statinfo/constant/Const.java
+3
-0
ApiQuest.java
.../main/java/com/srthinker/statinfo/presenter/ApiQuest.java
+3
-1
MainOldActivity.java
...main/java/com/srthinker/statinfo/uis/MainOldActivity.java
+5
-6
BaseViewModel.kt
.../main/java/com/srthinker/statinfo/update/BaseViewModel.kt
+6
-0
NetworkViewModel.kt
...in/java/com/srthinker/statinfo/update/NetworkViewModel.kt
+5
-0
SharedUtil.java
...n/java/com/srthinker/statinfo/util/common/SharedUtil.java
+9
-0
Utils.java
...c/main/java/com/srthinker/statinfo/util/common/Utils.java
+16
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-1
dimens.xml
app/src/main/res/values/dimens.xml
+1
-0
No files found.
app/build.gradle
View file @
1212e6be
...
@@ -20,7 +20,7 @@ android {
...
@@ -20,7 +20,7 @@ android {
minSdk
24
minSdk
24
targetSdk
32
targetSdk
32
versionCode
1
versionCode
1
versionName
"1.0.
0
"
versionName
"1.0.
1
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
}
...
...
app/src/main/AndroidManifest.xml
View file @
1212e6be
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
>
xmlns:tools=
"http://schemas.android.com/tools"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
<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"
...
@@ -23,14 +22,44 @@
...
@@ -23,14 +22,44 @@
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.StatInfo"
android:theme=
"@style/Theme.StatInfo"
android:usesCleartextTraffic=
"true"
android:usesCleartextTraffic=
"true"
tools:targetApi=
"31"
>
tools:targetApi=
"31"
>
<activity
android:name=
".uis.news.SettingActivity"
android:configChanges=
"keyboardHidden|orientation"
android:exported=
"false"
android:windowSoftInputMode=
"adjustPan"
>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
</activity>
<activity
android:name=
".uis.MainActivity"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<!--
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
-->
</intent-filter>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
</activity>
<meta-data
<meta-data
android:name=
"design_width_in_dp"
android:name=
"design_width_in_dp"
android:value=
"960"
/>
android:value=
"960"
/>
<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"
...
@@ -38,46 +67,37 @@
...
@@ -38,46 +67,37 @@
<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>
-->
<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"
android:grantUriPermissions=
"true"
>
android:grantUriPermissions=
"true"
>
<meta-data
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/file_paths"
/>
android:resource=
"@xml/file_paths"
/>
</provider>
</provider>
<activity
<activity
android:name=
".uis.MainActivity"
android:name=
".uis.Main
Old
Activity"
android:configChanges=
"keyboardHidden|orientation"
android:configChanges=
"keyboardHidden|orientation"
android:exported=
"true"
android:exported=
"false"
android:windowSoftInputMode=
"adjustPan"
>
android:windowSoftInputMode=
"adjustPan"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<!--<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />-->
</intent-filter>
<meta-data
<meta-data
android:name=
"android.app.lib_name"
android:name=
"android.app.lib_name"
android:value=
""
/>
android:value=
""
/>
</activity>
</activity>
<activity
<activity
android:name=
".uis.GroupActivity"
android:name=
".uis.GroupActivity"
android:exported=
"false"
>
android:exported=
"false"
>
<meta-data
<meta-data
android:name=
"android.app.lib_name"
android:name=
"android.app.lib_name"
android:value=
""
/>
android:value=
""
/>
</activity>
</activity>
<activity
<activity
android:name=
".uis.FlashActivity"
android:name=
".uis.FlashActivity"
android:exported=
"false"
>
android:exported=
"false"
>
<meta-data
<meta-data
android:name=
"android.app.lib_name"
android:name=
"android.app.lib_name"
android:value=
""
/>
android:value=
""
/>
...
...
app/src/main/java/com/srthinker/statinfo/constant/Const.java
View file @
1212e6be
package
com
.
srthinker
.
statinfo
.
constant
;
package
com
.
srthinker
.
statinfo
.
constant
;
import
com.srthinker.statinfo.util.common.FileUtil
;
public
class
Const
{
public
class
Const
{
public
static
final
String
DEVICE_TYPE
=
"RC500"
;
public
static
final
String
DEVICE_TYPE
=
"RC500"
;
public
static
final
String
SN_PATH
=
"/sdcard/devicesn/deviceSn.txt"
;
public
static
final
String
SN_PATH
=
"/sdcard/devicesn/deviceSn.txt"
;
public
static
final
String
DEVICE_SN
=
FileUtil
.
readTextFromFile
(
SN_PATH
);
}
}
app/src/main/java/com/srthinker/statinfo/presenter/ApiQuest.java
View file @
1212e6be
...
@@ -235,13 +235,15 @@ public class ApiQuest {
...
@@ -235,13 +235,15 @@ public class ApiQuest {
mgrHashMap
.
clear
();
mgrHashMap
.
clear
();
}
}
public
void
queryPersons
(
QueryPersonCallback
callback
){
public
boolean
queryPersons
(
QueryPersonCallback
callback
){
if
(
enterMgrHashMap
.
size
()>
0
){
if
(
enterMgrHashMap
.
size
()>
0
){
ApiManager
oneEnterMgr
=
enterMgrHashMap
.
get
(
oneEnterIp
);
ApiManager
oneEnterMgr
=
enterMgrHashMap
.
get
(
oneEnterIp
);
if
(
oneEnterMgr
!=
null
)
{
if
(
oneEnterMgr
!=
null
)
{
oneEnterMgr
.
queryPersons
();
oneEnterMgr
.
queryPersons
();
oneEnterMgr
.
setOnQueryPersonsCallback
(
callback
);
oneEnterMgr
.
setOnQueryPersonsCallback
(
callback
);
return
true
;
}
}
}
}
return
false
;
}
}
}
}
app/src/main/java/com/srthinker/statinfo/uis/MainActivity.java
→
app/src/main/java/com/srthinker/statinfo/uis/Main
Old
Activity.java
View file @
1212e6be
...
@@ -55,7 +55,6 @@ import com.srthinker.statinfo.presenter.RealTimeClock;
...
@@ -55,7 +55,6 @@ import com.srthinker.statinfo.presenter.RealTimeClock;
import
com.srthinker.statinfo.presenter.StatSize
;
import
com.srthinker.statinfo.presenter.StatSize
;
import
com.srthinker.statinfo.uis.fragment.ConfigDlgFragment
;
import
com.srthinker.statinfo.uis.fragment.ConfigDlgFragment
;
import
com.srthinker.statinfo.update.MDownloadCallBack
;
import
com.srthinker.statinfo.update.MDownloadCallBack
;
import
com.srthinker.statinfo.update.NetworkViewModel
;
import
com.srthinker.statinfo.update.UpdateInfo
;
import
com.srthinker.statinfo.update.UpdateInfo
;
import
com.srthinker.statinfo.util.common.ClickUtil
;
import
com.srthinker.statinfo.util.common.ClickUtil
;
import
com.srthinker.statinfo.util.common.FileUtil
;
import
com.srthinker.statinfo.util.common.FileUtil
;
...
@@ -74,7 +73,7 @@ import java.util.List;
...
@@ -74,7 +73,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.ScheduledExecutorService
;
public
class
MainActivity
extends
BaseActivity
implements
OnTimeUpdateListener
,
MDownloadCallBack
,
UpperDownloadCallback
,
NetworkIPMonitor
.
OnIPChangeCallback
,
ConfigCallback
,
QueryPersonCallback
,
UpperDevicesCallback
{
public
class
Main
Old
Activity
extends
BaseActivity
implements
OnTimeUpdateListener
,
MDownloadCallBack
,
UpperDownloadCallback
,
NetworkIPMonitor
.
OnIPChangeCallback
,
ConfigCallback
,
QueryPersonCallback
,
UpperDevicesCallback
{
private
static
final
String
TAG
=
"MainActivity"
;
private
static
final
String
TAG
=
"MainActivity"
;
private
com
.
srthinker
.
statinfo
.
databinding
.
ActivityMainBinding
mBinding
;
private
com
.
srthinker
.
statinfo
.
databinding
.
ActivityMainBinding
mBinding
;
...
@@ -204,10 +203,10 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -204,10 +203,10 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
}
}
private
void
detectUpgrade
()
{
private
void
detectUpgrade
()
{
NetworkViewModel
networkViewModel
=
new
NetworkViewModel
();
/*
NetworkViewModel networkViewModel = new NetworkViewModel();
networkViewModel.init(this,this);
networkViewModel.init(this,this);
networkViewModel.setDownloadCallback(this);
networkViewModel.setDownloadCallback(this);
networkViewModel
.
getLastestVersion
(
deviceSn
,
DEVICE_TYPE
);
networkViewModel.getLastestVersion(deviceSn,DEVICE_TYPE);
*/
}
}
private
void
checkAllPermission
()
{
private
void
checkAllPermission
()
{
...
@@ -341,7 +340,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -341,7 +340,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
ThreadPool
.
getInstance
().
getThreadPoolExecutor
().
execute
(()
->
{
ThreadPool
.
getInstance
().
getThreadPoolExecutor
().
execute
(()
->
{
boolean
restricted
=
Utils
.
isRootPermissionRestricted
();
boolean
restricted
=
Utils
.
isRootPermissionRestricted
();
if
(!
restricted
){
if
(!
restricted
){
Utils
.
clientInstall
(
installPath
,
Main
Activity
.
this
,
".uis.MainActivity"
);
Utils
.
clientInstall
(
installPath
,
MainOld
Activity
.
this
,
".uis.MainActivity"
);
}
else
{
}
else
{
Utils
.
installApp
(
getApplicationContext
(),
new
File
(
installPath
));
Utils
.
installApp
(
getApplicationContext
(),
new
File
(
installPath
));
}
}
...
@@ -533,7 +532,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
...
@@ -533,7 +532,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
runOnUiThread
(()->{
runOnUiThread
(()->{
ClickUtil
.
enableClick
(
mBinding
.
btnGroupDetail
);
ClickUtil
.
enableClick
(
mBinding
.
btnGroupDetail
);
});
});
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
GroupActivity
.
class
);
Intent
intent
=
new
Intent
(
Main
Old
Activity
.
this
,
GroupActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
});
});
...
...
app/src/main/java/com/srthinker/statinfo/update/BaseViewModel.kt
View file @
1212e6be
...
@@ -16,6 +16,7 @@ import java.util.concurrent.TimeUnit
...
@@ -16,6 +16,7 @@ import java.util.concurrent.TimeUnit
abstract
class
BaseViewModel
:
ViewModel
()
{
abstract
class
BaseViewModel
:
ViewModel
()
{
lateinit
var
mContext
:
Context
lateinit
var
mContext
:
Context
//lateinit var mActivity: MainActivity
lateinit
var
mActivity
:
MainActivity
lateinit
var
mActivity
:
MainActivity
...
@@ -34,6 +35,11 @@ abstract class BaseViewModel : ViewModel() {
...
@@ -34,6 +35,11 @@ abstract class BaseViewModel : ViewModel() {
)
)
/*open fun init(context: Context, mainActivity: MainActivity) {
mContext = context
mActivity = mainActivity
}*/
open
fun
init
(
context
:
Context
,
mainActivity
:
MainActivity
)
{
open
fun
init
(
context
:
Context
,
mainActivity
:
MainActivity
)
{
mContext
=
context
mContext
=
context
mActivity
=
mainActivity
mActivity
=
mainActivity
...
...
app/src/main/java/com/srthinker/statinfo/update/NetworkViewModel.kt
View file @
1212e6be
...
@@ -29,6 +29,11 @@ class NetworkViewModel : BaseViewModel(),
...
@@ -29,6 +29,11 @@ class NetworkViewModel : BaseViewModel(),
private
val
thirdUrl
=
"http://139.9.78.104:8080/"
private
val
thirdUrl
=
"http://139.9.78.104:8080/"
private
val
TAG
=
"lwl-DownloadViewModel"
private
val
TAG
=
"lwl-DownloadViewModel"
/*override fun init(context: Context, mainActivity: MainActivity) {
super.init(context, mainActivity)
initData()
}*/
override
fun
init
(
context
:
Context
,
mainActivity
:
MainActivity
)
{
override
fun
init
(
context
:
Context
,
mainActivity
:
MainActivity
)
{
super
.
init
(
context
,
mainActivity
)
super
.
init
(
context
,
mainActivity
)
initData
()
initData
()
...
...
app/src/main/java/com/srthinker/statinfo/util/common/SharedUtil.java
View file @
1212e6be
...
@@ -49,6 +49,11 @@ public class SharedUtil {
...
@@ -49,6 +49,11 @@ public class SharedUtil {
mEditor
.
commit
();
// 提交编辑器中的修改
mEditor
.
commit
();
// 提交编辑器中的修改
}
}
public
void
writeShared
(
String
key
,
boolean
value
){
mEditor
.
putBoolean
(
key
,
value
);
mEditor
.
commit
();
}
public
void
writeShared
(
int
key
,
Object
obj
){
public
void
writeShared
(
int
key
,
Object
obj
){
writeShared
(
String
.
valueOf
(
key
),
obj
);
writeShared
(
String
.
valueOf
(
key
),
obj
);
}
}
...
@@ -97,6 +102,10 @@ public class SharedUtil {
...
@@ -97,6 +102,10 @@ public class SharedUtil {
return
mShared
.
getInt
(
key
,
defaultValue
);
return
mShared
.
getInt
(
key
,
defaultValue
);
}
}
public
boolean
readShared
(
String
key
,
boolean
defaultValue
){
return
mShared
.
getBoolean
(
key
,
defaultValue
);
}
//将String转化回对象
//将String转化回对象
public
<
T
extends
Object
>
T
readSharedObject
(
String
key
,
Class
<
T
>
clazz
,
String
defaultValue
){
public
<
T
extends
Object
>
T
readSharedObject
(
String
key
,
Class
<
T
>
clazz
,
String
defaultValue
){
String
readString
=
readShared
(
key
,
defaultValue
);
String
readString
=
readShared
(
key
,
defaultValue
);
...
...
app/src/main/java/com/srthinker/statinfo/util/common/Utils.java
View file @
1212e6be
...
@@ -12,6 +12,7 @@ import android.provider.Settings;
...
@@ -12,6 +12,7 @@ import android.provider.Settings;
import
android.text.InputType
;
import
android.text.InputType
;
import
android.util.DisplayMetrics
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.util.Log
;
import
android.util.TypedValue
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -91,6 +92,21 @@ public class Utils {
...
@@ -91,6 +92,21 @@ public class Utils {
return
dm
.
density
;
// 返回屏幕的像素密度数值
return
dm
.
density
;
// 返回屏幕的像素密度数值
}
}
//根据高度和行数设置字体大小
public
static
float
calculateTextSize
(
Context
ctx
,
int
line
){
int
screenHeight
=
getScreenHeight
(
ctx
);
if
(
line
>
0
)
{
int
lineHeight
=
screenHeight
/
line
;
TypedValue
typedValue
=
new
TypedValue
();
typedValue
.
density
=
(
int
)
ctx
.
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_PX
,
lineHeight
,
ctx
.
getResources
().
getDisplayMetrics
());
}
else
{
return
0
;
}
}
public
static
void
installApp
(
Context
pContext
,
File
pFile
){
public
static
void
installApp
(
Context
pContext
,
File
pFile
){
if
(
null
==
pFile
)
if
(
null
==
pFile
)
return
;
return
;
...
...
app/src/main/res/layout/activity_main.xml
View file @
1212e6be
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
android:focusableInTouchMode=
"true"
android:focusableInTouchMode=
"true"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:background=
"@color/bg_070A2E"
android:background=
"@color/bg_070A2E"
tools:context=
".uis.MainActivity"
>
tools:context=
".uis.Main
Old
Activity"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"939.59dp"
android:layout_width=
"939.59dp"
...
...
app/src/main/res/values/dimens.xml
View file @
1212e6be
...
@@ -11,4 +11,5 @@
...
@@ -11,4 +11,5 @@
<dimen
name=
"text_15"
>
15sp
</dimen>
<dimen
name=
"text_15"
>
15sp
</dimen>
<dimen
name=
"text_11"
>
11sp
</dimen>
<dimen
name=
"text_11"
>
11sp
</dimen>
<dimen
name=
"dlg_margin"
>
10dp
</dimen>
<dimen
name=
"dlg_margin"
>
10dp
</dimen>
<dimen
name=
"display_text"
>
95sp
</dimen>
</resources>
</resources>
\ 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