Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
F
Fast Cleaner Junk
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
Fast Cleaner Junk
Commits
b6a1bb34
Commit
b6a1bb34
authored
Jun 12, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备信息数据补齐
parent
1496c13e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
6 deletions
+81
-6
DeviceScanActivity.kt
.../test/basd/fastcleanerjunk/activity/DeviceScanActivity.kt
+47
-2
ScreenShotActivity.kt
.../test/basd/fastcleanerjunk/activity/ScreenShotActivity.kt
+20
-2
ScreenShotAdapter.kt
...om/test/basd/fastcleanerjunk/adapter/ScreenShotAdapter.kt
+9
-1
activity_screen_shot.xml
app/src/main/res/layout/activity_screen_shot.xml
+4
-1
item_tool_grid.xml
app/src/main/res/layout/item_tool_grid.xml
+1
-0
No files found.
app/src/main/java/com/test/basd/fastcleanerjunk/activity/DeviceScanActivity.kt
View file @
b6a1bb34
...
...
@@ -8,6 +8,7 @@ import android.net.wifi.WifiManager
import
android.os.Build
import
android.os.Environment
import
android.os.StatFs
import
android.util.Log
import
androidx.activity.addCallback
import
com.blankj.utilcode.util.DeviceUtils
import
com.test.basd.fastcleanerjunk.databinding.ActivityDeviceScanBinding
...
...
@@ -17,6 +18,9 @@ import com.test.basd.fastcleanerjunk.helps.LogEx
import
com.test.basd.fastcleanerjunk.helps.StatFsHelper
import
com.test.basd.fastcleanerjunk.helps.ads.AdmobUtils
import
com.test.basd.fastcleanerjunk.view.AFunOb
import
java.io.BufferedReader
import
java.io.File
import
java.io.FileReader
import
java.io.IOException
import
java.nio.file.Files
import
java.nio.file.Paths
...
...
@@ -36,7 +40,7 @@ class DeviceScanActivity : BaseActivity<ActivityDeviceScanBinding>() {
binding
.
tvDeviceName
.
text
=
getDeviceName
()
binding
.
tvAndroidVersion
.
text
=
"System Version: Android ${Build.VERSION.RELEASE}"
initStorage
()
binding
.
tvAbis
.
text
=
DeviceUtils
.
getABIs
().
toString
e
x
()
binding
.
tvAbis
.
text
=
DeviceUtils
.
getABIs
().
toString
E
x
()
val
cupInfo
=
cpuInfo
()
cupInfo
.
forEach
{
LogEx
.
logDebug
(
TAG
,
"cupInfo $it"
)
...
...
@@ -45,6 +49,8 @@ class DeviceScanActivity : BaseActivity<ActivityDeviceScanBinding>() {
binding
.
tvIpAddress
.
text
=
if
(
isWifiConnected
(
this
))
getWifiIpAddress
(
this
)
else
""
binding
.
tvSsid
.
text
=
getWifiSSID
(
this
)
binding
.
tvLinkSpeed
.
text
=
"${getWifiLinkSpeed(this)} Mbps"
binding
.
tvCpuFrequency
.
text
=
"${getCpuFreq("
cpuinfo_min_freq
") / 1000}MHZ - ${getCpuFreq("
cpuinfo_max_freq
") / 1000}MHZ"
binding
.
tvCpuHardware
.
text
=
getCpuHardware
()
}
override
fun
initListener
()
{
...
...
@@ -151,9 +157,48 @@ class DeviceScanActivity : BaseActivity<ActivityDeviceScanBinding>() {
// 获取Wi-Fi链路速度,单位为Mbps
return
wifiInfo
?.
linkSpeed
?:
-
1
}
/**
* @param filePath
* cpuinfo_cur_freq
* cpuinfo_min_freq
* cpuinfo_max_freq
* scaling_available_frequencies
*
* @return 返回数据 546000KHZ=546MHZ
*/
fun
getCpuFreq
(
filePath
:
String
):
Int
{
val
scalingPath
=
"/sys/devices/system/cpu/cpu0/cpufreq/"
val
path
=
File
(
scalingPath
+
filePath
)
var
frequency
=
0
try
{
if
(
path
.
exists
())
{
val
reader
=
BufferedReader
(
FileReader
(
path
))
val
line
=
reader
.
readLine
()
reader
.
close
()
if
(
line
!=
null
)
{
// 处理读取到的频率值
LogEx
.
logDebug
(
"CPU Frequency"
,
"$filePath: $line kHz"
)
frequency
=
line
.
toInt
()
}
}
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
}
return
frequency
}
@SuppressLint
(
"PrivateApi"
)
fun
getCpuHardware
():
String
{
val
classType
=
Class
.
forName
(
"android.os.SystemProperties"
)
val
method
=
classType
.
getDeclaredMethod
(
"get"
,
String
::
class
.
java
)
val
result
=
method
.
invoke
(
classType
,
"ro.board.platform"
)
as
String
return
result
}
}
private
fun
<
T
>
Array
<
T
>.
toString
e
x
():
String
{
private
fun
<
T
>
Array
<
T
>.
toString
E
x
():
String
{
val
sb
=
StringBuffer
()
sb
.
append
(
"["
)
...
...
app/src/main/java/com/test/basd/fastcleanerjunk/activity/ScreenShotActivity.kt
View file @
b6a1bb34
package
com.test.basd.fastcleanerjunk.activity
import
android.annotation.SuppressLint
import
android.os.Environment
import
com.ironsource.mediationsdk.f
import
com.test.basd.fastcleanerjunk.adapter.ScreenShotAdapter
import
com.test.basd.fastcleanerjunk.bean.ScreenPhotoBean
import
com.test.basd.fastcleanerjunk.bean.ScreenshotBean
...
...
@@ -12,7 +14,7 @@ import java.text.SimpleDateFormat
import
java.util.Locale
import
kotlin.collections.HashSet
class
ScreenShotActivity
(
val
select
:
(
count
:
Int
)
->
Unit
)
:
BaseActivity
<
ActivityScreenShotBinding
>()
{
class
ScreenShotActivity
:
BaseActivity
<
ActivityScreenShotBinding
>()
{
private
lateinit
var
screenShotAdapter
:
ScreenShotAdapter
...
...
@@ -21,12 +23,26 @@ class ScreenShotActivity(val select: (count: Int) -> Unit) : BaseActivity<Activi
}
override
fun
initView
()
{
screenShotAdapter
=
ScreenShotAdapter
()
screenShotAdapter
=
ScreenShotAdapter
{
size
->
setCleanUpUi
(
size
)
}
binding
.
rv
.
adapter
=
screenShotAdapter
initData
()
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
setCleanUpUi
(
size
:
Int
)
{
if
(
size
>
0
)
{
binding
.
tvClean
.
isEnabled
=
true
binding
.
tvClean
.
text
=
"CLEAN(${size})"
}
else
{
binding
.
tvClean
.
isEnabled
=
false
binding
.
tvClean
.
text
=
"CLEAN"
}
}
private
fun
initData
()
{
val
list
=
getScreenshotBean
()
screenShotAdapter
.
setData
(
list
)
...
...
@@ -43,6 +59,8 @@ class ScreenShotActivity(val select: (count: Int) -> Unit) : BaseActivity<Activi
binding
.
llSelectAll
.
setOnClickListener
{
binding
.
llSelectAll
.
isSelected
=
!
binding
.
llSelectAll
.
isSelected
screenShotAdapter
.
toggleSelect
(
binding
.
llSelectAll
.
isSelected
)
val
size
=
screenShotAdapter
.
getSelectDataSize
()
setCleanUpUi
(
size
)
}
}
...
...
app/src/main/java/com/test/basd/fastcleanerjunk/adapter/ScreenShotAdapter.kt
View file @
b6a1bb34
...
...
@@ -16,7 +16,9 @@ import java.text.SimpleDateFormat
import
java.util.ArrayList
import
java.util.Locale
class
ScreenShotAdapter
()
:
RecyclerView
.
Adapter
<
ScreenShotAdapter
.
SSS
>()
{
class
ScreenShotAdapter
(
val
select
:
(
size
:
Int
)
->
Unit
)
:
RecyclerView
.
Adapter
<
ScreenShotAdapter
.
SSS
>()
{
private
val
beans
=
arrayListOf
<
ScreenshotBean
>()
...
...
@@ -40,6 +42,7 @@ class ScreenShotAdapter() : RecyclerView.Adapter<ScreenShotAdapter.SSS>() {
bean
.
isSelect
=
!
bean
.
isSelect
bean
.
screenPhotoBean
.
forEach
{
subBean
->
subBean
.
isSelect
=
bean
.
isSelect
}
notifyItemChanged
(
position
)
select
.
invoke
(
getSelectDataSize
())
}
binding
.
tvTime
.
text
=
bean
.
time
...
...
@@ -53,6 +56,7 @@ class ScreenShotAdapter() : RecyclerView.Adapter<ScreenShotAdapter.SSS>() {
photoBinding
.
ivSelector
.
isSelected
=
screenPhotoBean
.
isSelect
bean
.
isSelect
=
bean
.
screenPhotoBean
.
all
{
it
.
isSelect
}
notifyDataSetChanged
()
select
.
invoke
(
getSelectDataSize
())
}
binding
.
group
.
addView
(
photoBinding
.
root
)
}
...
...
@@ -76,4 +80,8 @@ class ScreenShotAdapter() : RecyclerView.Adapter<ScreenShotAdapter.SSS>() {
}
notifyDataSetChanged
()
}
fun
getSelectDataSize
():
Int
{
return
beans
.
sumOf
{
bean
->
bean
.
screenPhotoBean
.
filter
{
it
.
isSelect
}.
size
}
}
}
\ No newline at end of file
app/src/main/res/layout/activity_screen_shot.xml
View file @
b6a1bb34
...
...
@@ -136,14 +136,17 @@
</LinearLayout>
<com.noober.background.view.BLTextView
android:id=
"@+id/tv_clean"
android:layout_width=
"266dp"
android:layout_height=
"50dp"
android:enabled=
"false"
android:gravity=
"center"
android:text=
"CLEAN"
android:textColor=
"@color/white"
android:textSize=
"19sp"
app:bl_corners_radius=
"10dp"
app:bl_enabled_solid_color=
"@color/theme_color"
app:bl_
enabled_textColor=
"@color/white
"
app:bl_
unEnabled_solid_color=
"#BEBEBE
"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/ll_select_all"
...
...
app/src/main/res/layout/item_tool_grid.xml
View file @
b6a1bb34
...
...
@@ -12,6 +12,7 @@
tools:ignore=
"UseCompoundDrawables"
>
<ImageView
android:layout_marginTop=
"16dp"
android:id=
"@+id/iv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
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