Skip to content

Commit

Permalink
Change fast scroll support
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Feb 21, 2024
1 parent a775f06 commit 26e2c04
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 52 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down
18 changes: 0 additions & 18 deletions app/src/main/res/drawable/line.xml

This file was deleted.

6 changes: 0 additions & 6 deletions app/src/main/res/drawable/line_drawable.xml

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/res/drawable/thumb.xml

This file was deleted.

6 changes: 0 additions & 6 deletions app/src/main/res/drawable/thumb_drawable.xml

This file was deleted.

7 changes: 1 addition & 6 deletions app/src/main/res/layout/fragment_todo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down

0 comments on commit 26e2c04

Please sign in to comment.