Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
A
appzxhy
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
appzxhy
Commits
9de782f1
Commit
9de782f1
authored
Jun 25, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[新功能]设备信息
parent
aaf58ba6
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
743 additions
and
5 deletions
+743
-5
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+10
-0
BaseActivity.kt
app/src/main/java/com/base/appzxhy/base/BaseActivity.kt
+6
-0
DeviceInfoBean.kt
app/src/main/java/com/base/appzxhy/bean/DeviceInfoBean.kt
+24
-0
DeviceInfoActivity.kt
...java/com/base/appzxhy/ui/deviceinfo/DeviceInfoActivity.kt
+77
-0
DeviceInfoDetailActivity.kt
...om/base/appzxhy/ui/deviceinfo/DeviceInfoDetailActivity.kt
+355
-0
HomeFragment.kt
app/src/main/java/com/base/appzxhy/ui/main/HomeFragment.kt
+2
-4
slide_in_left.xml
app/src/main/res/anim/slide_in_left.xml
+7
-0
slide_in_right.xml
app/src/main/res/anim/slide_in_right.xml
+7
-0
slide_out_left.xml
app/src/main/res/anim/slide_out_left.xml
+7
-0
slide_out_right.xml
app/src/main/res/anim/slide_out_right.xml
+7
-0
icon_battery.png
app/src/main/res/drawable-xxhdpi/icon_battery.png
+0
-0
icon_camera.png
app/src/main/res/drawable-xxhdpi/icon_camera.png
+0
-0
icon_device_info_big.png
app/src/main/res/drawable-xxhdpi/icon_device_info_big.png
+0
-0
icon_display.png
app/src/main/res/drawable-xxhdpi/icon_display.png
+0
-0
icon_processor.png
app/src/main/res/drawable-xxhdpi/icon_processor.png
+0
-0
icon_ram.png
app/src/main/res/drawable-xxhdpi/icon_ram.png
+0
-0
icon_rom.png
app/src/main/res/drawable-xxhdpi/icon_rom.png
+0
-0
icon_shouji.png
app/src/main/res/drawable-xxhdpi/icon_shouji.png
+0
-0
icon_wifi.png
app/src/main/res/drawable-xxhdpi/icon_wifi.png
+0
-0
bg_ffffff_tlr24.xml
app/src/main/res/drawable/bg_ffffff_tlr24.xml
+8
-0
activity_device_info.xml
app/src/main/res/layout/activity_device_info.xml
+71
-0
activity_device_info_detail.xml
app/src/main/res/layout/activity_device_info_detail.xml
+71
-0
activity_splash.xml
app/src/main/res/layout/activity_splash.xml
+1
-1
item_device_detail.xml
app/src/main/res/layout/item_device_detail.xml
+38
-0
item_device_information.xml
app/src/main/res/layout/item_device_information.xml
+42
-0
dimens.xml
app/src/main/res/values/dimens.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+8
-0
themes.xml
app/src/main/res/values/themes.xml
+1
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
9de782f1
...
@@ -135,6 +135,16 @@
...
@@ -135,6 +135,16 @@
android:exported=
"false"
android:exported=
"false"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.deviceinfo.DeviceInfoActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.deviceinfo.DeviceInfoDetailActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<provider
<provider
android:name=
"androidx.core.content.FileProvider"
android:name=
"androidx.core.content.FileProvider"
...
...
app/src/main/java/com/base/appzxhy/base/BaseActivity.kt
View file @
9de782f1
...
@@ -34,6 +34,7 @@ import com.base.appzxhy.SpConstObject.appLanguageSp
...
@@ -34,6 +34,7 @@ import com.base.appzxhy.SpConstObject.appLanguageSp
import
com.base.appzxhy.R
import
com.base.appzxhy.R
import
com.base.appzxhy.SpConstObject.cleanedSize
import
com.base.appzxhy.SpConstObject.cleanedSize
import
com.base.appzxhy.bean.FeatureBean.Companion.BATTERY_INFO
import
com.base.appzxhy.bean.FeatureBean.Companion.BATTERY_INFO
import
com.base.appzxhy.bean.FeatureBean.Companion.DEVICE_INFO
import
com.base.appzxhy.bean.FeatureBean.Companion.JUNK_CLEAN
import
com.base.appzxhy.bean.FeatureBean.Companion.JUNK_CLEAN
import
com.base.appzxhy.bean.FeatureBean.Companion.LARGE_FILE_CLEAN
import
com.base.appzxhy.bean.FeatureBean.Companion.LARGE_FILE_CLEAN
import
com.base.appzxhy.bean.FeatureBean.Companion.PHOTO_COMPRESSION
import
com.base.appzxhy.bean.FeatureBean.Companion.PHOTO_COMPRESSION
...
@@ -49,6 +50,7 @@ import com.base.appzxhy.business.helper.EventUtils
...
@@ -49,6 +50,7 @@ import com.base.appzxhy.business.helper.EventUtils
import
com.base.appzxhy.ui.appuninstall.AppUninstallActivity
import
com.base.appzxhy.ui.appuninstall.AppUninstallActivity
import
com.base.appzxhy.ui.batteryinfo.BatteryInfoActivity
import
com.base.appzxhy.ui.batteryinfo.BatteryInfoActivity
import
com.base.appzxhy.ui.clean.JunkCleanActivity
import
com.base.appzxhy.ui.clean.JunkCleanActivity
import
com.base.appzxhy.ui.deviceinfo.DeviceInfoActivity
import
com.base.appzxhy.ui.dialog.FunctionBackDialog
import
com.base.appzxhy.ui.dialog.FunctionBackDialog
import
com.base.appzxhy.ui.largefile.LargeFileCleanActivity
import
com.base.appzxhy.ui.largefile.LargeFileCleanActivity
import
com.base.appzxhy.ui.main.MainActivity
import
com.base.appzxhy.ui.main.MainActivity
...
@@ -457,6 +459,10 @@ fun Activity.jumpAction(key: String) {
...
@@ -457,6 +459,10 @@ fun Activity.jumpAction(key: String) {
UNINSTALL_APP
->
{
UNINSTALL_APP
->
{
goToAc
(
AppUninstallActivity
::
class
.
java
)
goToAc
(
AppUninstallActivity
::
class
.
java
)
}
}
DEVICE_INFO
->
{
goToAc
(
DeviceInfoActivity
::
class
.
java
)
}
}
}
}
}
...
...
app/src/main/java/com/base/appzxhy/bean/DeviceInfoBean.kt
0 → 100644
View file @
9de782f1
package
com.base.appzxhy.bean
data class
DeviceInfoBean
(
val
key
:
String
,
val
iconRes
:
Int
=
0
,
val
titleRes
:
Int
=
0
,
val
value
:
String
=
""
,
)
{
companion
object
{
const
val
DEVICE_INFORMATION
=
"device information"
const
val
PROCESSOR_INFORMATION
=
"processor information"
const
val
WIFI_INFORMATION
=
"wifi information"
const
val
DISPLAY_INFORMATION
=
"display information"
const
val
RAM_INFORMATION
=
"ram information"
const
val
ROM_INFORMATION
=
"rom information"
const
val
CAMERA_INFORMATION
=
"camera information"
const
val
BATTERY_INFORMATION
=
"battery information"
}
}
data class
DeviceDetailBean
(
val
title
:
String
,
var
value
:
String
)
app/src/main/java/com/base/appzxhy/ui/deviceinfo/DeviceInfoActivity.kt
0 → 100644
View file @
9de782f1
package
com.base.appzxhy.ui.deviceinfo
import
android.content.Context
import
android.view.ViewGroup
import
com.base.appzxhy.R
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.bean.DeviceInfoBean
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.BATTERY_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.CAMERA_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.DEVICE_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.DISPLAY_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.PROCESSOR_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.RAM_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.ROM_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.WIFI_INFORMATION
import
com.base.appzxhy.databinding.ActivityDeviceInfoBinding
import
com.base.appzxhy.databinding.ItemDeviceInformationBinding
import
com.base.appzxhy.ui.adapter.CommonViewHolder
import
com.base.appzxhy.ui.deviceinfo.DeviceInfoDetailActivity.Companion.DeviceInfoKey
import
com.base.appzxhy.utils.XmlEx.inflate
import
com.chad.library.adapter4.BaseQuickAdapter
class
DeviceInfoActivity
:
BaseActivity
<
ActivityDeviceInfoBinding
>(
ActivityDeviceInfoBinding
::
inflate
)
{
private
val
list
by
lazy
{
listOf
(
DeviceInfoBean
(
DEVICE_INFORMATION
,
R
.
drawable
.
icon_shouji
,
R
.
string
.
device_information
),
DeviceInfoBean
(
PROCESSOR_INFORMATION
,
R
.
drawable
.
icon_processor
,
R
.
string
.
processor_information
),
DeviceInfoBean
(
BATTERY_INFORMATION
,
R
.
drawable
.
icon_battery
,
R
.
string
.
battery_information
),
DeviceInfoBean
(
WIFI_INFORMATION
,
R
.
drawable
.
icon_wifi
,
R
.
string
.
wifi_information
),
DeviceInfoBean
(
DISPLAY_INFORMATION
,
R
.
drawable
.
icon_display
,
R
.
string
.
display_information
),
DeviceInfoBean
(
RAM_INFORMATION
,
R
.
drawable
.
icon_ram
,
R
.
string
.
ram_information
),
DeviceInfoBean
(
ROM_INFORMATION
,
R
.
drawable
.
icon_rom
,
R
.
string
.
rom_information
),
DeviceInfoBean
(
CAMERA_INFORMATION
,
R
.
drawable
.
icon_camera
,
R
.
string
.
camera_information
),
)
}
val
adapter
=
object
:
BaseQuickAdapter
<
DeviceInfoBean
,
CommonViewHolder
>()
{
override
fun
onBindViewHolder
(
holder
:
CommonViewHolder
,
position
:
Int
,
item
:
DeviceInfoBean
?
)
{
item
?:
return
val
itemBinding
=
ItemDeviceInformationBinding
.
bind
(
holder
.
itemView
)
itemBinding
.
ivIcon
.
setImageResource
(
item
.
iconRes
)
itemBinding
.
tv
.
setText
(
item
.
titleRes
)
itemBinding
.
root
.
setOnClickListener
{
DeviceInfoKey
=
item
.
key
goToAc
(
DeviceInfoDetailActivity
::
class
.
java
)
overridePendingTransition
(
R
.
anim
.
slide_in_right
,
R
.
anim
.
slide_out_left
);
}
}
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
CommonViewHolder
{
return
CommonViewHolder
(
R
.
layout
.
item_device_information
.
inflate
(
parent
))
}
}
override
fun
initView
()
{
super
.
initView
()
binding
.
rv
.
adapter
=
adapter
adapter
.
submitList
(
list
)
}
override
fun
initListener
()
{
super
.
initListener
()
binding
.
ivBack
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/ui/deviceinfo/DeviceInfoDetailActivity.kt
0 → 100644
View file @
9de782f1
package
com.base.appzxhy.ui.deviceinfo
import
android.annotation.SuppressLint
import
android.app.ActivityManager
import
android.content.Context
import
android.content.res.Configuration
import
android.graphics.Camera
import
android.graphics.ImageFormat
import
android.graphics.Point
import
android.hardware.camera2.CameraCharacteristics
import
android.hardware.camera2.CameraManager
import
android.net.wifi.WifiManager
import
android.os.Build
import
android.os.storage.StorageManager
import
android.util.DisplayMetrics
import
android.view.Surface
import
android.view.View
import
android.view.ViewGroup
import
android.view.WindowManager
import
com.base.appzxhy.R
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.bean.DeviceDetailBean
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.BATTERY_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.CAMERA_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.DEVICE_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.DISPLAY_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.PROCESSOR_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.RAM_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.ROM_INFORMATION
import
com.base.appzxhy.bean.DeviceInfoBean.Companion.WIFI_INFORMATION
import
com.base.appzxhy.databinding.ActivityDeviceInfoDetailBinding
import
com.base.appzxhy.databinding.ItemDeviceDetailBinding
import
com.base.appzxhy.ui.adapter.CommonViewHolder
import
com.base.appzxhy.utils.KotlinExt.toFormatSize
import
com.base.appzxhy.utils.LogEx
import
com.base.appzxhy.utils.Utils
import
com.base.appzxhy.utils.XmlEx.inflate
import
com.chad.library.adapter4.BaseQuickAdapter
import
kotlinx.coroutines.async
import
java.io.BufferedReader
import
java.io.FileReader
import
java.net.NetworkInterface
import
java.util.Collections
import
kotlin.math.roundToInt
class
DeviceInfoDetailActivity
:
BaseActivity
<
ActivityDeviceInfoDetailBinding
>(
ActivityDeviceInfoDetailBinding
::
inflate
)
{
companion
object
{
var
DeviceInfoKey
=
""
}
val
adapter
=
object
:
BaseQuickAdapter
<
DeviceDetailBean
,
CommonViewHolder
>()
{
override
fun
onBindViewHolder
(
holder
:
CommonViewHolder
,
position
:
Int
,
item
:
DeviceDetailBean
?
)
{
item
?:
return
binding
.
progressBar
.
visibility
=
View
.
GONE
val
itemBinding
=
ItemDeviceDetailBinding
.
bind
(
holder
.
itemView
)
itemBinding
.
tvTitle
.
text
=
item
.
title
itemBinding
.
tvValue
.
text
=
item
.
value
}
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
CommonViewHolder
{
return
CommonViewHolder
(
R
.
layout
.
item_device_detail
.
inflate
(
parent
))
}
}
override
fun
initView
()
{
super
.
initView
()
binding
.
rv
.
adapter
=
adapter
initData
()
}
private
fun
initData
()
{
when
(
DeviceInfoKey
)
{
DEVICE_INFORMATION
->
{
getDeviceInformation
()
}
PROCESSOR_INFORMATION
->
{
getProcessorInformation
()
}
WIFI_INFORMATION
->
{
getWifiInformation
()
}
DISPLAY_INFORMATION
->
{
getDisplayInformation
()
}
RAM_INFORMATION
->
{
getRamInformation
()
}
ROM_INFORMATION
->
{
getRomInformation
()
}
CAMERA_INFORMATION
->
{
getCameraInformation
()
}
}
}
private
fun
getCameraInformation
()
{
val
arrayList
=
arrayListOf
<
DeviceDetailBean
>()
val
cameraManager
=
getSystemService
(
CAMERA_SERVICE
)
as
CameraManager
val
frontDevice
=
DeviceDetailBean
(
"Front Camera"
,
"N/A"
)
val
rearDevice
=
DeviceDetailBean
(
"Rear Camera"
,
"N/A"
)
val
cameraIdList
=
cameraManager
.
cameraIdList
cameraIdList
.
forEach
{
val
characteristics
=
cameraManager
.
getCameraCharacteristics
(
it
)
val
facing
=
characteristics
.
get
(
CameraCharacteristics
.
LENS_FACING
)
if
(
facing
==
CameraCharacteristics
.
LENS_FACING_FRONT
)
{
val
map
=
characteristics
.
get
(
CameraCharacteristics
.
SCALER_STREAM_CONFIGURATION_MAP
)
val
resolutions
=
map
?.
getOutputSizes
(
ImageFormat
.
JPEG
)
?.
toList
()
val
maxWith
=
resolutions
?.
maxOf
{
it
.
width
}
?:
0
val
maxHeight
=
resolutions
?.
maxOf
{
it
.
height
}
?:
0
if
(
resolutions
!=
null
)
{
val
megapixels
=
(
maxWith
*
maxHeight
)
/
1000000.0
frontDevice
.
value
=
"${maxWith}x${maxHeight}(${megapixels.roundToInt()} MP)"
}
}
if
(
facing
==
CameraCharacteristics
.
LENS_FACING_BACK
)
{
val
map
=
characteristics
.
get
(
CameraCharacteristics
.
SCALER_STREAM_CONFIGURATION_MAP
)
val
resolutions
=
map
?.
getOutputSizes
(
ImageFormat
.
JPEG
)
?.
toList
()
val
maxWith
=
resolutions
?.
maxOf
{
it
.
width
}
?:
0
val
maxHeight
=
resolutions
?.
maxOf
{
it
.
height
}
?:
0
if
(
resolutions
!=
null
)
{
val
megapixels
=
(
maxWith
*
maxHeight
)
/
1000000.0
rearDevice
.
value
=
"${maxWith}x${maxHeight}(${megapixels.roundToInt()} MP)"
}
}
}
arrayList
.
add
(
frontDevice
)
arrayList
.
add
(
rearDevice
)
adapter
.
submitList
(
arrayList
)
}
private
fun
getRomInformation
()
{
val
arrayList
=
arrayListOf
<
DeviceDetailBean
>()
val
totalStorageSize
=
Utils
.
getTotalStorageSize
()
val
availableStorageSize
=
Utils
.
getAvailableStorageSize
()
val
usedStorageSize
=
totalStorageSize
-
availableStorageSize
val
percent
=
(
100
*
usedStorageSize
/
totalStorageSize
)
arrayList
.
add
(
DeviceDetailBean
(
"Free ROM"
,
availableStorageSize
.
toFormatSize
()))
arrayList
.
add
(
DeviceDetailBean
(
"Used ROM"
,
usedStorageSize
.
toFormatSize
()))
arrayList
.
add
(
DeviceDetailBean
(
"Total ROM"
,
totalStorageSize
.
toFormatSize
()))
arrayList
.
add
(
DeviceDetailBean
(
"Percentage"
,
"$percent %"
))
adapter
.
submitList
(
arrayList
)
}
private
fun
getRamInformation
()
{
val
arrayList
=
arrayListOf
<
DeviceDetailBean
>()
val
activityManager
=
getSystemService
(
ACTIVITY_SERVICE
)
as
ActivityManager
val
memoryInfo
=
ActivityManager
.
MemoryInfo
()
activityManager
.
getMemoryInfo
(
memoryInfo
)
// 转换为MB
val
totalMem
=
memoryInfo
.
totalMem
val
availMem
=
memoryInfo
.
availMem
val
usedMem
=
totalMem
-
availMem
val
percent
=
(
100
*
usedMem
/
totalMem
)
arrayList
.
add
(
DeviceDetailBean
(
"Free RAM"
,
availMem
.
toFormatSize
()))
arrayList
.
add
(
DeviceDetailBean
(
"Used RAM"
,
usedMem
.
toFormatSize
()))
arrayList
.
add
(
DeviceDetailBean
(
"Total RAM"
,
totalMem
.
toFormatSize
()))
arrayList
.
add
(
DeviceDetailBean
(
"Percentage"
,
"$percent %"
))
adapter
.
submitList
(
arrayList
)
}
private
fun
getDisplayInformation
()
{
val
arrayList
=
arrayListOf
<
DeviceDetailBean
>()
val
windowManager
=
getSystemService
(
WINDOW_SERVICE
)
as
WindowManager
val
display
=
windowManager
.
defaultDisplay
val
fps
=
display
.
refreshRate
.
toInt
()
var
orientation
=
"Portrait"
when
{
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
->
{
val
windowMetrics
=
windowManager
.
currentWindowMetrics
val
bounds
=
windowMetrics
.
bounds
if
(
bounds
.
width
()
<
bounds
.
height
())
{
Configuration
.
ORIENTATION_PORTRAIT
orientation
=
"Portrait"
}
else
{
Configuration
.
ORIENTATION_LANDSCAPE
orientation
=
"Landscape"
}
}
else
->
{
val
rotation
=
display
.
rotation
val
metrics
=
DisplayMetrics
()
display
.
getMetrics
(
metrics
)
val
isNaturalPortrait
=
if
(
rotation
==
Surface
.
ROTATION_0
||
rotation
==
Surface
.
ROTATION_180
)
{
metrics
.
heightPixels
>=
metrics
.
widthPixels
}
else
{
metrics
.
widthPixels
>=
metrics
.
heightPixels
}
if
(
isNaturalPortrait
)
{
Configuration
.
ORIENTATION_PORTRAIT
orientation
=
"Portrait"
}
else
{
Configuration
.
ORIENTATION_LANDSCAPE
orientation
=
"Landscape"
}
}
}
arrayList
.
add
(
DeviceDetailBean
(
"Refresh Rate FPS"
,
fps
.
toString
()))
arrayList
.
add
(
DeviceDetailBean
(
"Default Orientation"
,
orientation
))
val
resolution
=
Point
()
display
.
getRealSize
(
resolution
)
arrayList
.
add
(
DeviceDetailBean
(
"Width"
,
"${resolution.x} px"
))
arrayList
.
add
(
DeviceDetailBean
(
"Height"
,
"${resolution.y} px"
))
adapter
.
submitList
(
arrayList
)
}
@SuppressLint
(
"DefaultLocale"
)
private
fun
getWifiInformation
()
{
val
arrayList
=
arrayListOf
<
DeviceDetailBean
>()
val
wifiManager
=
getSystemService
(
WIFI_SERVICE
)
as
WifiManager
val
wifiInfo
=
wifiManager
.
connectionInfo
val
ipAddress
=
wifiInfo
.
ipAddress
val
ip
=
if
(
ipAddress
==
0
)
{
"<unknown ip>"
}
else
{
String
.
format
(
"%d.%d.%d.%d"
,
ipAddress
and
0
xff
,
ipAddress
shr
8
and
0
xff
,
ipAddress
shr
16
and
0
xff
,
ipAddress
shr
24
and
0
xff
)
}
arrayList
.
add
(
DeviceDetailBean
(
"Ip Address"
,
ip
))
val
ssi
=
if
(
wifiInfo
.
bssid
!=
null
)
{
wifiInfo
.
rssi
.
toString
()
+
" dBm"
// 返回信号强度值 (dBm)
}
else
{
"<unknown ssid>"
// 未连接Wi-Fi
}
arrayList
.
add
(
DeviceDetailBean
(
"SSI"
,
ssi
))
var
macValue
=
"N/A"
val
interfaces
=
Collections
.
list
(
NetworkInterface
.
getNetworkInterfaces
())
interfaces
.
forEach
{
LogEx
.
logDebug
(
TAG
,
"${it.name} ${it.hardwareAddress}"
)
}
runCatching
{
interfaces
.
firstOrNull
{
it
.
name
.
equals
(
"wlan0"
,
ignoreCase
=
true
)
}
?.
hardwareAddress
?.
let
{
mac
->
macValue
=
mac
.
joinToString
(
":"
)
{
String
.
format
(
"%02X"
,
it
)
}
}
}
arrayList
.
add
(
DeviceDetailBean
(
"MAC Address"
,
macValue
))
adapter
.
submitList
(
arrayList
)
}
private
fun
getProcessorInformation
()
{
val
arrayList
=
arrayListOf
<
DeviceDetailBean
>()
val
abi
=
Build
.
SUPPORTED_64_BIT_ABIS
.
firstOrNull
()
?:
Build
.
SUPPORTED_ABIS
.
firstOrNull
()
?:
Build
.
CPU_ABI
?:
"unknown"
var
core
=
1
runCatching
{
core
=
Runtime
.
getRuntime
().
availableProcessors
()
}
val
s
=
if
(
core
>
1
)
"Cores"
else
"Core"
arrayList
.
add
(
DeviceDetailBean
(
"Process"
,
"$abi $core $s"
))
arrayList
.
add
(
DeviceDetailBean
(
"Cores Number"
,
"$core"
))
var
mhz
=
"N/A"
runCatching
{
val
reader
=
BufferedReader
(
FileReader
(
"/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
))
val
freq
=
reader
.
readLine
().
trim
()
reader
.
close
()
mhz
=
"${freq.toInt() / 1000}"
}
arrayList
.
add
(
DeviceDetailBean
(
"CPU Settings"
,
"$mhz MHz"
))
adapter
.
submitList
(
arrayList
)
}
private
fun
getDeviceInformation
()
{
val
arrayList
=
arrayListOf
<
DeviceDetailBean
>()
val
windowManager
=
getSystemService
(
WINDOW_SERVICE
)
as
WindowManager
val
display
=
windowManager
.
defaultDisplay
val
resolution
=
Point
()
display
.
getRealSize
(
resolution
)
arrayList
.
add
(
DeviceDetailBean
(
"Screen Resolution"
,
"${resolution.x}x${resolution.y}"
)
)
val
displayMetrics
=
resources
.
displayMetrics
val
widthInches
=
displayMetrics
.
widthPixels
/
displayMetrics
.
xdpi
val
heightInches
=
displayMetrics
.
heightPixels
/
displayMetrics
.
ydpi
arrayList
.
add
(
DeviceDetailBean
(
"Screen Size"
,
"${"
%.
0f
".format(widthInches)}x${"
%.
0f
".format(heightInches)} inches"
)
)
arrayList
.
add
(
DeviceDetailBean
(
"Model Number"
,
"${Build.MODEL}"
))
arrayList
.
add
(
DeviceDetailBean
(
"Android version"
,
"${Build.VERSION.RELEASE}"
))
adapter
.
submitList
(
arrayList
)
}
override
fun
initListener
()
{
super
.
initListener
()
binding
.
ivBack
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
}
override
fun
handleBackCallBack
()
{
finish
()
overridePendingTransition
(
R
.
anim
.
slide_in_left
,
R
.
anim
.
slide_out_right
)
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/ui/main/HomeFragment.kt
View file @
9de782f1
...
@@ -3,7 +3,6 @@ package com.base.appzxhy.ui.main
...
@@ -3,7 +3,6 @@ package com.base.appzxhy.ui.main
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.ActivityManager
import
android.app.ActivityManager
import
android.view.View
import
android.view.View
import
androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior.setTag
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat.getSystemService
import
androidx.core.content.ContextCompat.getSystemService
import
androidx.core.graphics.Insets
import
androidx.core.graphics.Insets
...
@@ -13,7 +12,6 @@ import androidx.core.view.WindowInsetsCompat
...
@@ -13,7 +12,6 @@ import androidx.core.view.WindowInsetsCompat
import
androidx.lifecycle.lifecycleScope
import
androidx.lifecycle.lifecycleScope
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.GridLayoutManager
import
com.airbnb.lottie.LottieDrawable
import
com.airbnb.lottie.LottieDrawable
import
com.applovin.impl.sb
import
com.base.appzxhy.R
import
com.base.appzxhy.R
import
com.base.appzxhy.base.BaseFragment
import
com.base.appzxhy.base.BaseFragment
import
com.base.appzxhy.base.jumpAction
import
com.base.appzxhy.base.jumpAction
...
@@ -158,7 +156,7 @@ class HomeFragment : BaseFragment<FragmentHome1Binding>(FragmentHome1Binding::in
...
@@ -158,7 +156,7 @@ class HomeFragment : BaseFragment<FragmentHome1Binding>(FragmentHome1Binding::in
binding
.
wave3
.
setWaves
(
randomWave
)
binding
.
wave3
.
setWaves
(
randomWave
)
binding
.
wave3
.
colorAlpha
=
1f
binding
.
wave3
.
colorAlpha
=
1f
binding
.
wave3
.
progress
=
0.1
5
f
binding
.
wave3
.
progress
=
0.1
3
f
binding
.
wave3
.
startColor
=
ContextCompat
.
getColor
(
requireContext
(),
R
.
color
.
colorPrimary
)
binding
.
wave3
.
startColor
=
ContextCompat
.
getColor
(
requireContext
(),
R
.
color
.
colorPrimary
)
binding
.
wave3
.
closeColor
=
ContextCompat
.
getColor
(
requireContext
(),
R
.
color
.
colorPrimary
)
binding
.
wave3
.
closeColor
=
ContextCompat
.
getColor
(
requireContext
(),
R
.
color
.
colorPrimary
)
binding
.
wave3
.
waveHeight
=
Random
.
nextInt
(
15
,
30
)
binding
.
wave3
.
waveHeight
=
Random
.
nextInt
(
15
,
30
)
...
@@ -229,7 +227,7 @@ class HomeFragment : BaseFragment<FragmentHome1Binding>(FragmentHome1Binding::in
...
@@ -229,7 +227,7 @@ class HomeFragment : BaseFragment<FragmentHome1Binding>(FragmentHome1Binding::in
(
requireActivity
()
as
MainActivity
).
permissionStorageJump
(
it
.
key
)
(
requireActivity
()
as
MainActivity
).
permissionStorageJump
(
it
.
key
)
}
}
BATTERY_INFO
,
UNINSTALL_APP
->
{
BATTERY_INFO
,
UNINSTALL_APP
,
DEVICE_INFO
->
{
(
requireActivity
()
as
MainActivity
).
jumpAction
(
it
.
key
)
(
requireActivity
()
as
MainActivity
).
jumpAction
(
it
.
key
)
}
}
...
...
app/src/main/res/anim/slide_in_left.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:duration=
"@android:integer/config_mediumAnimTime"
android:fromXDelta=
"-100%"
android:toXDelta=
"0%"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/slide_in_right.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:duration=
"@android:integer/config_mediumAnimTime"
android:fromXDelta=
"100%"
android:toXDelta=
"0%"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/slide_out_left.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:duration=
"@android:integer/config_mediumAnimTime"
android:fromXDelta=
"0%"
android:toXDelta=
"-100%"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/slide_out_right.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:duration=
"@android:integer/config_mediumAnimTime"
android:fromXDelta=
"0%"
android:toXDelta=
"100%"
/>
</set>
\ No newline at end of file
app/src/main/res/drawable-xxhdpi/icon_battery.png
0 → 100644
View file @
9de782f1
1.97 KB
app/src/main/res/drawable-xxhdpi/icon_camera.png
0 → 100644
View file @
9de782f1
2.36 KB
app/src/main/res/drawable-xxhdpi/icon_device_info_big.png
0 → 100644
View file @
9de782f1
25.5 KB
app/src/main/res/drawable-xxhdpi/icon_display.png
0 → 100644
View file @
9de782f1
1.26 KB
app/src/main/res/drawable-xxhdpi/icon_processor.png
0 → 100644
View file @
9de782f1
2.87 KB
app/src/main/res/drawable-xxhdpi/icon_ram.png
0 → 100644
View file @
9de782f1
1.47 KB
app/src/main/res/drawable-xxhdpi/icon_rom.png
0 → 100644
View file @
9de782f1
1.32 KB
app/src/main/res/drawable-xxhdpi/icon_shouji.png
0 → 100644
View file @
9de782f1
1.04 KB
app/src/main/res/drawable-xxhdpi/icon_wifi.png
0 → 100644
View file @
9de782f1
2.65 KB
app/src/main/res/drawable/bg_ffffff_tlr24.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/white"
/>
<corners
android:topLeftRadius=
"@dimen/dp_24"
android:topRightRadius=
"@dimen/dp_24"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_device_info.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/colorPrimary"
tools:context=
"com.base.appzxhy.ui.deviceinfo.DeviceInfoActivity"
>
<FrameLayout
android:id=
"@+id/flTop"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/ivBack"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"@dimen/dp_8"
android:layout_marginStart=
"@dimen/dp_8"
android:padding=
"@dimen/dp_8"
app:srcCompat=
"@drawable/icon_back_w"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|start"
android:layout_marginStart=
"@dimen/dp_60"
android:text=
"@string/device_info"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_18"
android:textStyle=
"bold"
/>
</FrameLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_marginTop=
"@dimen/dp_20"
android:background=
"@drawable/bg_ffffff_tlr24"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/flTop"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/flTop"
app:srcCompat=
"@drawable/icon_device_info_big"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:paddingVertical=
"@dimen/dp_16"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/iv"
>
</androidx.recyclerview.widget.RecyclerView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_device_info_detail.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/colorPrimary"
>
<FrameLayout
android:id=
"@+id/flTop"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/ivBack"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"@dimen/dp_8"
android:layout_marginStart=
"@dimen/dp_8"
android:padding=
"@dimen/dp_8"
app:srcCompat=
"@drawable/icon_back_w"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|start"
android:layout_marginStart=
"@dimen/dp_60"
android:text=
"@string/device_info"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_18"
android:textStyle=
"bold"
/>
</FrameLayout>
<View
android:id=
"@+id/v"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_marginTop=
"@dimen/dp_20"
android:background=
"@drawable/bg_ffffff_tlr24"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/flTop"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:paddingVertical=
"@dimen/dp_30"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/v"
>
</androidx.recyclerview.widget.RecyclerView>
<ProgressBar
android:id=
"@+id/progressBar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:indeterminateTint=
"@color/colorPrimary"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/rv"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_splash.xml
View file @
9de782f1
...
@@ -205,7 +205,7 @@
...
@@ -205,7 +205,7 @@
android:layout_marginBottom=
"@dimen/dp_50"
android:layout_marginBottom=
"@dimen/dp_50"
android:gravity=
"center"
android:gravity=
"center"
android:text=
"@string/involve_ad"
android:text=
"@string/involve_ad"
android:textColor=
"
#F2FEF8
"
android:textColor=
"
@color/black
"
android:textSize=
"@dimen/sp_14"
android:textSize=
"@dimen/sp_14"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
...
...
app/src/main/res/layout/item_device_detail.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_56"
android:layout_marginHorizontal=
"@dimen/dp_16"
android:layout_marginVertical=
"@dimen/dp_4"
app:cardCornerRadius=
"@dimen/dp_12"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center_vertical"
>
<TextView
android:id=
"@+id/tvTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_10"
android:includeFontPadding=
"false"
android:textColor=
"#1A1A1A"
android:textSize=
"@dimen/sp_16"
tools:text=
"Screen Resolution"
/>
<TextView
android:id=
"@+id/tvValue"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"@dimen/dp_10"
android:layout_weight=
"1"
android:gravity=
"end"
android:includeFontPadding=
"false"
android:textColor=
"#6E6E6E"
tools:text=
"1080 x 2260"
/>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
app/src/main/res/layout/item_device_information.xml
0 → 100644
View file @
9de782f1
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"@dimen/dp_16"
android:layout_marginVertical=
"@dimen/dp_4"
app:cardCornerRadius=
"@dimen/dp_12"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:foreground=
"?attr/selectableItemBackground"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/ivIcon"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"@dimen/dp_16"
android:layout_marginStart=
"@dimen/dp_10"
app:srcCompat=
"@drawable/icon_shouji"
/>
<TextView
android:id=
"@+id/tv"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"@dimen/dp_12"
android:layout_weight=
"1"
android:includeFontPadding=
"false"
/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/dp_10"
app:srcCompat=
"@drawable/icon_jiantou"
/>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
9de782f1
...
@@ -69,4 +69,5 @@
...
@@ -69,4 +69,5 @@
<dimen
name=
"dp_3"
>
3dp
</dimen>
<dimen
name=
"dp_3"
>
3dp
</dimen>
<dimen
name=
"dp__50"
>
-50dp
</dimen>
<dimen
name=
"dp__50"
>
-50dp
</dimen>
<dimen
name=
"dp__25"
>
-25dp
</dimen>
<dimen
name=
"dp__25"
>
-25dp
</dimen>
<dimen
name=
"dp_56"
>
56dp
</dimen>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
9de782f1
...
@@ -172,6 +172,14 @@ Please rest assured that we will handle your information in strict accordance wi
...
@@ -172,6 +172,14 @@ Please rest assured that we will handle your information in strict accordance wi
<string
name=
"scanning"
>
Scanning...
</string>
<string
name=
"scanning"
>
Scanning...
</string>
<string
name=
"device_info"
>
Device Info
</string>
<string
name=
"device_info"
>
Device Info
</string>
<string
name=
"junk_files"
>
%1$s Junk Files
</string>
<string
name=
"junk_files"
>
%1$s Junk Files
</string>
<string
name=
"device_information"
>
Device Information
</string>
<string
name=
"processor_information"
>
Processor Information
</string>
<string
name=
"wifi_information"
>
Wifi Information
</string>
<string
name=
"display_information"
>
Display Information
</string>
<string
name=
"ram_information"
>
RAM Information
</string>
<string
name=
"rom_information"
>
ROM Information
</string>
<string
name=
"camera_information"
>
Camera Information
</string>
<string
name=
"battery_information"
>
Battery Information
</string>
</resources>
</resources>
app/src/main/res/values/themes.xml
View file @
9de782f1
...
@@ -22,4 +22,5 @@
...
@@ -22,4 +22,5 @@
</style>
</style>
</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