Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy 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
Easy Cleaner Junk
Commits
f8cf95ff
Commit
f8cf95ff
authored
Jun 23, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+首页读取存储空间删掉
parent
82335b05
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
133 deletions
+1
-133
DeviceScanInfoActivity.kt
...t/easy/easycleanerjunk/activity/DeviceScanInfoActivity.kt
+0
-11
HomeFragment.kt
...va/com/test/easy/easycleanerjunk/fragment/HomeFragment.kt
+0
-4
StatFsHelper.kt
.../java/com/test/easy/easycleanerjunk/helps/StatFsHelper.kt
+0
-68
activity_device_scan_info.xml
app/src/main/res/layout/activity_device_scan_info.xml
+1
-22
fragment_layout_home.xml
app/src/main/res/layout/fragment_layout_home.xml
+0
-28
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/activity/DeviceScanInfoActivity.kt
View file @
f8cf95ff
...
...
@@ -13,7 +13,6 @@ import com.test.easy.easycleanerjunk.databinding.ActivityDeviceScanInfoBinding
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.KotlinExt.toFormatSize
import
com.test.easy.easycleanerjunk.helps.LogEx
import
com.test.easy.easycleanerjunk.helps.StatFsHelper
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.utils.DeviceUtils
import
com.test.easy.easycleanerjunk.view.AFunOb
...
...
@@ -37,7 +36,6 @@ class DeviceScanInfoActivity : BaseActivity<ActivityDeviceScanInfoBinding>() {
override
fun
initView
()
{
binding
.
tvDeviceName
.
text
=
getDeviceName
()
binding
.
tvAndroidVersion
.
text
=
"System Version: Android ${Build.VERSION.RELEASE}"
initStorage
()
binding
.
tvAbis
.
text
=
DeviceUtils
.
getABIs
().
toStringEx
()
val
cupInfo
=
cpuInfo
()
cupInfo
.
forEach
{
...
...
@@ -82,15 +80,6 @@ class DeviceScanInfoActivity : BaseActivity<ActivityDeviceScanInfoBinding>() {
}
else
capitalize
(
manufacturer
)
+
" "
+
model
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
initStorage
()
{
val
stat
=
StatFs
(
Environment
.
getExternalStorageDirectory
().
path
)
val
totalSize
=
StatFsHelper
.
totalSize
()
val
availableSize
=
StatFsHelper
.
availableSize
()
val
usedSize
=
totalSize
-
availableSize
val
usedPercentage
=
usedSize
.
toFloat
()
/
totalSize
*
100
binding
.
tvStorage
.
text
=
"${usedSize.toFormatSize()}/ ${totalSize.toFormatSize()}"
}
private
fun
cpuInfo
():
ArrayList
<
String
>
{
val
cpuList
:
ArrayList
<
String
>
=
arrayListOf
()
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fragment/HomeFragment.kt
View file @
f8cf95ff
...
...
@@ -19,7 +19,6 @@ import com.test.easy.easycleanerjunk.databinding.FragmentLayoutHomeBinding
import
com.test.easy.easycleanerjunk.helps.BaseFragment
import
com.test.easy.easycleanerjunk.helps.KotlinExt.setOnClickListener
import
com.test.easy.easycleanerjunk.helps.KotlinExt.toFormatSize
import
com.test.easy.easycleanerjunk.helps.StatFsHelper
import
com.test.easy.easycleanerjunk.notificationclean.NotificationGuestActivity
import
com.test.easy.easycleanerjunk.utils.BarUtils
...
...
@@ -114,9 +113,6 @@ class HomeFragment : BaseFragment<FragmentLayoutHomeBinding>() {
@SuppressLint
(
"SetTextI18n"
)
private
fun
initStorage
()
{
val
totalSize
=
StatFsHelper
.
totalSize
()
val
availableSize
=
StatFsHelper
.
availableSize
()
val
usedSize
=
totalSize
-
availableSize
binding
.
idTvOccupied
.
text
=
"${usedSize.toFormatSize()} / ${totalSize.toFormatSize()}"
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/StatFsHelper.kt
deleted
100644 → 0
View file @
82335b05
package
com.test.easy.easycleanerjunk.helps
import
android.os.Environment
import
android.os.StatFs
import
android.util.Log
object
StatFsHelper
{
var
totalsize
=
0L
fun
totalSize
():
Long
{
return
if
(
totalsize
>
0
)
{
totalsize
}
else
try
{
val
statFs
=
StatFs
(
Environment
.
getExternalStorageDirectory
().
path
)
val
statFs2
=
StatFs
(
Environment
.
getRootDirectory
().
path
)
Log
.
i
(
"storeByteDebug"
,
"store1: "
+
statFs2
.
blockSizeLong
*
statFs2
.
blockCountLong
+
"====store2: "
+
statFs
.
blockSizeLong
*
statFs
.
blockCountLong
)
var
blockSizeLong
=
statFs2
.
blockSizeLong
*
statFs2
.
blockCountLong
+
statFs
.
blockSizeLong
*
statFs
.
blockCountLong
blockSizeLong
=
getClosestPowerOfTwo
(
blockSizeLong
)
totalsize
=
blockSizeLong
blockSizeLong
}
catch
(
e10
:
java
.
lang
.
Exception
)
{
0L
}
}
fun
a
(
j10
:
Long
):
Long
{
var
tmep
=
j10
var
i7
=
0L
while
(
true
)
{
val
j11
:
Long
=
1000
if
(
tmep
<
j11
)
{
break
}
tmep
/=
j11
i7
++
}
for
(
i10
in
0
until
i7
)
{
tmep
*=
1024
}
return
tmep
}
fun
availableSize
():
Long
{
try
{
val
statFs
=
StatFs
(
Environment
.
getExternalStorageDirectory
().
path
)
val
statFs2
=
StatFs
(
Environment
.
getRootDirectory
().
path
)
val
blackSize
=
statFs2
.
blockSizeLong
*
statFs2
.
availableBlocksLong
+
statFs
.
blockSizeLong
*
statFs
.
availableBlocksLong
return
a
(
blackSize
)
}
catch
(
e10
:
Exception
)
{
return
0L
}
}
fun
getClosestPowerOfTwo
(
size
:
Long
):
Long
{
var
powerOfTwo
:
Long
=
1
while
(
powerOfTwo
<
size
)
{
powerOfTwo
*=
2
}
return
powerOfTwo
}
}
\ No newline at end of file
app/src/main/res/layout/activity_device_scan_info.xml
View file @
f8cf95ff
...
...
@@ -142,17 +142,6 @@
android:orientation=
"vertical"
app:layout_constraintStart_toStartOf=
"parent"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:gravity=
"center_vertical"
android:paddingStart=
"12dp"
android:text=
"Storage"
android:textColor=
"#666666"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText,RtlSymmetry"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
...
...
@@ -205,17 +194,7 @@
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/ll_device_info"
>
<TextView
android:id=
"@+id/tv_storage"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:gravity=
"center_vertical|end"
android:paddingEnd=
"12dp"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"RtlSymmetry"
tools:text=
"20.29GB/116.63GB"
/>
<TextView
android:id=
"@+id/tv_abis"
...
...
app/src/main/res/layout/fragment_layout_home.xml
View file @
f8cf95ff
...
...
@@ -68,34 +68,6 @@
</FrameLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:gravity=
"center_horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginEnd=
"7dp"
android:text=
"Occupied storage"
android:textColor=
"#666666"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/id_tv_occupied"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:textColor=
"#000000"
android:textSize=
"16sp"
android:textStyle=
"bold"
tools:text=
"13.58GB / 118GB"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.cardview.widget.CardView
android:id=
"@+id/id_clean_up"
android:layout_width=
"match_parent"
...
...
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