pull/83/head
kunfei 5 years ago
parent aa496ea382
commit 46abd120cd
  1. 1
      app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt
  2. 8
      app/src/main/java/io/legado/app/ui/importbook/ImportBookAdapter.kt

@ -108,6 +108,7 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity
}
docList.sortWith(compareBy({ !it.isDirectory }, { it.name }))
tv_path.text = path
importBookAdapter.selectedUris.clear()
importBookAdapter.setItems(docList)
}
}

@ -17,7 +17,7 @@ import java.util.*
class ImportBookAdapter(context: Context, val callBack: CallBack) :
SimpleRecyclerAdapter<DocumentFile>(context, R.layout.item_import_book) {
var selectedUris = linkedSetOf<String>()
private var localUri = arrayListOf<String>()
fun upBookHas(uriList: List<String>) {
@ -48,12 +48,18 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) :
tv_date.text = AppConst.DATE_FORMAT.format(Date(item.lastModified()))
}
tv_name.text = item.name
cb_select.isChecked = selectedUris.contains(item.uri.toString())
onClick {
item.name?.let { name ->
if (item.isDirectory) {
callBack.findFolder(name)
} else {
cb_select.isChecked = !cb_select.isChecked
if (cb_select.isChecked) {
selectedUris.add(item.uri.toString())
} else {
selectedUris.remove(item.uri.toString())
}
}
}
}

Loading…
Cancel
Save