pull/71/head^2^2
kunfei 5 years ago
parent a7d157db34
commit b032acca6a
  1. 28
      app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt

@ -90,12 +90,8 @@ class FontSelectDialog : DialogFragment(),
override fun onMenuItemClick(item: MenuItem?): Boolean {
when (item?.itemId) {
R.id.menu_default -> {
(parentFragment as? CallBack)?.let {
if (it.curFontPath != "") {
it.selectFile("")
}
}
(activity as? CallBack)?.let {
val cb = (parentFragment as? CallBack) ?: (activity as? CallBack)
cb?.let {
if (it.curFontPath != "") {
it.selectFile("")
}
@ -170,19 +166,19 @@ class FontSelectDialog : DialogFragment(),
}
override fun onClick(file: File) {
file.copyTo(FileHelp.getFile(fontFolder + file.name)).absolutePath.let { path ->
(parentFragment as? CallBack)?.let {
if (it.curFontPath != path) {
it.selectFile(path)
}
}
(activity as? CallBack)?.let {
if (it.curFontPath != path) {
it.selectFile(path)
launch(IO) {
file.copyTo(FileHelp.getFile(fontFolder + file.name)).absolutePath.let { path ->
val cb = (parentFragment as? CallBack) ?: (activity as? CallBack)
cb?.let {
if (it.curFontPath != path) {
withContext(Main) {
it.selectFile(path)
}
}
}
}
dialog?.dismiss()
}
dialog?.dismiss()
}
override fun curFilePath(): String {

Loading…
Cancel
Save