|
|
@@ -58,6 +58,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
|
|
override val viewModel by viewModels<BookSourceViewModel>()
|
|
|
private val importRecordKey = "bookSourceRecordKey"
|
|
|
private val adapter by lazy { BookSourceAdapter(this, this) }
|
|
|
+ private val itemTouchCallback by lazy { ItemTouchCallback(adapter) }
|
|
|
private val searchView: SearchView by lazy {
|
|
|
binding.titleBar.findViewById(R.id.search_view)
|
|
|
}
|
|
|
@@ -197,8 +198,6 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
|
|
dragSelectTouchHelper.attachToRecyclerView(binding.recyclerView)
|
|
|
dragSelectTouchHelper.activeSlideSelect()
|
|
|
// Note: need judge selection first, so add ItemTouchHelper after it.
|
|
|
- val itemTouchCallback = ItemTouchCallback(adapter)
|
|
|
- itemTouchCallback.isCanDrag = true
|
|
|
ItemTouchHelper(itemTouchCallback).attachToRecyclerView(binding.recyclerView)
|
|
|
}
|
|
|
|
|
|
@@ -276,6 +275,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
|
|
AppLog.put("书源界面更新书源出错", it)
|
|
|
}.conflate().collect { data ->
|
|
|
adapter.setItems(data, adapter.diffItemCallback)
|
|
|
+ itemTouchCallback.isCanDrag = sort == Sort.Default
|
|
|
delay(500)
|
|
|
}
|
|
|
}
|