编辑书源菜单添加清除cookie菜单

pull/1881/head
kunfei 3 years ago
parent 411c66b9cd
commit 591878bf4e
  1. 3
      app/src/main/AndroidManifest.xml
  2. 2
      app/src/main/java/io/legado/app/constant/BookType.kt
  3. 1
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  4. 7
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt
  5. 5
      app/src/main/res/menu/source_edit.xml
  6. 1
      app/src/main/res/values-es-rES/strings.xml
  7. 1
      app/src/main/res/values-ja-rJP/strings.xml
  8. 1
      app/src/main/res/values-pt-rBR/strings.xml
  9. 1
      app/src/main/res/values-zh-rHK/strings.xml
  10. 1
      app/src/main/res/values-zh-rTW/strings.xml
  11. 1
      app/src/main/res/values-zh/strings.xml
  12. 1
      app/src/main/res/values/strings.xml

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="io.legado.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />

@ -11,6 +11,6 @@ object BookType {
@Target(AnnotationTarget.VALUE_PARAMETER)
@Retention(AnnotationRetention.SOURCE)
@IntDef(default, audio, image)
@IntDef(default, audio, image, file)
annotation class Type
}

@ -109,6 +109,7 @@ class BookSourceEditActivity :
}
}
}
R.id.menu_clear_cookie -> getSource().let { viewModel.clearCookie(it.bookSourceUrl) }
R.id.menu_auto_complete -> viewModel.autoComplete = !viewModel.autoComplete
R.id.menu_copy_source -> sendToClip(GSON.toJson(getSource()))
R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) }

@ -7,6 +7,7 @@ import io.legado.app.data.appDb
import io.legado.app.data.entities.BookSource
import io.legado.app.exception.NoStackTraceException
import io.legado.app.help.RuleComplete
import io.legado.app.help.http.CookieStore
import io.legado.app.help.http.newCallStrResponse
import io.legado.app.help.http.okHttpClient
import io.legado.app.utils.*
@ -95,6 +96,12 @@ class BookSourceEditViewModel(application: Application) : BaseViewModel(applicat
}
}
fun clearCookie(url: String) {
execute {
CookieStore.removeCookie(url)
}
}
fun ruleComplete(rule: String?, preRule: String? = null, type: Int = 1): String? {
if (autoComplete) {
return RuleComplete.autoComplete(rule, preRule, type)

@ -21,6 +21,11 @@
android:title="@string/login"
app:showAsAction="never" />
<item
android:id="@+id/menu_clear_cookie"
android:title="@string/cookie"
app:showAsAction="never" />
<item
android:id="@+id/menu_auto_complete"
android:title="@string/auto_complete"

@ -979,5 +979,6 @@
<string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string>
<string name="cookie">清除cookie</string>
<!-- string end -->
</resources>

@ -982,5 +982,6 @@
<string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string>
<string name="cookie">清除cookie</string>
<!-- string end -->
</resources>

@ -982,5 +982,6 @@
<string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string>
<string name="cookie">清除cookie</string>
<!-- string end -->
</resources>

@ -979,5 +979,6 @@
<string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string>
<string name="cookie">清除cookie</string>
<!-- string end -->
</resources>

@ -981,5 +981,6 @@
<string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string>
<string name="cookie">清除cookie</string>
<!-- string end -->
</resources>

@ -981,5 +981,6 @@
<string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string>
<string name="cookie">清除cookie</string>
<!-- string end -->
</resources>

@ -982,5 +982,6 @@
<string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">CookieJar</string>
<string name="cookie">清除cookie</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save