mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -8,6 +8,7 @@ import androidx.annotation.LayoutRes
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import io.legado.app.R
|
||||
import io.legado.app.constant.AppLog
|
||||
import io.legado.app.help.coroutine.Coroutine
|
||||
import io.legado.app.lib.theme.ThemeStore
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -54,6 +55,8 @@ abstract class BaseDialogFragment(
|
||||
//在每个add事务前增加一个remove事务,防止连续的add
|
||||
manager.beginTransaction().remove(this).commit()
|
||||
super.show(manager, tag)
|
||||
}.onFailure {
|
||||
AppLog.put("显示对话框失败 tag:$tag", it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.os.Bundle
|
||||
import android.webkit.MimeTypeMap
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.VMBaseActivity
|
||||
import io.legado.app.constant.AppConst
|
||||
@@ -25,9 +26,8 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
import java.io.File
|
||||
|
||||
class HandleFileActivity :
|
||||
VMBaseActivity<ActivityTranslucenceBinding, HandleFileViewModel>(
|
||||
theme = Theme.Transparent
|
||||
), FilePickerDialog.CallBack {
|
||||
VMBaseActivity<ActivityTranslucenceBinding, HandleFileViewModel>(),
|
||||
FilePickerDialog.CallBack {
|
||||
|
||||
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
|
||||
override val viewModel by viewModels<HandleFileViewModel>()
|
||||
@@ -104,24 +104,32 @@ class HandleFileActivity :
|
||||
}.onFailure {
|
||||
AppLog.put(getString(R.string.open_sys_dir_picker_error), it)
|
||||
toastOnUi(R.string.open_sys_dir_picker_error)
|
||||
FilePickerDialog.show(
|
||||
supportFragmentManager,
|
||||
mode = HandleFileContract.FILE,
|
||||
allowExtensions = allowExtensions
|
||||
)
|
||||
checkPermissions {
|
||||
FilePickerDialog.show(
|
||||
supportFragmentManager,
|
||||
mode = HandleFileContract.FILE,
|
||||
allowExtensions = allowExtensions
|
||||
)
|
||||
}
|
||||
}
|
||||
10 -> checkPermissions {
|
||||
FilePickerDialog.show(
|
||||
supportFragmentManager,
|
||||
mode = HandleFileContract.DIR
|
||||
)
|
||||
@Suppress("DEPRECATION")
|
||||
lifecycleScope.launchWhenResumed {
|
||||
FilePickerDialog.show(
|
||||
supportFragmentManager,
|
||||
mode = HandleFileContract.DIR
|
||||
)
|
||||
}
|
||||
}
|
||||
11 -> checkPermissions {
|
||||
FilePickerDialog.show(
|
||||
supportFragmentManager,
|
||||
mode = HandleFileContract.FILE,
|
||||
allowExtensions = allowExtensions
|
||||
)
|
||||
@Suppress("DEPRECATION")
|
||||
lifecycleScope.launchWhenResumed {
|
||||
FilePickerDialog.show(
|
||||
supportFragmentManager,
|
||||
mode = HandleFileContract.FILE,
|
||||
allowExtensions = allowExtensions
|
||||
)
|
||||
}
|
||||
}
|
||||
111 -> getFileData()?.let {
|
||||
viewModel.upload(it.first, it.second, it.third) { url ->
|
||||
|
||||
Reference in New Issue
Block a user