|
|
@ -16,7 +16,9 @@ import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.BaseDialogFragment |
|
|
|
import io.legado.app.base.BaseDialogFragment |
|
|
|
|
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
|
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.permission.Permissions |
|
|
|
import io.legado.app.help.permission.Permissions |
|
|
|
import io.legado.app.help.permission.PermissionsCompat |
|
|
|
import io.legado.app.help.permission.PermissionsCompat |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
@ -89,9 +91,13 @@ class FontSelectDialog : BaseDialogFragment(), |
|
|
|
R.id.menu_default -> { |
|
|
|
R.id.menu_default -> { |
|
|
|
val cb = (parentFragment as? CallBack) ?: (activity as? CallBack) |
|
|
|
val cb = (parentFragment as? CallBack) ?: (activity as? CallBack) |
|
|
|
cb?.let { |
|
|
|
cb?.let { |
|
|
|
if (it.curFontPath != "") { |
|
|
|
val requireContext = requireContext() |
|
|
|
it.selectFile("") |
|
|
|
requireContext.alert(titleResource = R.string.system_typeface) { |
|
|
|
|
|
|
|
items(requireContext.resources.getStringArray(R.array.system_typefaces).toList()) { _, i -> |
|
|
|
|
|
|
|
AppConfig.systemTypefaces = i |
|
|
|
|
|
|
|
onDefaultFontChange(it) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}.show() |
|
|
|
} |
|
|
|
} |
|
|
|
dismiss() |
|
|
|
dismiss() |
|
|
|
} |
|
|
|
} |
|
|
@ -255,6 +261,14 @@ class FontSelectDialog : BaseDialogFragment(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun onDefaultFontChange(callBack: CallBack){ |
|
|
|
|
|
|
|
if (curFilePath() == "") { |
|
|
|
|
|
|
|
postEvent(EventBus.UP_CONFIG, true) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
callBack.selectFile("") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
interface CallBack { |
|
|
|
fun selectFile(path: String) |
|
|
|
fun selectFile(path: String) |
|
|
|
val curFontPath: String |
|
|
|
val curFontPath: String |
|
|
|