优化分组管理

pull/433/head
gedoor 4 years ago
parent 6a10d276f1
commit a0ebd3d000
  1. 10
      app/src/main/java/io/legado/app/data/entities/BookGroup.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt

@ -18,12 +18,12 @@ data class BookGroup(
var show: Boolean = true
) : Parcelable {
fun getDefaultName(context: Context): String {
fun getManageName(context: Context): String {
return when (groupId) {
AppConst.bookGroupAllId -> context.getString(R.string.all)
AppConst.bookGroupAudioId -> context.getString(R.string.audio)
AppConst.bookGroupLocalId -> context.getString(R.string.local)
AppConst.bookGroupNoneId -> context.getString(R.string.no_group)
AppConst.bookGroupAllId -> "$groupName(${context.getString(R.string.all)})"
AppConst.bookGroupAudioId -> "$groupName(${context.getString(R.string.audio)})"
AppConst.bookGroupLocalId -> "$groupName(${context.getString(R.string.local)})"
AppConst.bookGroupNoneId -> "$groupName(${context.getString(R.string.no_group)})"
else -> groupName
}
}

@ -107,7 +107,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
customView {
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply {
editText = edit_view.apply {
hint = "分组名称"
setHint(R.string.group_name)
}
}
}
@ -129,7 +129,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
customView {
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply {
editText = edit_view.apply {
hint = "分组名称"
setHint(R.string.group_name)
setText(bookGroup.groupName)
}
}
@ -187,7 +187,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
override fun convert(holder: ItemViewHolder, item: BookGroup, payloads: MutableList<Any>) {
holder.itemView.apply {
setBackgroundColor(context.backgroundColor)
tv_group.text = item.groupName
tv_group.text = item.getManageName(context)
sw_show.isChecked = item.show
tv_del.isGone = item.groupId < 0
sw_show.isGone = item.groupId >= 0

@ -128,7 +128,7 @@ class GroupSelectDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
customView {
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply {
editText = edit_view.apply {
hint = "分组名称"
setHint(R.string.group_name)
}
}
}
@ -150,7 +150,7 @@ class GroupSelectDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
customView {
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply {
editText = edit_view.apply {
hint = "分组名称"
setHint(R.string.group_name)
setText(bookGroup.groupName)
}
}

Loading…
Cancel
Save