feat: 优化代码

pull/103/head
kunfei 5 years ago
parent 6697e4cb82
commit f0b3f29575
  1. 6
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt

@ -76,7 +76,7 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
} }
override fun onClickMainAction() { override fun onClickMainAction() {
selectGroup(groupRequestCode) selectGroup(0, groupRequestCode)
} }
}) })
} }
@ -158,8 +158,8 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
} }
} }
override fun selectGroup(requestCode: Int) { override fun selectGroup(groupId: Int, requestCode: Int) {
GroupSelectDialog.show(supportFragmentManager, requestCode) GroupSelectDialog.show(supportFragmentManager, groupId, requestCode)
} }
override fun upGroup(requestCode: Int, group: BookGroup) { override fun upGroup(requestCode: Int, group: BookGroup) {

@ -68,7 +68,7 @@ class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
} }
tv_group.onClick { tv_group.onClick {
actionItem = item actionItem = item
callBack.selectGroup(groupRequestCode) callBack.selectGroup(item.group, groupRequestCode)
} }
} }
} }
@ -86,6 +86,6 @@ class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
val groupList: List<BookGroup> val groupList: List<BookGroup>
fun upSelectCount() fun upSelectCount()
fun deleteBook(book: Book) fun deleteBook(book: Book)
fun selectGroup(requestCode: Int) fun selectGroup(groupId: Int, requestCode: Int)
} }
} }

@ -237,7 +237,9 @@ class BookInfoActivity :
} }
} }
tv_group.onClick { tv_group.onClick {
GroupSelectDialog.show(supportFragmentManager) viewModel.bookData.value?.let {
GroupSelectDialog.show(supportFragmentManager, it.group)
}
} }
} }

Loading…
Cancel
Save