Change fast scroll support
This commit is contained in:
parent
a775f06dc2
commit
26e2c0400a
7 changed files with 9 additions and 52 deletions
|
|
@ -71,6 +71,8 @@ dependencies {
|
|||
ksp("androidx.room:room-compiler:2.6.1")
|
||||
// Gson
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
// Fast Scroll
|
||||
implementation("me.zhanghai.android.fastscroll:library:1.3.0")
|
||||
// Test
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import cn.super12138.todo.logic.model.ToDo
|
|||
import cn.super12138.todo.views.progress.ProgressFragmentViewModel
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import kotlinx.coroutines.launch
|
||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder
|
||||
import showToast
|
||||
import java.util.UUID
|
||||
|
||||
|
|
@ -63,6 +64,11 @@ class ToDoFragment : Fragment() {
|
|||
val adapter = ToDoAdapter(todoList, requireActivity())
|
||||
binding.todoList.adapter = adapter
|
||||
|
||||
FastScrollerBuilder(binding.todoList).apply {
|
||||
useMd2Style()
|
||||
build()
|
||||
}
|
||||
|
||||
if (todoList.isEmpty()) {
|
||||
todoViewModel.emptyTipVis.value = View.VISIBLE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="44dp"
|
||||
android:bottomRightRadius="44dp"
|
||||
android:topLeftRadius="44dp"
|
||||
android:topRightRadius="44dp" />
|
||||
|
||||
<solid android:color="?attr/colorSurfaceContainerHighest" />
|
||||
|
||||
<padding
|
||||
android:bottom="10dp"
|
||||
android:left="10dp"
|
||||
android:right="10dp"
|
||||
android:top="10dp" />
|
||||
</shape>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/line" android:state_pressed="true" />
|
||||
|
||||
<item android:drawable="@drawable/line" />
|
||||
</selector>
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="44dp"
|
||||
android:bottomRightRadius="44dp"
|
||||
android:topLeftRadius="44dp"
|
||||
android:topRightRadius="44dp" />
|
||||
|
||||
<padding
|
||||
android:paddingLeft="22dp"
|
||||
android:paddingRight="22dp" />
|
||||
|
||||
<solid android:color="?attr/colorSecondary" />
|
||||
</shape>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/thumb" android:state_pressed="true" />
|
||||
|
||||
<item android:drawable="@drawable/thumb" />
|
||||
</selector>
|
||||
|
|
@ -9,12 +9,7 @@
|
|||
android:id="@+id/todo_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
app:fastScrollEnabled="true"
|
||||
app:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
|
||||
app:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
|
||||
app:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
|
||||
app:fastScrollVerticalTrackDrawable="@drawable/line_drawable">
|
||||
android:visibility="gone">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue