Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
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
Data Recovery White
Commits
8a5eff91
Commit
8a5eff91
authored
Jul 12, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
901b66d6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
7 deletions
+73
-7
build.gradle
app/build.gradle
+1
-1
google-services.json
app/google-services.json
+6
-6
FileScanResultActivity.kt
.../datarecovery/activity/recovery/FileScanResultActivity.kt
+66
-0
No files found.
app/build.gradle
View file @
8a5eff91
...
@@ -10,7 +10,7 @@ android {
...
@@ -10,7 +10,7 @@ android {
compileSdk
34
compileSdk
34
defaultConfig
{
defaultConfig
{
applicationId
"com.
base.datarecovery
"
applicationId
"com.
test.basd.cleanmaster
"
minSdk
24
minSdk
24
targetSdk
34
targetSdk
34
versionCode
1
versionCode
1
...
...
app/google-services.json
View file @
8a5eff91
{
{
"project_info"
:
{
"project_info"
:
{
"project_number"
:
"
347166098933
"
,
"project_number"
:
"
993178188325
"
,
"project_id"
:
"
comtestklplafilemanag
er"
,
"project_id"
:
"
testcleanmast
er"
,
"storage_bucket"
:
"
comtestklplafilemanag
er.appspot.com"
"storage_bucket"
:
"
testcleanmast
er.appspot.com"
},
},
"client"
:
[
"client"
:
[
{
{
"client_info"
:
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:
347166098933:android:37d25f227cd33ae60b8cb
c"
,
"mobilesdk_app_id"
:
"1:
993178188325:android:a7986c2607f23024825dc
c"
,
"android_client_info"
:
{
"android_client_info"
:
{
"package_name"
:
"com.
base.datarecovery
"
"package_name"
:
"com.
test.basd.cleanmaster
"
}
}
},
},
"oauth_client"
:
[],
"oauth_client"
:
[],
"api_key"
:
[
"api_key"
:
[
{
{
"current_key"
:
"AIzaSy
DMBvW8CR7gxtL1n3V2Gx5vvoECmMvM6c8
"
"current_key"
:
"AIzaSy
CY5uqNx8qS5ZPvSIknbh2nH2v5vjzCmPI
"
}
}
],
],
"services"
:
{
"services"
:
{
...
...
app/src/main/java/com/base/datarecovery/activity/recovery/FileScanResultActivity.kt
View file @
8a5eff91
...
@@ -3,7 +3,10 @@ package com.base.datarecovery.activity.recovery
...
@@ -3,7 +3,10 @@ package com.base.datarecovery.activity.recovery
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Environment
import
androidx.activity.addCallback
import
androidx.activity.addCallback
import
androidx.lifecycle.lifecycleScope
import
com.base.datarecovery.R
import
com.base.datarecovery.adapter.FileFolderAdapter
import
com.base.datarecovery.adapter.FileFolderAdapter
import
com.base.datarecovery.ads.AdmobInterstitialUtils
import
com.base.datarecovery.ads.AdmobInterstitialUtils
import
com.base.datarecovery.bean.ConstObject.SCAN_DOCUMENTS
import
com.base.datarecovery.bean.ConstObject.SCAN_DOCUMENTS
...
@@ -14,16 +17,25 @@ import com.base.datarecovery.bean.RecoveryBean
...
@@ -14,16 +17,25 @@ import com.base.datarecovery.bean.RecoveryBean
import
com.base.datarecovery.bean.RecoveryBean.Companion.setType
import
com.base.datarecovery.bean.RecoveryBean.Companion.setType
import
com.base.datarecovery.databinding.ActivityFileScanResultBinding
import
com.base.datarecovery.databinding.ActivityFileScanResultBinding
import
com.base.datarecovery.help.BaseActivity
import
com.base.datarecovery.help.BaseActivity
import
com.base.datarecovery.help.FileHelp.loadFileByFilter
import
com.base.datarecovery.utils.BarUtils
import
com.base.datarecovery.utils.BarUtils
import
com.base.datarecovery.utils.FileHexEx
import
com.base.datarecovery.utils.LogEx
import
com.base.datarecovery.utils.LogEx
import
com.base.datarecovery.view.DialogViews.showExitFunctionDialog
import
com.base.datarecovery.view.DialogViews.showExitFunctionDialog
import
com.base.datarecovery.view.FileScanDialog
import
com.google.gson.Gson
import
com.google.gson.Gson
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.channels.BufferOverflow
import
kotlinx.coroutines.flow.MutableSharedFlow
import
kotlinx.coroutines.flow.SharedFlow
import
kotlinx.coroutines.launch
import
java.io.File
import
java.io.File
import
java.util.HashMap
import
java.util.HashMap
class
FileScanResultActivity
:
BaseActivity
<
ActivityFileScanResultBinding
>()
{
class
FileScanResultActivity
:
BaseActivity
<
ActivityFileScanResultBinding
>()
{
private
val
TAG
=
"FileScanResultActivity"
private
val
TAG
=
"FileScanResultActivity"
private
var
scanOnce
:
Boolean
=
false
private
var
scanType
=
0
private
var
scanType
=
0
override
val
binding
:
ActivityFileScanResultBinding
by
lazy
{
override
val
binding
:
ActivityFileScanResultBinding
by
lazy
{
ActivityFileScanResultBinding
.
inflate
(
layoutInflater
)
ActivityFileScanResultBinding
.
inflate
(
layoutInflater
)
...
@@ -106,6 +118,60 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
...
@@ -106,6 +118,60 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
binding
.
tvFolderNumber
.
text
=
list
.
size
.
toString
()
binding
.
tvFolderNumber
.
text
=
list
.
size
.
toString
()
fileFolderAdapter
.
setData
(
list
)
fileFolderAdapter
.
setData
(
list
)
}
}
private
fun
beginScan
()
{
if
(
scanOnce
)
return
scanOnce
=
true
val
mPathFlow
=
MutableSharedFlow
<
String
>(
replay
=
5
,
//当新的订阅者Collect时,发送几个已经发送过的数据给它
extraBufferCapacity
=
5
,
//减去replay,MutableSharedFlow还缓存多少数据,缓冲池容量 = replay + extraBufferCapacity
onBufferOverflow
=
BufferOverflow
.
SUSPEND
//缓存策略,三种 丢掉最新值、丢掉最旧值和挂起
)
val
pathFlow
:
SharedFlow
<
String
>
=
mPathFlow
val
mFoundFlow
=
MutableSharedFlow
<
Int
>(
replay
=
5
,
//当新的订阅者Collect时,发送几个已经发送过的数据给它
extraBufferCapacity
=
5
,
//减去replay,MutableSharedFlow还缓存多少数据,缓冲池容量 = replay + extraBufferCapacity
onBufferOverflow
=
BufferOverflow
.
SUSPEND
//缓存策略,三种 丢掉最新值、丢掉最旧值和挂起
)
val
foundFlow
:
SharedFlow
<
Int
>
=
mFoundFlow
val
dialogClass
=
FileScanDialog
(
this
)
val
scanDialog
=
dialogClass
.
showFileScanDialog
(
pathFlow
,
foundFlow
)
val
filter
=
when
(
scanType
)
{
SCAN_PHOTOS
->
FileHexEx
::
isImage
SCAN_DOCUMENTS
->
FileHexEx
::
isDocument
SCAN_VIDEOS
->
FileHexEx
::
isVideo
else
->
FileHexEx
::
isImage
}
var
oneShowAd
=
false
val
root
=
Environment
.
getExternalStorageDirectory
()
val
pathList
=
arrayListOf
<
String
>()
lifecycleScope
.
loadFileByFilter
(
mPathFlow
,
mFoundFlow
,
root
,
filter
=
filter
,
onDo
=
{
file
->
LogEx
.
logDebug
(
TAG
,
"file =${file.absolutePath}"
)
pathList
.
add
(
file
.
absolutePath
)
if
(!
oneShowAd
)
{
oneShowAd
=
true
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
dialogClass
.
scanShowUI
()
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@FileScanResultActivity
,
true
,
false
)
{
}
}
}
},
onFinish
=
{
scanDialog
.
dismiss
()
dialogClass
.
stopScan
(
scanType
,
pathList
)
}
)
}
}
}
\ 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