Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
F
File Recovery RecycleBin
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
File Recovery RecycleBin
Commits
f347e4f7
Commit
f347e4f7
authored
Jul 29, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
4ef31f4f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
23 deletions
+74
-23
MainActivity.kt
.../com/base/filerecoveryrecyclebin/activity/MainActivity.kt
+18
-19
CleanJunkActivity.kt
...ecoveryrecyclebin/activity/junkclean/CleanJunkActivity.kt
+1
-1
HomeFragment.kt
.../com/base/filerecoveryrecyclebin/fragment/HomeFragment.kt
+22
-1
fragment_home_3.xml
app/src/main/res/layout/fragment_home_3.xml
+33
-2
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/MainActivity.kt
View file @
f347e4f7
...
...
@@ -17,13 +17,11 @@ import com.base.filerecoveryrecyclebin.fragment.HomeFragment
import
com.base.filerecoveryrecyclebin.fragment.RecoveryFragment
import
com.base.filerecoveryrecyclebin.fragment.RecycleBinFragment
import
com.base.filerecoveryrecyclebin.help.BaseActivity
import
com.base.filerecoveryrecyclebin.help.FileHelp
import
com.base.filerecoveryrecyclebin.help.MediaStoreHelp.getImageMedia
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import
com.base.filerecoveryrecyclebin.service.StayNotificationService
import
com.base.filerecoveryrecyclebin.utils.AppPreferences
import
com.base.filerecoveryrecyclebin.utils.BarUtils
import
com.base.filerecoveryrecyclebin.utils.FileHexEx
import
com.base.filerecoveryrecyclebin.utils.LogEx
import
com.base.filerecoveryrecyclebin.view.DialogViews.showExitDialog
import
com.base.filerecoveryrecyclebin.view.PermissionDialog.showPermissionBottomSheet
...
...
@@ -34,6 +32,7 @@ import kotlinx.coroutines.delay
import
kotlinx.coroutines.flow.MutableSharedFlow
import
kotlinx.coroutines.launch
import
java.io.File
import
java.util.Locale
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
>()
{
private
val
TAG
=
"MainActivity"
...
...
@@ -160,24 +159,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}
var
photoSizeFlow
:
MutableSharedFlow
<
Long
>
=
MutableSharedFlow
(
0
)
fun
initPhotoSize
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
LogEx
.
logDebug
(
TAG
,
"initPhotoSize"
)
val
dcimSize
=
FileHelp
.
getDirFiles
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DCIM
))
.
filter
{
FileHexEx
.
isImage
(
it
)
}
.
sumOf
{
it
.
length
()
}
var
photoSizeFlow
:
MutableSharedFlow
<
Pair
<
Long
,
Long
>>
=
MutableSharedFlow
()
val
list
=
arrayListOf
<
MediaBean
>()
getImageMedia
(
list
)
val
photoSize
=
list
.
map
{
File
(
it
.
path
)
}.
sumOf
{
it
.
length
()
}
val
size
=
dcimSize
+
photoSize
LogEx
.
logDebug
(
TAG
,
"size=$size"
)
delay
(
1500
)
photoSizeFlow
.
emit
(
size
)
}
override
fun
onResume
()
{
super
.
onResume
()
...
...
@@ -192,4 +175,20 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
showRateStarPopDialog
()
}
}
private
fun
initPhotoSize
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
LogEx
.
logDebug
(
TAG
,
"initPhotoSize"
)
val
list
=
arrayListOf
<
MediaBean
>()
getImageMedia
(
list
)
val
screenSize
=
list
.
filter
{
it
.
path
.
lowercase
(
Locale
.
ENGLISH
).
contains
(
"screenshot"
)
}.
map
{
File
(
it
.
path
)
}.
sumOf
{
it
.
length
()
}
LogEx
.
logDebug
(
TAG
,
"screenSize=$screenSize"
)
delay
(
1500
)
photoSizeFlow
.
emit
(
Pair
(
screenSize
,
screenSize
))
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/activity/junkclean/CleanJunkActivity.kt
View file @
f347e4f7
...
...
@@ -147,7 +147,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
emptyFolder
.
addAll
(
emptyFolder5
)
emptyFolder
.
addAll
(
emptyFolder6
)
emptyFolder
.
forEach
{
l
->
list
.
add
(
ChildBean
(
R
.
mipmap
.
kongwenjian
,
l
.
name
,
l
.
path
,
0
))
list
.
add
(
ChildBean
(
R
.
mipmap
.
kongwenjian
,
l
.
name
,
l
.
path
,
4198
))
}
delay
(
Random
.
nextLong
(
1500
,
2000
))
}.
await
()
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/fragment/HomeFragment.kt
View file @
f347e4f7
...
...
@@ -10,6 +10,8 @@ import android.os.Environment
import
android.os.StatFs
import
android.os.storage.StorageManager
import
android.view.View
import
androidx.lifecycle.lifecycleScope
import
com.base.filerecoveryrecyclebin.activity.MainActivity
import
com.base.filerecoveryrecyclebin.activity.SettingActivity
import
com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
...
...
@@ -21,9 +23,10 @@ import com.base.filerecoveryrecyclebin.databinding.FragmentHome3Binding
import
com.base.filerecoveryrecyclebin.help.BaseFragment
import
com.base.filerecoveryrecyclebin.help.KotlinExt.toFormatSize
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import
kotlinx.coroutines.flow.collectLatest
import
kotlinx.coroutines.launch
import
java.io.File
class
HomeFragment
:
BaseFragment
<
FragmentHome3Binding
>()
{
private
val
TAG
=
"HomeFragment"
...
...
@@ -31,10 +34,28 @@ class HomeFragment : BaseFragment<FragmentHome3Binding>() {
FragmentHome3Binding
.
inflate
(
layoutInflater
)
}
@SuppressLint
(
"SetTextI18n"
)
override
fun
setView
()
{
binding
.
tvTitle
.
text
=
"Dumpster"
binding
.
lottie
.
repeatCount
=
ValueAnimator
.
INFINITE
lifecycleScope
.
launch
{
(
requireActivity
()
as
MainActivity
).
photoSizeFlow
.
collectLatest
{
pair
->
if
(
pair
.
first
!=
0L
)
{
binding
.
tvScreenshotSize
.
visibility
=
View
.
VISIBLE
binding
.
tvScreenshotSize
.
text
=
pair
.
first
.
toFormatSize
()
}
else
{
binding
.
tvScreenshotSize
.
visibility
=
View
.
GONE
}
if
(
pair
.
second
!=
0L
){
binding
.
tvDuplicateSize
.
visibility
=
View
.
VISIBLE
binding
.
tvDuplicateSize
.
text
=
pair
.
second
.
toFormatSize
()
}
else
{
binding
.
tvDuplicateSize
.
visibility
=
View
.
VISIBLE
}
}
}
}
override
fun
setListener
()
{
...
...
app/src/main/res/layout/fragment_home_3.xml
View file @
f347e4f7
...
...
@@ -368,12 +368,13 @@
tools:ignore=
"ContentDescription"
/>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
android:layout_weight=
"1"
android:orientation=
"
vertic
al"
android:orientation=
"
horizont
al"
tools:ignore=
"UseCompoundDrawables"
>
<TextView
...
...
@@ -384,6 +385,21 @@
android:textSize=
"15sp"
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/tv_screenshot_size"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginStart=
"20dp"
android:background=
"@drawable/bg_eb423b_2_5"
android:paddingHorizontal=
"5dp"
android:paddingVertical=
"2dp"
android:textColor=
"@color/white"
android:textSize=
"12sp"
android:visibility=
"gone"
tools:ignore=
"SmallSp"
tools:text=
"6.35 GB"
/>
</LinearLayout>
...
...
@@ -429,7 +445,7 @@
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
android:layout_weight=
"1"
android:orientation=
"
vertic
al"
android:orientation=
"
horizont
al"
tools:ignore=
"UseCompoundDrawables"
>
<TextView
...
...
@@ -440,6 +456,21 @@
android:textSize=
"15sp"
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/tv_duplicate_size"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginStart=
"20dp"
android:background=
"@drawable/bg_eb423b_2_5"
android:paddingHorizontal=
"5dp"
android:paddingVertical=
"2dp"
android:textColor=
"@color/white"
android:textSize=
"12sp"
android:visibility=
"gone"
tools:ignore=
"SmallSp"
tools:text=
"6.35 GB"
/>
</LinearLayout>
...
...
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