pull/298/head
gedoor 4 years ago
parent 289f48b687
commit 64589d5e86
  1. 3
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
  2. 4
      app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt
  3. 7
      app/src/main/java/io/legado/app/ui/widget/prefs/Preference.kt
  4. 2
      app/src/main/res/values-zh-rHK/strings.xml
  5. 2
      app/src/main/res/values-zh-rTW/strings.xml
  6. 2
      app/src/main/res/values-zh/strings.xml
  7. 2
      app/src/main/res/values/strings.xml

@ -46,6 +46,8 @@ class BackupConfigFragment : PreferenceFragmentCompat(),
upPreferenceSummary(PreferKey.webDavAccount, getPrefString(PreferKey.webDavAccount))
upPreferenceSummary(PreferKey.webDavPassword, getPrefString(PreferKey.webDavPassword))
upPreferenceSummary(PreferKey.backupPath, getPrefString(PreferKey.backupPath))
findPreference<io.legado.app.ui.widget.prefs.Preference>("web_dav_restore")
?.onLongClick = { BackupRestoreUi.restoreByFolder(this) }
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -114,6 +116,7 @@ class BackupConfigFragment : PreferenceFragmentCompat(),
return super.onPreferenceTreeClick(preference)
}
private fun restoreIgnore() {
val checkedItems = BooleanArray(Restore.ignoreKeys.size) {
Restore.ignoreConfig[Restore.ignoreKeys[it]] ?: false

@ -100,6 +100,10 @@ object BackupRestoreUi {
}
}
fun restoreByFolder(fragment: Fragment) {
selectBackupFolder(fragment, restoreSelectRequestCode)
}
private fun restoreUsePermission(fragment: Fragment, path: String) {
PermissionsCompat.Builder(fragment)
.addPermissions(*Permissions.Group.STORAGE)

@ -14,11 +14,14 @@ import androidx.preference.PreferenceViewHolder
import io.legado.app.R
import io.legado.app.lib.theme.accentColor
import org.jetbrains.anko.layoutInflater
import org.jetbrains.anko.sdk27.listeners.onLongClick
import kotlin.math.roundToInt
class Preference(context: Context, attrs: AttributeSet) :
androidx.preference.Preference(context, attrs) {
var onLongClick: (() -> Unit)? = null
init {
// isPersistent = true
layoutResource = R.layout.view_preference
@ -97,6 +100,10 @@ class Preference(context: Context, attrs: AttributeSet) :
override fun onBindViewHolder(holder: PreferenceViewHolder?) {
bindView<View>(context, holder, icon, title, summary, null, null)
super.onBindViewHolder(holder)
holder?.itemView?.onLongClick {
onLongClick?.invoke()
true
}
}
}

@ -702,7 +702,7 @@
<string name="other">其它</string>
<string name="official_account">legado-top</string>
<string name="backup_summary">本地和WebDav壹起備份</string>
<string name="restore_summary">優先從WebDav恢復,失敗時從本地恢復</string>
<string name="restore_summary">優先從WebDav恢復,長按從本地恢復</string>
<string name="import_old_summary">選擇舊版備份文件夾</string>
<string name="enabled">已啓用</string>
<string name="disabled">已禁用</string>

@ -702,7 +702,7 @@
<string name="text_font_weight_converter">文章字體轉換</string>
<string name="select_backup_path">請選擇備份路徑</string>
<string name="backup_summary">本地和WebDav壹起備份</string>
<string name="restore_summary">優先從WebDav恢復,失敗時從本地恢復</string>
<string name="restore_summary">優先從WebDav恢復,長按從本地恢復</string>
<string name="import_old_summary">選擇舊版備份文件夾</string>
<string name="enabled">已啓用</string>
<string name="disabled">已禁用</string>

@ -703,7 +703,7 @@
<string name="auto_page_speed">自动翻页速度</string>
<string name="sort_by_url">地址排序</string>
<string name="backup_summary">本地和WebDav一起备份</string>
<string name="restore_summary">优先从WebDav恢复,失败时从本地恢复</string>
<string name="restore_summary">优先从WebDav恢复,长按从本地恢复</string>
<string name="import_old_summary">选择旧版备份文件夹</string>
<string name="enabled">已启用</string>
<string name="disabled">已禁用</string>

@ -705,7 +705,7 @@
<string name="auto_page_speed">Auto scroll speed</string>
<string name="sort_by_url">Sort by URL</string>
<string name="backup_summary">Backup the local and WebDav simultaneously</string>
<string name="restore_summary">Restore from WebDAV first, and Restore form the local backup if failed</string>
<string name="restore_summary">Restore from WebDAV first, Restore form the local backup on long click</string>
<string name="import_old_summary">Select a legacy backup folder</string>
<string name="enabled">Enabled</string>
<string name="disabled">Disabled</string>

Loading…
Cancel
Save