From 09a39b0b2d656024a67e287e4804636be6f66314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=A3=E5=8F=A3=E5=90=95?= <156081428@qq.com> Date: Thu, 17 Sep 2020 21:31:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B1=E7=94=A8?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=85=8D=E7=BD=AE=E4=B8=8D=E8=83=BD=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/ReadBookConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 4353e2fe1..5cceab22d 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -75,7 +75,7 @@ object ReadBookConfig { } fun initShareConfig() { - val configFile = File(configFilePath) + val configFile = File(shareConfigFilePath) var c: Config? = null if (configFile.exists()) { try { From c2e54e1efd951757f711e8354d3228fa897d6f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=A3=E5=8F=A3=E5=90=95?= <156081428@qq.com> Date: Fri, 18 Sep 2020 00:52:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=BA=90=E5=88=86=E7=BB=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/ui/README.md | 1 + .../association/ImportBookSourceActivity.kt | 26 +++++++++++++++++++ app/src/main/res/menu/import_source.xml | 6 +++++ app/src/main/res/values-zh/strings.xml | 3 +++ app/src/main/res/values/strings.xml | 3 +++ 5 files changed, 39 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/README.md b/app/src/main/java/io/legado/app/ui/README.md index ef44bed69..102071a0c 100644 --- a/app/src/main/java/io/legado/app/ui/README.md +++ b/app/src/main/java/io/legado/app/ui/README.md @@ -1,6 +1,7 @@ ## 放置与界面有关的类 * about 关于界面 +* association 导入书源界面 * audio 音频播放界面 * book\arrange 书架整理界面 * book\info 书籍信息查看 diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt index 07b6451da..c045d0e33 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt @@ -20,16 +20,21 @@ import io.legado.app.data.entities.BookSource import io.legado.app.help.IntentDataHelp import io.legado.app.help.SourceHelp import io.legado.app.lib.dialogs.alert +import io.legado.app.lib.dialogs.customView +import io.legado.app.lib.dialogs.noButton import io.legado.app.lib.dialogs.okButton +import io.legado.app.ui.widget.text.AutoCompleteTextView import io.legado.app.utils.applyTint import io.legado.app.utils.getViewModel import io.legado.app.utils.visible import kotlinx.android.synthetic.main.activity_translucence.* +import kotlinx.android.synthetic.main.dialog_edit_text.view.* import kotlinx.android.synthetic.main.dialog_recycler_view.* import kotlinx.android.synthetic.main.item_source_import.view.* import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.toast + class ImportBookSourceActivity : VMBaseActivity( R.layout.activity_translucence, theme = Theme.Transparent @@ -112,6 +117,7 @@ class ImportBookSourceActivity : VMBaseActivity( class SourcesDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener { lateinit var adapter: SourcesAdapter + private var _groupName: String? = null override fun onStart() { super.onStart() @@ -165,6 +171,23 @@ class ImportBookSourceActivity : VMBaseActivity( override fun onMenuItemClick(item: MenuItem): Boolean { when (item.itemId) { + R.id.menu_new_group -> { + alert(R.string.diy_edit_source_group) { + var editText: AutoCompleteTextView? = null + customView { + layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { + editText = edit_view + } + } + okButton { + editText?.text?.toString()?.let { group -> + _groupName = group + item.title = getString(R.string.diy_edit_source_group_title, _groupName) + } + } + noButton { } + }.show().applyTint() + } R.id.menu_select_all -> { adapter.selectStatus.forEachIndexed { index, b -> if (!b) { @@ -193,6 +216,9 @@ class ImportBookSourceActivity : VMBaseActivity( private fun importSelect() { val selectSource = arrayListOf() adapter.selectStatus.forEachIndexed { index, b -> + if (_groupName != null) { + adapter.getItem(index)!!.bookSourceGroup = _groupName + } if (b) { selectSource.add(adapter.getItem(index)!!) } diff --git a/app/src/main/res/menu/import_source.xml b/app/src/main/res/menu/import_source.xml index 37c34f4de..8a2971e3f 100644 --- a/app/src/main/res/menu/import_source.xml +++ b/app/src/main/res/menu/import_source.xml @@ -3,6 +3,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> + + 源名称(sourceName) 源URL(sourceUrl) 源分组(sourceGroup) + 自定义源分组 + 输入自定义源分组名称 + 【%s】 分类Url 登录URL(loginUrl) 源注释(sourceComment) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index be20fce1e..46e2c5304 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -389,6 +389,9 @@ 源名称(sourceName) 源URL(sourceUrl) 源分组(sourceGroup) + 自定义源分组 + 输入自定义源分组名称 + 【%s】 分类Url 登录URL(loginUrl) 源注释(sourceComment)