Merge pull request #386 from KKL369/master

push
pull/392/head
kunfei 4 years ago committed by GitHub
commit 3d15773f22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  2. 1
      app/src/main/java/io/legado/app/ui/README.md
  3. 26
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt
  4. 6
      app/src/main/res/menu/import_source.xml
  5. 3
      app/src/main/res/values-zh/strings.xml
  6. 3
      app/src/main/res/values/strings.xml

@ -75,7 +75,7 @@ object ReadBookConfig {
}
fun initShareConfig() {
val configFile = File(configFilePath)
val configFile = File(shareConfigFilePath)
var c: Config? = null
if (configFile.exists()) {
try {

@ -1,6 +1,7 @@
## 放置与界面有关的类
* about 关于界面
* association 导入书源界面
* audio 音频播放界面
* book\arrange 书架整理界面
* book\info 书籍信息查看

@ -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<ImportBookSourceViewModel>(
R.layout.activity_translucence,
theme = Theme.Transparent
@ -112,6 +117,7 @@ class ImportBookSourceActivity : VMBaseActivity<ImportBookSourceViewModel>(
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<ImportBookSourceViewModel>(
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<ImportBookSourceViewModel>(
private fun importSelect() {
val selectSource = arrayListOf<BookSource>()
adapter.selectStatus.forEachIndexed { index, b ->
if (_groupName != null) {
adapter.getItem(index)!!.bookSourceGroup = _groupName
}
if (b) {
selectSource.add(adapter.getItem(index)!!)
}

@ -3,6 +3,12 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_new_group"
android:title="@string/diy_source_group"
app:showAsAction="always"
tools:ignore="AlwaysShowAction" />
<item
android:id="@+id/menu_select_all"
android:title="@string/select_all"

@ -389,6 +389,9 @@
<string name="source_name">源名称(sourceName)</string>
<string name="source_url">源URL(sourceUrl)</string>
<string name="source_group">源分组(sourceGroup)</string>
<string name="diy_source_group">自定义源分组</string>
<string name="diy_edit_source_group">输入自定义源分组名称</string>
<string name="diy_edit_source_group_title">【%s】</string>
<string name="sort_url">分类Url</string>
<string name="login_url">登录URL(loginUrl)</string>
<string name="comment">源注释(sourceComment)</string>

@ -389,6 +389,9 @@
<string name="source_name">源名称(sourceName)</string>
<string name="source_url">源URL(sourceUrl)</string>
<string name="source_group">源分组(sourceGroup)</string>
<string name="diy_source_group">自定义源分组</string>
<string name="diy_edit_source_group">输入自定义源分组名称</string>
<string name="diy_edit_source_group_title">【%s】</string>
<string name="sort_url">分类Url</string>
<string name="login_url">登录URL(loginUrl)</string>
<string name="comment">源注释(sourceComment)</string>

Loading…
Cancel
Save