|
|
@ -209,7 +209,7 @@ class FontSelectDialog : BaseDialogFragment(), |
|
|
|
launch(IO) { |
|
|
|
launch(IO) { |
|
|
|
file.copyTo(FileUtils.createFileIfNotExist(fontFolder, file.name), true) |
|
|
|
file.copyTo(FileUtils.createFileIfNotExist(fontFolder, file.name), true) |
|
|
|
.absolutePath.let { path -> |
|
|
|
.absolutePath.let { path -> |
|
|
|
if (callBack?.curFontPath != path) { |
|
|
|
if (curFilePath != path) { |
|
|
|
withContext(Main) { |
|
|
|
withContext(Main) { |
|
|
|
callBack?.selectFile(path) |
|
|
|
callBack?.selectFile(path) |
|
|
|
} |
|
|
|
} |
|
|
@ -219,10 +219,6 @@ class FontSelectDialog : BaseDialogFragment(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun curFilePath(): String { |
|
|
|
|
|
|
|
return callBack?.curFontPath ?: "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onFilePicked(requestCode: Int, currentPath: String) { |
|
|
|
override fun onFilePicked(requestCode: Int, currentPath: String) { |
|
|
|
when (requestCode) { |
|
|
|
when (requestCode) { |
|
|
|
fontFolderRequestCode -> { |
|
|
|
fontFolderRequestCode -> { |
|
|
@ -256,13 +252,15 @@ class FontSelectDialog : BaseDialogFragment(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun onDefaultFontChange() { |
|
|
|
private fun onDefaultFontChange() { |
|
|
|
if (curFilePath() == "") { |
|
|
|
if (curFilePath == "") { |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
callBack?.selectFile("") |
|
|
|
callBack?.selectFile("") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override val curFilePath: String get() = callBack?.curFontPath ?: "" |
|
|
|
|
|
|
|
|
|
|
|
private val callBack: CallBack? |
|
|
|
private val callBack: CallBack? |
|
|
|
get() = (parentFragment as? CallBack) ?: (activity as? CallBack) |
|
|
|
get() = (parentFragment as? CallBack) ?: (activity as? CallBack) |
|
|
|
|
|
|
|
|
|
|
|