|
|
@ -13,10 +13,6 @@ import io.legado.app.R |
|
|
|
import io.legado.app.base.BaseFragment |
|
|
|
import io.legado.app.base.BaseFragment |
|
|
|
import io.legado.app.constant.Bus |
|
|
|
import io.legado.app.constant.Bus |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
import io.legado.app.help.permission.Permissions |
|
|
|
|
|
|
|
import io.legado.app.help.permission.PermissionsCompat |
|
|
|
|
|
|
|
import io.legado.app.help.storage.Backup |
|
|
|
|
|
|
|
import io.legado.app.help.storage.WebDavHelp |
|
|
|
|
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.service.WebService |
|
|
|
import io.legado.app.service.WebService |
|
|
|
import io.legado.app.ui.about.AboutActivity |
|
|
|
import io.legado.app.ui.about.AboutActivity |
|
|
@ -24,6 +20,7 @@ import io.legado.app.ui.about.DonateActivity |
|
|
|
import io.legado.app.ui.book.source.manage.BookSourceActivity |
|
|
|
import io.legado.app.ui.book.source.manage.BookSourceActivity |
|
|
|
import io.legado.app.ui.config.ConfigActivity |
|
|
|
import io.legado.app.ui.config.ConfigActivity |
|
|
|
import io.legado.app.ui.config.ConfigViewModel |
|
|
|
import io.legado.app.ui.config.ConfigViewModel |
|
|
|
|
|
|
|
import io.legado.app.ui.main.MainActivity |
|
|
|
import io.legado.app.ui.replacerule.ReplaceRuleActivity |
|
|
|
import io.legado.app.ui.replacerule.ReplaceRuleActivity |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.* |
|
|
|
import kotlinx.android.synthetic.main.view_title_bar.* |
|
|
|
import kotlinx.android.synthetic.main.view_title_bar.* |
|
|
@ -46,16 +43,14 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config) { |
|
|
|
override fun onCompatOptionsItemSelected(item: MenuItem) { |
|
|
|
override fun onCompatOptionsItemSelected(item: MenuItem) { |
|
|
|
when (item.itemId) { |
|
|
|
when (item.itemId) { |
|
|
|
R.id.menu_help -> startActivity<AboutActivity>() |
|
|
|
R.id.menu_help -> startActivity<AboutActivity>() |
|
|
|
R.id.menu_backup -> PermissionsCompat.Builder(this) |
|
|
|
R.id.menu_backup -> { |
|
|
|
.addPermissions(*Permissions.Group.STORAGE) |
|
|
|
val activity = activity as? MainActivity |
|
|
|
.rationale(R.string.tip_perm_request_storage) |
|
|
|
activity?.backup() |
|
|
|
.onGranted { Backup.backup() } |
|
|
|
} |
|
|
|
.request() |
|
|
|
R.id.menu_restore -> { |
|
|
|
R.id.menu_restore -> PermissionsCompat.Builder(this) |
|
|
|
val activity = activity as? MainActivity |
|
|
|
.addPermissions(*Permissions.Group.STORAGE) |
|
|
|
activity?.restore() |
|
|
|
.rationale(R.string.tip_perm_request_storage) |
|
|
|
} |
|
|
|
.onGranted { WebDavHelp.showRestoreDialog(requireContext()) } |
|
|
|
|
|
|
|
.request() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|