调试订阅添加查看源码

pull/940/head
gedoor 4 years ago
parent 547fd17ac3
commit bd3e196688
  1. 18
      app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugActivity.kt
  2. 10
      app/src/main/java/io/legado/app/ui/rss/source/debug/RssSourceDebugModel.kt
  3. 8
      app/src/main/res/menu/book_source_debug.xml
  4. 17
      app/src/main/res/menu/rss_source_debug.xml
  5. 5
      app/src/main/res/values-zh-rHK/strings.xml
  6. 5
      app/src/main/res/values-zh-rTW/strings.xml
  7. 5
      app/src/main/res/values-zh/strings.xml
  8. 5
      app/src/main/res/values/strings.xml

@ -1,6 +1,8 @@
package io.legado.app.ui.rss.source.debug
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.SearchView
import androidx.activity.viewModels
import io.legado.app.R
@ -8,6 +10,7 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.databinding.ActivitySourceDebugBinding
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.utils.gone
import io.legado.app.utils.toastOnUi
@ -41,6 +44,21 @@ class RssSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, RssSou
}
}
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.rss_source_debug, menu)
return super.onCompatCreateOptionsMenu(menu)
}
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_list_src ->
TextDialog.show(supportFragmentManager, viewModel.listSrc)
R.id.menu_content_src ->
TextDialog.show(supportFragmentManager, viewModel.contentSrc)
}
return super.onCompatOptionsItemSelected(item)
}
private fun initRecyclerView() {
ATH.applyEdgeEffectColor(binding.recyclerView)
adapter = RssSourceDebugAdapter(this)

@ -8,10 +8,10 @@ import io.legado.app.model.Debug
class RssSourceDebugModel(application: Application) : BaseViewModel(application),
Debug.Callback {
private var rssSource: RssSource? = null
private var callback: ((Int, String) -> Unit)? = null
var listSrc: String? = null
var contentSrc: String? = null
fun initData(sourceUrl: String?, finally: () -> Unit) {
sourceUrl?.let {
@ -36,7 +36,11 @@ class RssSourceDebugModel(application: Application) : BaseViewModel(application)
}
override fun printLog(state: Int, msg: String) {
callback?.invoke(state, msg)
when (state) {
10 -> listSrc = msg
20 -> contentSrc = msg
else -> callback?.invoke(state, msg)
}
}
override fun onCleared() {

@ -12,22 +12,22 @@
<item
android:id="@+id/menu_search_src"
android:title="搜索源码"
android:title="@string/search_src"
app:showAsAction="never" />
<item
android:id="@+id/menu_book_src"
android:title="书籍源码"
android:title="@string/boo_src"
app:showAsAction="never" />
<item
android:id="@+id/menu_toc_src"
android:title="目录源码"
android:title="@string/toc_src"
app:showAsAction="never" />
<item
android:id="@+id/menu_content_src"
android:title="正文源码"
android:title="@string/content_src"
app:showAsAction="never" />
<item

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="AlwaysShowAction">
<item
android:id="@+id/menu_list_src"
android:title="@string/list_src"
app:showAsAction="never" />
<item
android:id="@+id/menu_content_src"
android:title="@string/content_src"
app:showAsAction="never" />
</menu>

@ -813,5 +813,10 @@
<string name="system_tts">系统TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
<string name="search_src">搜索源码</string>
<string name="boo_src">书籍源码</string>
<string name="toc_src">目录源码</string>
<string name="content_src">正文源码</string>
<string name="list_src">列表源码</string>
</resources>

@ -815,5 +815,10 @@
<string name="system_tts">系统TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
<string name="search_src">搜索源码</string>
<string name="boo_src">书籍源码</string>
<string name="toc_src">目录源码</string>
<string name="content_src">正文源码</string>
<string name="list_src">列表源码</string>
</resources>

@ -817,5 +817,10 @@
<string name="system_tts">系统TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
<string name="search_src">搜索源码</string>
<string name="boo_src">书籍源码</string>
<string name="toc_src">目录源码</string>
<string name="content_src">正文源码</string>
<string name="list_src">列表源码</string>
</resources>

@ -820,5 +820,10 @@
<string name="system_tts">System TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
<string name="search_src">搜索源码</string>
<string name="boo_src">书籍源码</string>
<string name="toc_src">目录源码</string>
<string name="content_src">正文源码</string>
<string name="list_src">列表源码</string>
</resources>

Loading…
Cancel
Save