diff --git a/app/src/main/kotlin/cn/super12138/todo/views/bottomsheet/ToDoBottomSheet.kt b/app/src/main/kotlin/cn/super12138/todo/views/bottomsheet/ToDoBottomSheet.kt index 6f7ebe2..2e2bc78 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/bottomsheet/ToDoBottomSheet.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/bottomsheet/ToDoBottomSheet.kt @@ -15,8 +15,8 @@ import cn.super12138.todo.utils.TextUtils import cn.super12138.todo.utils.VibrationUtils import cn.super12138.todo.utils.showToast import cn.super12138.todo.utils.toEditable -import cn.super12138.todo.views.progress.ProgressFragmentViewModel -import cn.super12138.todo.views.todo.ToDoFragmentViewModel +import cn.super12138.todo.views.progress.ProgressViewModel +import cn.super12138.todo.views.todo.ToDoViewModel import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment @@ -25,8 +25,8 @@ import java.util.UUID class ToDoBottomSheet : BottomSheetDialogFragment() { private lateinit var binding: BottomSheetTodoBinding - private val progressViewModel: ProgressFragmentViewModel by viewModels({ requireActivity() }) - private val todoViewModel: ToDoFragmentViewModel by viewModels({ requireActivity() }) + private val progressViewModel: ProgressViewModel by viewModels({ requireActivity() }) + private val todoViewModel: ToDoViewModel by viewModels({ requireActivity() }) private var editMode: Boolean = false private var todoState: Int = 0 diff --git a/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt b/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt index 0d95324..09879e3 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt @@ -12,7 +12,7 @@ import cn.super12138.todo.databinding.FragmentProgressBinding class ProgressFragment : Fragment() { - private val viewModel: ProgressFragmentViewModel by viewModels({ requireActivity() }) + private val viewModel: ProgressViewModel by viewModels({ requireActivity() }) private lateinit var binding: FragmentProgressBinding override fun onCreateView( diff --git a/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragmentViewModel.kt b/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressViewModel.kt similarity index 95% rename from app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragmentViewModel.kt rename to app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressViewModel.kt index c7160b1..a1d0b9f 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragmentViewModel.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressViewModel.kt @@ -7,7 +7,7 @@ import cn.super12138.todo.logic.Repository import kotlinx.coroutines.delay import kotlinx.coroutines.launch -class ProgressFragmentViewModel : ViewModel() { +class ProgressViewModel : ViewModel() { val totalCount: MutableLiveData = MutableLiveData() val completeCount: MutableLiveData = MutableLiveData() val remainCount: MutableLiveData = MutableLiveData() diff --git a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoAdapter.kt b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoAdapter.kt index deca559..61ef5b0 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoAdapter.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoAdapter.kt @@ -15,7 +15,7 @@ import cn.super12138.todo.logic.model.ToDo import cn.super12138.todo.utils.VibrationUtils import cn.super12138.todo.utils.showToast import cn.super12138.todo.views.bottomsheet.ToDoBottomSheet -import cn.super12138.todo.views.progress.ProgressFragmentViewModel +import cn.super12138.todo.views.progress.ProgressViewModel class ToDoAdapter( private val todoList: MutableList, @@ -48,9 +48,9 @@ class ToDoAdapter( }*/ val progressViewModel = - ViewModelProvider(viewModelStoreOwner)[ProgressFragmentViewModel::class.java] + ViewModelProvider(viewModelStoreOwner)[ProgressViewModel::class.java] val todoViewModel = - ViewModelProvider(viewModelStoreOwner)[ToDoFragmentViewModel::class.java] + ViewModelProvider(viewModelStoreOwner)[ToDoViewModel::class.java] holder.checkToDoBtn.setOnClickListener { VibrationUtils.performHapticFeedback(it) diff --git a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt index 1b4795e..8902f8a 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt @@ -19,14 +19,14 @@ import cn.super12138.todo.databinding.FragmentTodoBinding import cn.super12138.todo.logic.Repository import cn.super12138.todo.utils.VibrationUtils import cn.super12138.todo.views.bottomsheet.ToDoBottomSheet -import cn.super12138.todo.views.progress.ProgressFragmentViewModel +import cn.super12138.todo.views.progress.ProgressViewModel import com.google.android.material.dialog.MaterialAlertDialogBuilder import kotlinx.coroutines.launch import me.zhanghai.android.fastscroll.FastScrollerBuilder class ToDoFragment : Fragment() { - private val progressViewModel: ProgressFragmentViewModel by viewModels({ requireActivity() }) - private val todoViewModel: ToDoFragmentViewModel by viewModels({ requireActivity() }) + private val progressViewModel: ProgressViewModel by viewModels({ requireActivity() }) + private val todoViewModel: ToDoViewModel by viewModels({ requireActivity() }) private lateinit var binding: FragmentTodoBinding override fun onCreateView( diff --git a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragmentViewModel.kt b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoViewModel.kt similarity index 97% rename from app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragmentViewModel.kt rename to app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoViewModel.kt index b3a6ae8..055e79d 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragmentViewModel.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoViewModel.kt @@ -9,7 +9,7 @@ import cn.super12138.todo.logic.dao.ToDoRoom import cn.super12138.todo.logic.model.ToDo import kotlinx.coroutines.launch -class ToDoFragmentViewModel : ViewModel() { +class ToDoViewModel : ViewModel() { val emptyTipVis = MutableLiveData(View.GONE) val addData = MutableLiveData(0)