pull/37/head
kunfei 5 years ago
parent c441b86216
commit 348b5d23b1
  1. 8
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
  2. 21
      app/src/main/res/layout/activity_rss_source_edit.xml
  3. 1
      app/src/main/res/values/strings.xml

@ -24,7 +24,7 @@ import io.legado.app.ui.rss.source.debug.RssSourceDebugActivity
import io.legado.app.ui.widget.KeyboardToolPop
import io.legado.app.utils.GSON
import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_book_source_edit.*
import kotlinx.android.synthetic.main.activity_rss_source_edit.*
import org.jetbrains.anko.displayMetrics
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast
@ -99,6 +99,10 @@ class RssSourceEditActivity :
}
private fun upRecyclerView(rssSource: RssSource?) {
rssSource?.let {
cb_is_enable.isChecked = rssSource.enabled
cb_enable_js.isChecked = rssSource.enableJs
}
sourceEntities.clear()
sourceEntities.apply {
add(EditEntity("sourceName", rssSource?.sourceName, R.string.rss_source_name))
@ -132,6 +136,8 @@ class RssSourceEditActivity :
private fun getRssSource(): RssSource? {
val source = viewModel.sourceLiveData.value ?: RssSource()
source.enabled = cb_is_enable.isChecked
source.enableJs = cb_enable_js.isChecked
sourceEntities.forEach {
when (it.key) {
"sourceName" -> source.sourceName = it.value ?: ""

@ -15,6 +15,27 @@
app:fitStatusBar="false"
app:title="@string/rss_source_edit" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<io.legado.app.lib.theme.view.ATECheckBox
android:id="@+id/cb_is_enable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/is_enable" />
<io.legado.app.lib.theme.view.ATECheckBox
android:id="@+id/cb_enable_js"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/is_enable" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"

@ -492,6 +492,7 @@
<string name="music">音乐</string>
<string name="audio">音频</string>
<string name="is_enable">启用</string>
<string name="enable_js">启用JS</string>
<string name="all_source">全部书源</string>
<string name="cannot_empty">输入不能为空</string>
<string name="clear_find_cache">清空发现缓存</string>

Loading…
Cancel
Save