From 24537f1a482031aa3b081ddcb9ed4c66e958a500 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 30 Oct 2020 08:10:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/book/cache/CacheActivity.kt | 6 +- .../app/ui/book/local/ImportBookActivity.kt | 6 +- .../ui/book/read/config/BgTextConfigDialog.kt | 6 +- .../book/source/manage/BookSourceActivity.kt | 6 +- .../app/ui/config/BackupConfigFragment.kt | 4 +- .../legado/app/ui/config/BackupRestoreUi.kt | 2 +- .../{filechooser => filepicker}/FilePicker.kt | 140 +++++++++--------- .../FilePickerDialog.kt} | 10 +- .../adapter/FileAdapter.kt | 8 +- .../adapter/PathAdapter.kt | 6 +- .../entity/FileItem.kt | 2 +- .../entity/JavaBean.kt | 2 +- .../utils/ConvertUtils.kt | 2 +- .../utils/FilePickerIcon.java | 2 +- .../io/legado/app/ui/main/my/MyFragment.kt | 4 +- .../app/ui/replace/ReplaceRuleActivity.kt | 6 +- .../legado/app/ui/rss/read/ReadRssActivity.kt | 6 +- .../ui/rss/source/manage/RssSourceActivity.kt | 6 +- .../app/ui/widget/font/FontSelectDialog.kt | 6 +- .../java/io/legado/app/utils/FileUtils.kt | 2 +- 20 files changed, 115 insertions(+), 117 deletions(-) rename app/src/main/java/io/legado/app/ui/{filechooser => filepicker}/FilePicker.kt (60%) rename app/src/main/java/io/legado/app/ui/{filechooser/FileChooserDialog.kt => filepicker/FilePickerDialog.kt} (96%) rename app/src/main/java/io/legado/app/ui/{filechooser => filepicker}/adapter/FileAdapter.kt (95%) rename app/src/main/java/io/legado/app/ui/{filechooser => filepicker}/adapter/PathAdapter.kt (92%) rename app/src/main/java/io/legado/app/ui/{filechooser => filepicker}/entity/FileItem.kt (87%) rename app/src/main/java/io/legado/app/ui/{filechooser => filepicker}/entity/JavaBean.kt (97%) rename app/src/main/java/io/legado/app/ui/{filechooser => filepicker}/utils/ConvertUtils.kt (98%) rename app/src/main/java/io/legado/app/ui/{filechooser => filepicker}/utils/FilePickerIcon.java (99%) diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt index 8aba5d38d..6a377b542 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.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(R.layout.activity_download), - FileChooserDialog.CallBack, + FilePickerDialog.CallBack, CacheAdapter.CallBack { private val exportRequestCode = 32 private val exportBookPathKey = "exportBookPath" diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index 42da2f587..1663c38dd 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -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(R.layout.activity_import_book), - FileChooserDialog.CallBack, + FilePickerDialog.CallBack, PopupMenu.OnMenuItemClickListener, ImportBookAdapter.CallBack { private val requestCodeSelectFolder = 342 diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt index 5e5d64e2e..edf960ee4 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index e1310c6cf..e9788dd83 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -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(R.layout.activity_book_source), PopupMenu.OnMenuItemClickListener, BookSourceAdapter.CallBack, - FileChooserDialog.CallBack, + FilePickerDialog.CallBack, SearchView.OnQueryTextListener { override val viewModel: BookSourceViewModel get() = getViewModel(BookSourceViewModel::class.java) diff --git a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt index 56d753eaf..d5f3815a1 100644 --- a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt @@ -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) diff --git a/app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt b/app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt index e62030482..05a5e8bbf 100644 --- a/app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt +++ b/app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt b/app/src/main/java/io/legado/app/ui/filepicker/FilePicker.kt similarity index 60% rename from app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt rename to app/src/main/java/io/legado/app/ui/filepicker/FilePicker.kt index 07ed5c6f1..d2b0ff17f 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/FilePicker.kt @@ -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? = null, otherFun: ((action: String) -> Unit)? = null ) { + val selectList = + activity.resources.getStringArray(R.array.select_folder).toMutableList() + otherActions?.let { + selectList.addAll(otherActions) + } activity.alert(title = title) { - val selectList = - activity.resources.getStringArray(R.array.select_folder).toMutableList() - otherActions?.let { - selectList.addAll(otherActions) - } 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,35 +59,34 @@ object FilePicker { otherActions: List? = 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) - } - items(selectList) { _, index -> - when (index) { - 0 -> { - try { - val intent = createSelectDirIntent() - fragment.startActivityForResult(intent, requestCode) - } catch (e: java.lang.Exception) { - e.printStackTrace() - fragment.toast(e.localizedMessage ?: "ERROR") - } - } - 1 -> checkPermissions(fragment) { - FileChooserDialog.show( - fragment.childFragmentManager, - requestCode, - mode = FileChooserDialog.DIRECTORY - ) + 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 -> { + try { + val intent = createSelectDirIntent() + fragment.startActivityForResult(intent, requestCode) + } catch (e: java.lang.Exception) { + e.printStackTrace() + fragment.toast(e.localizedMessage ?: "ERROR") } - else -> otherFun?.invoke(selectList[index]) } + 1 -> checkPermissions(fragment) { + FilePickerDialog.show( + fragment.childFragmentManager, + requestCode, + mode = FilePickerDialog.DIRECTORY + ) + } + else -> otherFun?.invoke(selectList[index]) } - }.show().applyTint() + } + }.show().applyTint() } fun selectFile( @@ -98,12 +97,12 @@ object FilePicker { otherActions: List? = null, otherFun: ((action: String) -> Unit)? = null ) { + val selectList = + activity.resources.getStringArray(R.array.select_folder).toMutableList() + otherActions?.let { + selectList.addAll(otherActions) + } activity.alert(title = title) { - val selectList = - activity.resources.getStringArray(R.array.select_folder).toMutableList() - otherActions?.let { - selectList.addAll(otherActions) - } 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,40 +140,39 @@ object FilePicker { otherActions: List? = 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) - } - items(selectList) { _, index -> - when (index) { - 0 -> { - try { - val intent = createSelectFileIntent() - intent.putExtra( - Intent.EXTRA_MIME_TYPES, - typesOfExtensions(allowExtensions) - ) - fragment.startActivityForResult(intent, requestCode) - } catch (e: java.lang.Exception) { - e.printStackTrace() - fragment.toast(e.localizedMessage ?: "ERROR") - } - } - 1 -> checkPermissions(fragment) { - FileChooserDialog.show( - fragment.childFragmentManager, - requestCode, - mode = FileChooserDialog.FILE, - allowExtensions = allowExtensions + 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 -> { + try { + val intent = createSelectFileIntent() + intent.putExtra( + Intent.EXTRA_MIME_TYPES, + typesOfExtensions(allowExtensions) ) + fragment.startActivityForResult(intent, requestCode) + } catch (e: java.lang.Exception) { + e.printStackTrace() + fragment.toast(e.localizedMessage ?: "ERROR") } - else -> otherFun?.invoke(selectList[index]) } + 1 -> checkPermissions(fragment) { + FilePickerDialog.show( + fragment.childFragmentManager, + requestCode, + mode = FilePickerDialog.FILE, + allowExtensions = allowExtensions + ) + } + else -> otherFun?.invoke(selectList[index]) } - }.show().applyTint() + } + }.show().applyTint() } private fun createSelectFileIntent(): Intent { diff --git a/app/src/main/java/io/legado/app/ui/filechooser/FileChooserDialog.kt b/app/src/main/java/io/legado/app/ui/filepicker/FilePickerDialog.kt similarity index 96% rename from app/src/main/java/io/legado/app/ui/filechooser/FileChooserDialog.kt rename to app/src/main/java/io/legado/app/ui/filepicker/FilePickerDialog.kt index d89058929..b3c9d3831 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/FileChooserDialog.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/FilePickerDialog.kt @@ -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? = null, menus: Array? = null ) { - FileChooserDialog().apply { + FilePickerDialog().apply { val bundle = Bundle() bundle.putInt("mode", mode) bundle.putInt("requestCode", requestCode) diff --git a/app/src/main/java/io/legado/app/ui/filechooser/adapter/FileAdapter.kt b/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt similarity index 95% rename from app/src/main/java/io/legado/app/ui/filechooser/adapter/FileAdapter.kt rename to app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt index 12c45477a..9d0c1ad34 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/adapter/FileAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/adapter/FileAdapter.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/filechooser/adapter/PathAdapter.kt b/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt similarity index 92% rename from app/src/main/java/io/legado/app/ui/filechooser/adapter/PathAdapter.kt rename to app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt index 9d8cf6fab..cadf5b1e2 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/adapter/PathAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/adapter/PathAdapter.kt @@ -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.* diff --git a/app/src/main/java/io/legado/app/ui/filechooser/entity/FileItem.kt b/app/src/main/java/io/legado/app/ui/filepicker/entity/FileItem.kt similarity index 87% rename from app/src/main/java/io/legado/app/ui/filechooser/entity/FileItem.kt rename to app/src/main/java/io/legado/app/ui/filepicker/entity/FileItem.kt index bf4a00229..a558fcc80 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/entity/FileItem.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/entity/FileItem.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.filechooser.entity +package io.legado.app.ui.filepicker.entity import android.graphics.drawable.Drawable diff --git a/app/src/main/java/io/legado/app/ui/filechooser/entity/JavaBean.kt b/app/src/main/java/io/legado/app/ui/filepicker/entity/JavaBean.kt similarity index 97% rename from app/src/main/java/io/legado/app/ui/filechooser/entity/JavaBean.kt rename to app/src/main/java/io/legado/app/ui/filepicker/entity/JavaBean.kt index 33760dce6..c23a827fb 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/entity/JavaBean.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/entity/JavaBean.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/filechooser/utils/ConvertUtils.kt b/app/src/main/java/io/legado/app/ui/filepicker/utils/ConvertUtils.kt similarity index 98% rename from app/src/main/java/io/legado/app/ui/filechooser/utils/ConvertUtils.kt rename to app/src/main/java/io/legado/app/ui/filepicker/utils/ConvertUtils.kt index e6ab2c13c..1af75ebe8 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/utils/ConvertUtils.kt +++ b/app/src/main/java/io/legado/app/ui/filepicker/utils/ConvertUtils.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/filechooser/utils/FilePickerIcon.java b/app/src/main/java/io/legado/app/ui/filepicker/utils/FilePickerIcon.java similarity index 99% rename from app/src/main/java/io/legado/app/ui/filechooser/utils/FilePickerIcon.java rename to app/src/main/java/io/legado/app/ui/filepicker/utils/FilePickerIcon.java index c53ab6631..238b88c43 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/utils/FilePickerIcon.java +++ b/app/src/main/java/io/legado/app/ui/filepicker/utils/FilePickerIcon.java @@ -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 diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt index 75f840986..09207b12a 100644 --- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt @@ -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) diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt index a88189f8d..0863281ae 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt @@ -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(R.layout.activity_replace_rule), SearchView.OnQueryTextListener, PopupMenu.OnMenuItemClickListener, - FileChooserDialog.CallBack, + FilePickerDialog.CallBack, ReplaceRuleAdapter.CallBack { override val viewModel: ReplaceRuleViewModel get() = getViewModel(ReplaceRuleViewModel::class.java) diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt index c66cad69f..cf734f229 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt @@ -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(R.layout.activity_rss_read, false), - FileChooserDialog.CallBack, + FilePickerDialog.CallBack, ReadRssViewModel.CallBack { override val viewModel: ReadRssViewModel diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index bf4613239..097e682e5 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -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(R.layout.activity_rss_source), PopupMenu.OnMenuItemClickListener, - FileChooserDialog.CallBack, + FilePickerDialog.CallBack, RssSourceAdapter.CallBack { override val viewModel: RssSourceViewModel diff --git a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt index f29ea0b9f..c7515a679 100644 --- a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt @@ -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 diff --git a/app/src/main/java/io/legado/app/utils/FileUtils.kt b/app/src/main/java/io/legado/app/utils/FileUtils.kt index ecb22f244..ac7adaaa9 100644 --- a/app/src/main/java/io/legado/app/utils/FileUtils.kt +++ b/app/src/main/java/io/legado/app/utils/FileUtils.kt @@ -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