feat: 优化

pull/209/head
kunfei 5 years ago
parent 96acb580c9
commit cb1cfe5fed
  1. 2
      app/src/main/java/io/legado/app/ui/about/AboutActivity.kt
  2. 21
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceAdapter.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  4. 6
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt
  5. 2
      app/src/main/java/io/legado/app/ui/main/rss/RssAdapter.kt
  6. 8
      app/src/main/res/menu/change_source_item.xml
  7. 7
      app/src/main/res/values-zh-rHK/strings.xml
  8. 39
      app/src/main/res/values/pref_key_value.xml
  9. 6
      app/src/main/res/values/strings.xml

@ -26,7 +26,7 @@ class AboutActivity : BaseActivity(R.layout.activity_about) {
tv_app_summary.post {
val span = ForegroundColorSpan(accentColor)
val spannableString = SpannableString(tv_app_summary.text)
val start = spannableString.indexOf("开源阅读软件")
val start = spannableString.indexOf(getString(R.string.legado_gzh))
spannableString.setSpan(
span, start, start + 6,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE

@ -2,6 +2,8 @@ package io.legado.app.ui.book.changesource
import android.content.Context
import android.os.Bundle
import android.view.View
import androidx.appcompat.widget.PopupMenu
import io.legado.app.R
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
@ -10,6 +12,7 @@ import io.legado.app.utils.invisible
import io.legado.app.utils.visible
import kotlinx.android.synthetic.main.item_change_source.view.*
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
class ChangeSourceAdapter(context: Context, val callBack: CallBack) :
@ -43,10 +46,28 @@ class ChangeSourceAdapter(context: Context, val callBack: CallBack) :
callBack.changeTo(it)
}
}
holder.itemView.onLongClick {
showMenu(holder.itemView, getItem(holder.layoutPosition))
true
}
}
private fun showMenu(view: View, searchBook: SearchBook?) {
searchBook ?: return
val popupMenu = PopupMenu(context, view)
popupMenu.inflate(R.menu.change_source_item)
popupMenu.setOnMenuItemClickListener {
when (it.itemId) {
R.id.menu_disable_book_source -> callBack.disableSource(searchBook.origin)
}
true
}
popupMenu.show()
}
interface CallBack {
val bookUrl: String?
fun changeTo(searchBook: SearchBook)
fun disableSource(sourceUrl: String)
}
}

@ -185,6 +185,10 @@ class ChangeSourceDialog : BaseDialogFragment(),
override val bookUrl: String?
get() = callBack?.oldBook?.bookUrl
override fun disableSource(sourceUrl: String) {
viewModel.disableSource(sourceUrl)
}
interface CallBack {
val oldBook: Book?
fun changeTo(book: Book)

@ -165,4 +165,10 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
searchPool.close()
}
fun disableSource(sourceUrl: String) {
execute {
}
}
}

@ -34,7 +34,7 @@ class RssAdapter(context: Context, val callBack: CallBack) :
}
holder.itemView.onLongClick {
getItem(holder.layoutPosition)?.let {
showMenu(holder.itemView, it)
showMenu(holder.itemView.iv_icon, it)
}
true
}

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_disable_book_source"
android:title="@string/disable_book_source" />
</menu>

@ -88,7 +88,7 @@
<string name="download_offline_s">下載已選擇的章節到本地</string>
<string name="change_origin">換源</string>
<string name="about_description">
\u3000\u3000這是一款使用 Kotlin 全新開發的開源的閲讀應用程式,歡迎你的加入。關注公眾號[开源阅读软件]!
\u3000\u3000這是一款使用 Kotlin 全新開發的開源的閲讀應用程式,歡迎你的加入。關注公眾號[开源阅读]!
</string>
<string name="app_share_description">
閲讀3.0下載地址:\nhttps://play.google.com/store/apps/details?id=io.legado.app
@ -664,7 +664,7 @@
<string name="follow_official_account">關注公衆號</string>
<string name="wechat">WeChat</string>
<string name="thanks">你的支持是我更新的動力</string>
<string name="about_official_account">公众号[开源阅读软件]</string>
<string name="about_official_account">公众号[开源阅读]</string>
<string name="source_auto_changing">正在自動換源</string>
<string name="click_to_apply">點擊加入</string>
<string name="middle"></string>
@ -685,4 +685,7 @@
<string name="night_accent">夜間,強調色</string>
<string name="night_background_color">夜間,背景色</string>
<string name="night_navbar_color">夜間,導航欄顏色</string>
<string name="hideHeader">隐藏页眉</string>
<string name="hideFooter">隐藏页脚</string>
<string name="auto_change_source">自动换源</string>
</resources>

@ -1,22 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="pk_auto_refresh">auto_refresh</string>
<string name="pk_requested_direction">list_screen_direction</string>
<string name="pk_full_screen">full_screen</string>
<string name="pk_threads_num">threads_num</string>
<string name="pk_user_agent">user_agent</string>
<string name="pk_bookshelf_px">bookshelf_px</string>
<string name="pk_read_type">read_type</string>
<string name="pk_find_expand_group">expandGroupFind</string>
<string name="pk_default_read">defaultToRead</string>
<string name="pk_auto_download">autoDownload</string>
<string name="pk_check_update">checkUpdate</string>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="pk_auto_refresh" tools:ignore="MissingTranslation">auto_refresh</string>
<string name="pk_requested_direction" tools:ignore="MissingTranslation">list_screen_direction</string>
<string name="pk_full_screen" tools:ignore="MissingTranslation">full_screen</string>
<string name="pk_threads_num" tools:ignore="MissingTranslation">threads_num</string>
<string name="pk_user_agent" tools:ignore="MissingTranslation">user_agent</string>
<string name="pk_bookshelf_px" tools:ignore="MissingTranslation">bookshelf_px</string>
<string name="pk_read_type" tools:ignore="MissingTranslation">read_type</string>
<string name="pk_find_expand_group" tools:ignore="MissingTranslation">expandGroupFind</string>
<string name="pk_default_read" tools:ignore="MissingTranslation">defaultToRead</string>
<string name="pk_auto_download" tools:ignore="MissingTranslation">autoDownload</string>
<string name="pk_check_update" tools:ignore="MissingTranslation">checkUpdate</string>
<string name="legado_gzh" tools:ignore="MissingTranslation">开源阅读</string>
<string name="source_rule_url">https://gitee.com/alanskycn/yuedu/blob/master/Rule/README.md</string>
<string name="this_github_url">https://github.com/gedoor/legado</string>
<string name="contributors_url">https://github.com/gedoor/legado/graphs/contributors</string>
<string name="disclaimer_url">https://gedoor.github.io/MyBookshelf/disclaimer.html</string>
<string name="home_page_url">https://gedoor.github.io/MyBookshelf/</string>
<string name="latest_release_url">https://github.com/gedoor/legado/releases/latest</string>
<string name="latest_release_api">https://api.github.com/repos/gedoor/legado/releases/latest</string>
<string name="source_rule_url" tools:ignore="MissingTranslation">https://gitee.com/alanskycn/yuedu/blob/master/Rule/README.md</string>
<string name="this_github_url" tools:ignore="MissingTranslation">https://github.com/gedoor/legado</string>
<string name="contributors_url" tools:ignore="MissingTranslation">https://github.com/gedoor/legado/graphs/contributors</string>
<string name="disclaimer_url" tools:ignore="MissingTranslation">https://gedoor.github.io/MyBookshelf/disclaimer.html</string>
<string name="home_page_url" tools:ignore="MissingTranslation">https://gedoor.github.io/MyBookshelf/</string>
<string name="latest_release_url" tools:ignore="MissingTranslation">https://github.com/gedoor/legado/releases/latest</string>
<string name="latest_release_api" tools:ignore="MissingTranslation">https://api.github.com/repos/gedoor/legado/releases/latest</string>
</resources>

@ -88,7 +88,7 @@
<string name="download_offline_s">下载选择的章节到本地</string>
<string name="change_origin">换源</string>
<string name="about_description">
\u3000\u3000这是一款使用Kotlin全新开发的开源的阅读软件,欢迎您的加入。关注公众号[开源阅读软件]!
\u3000\u3000这是一款使用Kotlin全新开发的开源的阅读软件,欢迎您的加入。关注公众号[开源阅读]!
</string>
<string name="app_share_description">
阅读3.0下载地址:\nhttps://play.google.com/store/apps/details?id=io.legado.app
@ -662,11 +662,11 @@
<string name="contact">联系我们</string>
<string name="license">开源许可</string>
<string name="other" translatable="false">其它</string>
<string name="official_account" translatable="false">开源阅读软件</string>
<string name="official_account" translatable="false">开源阅读</string>
<string name="follow_official_account">关注公众号</string>
<string name="wechat">微信</string>
<string name="thanks">您的支持是我更新的动力</string>
<string name="about_official_account">公众号[开源阅读软件]</string>
<string name="about_official_account">公众号[开源阅读]</string>
<string name="source_auto_changing">正在自动换源</string>
<string name="click_to_apply">点击加入</string>
<string name="middle"></string>

Loading…
Cancel
Save