|
|
@ -41,11 +41,11 @@ class FontSelectDialog : DialogFragment(), |
|
|
|
FontAdapter.CallBack { |
|
|
|
FontAdapter.CallBack { |
|
|
|
lateinit var job: Job |
|
|
|
lateinit var job: Job |
|
|
|
private val fontFolderRequestCode = 35485 |
|
|
|
private val fontFolderRequestCode = 35485 |
|
|
|
private lateinit var adapter: FontAdapter |
|
|
|
|
|
|
|
private val fontFolder = |
|
|
|
private val fontFolder = |
|
|
|
App.INSTANCE.filesDir.absolutePath + File.separator + "Fonts" + File.separator |
|
|
|
App.INSTANCE.filesDir.absolutePath + File.separator + "Fonts" + File.separator |
|
|
|
override val coroutineContext: CoroutineContext |
|
|
|
override val coroutineContext: CoroutineContext |
|
|
|
get() = job + Main |
|
|
|
get() = job + Main |
|
|
|
|
|
|
|
private var adapter: FontAdapter? = null |
|
|
|
|
|
|
|
|
|
|
|
override fun onStart() { |
|
|
|
override fun onStart() { |
|
|
|
super.onStart() |
|
|
|
super.onStart() |
|
|
@ -144,7 +144,7 @@ class FontSelectDialog : DialogFragment(), |
|
|
|
pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex()) |
|
|
|
pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex()) |
|
|
|
}?.let { |
|
|
|
}?.let { |
|
|
|
withContext(Main) { |
|
|
|
withContext(Main) { |
|
|
|
adapter.setItems(it.toList()) |
|
|
|
adapter?.setItems(it.toList()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
@ -161,7 +161,7 @@ class FontSelectDialog : DialogFragment(), |
|
|
|
file.listFiles { pathName -> |
|
|
|
file.listFiles { pathName -> |
|
|
|
pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex()) |
|
|
|
pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex()) |
|
|
|
}?.let { |
|
|
|
}?.let { |
|
|
|
adapter.setItems(it.toList()) |
|
|
|
adapter?.setItems(it.toList()) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
|
toast(e.localizedMessage ?: "") |
|
|
|
toast(e.localizedMessage ?: "") |
|
|
|