pull/457/head
gedoor 4 years ago
parent 199df056d9
commit 24537f1a48
  1. 6
      app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt
  3. 6
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  4. 6
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  5. 4
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
  6. 2
      app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt
  7. 28
      app/src/main/java/io/legado/app/ui/filepicker/FilePicker.kt
  8. 10
      app/src/main/java/io/legado/app/ui/filepicker/FilePickerDialog.kt
  9. 8
      app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt
  10. 6
      app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt
  11. 2
      app/src/main/java/io/legado/app/ui/filepicker/entity/FileItem.kt
  12. 2
      app/src/main/java/io/legado/app/ui/filepicker/entity/JavaBean.kt
  13. 2
      app/src/main/java/io/legado/app/ui/filepicker/utils/ConvertUtils.kt
  14. 2
      app/src/main/java/io/legado/app/ui/filepicker/utils/FilePickerIcon.java
  15. 4
      app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt
  16. 6
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
  17. 6
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt
  18. 6
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
  19. 6
      app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt
  20. 2
      app/src/main/java/io/legado/app/utils/FileUtils.kt

@ -19,8 +19,8 @@ import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookGroup
import io.legado.app.help.BookHelp
import io.legado.app.service.help.CacheBook
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.widget.dialog.TextListDialog
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_download.*
@ -33,7 +33,7 @@ import java.util.concurrent.CopyOnWriteArraySet
class CacheActivity : VMBaseActivity<CacheViewModel>(R.layout.activity_download),
FileChooserDialog.CallBack,
FilePickerDialog.CallBack,
CacheAdapter.CallBack {
private val exportRequestCode = 32
private val exportBookPathKey = "exportBookPath"

@ -20,8 +20,8 @@ import io.legado.app.help.AppConfig
import io.legado.app.help.permission.Permissions
import io.legado.app.help.permission.PermissionsCompat
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_import_book.*
@ -35,7 +35,7 @@ import java.util.*
class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity_import_book),
FileChooserDialog.CallBack,
FilePickerDialog.CallBack,
PopupMenu.OnMenuItemClickListener,
ImportBookAdapter.CallBack {
private val requestCodeSelectFolder = 342

@ -22,8 +22,8 @@ import io.legado.app.lib.theme.bottomBackground
import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.lib.theme.getSecondaryTextColor
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.widget.text.AutoCompleteTextView
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.dialog_edit_text.view.*
@ -33,7 +33,7 @@ import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick
import java.io.File
class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack {
class BgTextConfigDialog : BaseDialogFragment(), FilePickerDialog.CallBack {
companion object {
const val TEXT_COLOR = 121

@ -31,8 +31,8 @@ import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.service.help.CheckSource
import io.legado.app.ui.association.ImportBookSourceActivity
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.qrcode.QrCodeActivity
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
@ -52,7 +52,7 @@ import java.text.Collator
class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity_book_source),
PopupMenu.OnMenuItemClickListener,
BookSourceAdapter.CallBack,
FileChooserDialog.CallBack,
FilePickerDialog.CallBack,
SearchView.OnQueryTextListener {
override val viewModel: BookSourceViewModel
get() = getViewModel(BookSourceViewModel::class.java)

@ -15,13 +15,13 @@ import io.legado.app.help.storage.Restore
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.utils.applyTint
import io.legado.app.utils.getPrefString
class BackupConfigFragment : BasePreferenceFragment(),
SharedPreferences.OnSharedPreferenceChangeListener,
FileChooserDialog.CallBack {
FilePickerDialog.CallBack {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.pref_config_backup)

@ -16,7 +16,7 @@ import io.legado.app.help.storage.Backup
import io.legado.app.help.storage.ImportOldData
import io.legado.app.help.storage.Restore
import io.legado.app.help.storage.WebDavHelp
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.utils.getPrefString
import io.legado.app.utils.isContentPath
import io.legado.app.utils.longToast

@ -1,4 +1,4 @@
package io.legado.app.ui.filechooser
package io.legado.app.ui.filepicker
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
@ -22,12 +22,12 @@ object FilePicker {
otherActions: List<String>? = null,
otherFun: ((action: String) -> Unit)? = null
) {
activity.alert(title = title) {
val selectList =
activity.resources.getStringArray(R.array.select_folder).toMutableList()
otherActions?.let {
selectList.addAll(otherActions)
}
activity.alert(title = title) {
items(selectList) { _, index ->
when (index) {
0 -> {
@ -40,10 +40,10 @@ object FilePicker {
}
}
1 -> checkPermissions(activity) {
FileChooserDialog.show(
FilePickerDialog.show(
activity.supportFragmentManager,
requestCode,
mode = FileChooserDialog.DIRECTORY
mode = FilePickerDialog.DIRECTORY
)
}
else -> otherFun?.invoke(selectList[index])
@ -59,13 +59,12 @@ object FilePicker {
otherActions: List<String>? = null,
otherFun: ((action: String) -> Unit)? = null
) {
fragment.requireContext()
.alert(title = title) {
val selectList =
fragment.resources.getStringArray(R.array.select_folder).toMutableList()
otherActions?.let {
selectList.addAll(otherActions)
}
fragment.alert(title = title) {
items(selectList) { _, index ->
when (index) {
0 -> {
@ -78,10 +77,10 @@ object FilePicker {
}
}
1 -> checkPermissions(fragment) {
FileChooserDialog.show(
FilePickerDialog.show(
fragment.childFragmentManager,
requestCode,
mode = FileChooserDialog.DIRECTORY
mode = FilePickerDialog.DIRECTORY
)
}
else -> otherFun?.invoke(selectList[index])
@ -98,12 +97,12 @@ object FilePicker {
otherActions: List<String>? = null,
otherFun: ((action: String) -> Unit)? = null
) {
activity.alert(title = title) {
val selectList =
activity.resources.getStringArray(R.array.select_folder).toMutableList()
otherActions?.let {
selectList.addAll(otherActions)
}
activity.alert(title = title) {
items(selectList) { _, index ->
when (index) {
0 -> {
@ -120,10 +119,10 @@ object FilePicker {
}
}
1 -> checkPermissions(activity) {
FileChooserDialog.show(
FilePickerDialog.show(
activity.supportFragmentManager,
requestCode,
mode = FileChooserDialog.FILE,
mode = FilePickerDialog.FILE,
allowExtensions = allowExtensions
)
}
@ -141,13 +140,12 @@ object FilePicker {
otherActions: List<String>? = null,
otherFun: ((action: String) -> Unit)? = null
) {
fragment.requireContext()
.alert(title = title) {
val selectList =
fragment.resources.getStringArray(R.array.select_folder).toMutableList()
otherActions?.let {
selectList.addAll(otherActions)
}
fragment.alert(title = title) {
items(selectList) { _, index ->
when (index) {
0 -> {
@ -164,10 +162,10 @@ object FilePicker {
}
}
1 -> checkPermissions(fragment) {
FileChooserDialog.show(
FilePickerDialog.show(
fragment.childFragmentManager,
requestCode,
mode = FileChooserDialog.FILE,
mode = FilePickerDialog.FILE,
allowExtensions = allowExtensions
)
}

@ -1,4 +1,4 @@
package io.legado.app.ui.filechooser
package io.legado.app.ui.filepicker
import android.os.Bundle
import android.view.LayoutInflater
@ -12,14 +12,14 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.filechooser.adapter.FileAdapter
import io.legado.app.ui.filechooser.adapter.PathAdapter
import io.legado.app.ui.filepicker.adapter.FileAdapter
import io.legado.app.ui.filepicker.adapter.PathAdapter
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.dialog_file_chooser.*
class FileChooserDialog : DialogFragment(),
class FilePickerDialog : DialogFragment(),
Toolbar.OnMenuItemClickListener,
FileAdapter.CallBack,
PathAdapter.CallBack {
@ -41,7 +41,7 @@ class FileChooserDialog : DialogFragment(),
allowExtensions: Array<String>? = null,
menus: Array<String>? = null
) {
FileChooserDialog().apply {
FilePickerDialog().apply {
val bundle = Bundle()
bundle.putInt("mode", mode)
bundle.putInt("requestCode", requestCode)

@ -1,4 +1,4 @@
package io.legado.app.ui.filechooser.adapter
package io.legado.app.ui.filepicker.adapter
import android.content.Context
@ -8,9 +8,9 @@ import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.help.AppConfig
import io.legado.app.lib.theme.getPrimaryDisabledTextColor
import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.ui.filechooser.entity.FileItem
import io.legado.app.ui.filechooser.utils.ConvertUtils
import io.legado.app.ui.filechooser.utils.FilePickerIcon
import io.legado.app.ui.filepicker.entity.FileItem
import io.legado.app.ui.filepicker.utils.ConvertUtils
import io.legado.app.ui.filepicker.utils.FilePickerIcon
import io.legado.app.utils.FileUtils
import kotlinx.android.synthetic.main.item_path_filepicker.view.*
import org.jetbrains.anko.sdk27.listeners.onClick

@ -1,12 +1,12 @@
package io.legado.app.ui.filechooser.adapter
package io.legado.app.ui.filepicker.adapter
import android.content.Context
import android.os.Environment
import io.legado.app.R
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.ui.filechooser.utils.ConvertUtils
import io.legado.app.ui.filechooser.utils.FilePickerIcon
import io.legado.app.ui.filepicker.utils.ConvertUtils
import io.legado.app.ui.filepicker.utils.FilePickerIcon
import kotlinx.android.synthetic.main.item_path_filepicker.view.*
import org.jetbrains.anko.sdk27.listeners.onClick
import java.util.*

@ -1,4 +1,4 @@
package io.legado.app.ui.filechooser.entity
package io.legado.app.ui.filepicker.entity
import android.graphics.drawable.Drawable

@ -1,4 +1,4 @@
package io.legado.app.ui.filechooser.entity
package io.legado.app.ui.filepicker.entity
import java.io.Serializable
import java.lang.reflect.Field

@ -1,4 +1,4 @@
package io.legado.app.ui.filechooser.utils
package io.legado.app.ui.filepicker.utils
import android.content.res.Resources
import android.graphics.Bitmap

@ -1,4 +1,4 @@
package io.legado.app.ui.filechooser.utils;
package io.legado.app.ui.filepicker.utils;
/**
* Generated by https://github.com/gzu-liyujiang/Image2ByteVar

@ -23,7 +23,7 @@ import io.legado.app.ui.book.source.manage.BookSourceActivity
import io.legado.app.ui.config.BackupRestoreUi
import io.legado.app.ui.config.ConfigActivity
import io.legado.app.ui.config.ConfigViewModel
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.replace.ReplaceRuleActivity
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.ui.widget.prefs.NameListPreference
@ -32,7 +32,7 @@ import io.legado.app.ui.widget.prefs.SwitchPreference
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.view_title_bar.*
class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog.CallBack {
class MyFragment : BaseFragment(R.layout.fragment_my_config), FilePickerDialog.CallBack {
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
setSupportToolbar(toolbar)

@ -26,8 +26,8 @@ import io.legado.app.lib.dialogs.*
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.ui.association.ImportReplaceRuleActivity
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.replace.edit.ReplaceEditActivity
import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
@ -49,7 +49,7 @@ class ReplaceRuleActivity :
VMBaseActivity<ReplaceRuleViewModel>(R.layout.activity_replace_rule),
SearchView.OnQueryTextListener,
PopupMenu.OnMenuItemClickListener,
FileChooserDialog.CallBack,
FilePickerDialog.CallBack,
ReplaceRuleAdapter.CallBack {
override val viewModel: ReplaceRuleViewModel
get() = getViewModel(ReplaceRuleViewModel::class.java)

@ -16,8 +16,8 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.lib.theme.DrawableUtils
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.service.help.Download
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_rss_read.*
import kotlinx.coroutines.launch
@ -28,7 +28,7 @@ import org.jsoup.Jsoup
class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_read, false),
FileChooserDialog.CallBack,
FilePickerDialog.CallBack,
ReadRssViewModel.CallBack {
override val viewModel: ReadRssViewModel

@ -24,8 +24,8 @@ import io.legado.app.lib.dialogs.*
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.ui.association.ImportRssSourceActivity
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.ui.qrcode.QrCodeActivity
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity
import io.legado.app.ui.widget.SelectActionBar
@ -47,7 +47,7 @@ import java.util.*
class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_rss_source),
PopupMenu.OnMenuItemClickListener,
FileChooserDialog.CallBack,
FilePickerDialog.CallBack,
RssSourceAdapter.CallBack {
override val viewModel: RssSourceViewModel

@ -20,8 +20,8 @@ import io.legado.app.help.permission.Permissions
import io.legado.app.help.permission.PermissionsCompat
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.filepicker.FilePicker
import io.legado.app.ui.filepicker.FilePickerDialog
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.dialog_font_select.*
import kotlinx.coroutines.Dispatchers.Main
@ -30,7 +30,7 @@ import java.io.File
import java.util.*
class FontSelectDialog : BaseDialogFragment(),
FileChooserDialog.CallBack,
FilePickerDialog.CallBack,
Toolbar.OnMenuItemClickListener,
FontAdapter.CallBack {
private val fontFolderRequestCode = 35485

@ -4,7 +4,7 @@ import android.os.Environment
import android.webkit.MimeTypeMap
import androidx.annotation.IntDef
import io.legado.app.App
import io.legado.app.ui.filechooser.utils.ConvertUtils
import io.legado.app.ui.filepicker.utils.ConvertUtils
import java.io.*
import java.nio.charset.Charset
import java.text.SimpleDateFormat

Loading…
Cancel
Save