chore: code cleanup
This commit is contained in:
parent
386e02a564
commit
24147e746a
198 changed files with 1367 additions and 965 deletions
|
@ -1,7 +1,6 @@
|
|||
package ani.dantotsu.util
|
||||
|
||||
import ani.dantotsu.util.ColorEditor.Companion.toCssColor
|
||||
import ani.dantotsu.util.ColorEditor.Companion.toHexColor
|
||||
|
||||
class AniMarkdown { //istg anilist has the worst api
|
||||
companion object {
|
||||
|
|
|
@ -133,7 +133,11 @@ object Logger {
|
|||
shareIntent.type = "text/plain"
|
||||
shareIntent.putExtra(
|
||||
Intent.EXTRA_STREAM,
|
||||
FileProvider.getUriForFile(context, "${BuildConfig.APPLICATION_ID}.provider", fileToUse!!)
|
||||
FileProvider.getUriForFile(
|
||||
context,
|
||||
"${BuildConfig.APPLICATION_ID}.provider",
|
||||
fileToUse!!
|
||||
)
|
||||
)
|
||||
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Log file")
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, "Log file")
|
||||
|
|
|
@ -62,9 +62,10 @@ class StoragePermissions {
|
|||
return hasDirAccess(context, path)
|
||||
}
|
||||
|
||||
fun AppCompatActivity.accessAlertDialog(launcher: LauncherWrapper,
|
||||
force: Boolean = false,
|
||||
complete: (Boolean) -> Unit
|
||||
fun AppCompatActivity.accessAlertDialog(
|
||||
launcher: LauncherWrapper,
|
||||
force: Boolean = false,
|
||||
complete: (Boolean) -> Unit
|
||||
) {
|
||||
if (hasDirAccess(this) && !force) {
|
||||
complete(true)
|
||||
|
@ -97,11 +98,12 @@ class StoragePermissions {
|
|||
|
||||
class LauncherWrapper(
|
||||
activity: AppCompatActivity,
|
||||
contract: ActivityResultContracts.OpenDocumentTree)
|
||||
{
|
||||
contract: ActivityResultContracts.OpenDocumentTree
|
||||
) {
|
||||
private var launcher: ActivityResultLauncher<Uri?>
|
||||
var complete: (Boolean) -> Unit = {}
|
||||
init{
|
||||
|
||||
init {
|
||||
launcher = activity.registerForActivityResult(contract) { uri ->
|
||||
if (uri != null) {
|
||||
activity.contentResolver.takePersistableUriPermission(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue