pull/475/head
gedoor 4 years ago
parent 39dd1b6a00
commit adf425a854
  1. 24
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
  2. 13
      app/src/main/res/menu/backup_restore.xml

@ -4,6 +4,9 @@ import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.text.InputType
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.preference.EditTextPreference
import androidx.preference.ListPreference
@ -57,13 +60,30 @@ class BackupConfigFragment : BasePreferenceFragment(),
super.onViewCreated(view, savedInstanceState)
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
ATH.applyEdgeEffectColor(listView)
setHasOptionsMenu(true)
if (LocalConfig.isFirstOpenBackup) {
val text = String(requireContext().assets.open("help/webDavHelp.md").readBytes())
TextDialog.show(childFragmentManager, text, TextDialog.MD)
showHelp()
LocalConfig.isFirstOpen = false
}
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.backup_restore, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_help -> showHelp()
}
return super.onOptionsItemSelected(item)
}
private fun showHelp() {
val text = String(requireContext().assets.open("help/webDavHelp.md").readBytes())
TextDialog.show(childFragmentManager, text, TextDialog.MD)
}
override fun onDestroy() {
super.onDestroy()
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_help"
android:title="@string/help"
android:icon="@drawable/ic_help"
app:showAsAction="always"
tools:ignore="AlwaysShowAction" />
</menu>
Loading…
Cancel
Save