pull/71/head^2^2
kunfei 5 years ago
parent a7d157db34
commit b032acca6a
  1. 18
      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,20 +166,20 @@ class FontSelectDialog : DialogFragment(),
}
override fun onClick(file: File) {
launch(IO) {
file.copyTo(FileHelp.getFile(fontFolder + file.name)).absolutePath.let { path ->
(parentFragment as? CallBack)?.let {
val cb = (parentFragment as? CallBack) ?: (activity as? CallBack)
cb?.let {
if (it.curFontPath != path) {
withContext(Main) {
it.selectFile(path)
}
}
(activity as? CallBack)?.let {
if (it.curFontPath != path) {
it.selectFile(path)
}
}
}
dialog?.dismiss()
}
}
override fun curFilePath(): String {
return (parentFragment as? CallBack)?.curFontPath

Loading…
Cancel
Save