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
Hide 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
This diff is collapsed.
Click to expand it.
MyDemo3/app/src/main/java/com/test/mydemo3/adapter/CleanAdapter2.kt
View file @
28cd9e39
package
com.test.mydemo3.adapter
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
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
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
{
TODO
(
"Not yet implemented"
)
return
AAA
(
R
.
layout
.
clean_list_item_layout
.
inflate
(
parent
)
)
}
override
fun
getItemCount
():
Int
{
TODO
(
"Not yet implemented"
)
return
list
.
size
}
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
Sub
inner
class
SubAdapter
:
RecyclerView
.
Adapter
<
SubAdapter
.
BBB
>()
{
private
val
sibList
=
ArrayList
<
FileBean
>()
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"?>
<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:
orientation=
"vertical
"
android:
layout_height=
"wrap_content
"
>
android:
layout_height=
"wrap_content
"
android:
orientation=
"vertical
"
>
<RelativeLayout
android:id=
"@+id/clean_item_bar"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
>
<TextView
android:id=
"@+id/clean_item_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:text
Size=
"16dp
"
android:text
=
"Uninstall remains
"
android:textColor=
"@color/black"
android:text=
"Uninstall remains"
/>
android:textSize=
"16dp"
/>
<ImageView
android:id=
"@+id/clean_item_unfold"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"12dp"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"12dp"
android:layout_toEndOf=
"@+id/clean_item_name"
android:src=
"@mipmap/unfold"
/>
android:src=
"@mipmap/unfold"
/>
<CheckBox
android:id=
"@+id/clean_item_check_box"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:button=
"@null"
android:layout_centerVertical=
"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
android:id=
"@+id/clean_item_more"
...
...
@@ -40,25 +43,26 @@
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:src=
"@mipmap/more"
/>
android:src=
"@mipmap/more"
/>
<TextView
android:id=
"@+id/file_item_size"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"23MB"
android:layout_alignParentEnd=
"true"
android:layout_marginEnd=
"46dp"
android:layout_centerVertical=
"true"
android:textColor=
"#DBDBDB"
/>
android:layout_marginEnd=
"46dp"
android:text=
"23MB"
android:textColor=
"#DBDBDB"
/>
</RelativeLayout>
<
List
View
<
androidx.recyclerview.widget.Recycler
View
android:id=
"@+id/clean_item_list"
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>
\ 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