Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
F
FileManager
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
yanglin
FileManager
Commits
28cd9e39
Commit
28cd9e39
authored
Apr 16, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aaa
parent
b2ee4c82
Pipeline
#1048
failed with stages
Changes
4
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
389 additions
and
301 deletions
+389
-301
CleanActivity.kt
.../src/main/java/com/test/mydemo3/activity/CleanActivity.kt
+143
-137
CleanAdapter2.kt
...p/src/main/java/com/test/mydemo3/adapter/CleanAdapter2.kt
+68
-5
activity_clean.xml
MyDemo3/app/src/main/res/layout/activity_clean.xml
+158
-143
clean_list_item_layout.xml
MyDemo3/app/src/main/res/layout/clean_list_item_layout.xml
+20
-16
No files found.
MyDemo3/app/src/main/java/com/test/mydemo3/activity/CleanActivity.kt
View file @
28cd9e39
...
@@ -12,6 +12,7 @@ import android.widget.ListView
...
@@ -12,6 +12,7 @@ import android.widget.ListView
import
android.widget.ProgressBar
import
android.widget.ProgressBar
import
android.widget.TextView
import
android.widget.TextView
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.recyclerview.widget.RecyclerView
import
com.cleanmaster.junk.bean.SDcardRubbishResult
import
com.cleanmaster.junk.bean.SDcardRubbishResult
import
com.cloud.cleanjunksdk.ad.AdvBean
import
com.cloud.cleanjunksdk.ad.AdvBean
import
com.cloud.cleanjunksdk.cache.CacheBean
import
com.cloud.cleanjunksdk.cache.CacheBean
...
@@ -25,6 +26,7 @@ import com.cm.plugincluster.junkengine.junk.engine.MEDIA_TYPE
...
@@ -25,6 +26,7 @@ import com.cm.plugincluster.junkengine.junk.engine.MEDIA_TYPE
import
com.test.mydemo3.MyApplication
import
com.test.mydemo3.MyApplication
import
com.test.mydemo3.R
import
com.test.mydemo3.R
import
com.test.mydemo3.adapter.CleanAdapter
import
com.test.mydemo3.adapter.CleanAdapter
import
com.test.mydemo3.adapter.CleanAdapter2
import
com.test.mydemo3.antivirus.AntivirusActivity
import
com.test.mydemo3.antivirus.AntivirusActivity
import
com.test.mydemo3.model.CleanBean
import
com.test.mydemo3.model.CleanBean
import
com.test.mydemo3.model.FileBean
import
com.test.mydemo3.model.FileBean
...
@@ -35,12 +37,14 @@ class CleanActivity : AppCompatActivity() {
...
@@ -35,12 +37,14 @@ class CleanActivity : AppCompatActivity() {
private
var
mQuitBtn
:
ImageView
?
=
null
private
var
mQuitBtn
:
ImageView
?
=
null
private
var
mHintTv
:
TextView
?
=
null
private
var
mHintTv
:
TextView
?
=
null
private
var
mProgress
:
ProgressBar
?
=
null
private
var
mProgress
:
ProgressBar
?
=
null
private
lateinit
var
mListView
:
ListView
private
lateinit
var
mListView
:
RecyclerView
private
var
mCleanAdapter
:
CleanAdapter
?
=
null
// private var mCleanAdapter: CleanAdapter? = null
private
var
mCleanAdapter2
:
CleanAdapter2
?
=
null
private
var
mAdView
:
View
?
=
null
private
var
mAdView
:
View
?
=
null
private
lateinit
var
mAnimation
:
View
private
lateinit
var
mAnimation
:
View
private
lateinit
var
mCleanBtn
:
TextView
private
lateinit
var
mCleanBtn
:
TextView
private
var
junkScanCallback
:
JunkScanCallback
?
=
null
private
var
junkScanCallback
:
JunkScanCallback
?
=
null
private
var
mCount
=
0
private
var
mCount
=
0
// private var mBooleans = ArrayList<Boolean>()
// private var mBooleans = ArrayList<Boolean>()
...
@@ -53,7 +57,7 @@ class CleanActivity : AppCompatActivity() {
...
@@ -53,7 +57,7 @@ class CleanActivity : AppCompatActivity() {
setContentView
(
R
.
layout
.
activity_clean
)
setContentView
(
R
.
layout
.
activity_clean
)
initJunkScanCallBack
()
initJunkScanCallBack
()
initView
()
initView
()
if
(
MyApplication
.
mCleanSdk
!=
null
){
if
(
MyApplication
.
mCleanSdk
!=
null
)
{
MyApplication
.
mCleanSdk
?.
cancel
()
MyApplication
.
mCleanSdk
?.
cancel
()
// MyApplication.mCleanSdk?.startScan(junkScanCallback, true)
// MyApplication.mCleanSdk?.startScan(junkScanCallback, true)
}
}
...
@@ -91,18 +95,19 @@ class CleanActivity : AppCompatActivity() {
...
@@ -91,18 +95,19 @@ class CleanActivity : AppCompatActivity() {
cleanBean
=
CleanBean
()
cleanBean
=
CleanBean
()
cleanBean
.
typeName
=
"Other trash"
cleanBean
.
typeName
=
"Other trash"
mCleanBeans
.
add
(
cleanBean
)
mCleanBeans
.
add
(
cleanBean
)
mCleanAdapter
=
CleanAdapter
(
mCleanBeans
,
this
)
// mCleanAdapter = CleanAdapter(mCleanBeans, this)
mListView
.
adapter
=
mCleanAdapter
mCleanAdapter2
=
CleanAdapter2
()
mListView
.
adapter
=
mCleanAdapter2
MyApplication
.
mCleanSdk
?.
startScan
(
junkScanCallback
,
false
)
MyApplication
.
mCleanSdk
?.
startScan
(
junkScanCallback
,
false
)
MyApplication
.
mCleanSdk
?.
timeout
(
60000
)
MyApplication
.
mCleanSdk
?.
timeout
(
60000
)
val
handler
=
Handler
(
Looper
.
getMainLooper
())
val
handler
=
Handler
(
Looper
.
getMainLooper
())
val
runnable
=
object
:
Runnable
{
val
runnable
=
object
:
Runnable
{
override
fun
run
()
{
override
fun
run
()
{
if
(
mCount
<
99
){
if
(
mCount
<
99
)
{
mCount
++
mCount
++
mProgress
?.
setProgress
(
mCount
)
mProgress
?.
setProgress
(
mCount
)
handler
.
postDelayed
(
this
,
300
)
handler
.
postDelayed
(
this
,
300
)
}
}
...
@@ -130,37 +135,37 @@ class CleanActivity : AppCompatActivity() {
...
@@ -130,37 +135,37 @@ class CleanActivity : AppCompatActivity() {
startActivity
(
Intent
(
this
,
SimilarImagesActivity
::
class
.
java
))
startActivity
(
Intent
(
this
,
SimilarImagesActivity
::
class
.
java
))
}
}
findViewById
<
View
>(
R
.
id
.
clean_click_text
).
setOnClickListener
{
findViewById
<
View
>(
R
.
id
.
clean_click_text
).
setOnClickListener
{
mAnimation
.
visibility
=
View
.
VISIBLE
//
mAnimation.visibility = View.VISIBLE
Thread
(
Runnable
{
//
Thread(Runnable {
Thread
.
sleep
(
1000
)
//
Thread.sleep(1000)
for
(
fileBeans
in
mCleanAdapter
?.
mFileCheckedItemList
!!
)
{
// for (fileBeans in mCleanAdapter?.mFileCheckedItemList!!)
{
for
(
fileBean
in
fileBeans
)
{
// for (fileBean in fileBeans)
{
try
{
//
try {
MyApplication
.
mCleanSdk
?.
delete
(
File
(
fileBean
.
filePath
))
//
MyApplication.mCleanSdk?.delete(File(fileBean.filePath))
}
catch
(
e
:
Exception
)
{
// } catch (e: Exception)
{
e
.
printStackTrace
()
//
e.printStackTrace()
}
//
}
}
//
}
}
//
}
runOnUiThread
{
//
runOnUiThread {
mListView
.
visibility
=
View
.
GONE
//
mListView.visibility = View.GONE
mAnimation
.
visibility
=
View
.
GONE
//
mAnimation.visibility = View.GONE
findViewById
<
View
>(
R
.
id
.
clean_over_layout
).
visibility
=
View
.
VISIBLE
//
findViewById<View>(R.id.clean_over_layout).visibility = View.VISIBLE
}
//
}
}).
start
()
//
}).start()
}
//
}
}
}
}
fun
initJunkScanCallBack
()
{
fun
initJunkScanCallBack
()
{
val
TAG
=
"yanglin"
val
TAG
=
"yanglin"
junkScanCallback
=
object
:
JunkScanCallback
{
junkScanCallback
=
object
:
JunkScanCallback
{
override
fun
onStart
()
{
override
fun
onStart
()
{
// Log.e(TAG, "onStart: ", )
// Log.e(TAG, "onStart: ", )
}
}
override
fun
error
(
p0
:
Int
,
p1
:
Throwable
?)
{
override
fun
error
(
p0
:
Int
,
p1
:
Throwable
?)
{
Log
.
e
(
TAG
,
"error: $p0"
,
)
Log
.
e
(
TAG
,
"error: $p0"
)
}
}
override
fun
onAdJunkEmitOne
(
p0
:
AdvBean
?)
{
override
fun
onAdJunkEmitOne
(
p0
:
AdvBean
?)
{
...
@@ -189,7 +194,7 @@ class CleanActivity : AppCompatActivity() {
...
@@ -189,7 +194,7 @@ class CleanActivity : AppCompatActivity() {
}
}
override
fun
onApkJunkScanSucceed
()
{
override
fun
onApkJunkScanSucceed
()
{
Log
.
e
(
TAG
,
"onApkJunkScanSucceed: "
,
)
Log
.
e
(
TAG
,
"onApkJunkScanSucceed: "
)
// mCount +=10
// mCount +=10
// mProgress?.setProgress(mCount)
// mProgress?.setProgress(mCount)
mIsApkScanSuccess
=
true
mIsApkScanSuccess
=
true
...
@@ -219,7 +224,7 @@ class CleanActivity : AppCompatActivity() {
...
@@ -219,7 +224,7 @@ class CleanActivity : AppCompatActivity() {
}
}
override
fun
onLogJunkEmitOne
(
p0
:
LogBean
?)
{
override
fun
onLogJunkEmitOne
(
p0
:
LogBean
?)
{
Log
.
e
(
TAG
,
"onLogJunkEmitOne: $p0"
,
)
Log
.
e
(
TAG
,
"onLogJunkEmitOne: $p0"
)
// val fileBean = FileBean()
// val fileBean = FileBean()
// fileBean.fileName = p0?.name!!
// fileBean.fileName = p0?.name!!
// fileBean.filePath = p0.path
// fileBean.filePath = p0.path
...
@@ -241,7 +246,7 @@ class CleanActivity : AppCompatActivity() {
...
@@ -241,7 +246,7 @@ class CleanActivity : AppCompatActivity() {
override
fun
onCacheJunkEmitOne
(
p0
:
CacheBean
?)
{
override
fun
onCacheJunkEmitOne
(
p0
:
CacheBean
?)
{
// Log.e(TAG, "onCacheJunkEmitOne: $p0", )
// Log.e(TAG, "onCacheJunkEmitOne: $p0", )
val
fileBean
=
FileBean
()
val
fileBean
=
FileBean
()
for
(
pathBean
in
p0
?.
pathBeen
!!
)
{
for
(
pathBean
in
p0
?.
pathBeen
!!
)
{
fileBean
.
fileName
=
p0
.
packageName
fileBean
.
fileName
=
p0
.
packageName
fileBean
.
filePath
=
pathBean
.
cleanPath
fileBean
.
filePath
=
pathBean
.
cleanPath
fileBean
.
hint
=
p0
.
appName
fileBean
.
hint
=
p0
.
appName
...
@@ -312,12 +317,12 @@ class CleanActivity : AppCompatActivity() {
...
@@ -312,12 +317,12 @@ class CleanActivity : AppCompatActivity() {
if
(
mIsApkScanSuccess
&&
mIsCacheScanSuccess
&&
mIsTmpScanSuccess
)
{
if
(
mIsApkScanSuccess
&&
mIsCacheScanSuccess
&&
mIsTmpScanSuccess
)
{
// MyApplication.mCleanSdk?.
// MyApplication.mCleanSdk?.
findViewById
<
View
>(
R
.
id
.
battery_animation_btn
).
visibility
=
View
.
GONE
findViewById
<
View
>(
R
.
id
.
battery_animation_btn
).
visibility
=
View
.
GONE
mCleanAdapter
?.
setData
(
mCleanBeans
)
mCleanAdapter2
?.
setData
(
mCleanBeans
)
CleanAdapter
.
isCleanOver
=
true
CleanAdapter
.
isCleanOver
=
true
var
allSize
:
Long
=
0
var
allSize
:
Long
=
0
for
(
size
in
mCleanAdapter
?.
mAllSizes
!!
)
{
// for (size in mCleanAdapter2
?.mAllSizes!!) {
allSize
+=
size
//
allSize += size
}
//
}
mCount
=
0
mCount
=
0
mProgress
?.
setProgress
(
100
)
mProgress
?.
setProgress
(
100
)
mProgress
?.
visibility
=
View
.
GONE
mProgress
?.
visibility
=
View
.
GONE
...
@@ -336,4 +341,5 @@ class CleanActivity : AppCompatActivity() {
...
@@ -336,4 +341,5 @@ class CleanActivity : AppCompatActivity() {
}
}
}
}
}
}
\ No newline at end of file
MyDemo3/app/src/main/java/com/test/mydemo3/adapter/CleanAdapter2.kt
View file @
28cd9e39
package
com.test.mydemo3.adapter
package
com.test.mydemo3.adapter
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
com.test.mydemo3.R
import
com.test.mydemo3.databinding.CleanListItemLayoutBinding
import
com.test.mydemo3.databinding.FilesItemLayoutBinding
import
com.test.mydemo3.model.CleanBean
import
com.test.mydemo3.model.FileBean
class
CleanAdapter2
:
RecyclerView
.
Adapter
<
CleanAdapter2
.
AAA
>()
{
class
CleanAdapter2
:
RecyclerView
.
Adapter
<
CleanAdapter2
.
AAA
>()
{
class
AAA
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
private
val
list
=
ArrayList
<
CleanBean
>()
fun
Int
.
inflate
(
parent
:
ViewGroup
,
attachToRoot
:
Boolean
=
false
):
View
{
return
LayoutInflater
.
from
(
parent
.
context
).
inflate
(
this
,
parent
,
attachToRoot
)
}
class
AAA
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
binding
=
CleanListItemLayoutBinding
.
bind
(
view
)
}
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
AAA
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
AAA
{
TODO
(
"Not yet implemented"
)
return
AAA
(
R
.
layout
.
clean_list_item_layout
.
inflate
(
parent
)
)
}
}
override
fun
getItemCount
():
Int
{
override
fun
getItemCount
():
Int
{
TODO
(
"Not yet implemented"
)
return
list
.
size
}
}
override
fun
onBindViewHolder
(
holder
:
AAA
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
AAA
,
position
:
Int
)
{
TODO
(
"Not yet implemented"
)
val
data
=
list
[
position
]
holder
.
binding
.
cleanItemName
.
text
=
data
.
typeName
///展开逻辑
if
(
data
.
isListViewShow
)
{
holder
.
binding
.
cleanItemList
.
visibility
=
View
.
VISIBLE
val
subAdapter
=
SubAdapter
()
holder
.
binding
.
cleanItemList
.
adapter
=
subAdapter
subAdapter
.
setData
(
data
.
fileBeans
)
}
else
{
holder
.
binding
.
cleanItemList
.
visibility
=
View
.
GONE
}
holder
.
binding
.
cleanItemUnfold
.
setOnClickListener
{
data
.
isListViewShow
=
!
data
.
isListViewShow
notifyItemChanged
(
position
)
}
//选中的逻辑,先外层通过data的属性值是否选中,点击事假更新子类表选中状态下
}
}
fun
setData
(
datas
:
List
<
CleanBean
>)
{
list
.
clear
()
list
.
addAll
(
datas
)
notifyDataSetChanged
()
}
inner
class
SubAdapter
:
RecyclerView
.
Adapter
<
SubAdapter
.
BBB
>()
{
private
val
sibList
=
ArrayList
<
FileBean
>()
inner
Sub
inner
class
BBB
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
binding
=
FilesItemLayoutBinding
.
bind
(
view
)
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
BBB
{
return
BBB
(
R
.
layout
.
files_item_layout
.
inflate
(
parent
))
}
override
fun
getItemCount
():
Int
{
return
sibList
.
size
}
override
fun
onBindViewHolder
(
holder
:
BBB
,
position
:
Int
)
{
val
data
=
sibList
[
position
]
holder
.
binding
.
fileItemName
.
text
=
data
.
fileName
//todo data通过状态值显示选中状态
// holder.binding.fileJoinToImg.isSelected=data.
}
fun
setData
(
datas
:
List
<
FileBean
>)
{
sibList
.
clear
()
sibList
.
addAll
(
datas
)
notifyDataSetChanged
()
}
}
}
}
\ No newline at end of file
MyDemo3/app/src/main/res/layout/activity_clean.xml
View file @
28cd9e39
This diff is collapsed.
Click to expand it.
MyDemo3/app/src/main/res/layout/clean_list_item_layout.xml
View file @
28cd9e39
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:
orientation=
"vertical
"
android:
layout_height=
"wrap_content
"
android:
layout_height=
"wrap_content
"
>
android:
orientation=
"vertical
"
>
<RelativeLayout
<RelativeLayout
android:id=
"@+id/clean_item_bar"
android:id=
"@+id/clean_item_bar"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
>
android:layout_height=
"50dp"
>
<TextView
<TextView
android:id=
"@+id/clean_item_name"
android:id=
"@+id/clean_item_name"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:text
Size=
"16dp
"
android:text
=
"Uninstall remains
"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:text=
"Uninstall remains"
/>
android:textSize=
"16dp"
/>
<ImageView
<ImageView
android:id=
"@+id/clean_item_unfold"
android:id=
"@+id/clean_item_unfold"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"12dp"
android:layout_toEndOf=
"@+id/clean_item_name"
android:layout_toEndOf=
"@+id/clean_item_name"
android:src=
"@mipmap/unfold"
/>
android:src=
"@mipmap/unfold"
/>
<CheckBox
<CheckBox
android:id=
"@+id/clean_item_check_box"
android:id=
"@+id/clean_item_check_box"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:button=
"@null"
android:layout_centerVertical=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:drawableEnd=
"@drawable/bg_item_switch_selector"
/>
android:layout_centerVertical=
"true"
android:button=
"@null"
android:drawableEnd=
"@drawable/bg_item_switch_selector"
/>
<ImageView
<ImageView
android:id=
"@+id/clean_item_more"
android:id=
"@+id/clean_item_more"
...
@@ -40,25 +43,26 @@
...
@@ -40,25 +43,26 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:src=
"@mipmap/more"
/>
android:src=
"@mipmap/more"
/>
<TextView
<TextView
android:id=
"@+id/file_item_size"
android:id=
"@+id/file_item_size"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"23MB"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:layout_marginEnd=
"46dp"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:textColor=
"#DBDBDB"
/>
android:layout_marginEnd=
"46dp"
android:text=
"23MB"
android:textColor=
"#DBDBDB"
/>
</RelativeLayout>
</RelativeLayout>
<
List
View
<
androidx.recyclerview.widget.Recycler
View
android:id=
"@+id/clean_item_list"
android:id=
"@+id/clean_item_list"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
/>
</LinearLayout>
</LinearLayout>
\ 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