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 {
minSdk
24
targetSdk
32
versionCode
1
versionName
"1.0.
0
"
versionName
"1.0.
1
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
...
...
app/src/main/AndroidManifest.xml
View file @
1212e6be
<?xml version="1.0" encoding="utf-8"?>
<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.ACCESS_NETWORK_STATE"
/>
...
...
@@ -9,7 +9,6 @@
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- 安装APK权限,需要在程序中动态申请,并且不同于外部存储读写权限申请 -->
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<application
android:name=
".uis.MyApplication"
android:allowBackup=
"true"
...
...
@@ -23,14 +22,44 @@
android:supportsRtl=
"true"
android:theme=
"@style/Theme.StatInfo"
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
android:name=
"design_width_in_dp"
android:value=
"960"
/>
<meta-data
android:name=
"design_height_in_dp"
android:value=
"540"
/>
<!-- fileprovider名称在安装时传递给系统安装程序 -->
<!--<provider
<!--
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
...
...
@@ -38,46 +67,37 @@
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/autoupdate" />
</provider>-->
</provider>
-->
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"${applicationId}.fileProvider"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/file_paths"
/>
</provider>
<activity
android:name=
".uis.MainActivity"
android:name=
".uis.Main
Old
Activity"
android:configChanges=
"keyboardHidden|orientation"
android:exported=
"true"
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>
android:exported=
"false"
android:windowSoftInputMode=
"adjustPan"
>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
</activity>
<activity
android:name=
".uis.GroupActivity"
android:exported=
"false"
>
android:exported=
"false"
>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
</activity>
<activity
android:name=
".uis.FlashActivity"
android:exported=
"false"
>
android:exported=
"false"
>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
...
...
app/src/main/java/com/srthinker/statinfo/constant/Const.java
View file @
1212e6be
package
com
.
srthinker
.
statinfo
.
constant
;
import
com.srthinker.statinfo.util.common.FileUtil
;
public
class
Const
{
public
static
final
String
DEVICE_TYPE
=
"RC500"
;
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 {
mgrHashMap
.
clear
();
}
public
void
queryPersons
(
QueryPersonCallback
callback
){
public
boolean
queryPersons
(
QueryPersonCallback
callback
){
if
(
enterMgrHashMap
.
size
()>
0
){
ApiManager
oneEnterMgr
=
enterMgrHashMap
.
get
(
oneEnterIp
);
if
(
oneEnterMgr
!=
null
)
{
oneEnterMgr
.
queryPersons
();
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;
import
com.srthinker.statinfo.presenter.StatSize
;
import
com.srthinker.statinfo.uis.fragment.ConfigDlgFragment
;
import
com.srthinker.statinfo.update.MDownloadCallBack
;
import
com.srthinker.statinfo.update.NetworkViewModel
;
import
com.srthinker.statinfo.update.UpdateInfo
;
import
com.srthinker.statinfo.util.common.ClickUtil
;
import
com.srthinker.statinfo.util.common.FileUtil
;
...
...
@@ -74,7 +73,7 @@ import java.util.List;
import
java.util.Map
;
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
com
.
srthinker
.
statinfo
.
databinding
.
ActivityMainBinding
mBinding
;
...
...
@@ -204,10 +203,10 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
}
private
void
detectUpgrade
()
{
NetworkViewModel
networkViewModel
=
new
NetworkViewModel
();
/*
NetworkViewModel networkViewModel = new NetworkViewModel();
networkViewModel.init(this,this);
networkViewModel.setDownloadCallback(this);
networkViewModel
.
getLastestVersion
(
deviceSn
,
DEVICE_TYPE
);
networkViewModel.getLastestVersion(deviceSn,DEVICE_TYPE);
*/
}
private
void
checkAllPermission
()
{
...
...
@@ -341,7 +340,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
ThreadPool
.
getInstance
().
getThreadPoolExecutor
().
execute
(()
->
{
boolean
restricted
=
Utils
.
isRootPermissionRestricted
();
if
(!
restricted
){
Utils
.
clientInstall
(
installPath
,
Main
Activity
.
this
,
".uis.MainActivity"
);
Utils
.
clientInstall
(
installPath
,
MainOld
Activity
.
this
,
".uis.MainActivity"
);
}
else
{
Utils
.
installApp
(
getApplicationContext
(),
new
File
(
installPath
));
}
...
...
@@ -533,7 +532,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
runOnUiThread
(()->{
ClickUtil
.
enableClick
(
mBinding
.
btnGroupDetail
);
});
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
GroupActivity
.
class
);
Intent
intent
=
new
Intent
(
Main
Old
Activity
.
this
,
GroupActivity
.
class
);
startActivity
(
intent
);
});
...
...
app/src/main/java/com/srthinker/statinfo/update/BaseViewModel.kt
View file @
1212e6be
...
...
@@ -16,6 +16,7 @@ import java.util.concurrent.TimeUnit
abstract
class
BaseViewModel
:
ViewModel
()
{
lateinit
var
mContext
:
Context
//lateinit var mActivity: MainActivity
lateinit
var
mActivity
:
MainActivity
...
...
@@ -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
)
{
mContext
=
context
mActivity
=
mainActivity
...
...
app/src/main/java/com/srthinker/statinfo/update/NetworkViewModel.kt
View file @
1212e6be
...
...
@@ -29,6 +29,11 @@ class NetworkViewModel : BaseViewModel(),
private
val
thirdUrl
=
"http://139.9.78.104:8080/"
private
val
TAG
=
"lwl-DownloadViewModel"
/*override fun init(context: Context, mainActivity: MainActivity) {
super.init(context, mainActivity)
initData()
}*/
override
fun
init
(
context
:
Context
,
mainActivity
:
MainActivity
)
{
super
.
init
(
context
,
mainActivity
)
initData
()
...
...
app/src/main/java/com/srthinker/statinfo/util/common/SharedUtil.java
View file @
1212e6be
...
...
@@ -49,6 +49,11 @@ public class SharedUtil {
mEditor
.
commit
();
// 提交编辑器中的修改
}
public
void
writeShared
(
String
key
,
boolean
value
){
mEditor
.
putBoolean
(
key
,
value
);
mEditor
.
commit
();
}
public
void
writeShared
(
int
key
,
Object
obj
){
writeShared
(
String
.
valueOf
(
key
),
obj
);
}
...
...
@@ -97,6 +102,10 @@ public class SharedUtil {
return
mShared
.
getInt
(
key
,
defaultValue
);
}
public
boolean
readShared
(
String
key
,
boolean
defaultValue
){
return
mShared
.
getBoolean
(
key
,
defaultValue
);
}
//将String转化回对象
public
<
T
extends
Object
>
T
readSharedObject
(
String
key
,
Class
<
T
>
clazz
,
String
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;
import
android.text.InputType
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.util.TypedValue
;
import
android.view.WindowManager
;
import
android.widget.EditText
;
import
android.widget.Toast
;
...
...
@@ -91,6 +92,21 @@ public class Utils {
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
){
if
(
null
==
pFile
)
return
;
...
...
app/src/main/res/layout/activity_main.xml
View file @
1212e6be
...
...
@@ -8,7 +8,7 @@
android:focusableInTouchMode=
"true"
android:orientation=
"vertical"
android:background=
"@color/bg_070A2E"
tools:context=
".uis.MainActivity"
>
tools:context=
".uis.Main
Old
Activity"
>
<RelativeLayout
android:layout_width=
"939.59dp"
...
...
app/src/main/res/values/dimens.xml
View file @
1212e6be
...
...
@@ -11,4 +11,5 @@
<dimen
name=
"text_15"
>
15sp
</dimen>
<dimen
name=
"text_11"
>
11sp
</dimen>
<dimen
name=
"dlg_margin"
>
10dp
</dimen>
<dimen
name=
"display_text"
>
95sp
</dimen>
</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