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
a160dbed
Commit
a160dbed
authored
Jul 29, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
00120edd
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
895 additions
and
3 deletions
+895
-3
MainActivity.kt
.../com/base/filerecoveryrecyclebin/activity/MainActivity.kt
+16
-1
LargeFileActivity.kt
...ecoveryrecyclebin/activity/largefile/LargeFileActivity.kt
+169
-0
LargeFileAnimationActivity.kt
...cyclebin/activity/largefile/LargeFileAnimationActivity.kt
+62
-0
LargeFileAdapter.kt
...m/base/filerecoveryrecyclebin/adapter/LargeFileAdapter.kt
+92
-0
ConstObject.kt
.../java/com/base/filerecoveryrecyclebin/bean/ConstObject.kt
+8
-0
MediaBean.kt
...in/java/com/base/filerecoveryrecyclebin/bean/MediaBean.kt
+1
-0
HomeFragment.kt
.../com/base/filerecoveryrecyclebin/fragment/HomeFragment.kt
+0
-2
RecoveryFragment.kt
.../base/filerecoveryrecyclebin/fragment/RecoveryFragment.kt
+18
-0
BaseActivity.kt
...java/com/base/filerecoveryrecyclebin/help/BaseActivity.kt
+2
-0
MediaStoreHelp.kt
...va/com/base/filerecoveryrecyclebin/help/MediaStoreHelp.kt
+36
-0
DialogViews.kt
.../java/com/base/filerecoveryrecyclebin/view/DialogViews.kt
+55
-0
activity_large_file.xml
app/src/main/res/layout/activity_large_file.xml
+112
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+30
-0
dialog_large_file_type.xml
app/src/main/res/layout/dialog_large_file_type.xml
+188
-0
fragment_recovery.xml
app/src/main/res/layout/fragment_recovery.xml
+14
-0
item_large_file.xml
app/src/main/res/layout/item_large_file.xml
+92
-0
arrow_l.png
app/src/main/res/mipmap-xxhdpi/arrow_l.png
+0
-0
largeicon.png
app/src/main/res/mipmap-xxhdpi/largeicon.png
+0
-0
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/MainActivity.kt
View file @
a160dbed
...
...
@@ -14,6 +14,7 @@ import com.base.filerecoveryrecyclebin.ads.admob.AdmobBannerUtils
import
com.base.filerecoveryrecyclebin.bean.MediaBean
import
com.base.filerecoveryrecyclebin.databinding.ActivityMainBinding
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
...
...
@@ -41,11 +42,14 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
private
val
homeFragment
by
lazy
{
HomeFragment
()
}
private
val
recoveryFragment
by
lazy
{
RecoveryFragment
()
}
private
val
recycleBinFragment
by
lazy
{
RecycleBinFragment
()
}
private
val
fragments
by
lazy
{
mutableListOf
(
homeFragment
,
recycleBinFragment
)
mutableListOf
(
homeFragment
,
rec
overyFragment
,
rec
ycleBinFragment
)
}
...
...
@@ -92,6 +96,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding
.
viewpager2
.
currentItem
=
1
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
}
binding
.
ll3
.
setOnClickListener
{
binding
.
viewpager2
.
currentItem
=
2
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
}
}
...
...
@@ -109,8 +117,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
private
fun
setPageIndicate
(
p
:
Int
)
{
binding
.
ll1
.
isSelected
=
false
binding
.
ll2
.
isSelected
=
false
binding
.
ll3
.
isSelected
=
false
binding
.
tv1
.
typeface
=
Typeface
.
DEFAULT
binding
.
tv2
.
typeface
=
Typeface
.
DEFAULT
binding
.
tv3
.
typeface
=
Typeface
.
DEFAULT
when
(
p
)
{
0
->
{
binding
.
ll1
.
isSelected
=
true
...
...
@@ -121,6 +131,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding
.
ll2
.
isSelected
=
true
binding
.
tv2
.
typeface
=
Typeface
.
DEFAULT_BOLD
}
2
->
{
binding
.
ll3
.
isSelected
=
true
binding
.
tv3
.
typeface
=
Typeface
.
DEFAULT_BOLD
}
}
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/activity/largefile/LargeFileActivity.kt
0 → 100644
View file @
a160dbed
package
com.base.filerecoveryrecyclebin.activity.largefile
import
android.annotation.SuppressLint
import
android.content.Intent
import
androidx.activity.addCallback
import
androidx.core.view.isVisible
import
androidx.lifecycle.lifecycleScope
import
com.base.filerecoveryrecyclebin.activity.ResultActivity
import
com.base.filerecoveryrecyclebin.adapter.LargeFileAdapter
import
com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import
com.base.filerecoveryrecyclebin.bean.ConstObject
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_ALL
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_AUDIO
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_DOCUMENT
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_OTHER
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_PICTURE
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_VIDEO
import
com.base.filerecoveryrecyclebin.bean.MediaBean
import
com.base.filerecoveryrecyclebin.databinding.ActivityLargeFileBinding
import
com.base.filerecoveryrecyclebin.help.BaseActivity
import
com.base.filerecoveryrecyclebin.help.KotlinExt.toFormatSize
import
com.base.filerecoveryrecyclebin.help.MediaStoreHelp.getAllMedia
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import
com.base.filerecoveryrecyclebin.help.PermissionHelp.requestStorePermission
import
com.base.filerecoveryrecyclebin.view.DialogViews.showDeletePermanentlyDialog
import
com.base.filerecoveryrecyclebin.view.DialogViews.showExitFunctionDialog
import
com.base.filerecoveryrecyclebin.view.DialogViews.showGerPermission
import
com.base.filerecoveryrecyclebin.view.DialogViews.showLargeFileTypeDialog
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
java.io.File
class
LargeFileActivity
:
BaseActivity
<
ActivityLargeFileBinding
>()
{
private
lateinit
var
largeFileAdapter
:
LargeFileAdapter
private
var
largeData
=
listOf
<
MediaBean
>()
override
val
binding
:
ActivityLargeFileBinding
by
lazy
{
ActivityLargeFileBinding
.
inflate
(
layoutInflater
)
}
var
selectType
=
SELECT_FILE_ALL
@SuppressLint
(
"SetTextI18n"
)
override
fun
initView
()
{
largeFileAdapter
=
LargeFileAdapter
(
itemClick
=
{},
selectClick
=
{
if
(
it
.
isNotEmpty
())
{
binding
.
tvDelete
.
isEnabled
=
true
binding
.
tvDelete
.
text
=
"Delete(${it.sumOf { bean -> bean.size }.toFormatSize()})"
}
else
{
binding
.
tvDelete
.
isEnabled
=
false
}
})
binding
.
rv
.
adapter
=
largeFileAdapter
if
(
checkStorePermission
())
{
initData
()
}
else
{
showGerPermission
(
desc
=
"This feature requires access to your storage to scan your large files and clean up large files."
+
"We will not transmit your data to any third-party service. Please grant permission so that we can provide you with better service."
,
deny
=
{
finishToMain
()
},
allow
=
{
requestStorePermission
(
launcher
)
{
if
(
it
)
initData
()
else
finishToMain
()
}
})
}
}
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
showExitFunctionDialog
{
show
->
if
(
show
)
{
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
@LargeFileActivity
)
{
finishToMain
()
}
}
else
{
finishToMain
()
}
}
}
binding
.
flBack
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
binding
.
tvDelete
.
setOnClickListener
{
showDeletePermanentlyDialog
{
deleteFiles
()
}
}
binding
.
flFilter
.
setOnClickListener
{
showLargeFileTypeDialog
(
selectType
)
{
type
->
selectType
=
type
binding
.
tvType
.
text
=
selectType
largeFileAdapter
.
setData
(
largeData
.
filter
{
selectFilter
(
it
)
})
}
}
}
private
fun
selectFilter
(
mediaBean
:
MediaBean
):
Boolean
{
when
(
selectType
)
{
SELECT_FILE_ALL
->
return
true
SELECT_FILE_PICTURE
->
{
return
mediaBean
.
mimeType
.
contains
(
"image"
)
}
SELECT_FILE_VIDEO
->
{
return
mediaBean
.
mimeType
.
contains
(
"video"
)
}
SELECT_FILE_AUDIO
->
{
return
mediaBean
.
mimeType
.
contains
(
"audio"
)
}
SELECT_FILE_DOCUMENT
->
{
return
mediaBean
.
mimeType
.
contains
(
"pdf"
)
||
mediaBean
.
mimeType
.
contains
(
"msword"
)
||
mediaBean
.
mimeType
.
contains
(
"document"
)
||
mediaBean
.
mimeType
.
contains
(
"excel"
)
||
mediaBean
.
mimeType
.
contains
(
"sheet"
)
||
mediaBean
.
mimeType
.
contains
(
"powerpoint"
)
||
mediaBean
.
mimeType
.
contains
(
"presentation"
)
}
SELECT_FILE_OTHER
->
{
return
mediaBean
.
mimeType
.
contains
(
"zip"
)
||
mediaBean
.
mimeType
.
contains
(
"rar"
)
||
mediaBean
.
mimeType
.
contains
(
"7z"
)
||
mediaBean
.
mimeType
.
contains
(
"tar"
)
||
mediaBean
.
mimeType
.
contains
(
"archive"
)
||
mediaBean
.
mimeType
.
contains
(
"stream"
)
}
}
return
false
}
private
fun
deleteFiles
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
list
=
largeFileAdapter
.
getSelectData
()
runCatching
{
list
.
forEach
{
bean
->
File
(
bean
.
path
).
delete
()
}
}
launch
(
Dispatchers
.
Main
)
{
largeFileAdapter
.
removeData
(
list
)
delay
(
1000
)
startActivity
(
Intent
(
this
@LargeFileActivity
,
ResultActivity
::
class
.
java
).
apply
{
putExtra
(
"from"
,
ConstObject
.
LARGE_FILE
)
})
finish
()
}
}
private
fun
initData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
beanList
=
getAllMedia
{
size
->
size
>
1024
*
1024
*
50
}
launch
(
Dispatchers
.
Main
)
{
largeData
=
beanList
binding
.
ivEmpty
.
isVisible
=
beanList
.
isEmpty
()
largeFileAdapter
.
setData
(
beanList
)
}
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/activity/largefile/LargeFileAnimationActivity.kt
0 → 100644
View file @
a160dbed
package
com.base.datarecovery.activity.largefile
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.view.View
import
android.widget.Toast
import
androidx.activity.addCallback
import
androidx.lifecycle.lifecycleScope
import
com.base.datarecovery.ads.AdmobMaxHelper
import
com.base.datarecovery.databinding.ActivityLargeFileAnimationBinding
import
com.base.datarecovery.help.BaseActivity
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
class
LargeFileAnimationActivity
:
BaseActivity
<
ActivityLargeFileAnimationBinding
>()
{
override
val
binding
:
ActivityLargeFileAnimationBinding
by
lazy
{
ActivityLargeFileAnimationBinding
.
inflate
(
layoutInflater
)
}
private
var
job
:
Job
?
=
null
override
fun
initView
()
{
}
override
fun
initListener
()
{
onBackPressedDispatcher
.
addCallback
{
Toast
.
makeText
(
this
@LargeFileAnimationActivity
,
"wait a moment"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
fun
jumpJob
()
=
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
delay
(
5000
)
binding
.
lottie
.
visibility
=
View
.
GONE
binding
.
lottie
.
clearAnimation
()
binding
.
lottieCompleted
.
visibility
=
View
.
VISIBLE
binding
.
lottieCompleted
.
playAnimation
()
binding
.
tv
.
text
=
"Completed!"
delay
(
1000
)
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
@LargeFileAnimationActivity
)
{
startActivity
(
Intent
(
this
@LargeFileAnimationActivity
,
LargeFileActivity
::
class
.
java
))
finish
()
}
}
override
fun
onResume
()
{
super
.
onResume
()
if
(
job
?.
isActive
==
false
&&
job
==
null
)
{
job
=
jumpJob
()
}
}
override
fun
onPause
()
{
super
.
onPause
()
job
?.
cancel
()
job
=
null
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/adapter/LargeFileAdapter.kt
0 → 100644
View file @
a160dbed
package
com.base.filerecoveryrecyclebin.adapter
import
android.annotation.SuppressLint
import
android.text.format.Formatter
import
android.view.View
import
android.view.ViewGroup
import
androidx.recyclerview.widget.RecyclerView.Adapter
import
androidx.recyclerview.widget.RecyclerView.ViewHolder
import
com.base.filerecoveryrecyclebin.R
import
com.base.filerecoveryrecyclebin.bean.MediaBean
import
com.base.filerecoveryrecyclebin.databinding.ItemLargeFileBinding
import
com.base.filerecoveryrecyclebin.utils.LogEx
import
com.base.filerecoveryrecyclebin.view.XmlEx.inflate
class
LargeFileAdapter
(
val
itemClick
:
(
data
:
MediaBean
)
->
Unit
,
val
selectClick
:
(
selectList
:
List
<
MediaBean
>)
->
Unit
)
:
Adapter
<
LargeFileAdapter
.
UUU
>()
{
private
val
TAG
=
"BigFileAdapter"
private
val
files
=
arrayListOf
<
MediaBean
>()
class
UUU
(
view
:
View
)
:
ViewHolder
(
view
)
{
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
UUU
{
return
UUU
(
R
.
layout
.
item_large_file
.
inflate
(
parent
))
}
override
fun
getItemCount
():
Int
{
return
files
.
size
}
override
fun
onBindViewHolder
(
holder
:
UUU
,
position
:
Int
)
{
}
override
fun
onBindViewHolder
(
holder
:
UUU
,
position
:
Int
,
payloads
:
MutableList
<
Any
>)
{
val
binding
=
ItemLargeFileBinding
.
bind
(
holder
.
itemView
)
val
data
=
files
[
position
]
val
content
=
holder
.
itemView
.
context
if
(
payloads
.
isEmpty
())
{
binding
.
tvName
.
text
=
data
.
path
.
substring
(
data
.
path
.
lastIndexOf
(
"/"
)
+
1
)
binding
.
tvSize
.
text
=
Formatter
.
formatFileSize
(
content
,
data
.
size
)
binding
.
root
.
setOnClickListener
{
itemClick
.
invoke
(
data
)
}
binding
.
ivSelector
.
isSelected
=
data
.
isSelect
binding
.
flSelect
.
setOnClickListener
{
data
.
isSelect
=
!
data
.
isSelect
binding
.
ivSelector
.
isSelected
=
data
.
isSelect
notifyItemChanged
(
position
,
"dasds"
)
val
selectList
=
files
.
filter
{
it
.
isSelect
}
selectClick
.
invoke
(
selectList
)
}
}
else
{
binding
.
ivSelector
.
isSelected
=
data
.
isSelect
super
.
onBindViewHolder
(
holder
,
position
,
payloads
)
}
}
@SuppressLint
(
"NotifyDataSetChanged"
)
fun
setData
(
bigFileList
:
List
<
MediaBean
>)
{
bigFileList
.
forEach
{
LogEx
.
logDebug
(
TAG
,
"$it"
)
}
files
.
clear
()
files
.
addAll
(
bigFileList
)
files
.
sortByDescending
{
it
.
size
}
notifyDataSetChanged
()
}
fun
getSelectData
():
List
<
MediaBean
>
{
return
files
.
filter
{
it
.
isSelect
}
}
@SuppressLint
(
"NotifyDataSetChanged"
)
fun
removeData
(
deleteList
:
List
<
MediaBean
>)
{
files
.
removeAll
(
deleteList
.
toSet
())
notifyDataSetChanged
()
}
fun
isEmpty
():
Boolean
{
return
files
.
isEmpty
()
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/bean/ConstObject.kt
View file @
a160dbed
...
...
@@ -23,12 +23,20 @@ object ConstObject {
const
val
RECYCLE_BIN
=
"Recycle Bin"
const
val
WHATSAPP_CLEANER
=
"WhatsApp Cleaner"
const
val
APP_PROCESS
=
"App Process"
const
val
LARGE_FILE
=
"Large File"
const
val
SCAN_PHOTOS
=
1
const
val
SCAN_DOCUMENTS
=
2
const
val
SCAN_VIDEOS
=
3
const
val
SCAN_AUDIOS
=
4
const
val
SELECT_FILE_ALL
=
"All types"
const
val
SELECT_FILE_PICTURE
=
"Picture"
const
val
SELECT_FILE_VIDEO
=
"Video"
const
val
SELECT_FILE_AUDIO
=
"Audio"
const
val
SELECT_FILE_DOCUMENT
=
"Document"
const
val
SELECT_FILE_OTHER
=
"Other types"
var
ifAgreePrivacy
=
false
get
()
{
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/bean/MediaBean.kt
View file @
a160dbed
...
...
@@ -5,6 +5,7 @@ import android.net.Uri
data class
MediaBean
(
val
path
:
String
=
""
,
val
uri
:
Uri
=
Uri
.
EMPTY
,
var
size
:
Long
=
0
,
val
time
:
Long
=
0
,
val
mimeType
:
String
=
""
,
)
{
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/fragment/HomeFragment.kt
View file @
a160dbed
...
...
@@ -5,7 +5,6 @@ import android.annotation.SuppressLint
import
android.content.Intent
import
android.view.View
import
androidx.lifecycle.lifecycleScope
import
com.applovin.sdk.AppLovinSdk
import
com.base.filerecoveryrecyclebin.activity.MainActivity
import
com.base.filerecoveryrecyclebin.activity.SettingActivity
import
com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity
...
...
@@ -13,7 +12,6 @@ import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import
com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.recovery.FileScanResultActivity
import
com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimationActivity
import
com.base.filerecoveryrecyclebin.ads.max.AdMaxInit.initAdMax
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_AUDIOS
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_DOCUMENTS
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_PHOTOS
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/fragment/RecoveryFragment.kt
0 → 100644
View file @
a160dbed
package
com.base.filerecoveryrecyclebin.fragment
import
com.base.filerecoveryrecyclebin.databinding.FragmentRecoveryBinding
import
com.base.filerecoveryrecyclebin.help.BaseFragment
class
RecoveryFragment
:
BaseFragment
<
FragmentRecoveryBinding
>()
{
override
val
binding
:
FragmentRecoveryBinding
by
lazy
{
FragmentRecoveryBinding
.
inflate
(
layoutInflater
)
}
override
fun
setView
()
{
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/help/BaseActivity.kt
View file @
a160dbed
...
...
@@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import
androidx.viewbinding.ViewBinding
import
com.base.filerecoveryrecyclebin.activity.MainActivity
import
com.base.filerecoveryrecyclebin.utils.ActivityManagerUtils
import
com.base.filerecoveryrecyclebin.utils.EventUtils
abstract
class
BaseActivity
<
T
:
ViewBinding
>
:
AppCompatActivity
()
{
...
...
@@ -21,6 +22,7 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
launcher
=
ActivityLauncher
(
this
)
setContentView
(
binding
.
root
)
EventUtils
.
event
(
"page_${javaClass.simpleName}"
)
initView
()
initListener
()
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/help/MediaStoreHelp.kt
View file @
a160dbed
...
...
@@ -14,6 +14,42 @@ import com.base.filerecoveryrecyclebin.bean.MediaBean
object
MediaStoreHelp
{
@SuppressLint
(
"Recycle"
)
fun
Context
.
getAllMedia
(
filter
:
(
size
:
Long
)
->
Boolean
):
MutableList
<
MediaBean
>
{
val
files
:
MutableList
<
MediaBean
>
=
ArrayList
()
var
cursor
:
Cursor
?
=
null
try
{
val
uri
=
MediaStore
.
Files
.
getContentUri
(
"external"
)
cursor
=
contentResolver
.
query
(
uri
,
null
,
null
,
null
,
null
)
if
(
cursor
!=
null
)
{
while
(
cursor
.
moveToNext
())
{
val
path
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATA
).
let
{
cursor
.
getString
(
it
)
}
?:
""
val
mimeType
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
MIME_TYPE
).
let
{
cursor
.
getString
(
it
)
}
?:
""
val
size
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
SIZE
).
let
{
cursor
.
getLong
(
it
)
}
val
modifiedDate
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Files
.
FileColumns
.
DATE_MODIFIED
).
let
{
cursor
.
getLong
(
it
)
}
val
info
=
MediaBean
(
path
=
path
,
size
=
size
,
mimeType
=
mimeType
,
time
=
modifiedDate
)
if
(
filter
(
size
))
{
files
.
add
(
info
)
}
}
}
}
catch
(
e
:
java
.
lang
.
Exception
)
{
e
.
printStackTrace
()
}
finally
{
cursor
?.
close
()
}
return
files
}
@SuppressLint
(
"Range"
)
fun
Context
.
getImageMedia
(
list
:
ArrayList
<
MediaBean
>,
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/view/DialogViews.kt
View file @
a160dbed
...
...
@@ -18,12 +18,19 @@ import androidx.lifecycle.LifecycleCoroutineScope
import
com.base.filerecoveryrecyclebin.R
import
com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils.showInterAdSp
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_ALL
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_AUDIO
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_DOCUMENT
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_OTHER
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_PICTURE
import
com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_VIDEO
import
com.base.filerecoveryrecyclebin.bean.RecycleBinBean
import
com.base.filerecoveryrecyclebin.databinding.DialogCameraSettingBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogDeletePermanentlyBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogExitAppBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogExitFunctionBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogImageTakeBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogLargeFileTypeBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogPermissonOpenBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogRecoveringBinding
import
com.base.filerecoveryrecyclebin.databinding.DialogRecyclebinFileRestoreBinding
...
...
@@ -349,5 +356,53 @@ object DialogViews {
}
}
fun
Context
.
showLargeFileTypeDialog
(
type
:
String
,
click
:
(
type
:
String
)
->
Unit
)
{
val
binding
=
DialogLargeFileTypeBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
val
dialog
=
AlertDialog
.
Builder
(
this
).
create
()
dialog
.
setView
(
binding
.
root
)
// dialog.setCanceledOnTouchOutside(false)
// dialog.setCancelable(false)
dialog
.
show
()
dialog
.
window
?.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
)
val
lp
:
WindowManager
.
LayoutParams
?
=
dialog
.
window
?.
attributes
lp
?.
gravity
=
Gravity
.
BOTTOM
lp
?.
width
=
ConstraintLayout
.
LayoutParams
.
MATCH_PARENT
dialog
.
window
?.
setAttributes
(
lp
)
when
(
type
)
{
SELECT_FILE_ALL
->
binding
.
flAllType
.
isSelected
=
true
SELECT_FILE_PICTURE
->
binding
.
flPicture
.
isSelected
=
true
SELECT_FILE_VIDEO
->
binding
.
flVideo
.
isSelected
=
true
SELECT_FILE_AUDIO
->
binding
.
flAudio
.
isSelected
=
true
SELECT_FILE_DOCUMENT
->
binding
.
flDocument
.
isSelected
=
true
SELECT_FILE_OTHER
->
binding
.
flOther
.
isSelected
=
true
}
binding
.
flAllType
.
setOnClickListener
{
dialog
.
dismiss
()
click
.
invoke
(
SELECT_FILE_ALL
)
}
binding
.
flPicture
.
setOnClickListener
{
dialog
.
dismiss
()
click
.
invoke
(
SELECT_FILE_PICTURE
)
}
binding
.
flVideo
.
setOnClickListener
{
dialog
.
dismiss
()
click
.
invoke
(
SELECT_FILE_VIDEO
)
}
binding
.
flAudio
.
setOnClickListener
{
dialog
.
dismiss
()
click
.
invoke
(
SELECT_FILE_AUDIO
)
}
binding
.
flDocument
.
setOnClickListener
{
dialog
.
dismiss
()
click
.
invoke
(
SELECT_FILE_DOCUMENT
)
}
binding
.
flOther
.
setOnClickListener
{
dialog
.
dismiss
()
click
.
invoke
(
SELECT_FILE_OTHER
)
}
}
}
app/src/main/res/layout/activity_large_file.xml
0 → 100644
View file @
a160dbed
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:background=
"@color/white"
tools:ignore=
"UselessParent"
>
<FrameLayout
android:id=
"@+id/fl_back"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
tools:ignore=
"UselessParent"
>
<ImageView
android:layout_width=
"17dp"
android:layout_height=
"17dp"
android:layout_gravity=
"center"
android:src=
"@mipmap/quit"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"Large File Cleaner"
android:textColor=
"#000000"
android:textSize=
"19sp"
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
</FrameLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:id=
"@+id/tv_type"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|start"
android:layout_marginStart=
"15dp"
android:text=
"All types"
android:textColor=
"#333333"
tools:ignore=
"HardcodedText"
/>
<FrameLayout
android:id=
"@+id/fl_filter"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"5dp"
android:padding=
"15dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/arrow_l"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</FrameLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem=
"@layout/item_large_file"
/>
<ImageView
android:id=
"@+id/iv_empty"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:src=
"@mipmap/queshengye"
android:visibility=
"gone"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_delete"
android:layout_width=
"289dp"
android:layout_height=
"45dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"16dp"
android:background=
"@drawable/bg_delete_selector"
android:enabled=
"false"
android:gravity=
"center"
android:text=
"Delete"
android:textColor=
"@color/color_delete_selector"
android:textSize=
"18sp"
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
a160dbed
...
...
@@ -77,6 +77,36 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"Recovery"
android:textColor=
"@color/color_tab_select"
android:textSize=
"11sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingTop=
"10dp"
android:paddingBottom=
"15dp"
tools:ignore=
"UseCompoundDrawables"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:background=
"@drawable/bg_recyclebin_tab"
tools:ignore=
"ContentDescription"
/>
<TextView
android:id=
"@+id/tv_3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"RecycleBin"
android:textColor=
"@color/color_tab_select"
android:textSize=
"11sp"
...
...
app/src/main/res/layout/dialog_large_file_type.xml
0 → 100644
View file @
a160dbed
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_ffffff_tlr10"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"22dp"
android:layout_marginTop=
"25dp"
android:text=
"Select type"
android:textColor=
"@color/black"
android:textSize=
"16sp"
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:layout_marginTop=
"16dp"
android:background=
"#EEEEEE"
/>
<FrameLayout
android:id=
"@+id/fl_all_type"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"18dp"
android:layout_marginStart=
"22dp"
android:text=
"All types"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"22dp"
android:src=
"@drawable/bg_circle_selector"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_picture"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"18dp"
android:layout_marginStart=
"22dp"
android:text=
"Picture"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"22dp"
android:src=
"@drawable/bg_circle_selector"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_Video"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"18dp"
android:layout_marginStart=
"22dp"
android:text=
"Video"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"22dp"
android:src=
"@drawable/bg_circle_selector"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_Audio"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"18dp"
android:layout_marginStart=
"22dp"
android:text=
"Audio"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"22dp"
android:src=
"@drawable/bg_circle_selector"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_document"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"18dp"
android:layout_marginStart=
"22dp"
android:text=
"Document"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"22dp"
android:src=
"@drawable/bg_circle_selector"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_other"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginVertical=
"18dp"
android:layout_marginStart=
"22dp"
android:text=
"Other types"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"22dp"
android:src=
"@drawable/bg_circle_selector"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_recovery.xml
0 → 100644
View file @
a160dbed
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".fragment.RecoveryFragment"
>
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:text=
"@string/hello_blank_fragment"
/>
</FrameLayout>
\ No newline at end of file
app/src/main/res/layout/item_large_file.xml
0 → 100644
View file @
a160dbed
<?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:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"6dp"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"10dp"
>
<androidx.cardview.widget.CardView
android:id=
"@+id/card"
android:layout_width=
"45dp"
android:layout_height=
"45dp"
android:layout_marginStart=
"5dp"
app:cardCornerRadius=
"8dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:id=
"@+id/iv"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:src=
"@mipmap/largeicon"
tools:ignore=
"ContentDescription"
/>
</androidx.cardview.widget.CardView>
<LinearLayout
android:id=
"@+id/ll"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"@id/card"
app:layout_constraintEnd_toStartOf=
"@id/fl_select"
app:layout_constraintStart_toEndOf=
"@id/card"
app:layout_constraintTop_toTopOf=
"@id/card"
>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"middle"
android:singleLine=
"true"
android:textColor=
"#333333"
android:textSize=
"15sp"
android:textStyle=
"bold"
tools:text=
"aaaaa.xxx"
/>
<TextView
android:id=
"@+id/tv_size"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:textColor=
"#999999"
android:textSize=
"12sp"
tools:text=
"8.7 MB"
/>
</LinearLayout>
<FrameLayout
android:id=
"@+id/fl_select"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:padding=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:id=
"@+id/iv_selector"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:background=
"@drawable/bg_circle_selector"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<View
android:layout_width=
"0dp"
android:layout_height=
"1dp"
android:layout_marginTop=
"12dp"
android:layout_marginEnd=
"10dp"
android:background=
"#F4F4F4"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"@id/fl_select"
app:layout_constraintStart_toStartOf=
"@id/ll"
app:layout_constraintTop_toBottomOf=
"@id/ll"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/mipmap-xxhdpi/arrow_l.png
0 → 100644
View file @
a160dbed
1.27 KB
app/src/main/res/mipmap-xxhdpi/largeicon.png
0 → 100644
View file @
a160dbed
3.43 KB
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