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