Merge pull request #24 from gedoor/master

up
pull/379/head
口口吕 5 years ago committed by GitHub
commit c61d066576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/build.gradle
  2. 8
      app/src/main/assets/updateLog.md
  3. 6
      app/src/main/java/io/legado/app/data/dao/SearchBookDao.kt
  4. 17
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  5. 6
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt
  6. 24
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt
  7. 12
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookAdapter.kt
  8. 9
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt
  9. 9
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  10. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  11. 124
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  12. 91
      app/src/main/java/io/legado/app/ui/book/read/config/ReadTypeDialog.kt
  13. 12
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt
  14. 23
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  15. 8
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  16. 8
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  17. 16
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt
  18. 10
      app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt
  19. 9
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
  20. 2
      app/src/main/java/io/legado/app/ui/widget/LabelsBar.kt
  21. 12
      app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt
  22. 22
      app/src/main/java/io/legado/app/ui/widget/text/MultilineTextView.kt
  23. 18
      app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt
  24. 4
      app/src/main/java/io/legado/app/utils/EventBusKt.kt
  25. 12
      app/src/main/res/drawable/ic_type_default_1.xml
  26. 15
      app/src/main/res/drawable/ic_type_default_2.xml
  27. 18
      app/src/main/res/drawable/ic_type_default_3.xml
  28. 135
      app/src/main/res/layout/dialog_read_book_style.xml
  29. 45
      app/src/main/res/layout/dialog_read_type.xml
  30. 61
      app/src/main/res/layout/dialog_title_config.xml
  31. 11
      app/src/main/res/layout/item_search.xml
  32. 12
      app/src/main/res/layout/view_book_page.xml
  33. 12
      app/src/main/res/menu/arrange_book_sel.xml
  34. 5
      app/src/main/res/menu/book_source_sel.xml
  35. 5
      app/src/main/res/menu/rss_source_sel.xml
  36. 6
      app/src/main/res/values/arrays.xml
  37. 4
      app/src/main/res/values/attrs.xml
  38. 7
      app/src/main/res/values/strings.xml

@ -167,7 +167,7 @@ dependencies {
implementation 'org.nanohttpd:nanohttpd-websocket:2.3.1'
//
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.6'
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7'
//
implementation 'com.jaredrummler:colorpicker:1.1.0'

@ -2,6 +2,14 @@
* 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。
* 请关注[开源阅读软件]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。
**2020/03/07**
* 添加标题上下间距调整
* 添加标题大小调整
* 书籍整理添加批量启用禁用更新
* 换源禁用书源不显示
* 修复搜索界面简介最下面显示半行文字
* 搜索历史改为多行
**2020/03/06**
* 添加隐藏标题
* 行距段距改成倍距,根据字体大小变化

@ -27,7 +27,7 @@ interface SearchBookDao {
select t1.name, t1.author, t1.origin, t1.originName, t1.coverUrl, t1.bookUrl, t1.type, t1.time, t1.intro, t1.kind, t1.latestChapterTitle, t1.tocUrl, t1.variable, t1.wordCount, t2.customOrder as originOrder
from searchBooks as t1 inner join book_sources as t2
on t1.origin = t2.bookSourceUrl
where t1.name = :name and t1.author = :author
where t1.name = :name and t1.author = :author and t2.enabled = 1
order by t2.customOrder
"""
)
@ -38,7 +38,7 @@ interface SearchBookDao {
select t1.name, t1.author, t1.origin, t1.originName, t1.coverUrl, t1.bookUrl, t1.type, t1.time, t1.intro, t1.kind, t1.latestChapterTitle, t1.tocUrl, t1.variable, t1.wordCount, t2.customOrder as originOrder
from searchBooks as t1 inner join book_sources as t2
on t1.origin = t2.bookSourceUrl
where t1.name = :name and t1.author = :author and originName like '%'||:key||'%'
where t1.name = :name and t1.author = :author and originName like '%'||:key||'%' and t2.enabled = 1
order by t2.customOrder
"""
)
@ -49,7 +49,7 @@ interface SearchBookDao {
select t1.name, t1.author, t1.origin, t1.originName, t1.coverUrl, t1.bookUrl, t1.type, t1.time, t1.intro, t1.kind, t1.latestChapterTitle, t1.tocUrl, t1.variable, t1.wordCount, t2.customOrder as originOrder
from searchBooks as t1 inner join book_sources as t2
on t1.origin = t2.bookSourceUrl
where t1.name = :name and t1.author = :author and t1.coverUrl is not null and t1.coverUrl <> ''
where t1.name = :name and t1.author = :author and t1.coverUrl is not null and t1.coverUrl <> '' and t2.enabled = 1
order by t2.customOrder
"""
)

@ -70,12 +70,11 @@ object ReadBookConfig {
val dm = resources.displayMetrics
val width = dm.widthPixels
val height = dm.heightPixels
bg = durConfig.bgDrawable(width, height)
bg?.let {
if (it is BitmapDrawable) {
bgMeanColor = BitmapUtils.getMeanColor(it.bitmap)
} else if (it is ColorDrawable) {
bgMeanColor = it.color
bg = durConfig.bgDrawable(width, height).apply {
if (this is BitmapDrawable) {
bgMeanColor = BitmapUtils.getMeanColor(bitmap)
} else if (this is ColorDrawable) {
bgMeanColor = color
}
}
}
@ -169,7 +168,10 @@ object ReadBookConfig {
get() = if (shareLayout) shareConfig.titleMode else durConfig.titleMode
set(value) =
if (shareLayout) shareConfig.titleMode = value else durConfig.titleMode = value
var titleSize: Int
get() = if (shareLayout) shareConfig.titleSize else durConfig.titleSize
set(value) =
if (shareLayout) shareConfig.titleSize = value else durConfig.titleSize = value
var titleTopSpacing: Int
get() = if (shareLayout) shareConfig.titleTopSpacing else durConfig.titleTopSpacing
set(value) =
@ -271,6 +273,7 @@ object ReadBookConfig {
var lineSpacingExtra: Int = 12,//行间距
var paragraphSpacing: Int = 12,//段距
var titleMode: Int = 0,//标题居中
var titleSize: Int = 0,
var titleTopSpacing: Int = 0,
var titleBottomSpacing: Int = 0,
var paddingBottom: Int = 6,

@ -39,7 +39,7 @@ object BookContent {
var contentData = analyzeContent(
book, baseUrl, body, contentRule, bookChapter, bookSource
)
content.append(contentData.content.replace(bookChapter.title, ""))
content.append(contentData.content.replace(bookChapter.title, "")).append("\n")
if (contentData.nextUrl.size == 1) {
var nextUrl = contentData.nextUrl[0]
val nextChapterUrl = if (!nextChapterUrlF.isNullOrEmpty())
@ -64,7 +64,7 @@ object BookContent {
)
nextUrl =
if (contentData.nextUrl.isNotEmpty()) contentData.nextUrl[0] else ""
content.append(contentData.content)
content.append(contentData.content).append("\n")
}
}
Debug.log(bookSource.bookSourceUrl, "◇本章总页数:${nextUrlList.size}")
@ -91,7 +91,7 @@ object BookContent {
}
}
for (item in contentDataList) {
content.append(item.content)
content.append(item.content).append("\n")
}
}

@ -32,6 +32,7 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
get() = getViewModel(ArrangeBookViewModel::class.java)
override val groupList: ArrayList<BookGroup> = arrayListOf()
private val groupRequestCode = 22
private val addToGroupRequestCode = 34
private lateinit var adapter: ArrangeBookAdapter
private var groupLiveData: LiveData<List<BookGroup>>? = null
private var booksLiveData: LiveData<List<Book>>? = null
@ -102,7 +103,6 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
else -> App.db.bookDao().observeByGroup(groupId)
}
booksLiveData?.observe(this, Observer {
adapter.selectedBooks.clear()
adapter.setItems(it)
upSelectCount()
})
@ -115,25 +115,21 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
R.id.menu_all -> {
title_bar.subtitle = item.title
groupId = -1
adapter.selectedBooks.clear()
initBookData()
}
R.id.menu_local -> {
title_bar.subtitle = item.title
groupId = -2
adapter.selectedBooks.clear()
initBookData()
}
R.id.menu_audio -> {
title_bar.subtitle = item.title
groupId = -3
adapter.selectedBooks.clear()
initBookData()
}
else -> if (item.groupId == R.id.menu_group) {
title_bar.subtitle = item.title
groupId = item.itemId
adapter.selectedBooks.clear()
initBookData()
}
}
@ -144,9 +140,14 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
when (item?.itemId) {
R.id.menu_del_selection ->
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
okButton { viewModel.deleteBook(*adapter.selectedBooks.toTypedArray()) }
okButton { viewModel.deleteBook(*adapter.selectedBooks()) }
noButton { }
}.show().applyTint()
R.id.menu_update_enable ->
viewModel.upCanUpdate(adapter.selectedBooks(), true)
R.id.menu_update_disable ->
viewModel.upCanUpdate(adapter.selectedBooks(), false)
R.id.menu_add_to_group -> selectGroup(0, addToGroupRequestCode)
}
return false
}
@ -168,7 +169,7 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
when (requestCode) {
groupRequestCode -> {
val books = arrayListOf<Book>()
adapter.selectedBooks.forEach {
adapter.selectedBooks().forEach {
books.add(it.copy(group = groupId))
}
viewModel.updateBook(*books.toTypedArray())
@ -178,11 +179,18 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi
viewModel.updateBook(it.copy(group = groupId))
}
}
addToGroupRequestCode -> {
val books = arrayListOf<Book>()
adapter.selectedBooks().forEach {
books.add(it.copy(group = it.group or groupId))
}
viewModel.updateBook(*books.toTypedArray())
}
}
}
override fun upSelectCount() {
select_action_bar.upCountView(adapter.selectedBooks.size, adapter.getItems().size)
select_action_bar.upCountView(adapter.selectedBooks().size, adapter.getItems().size)
}
override fun deleteBook(book: Book) {

@ -13,7 +13,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
SimpleRecyclerAdapter<Book>(context, R.layout.item_arrange_book) {
val groupRequestCode = 12
val selectedBooks: HashSet<Book> = hashSetOf()
private val selectedBooks: HashSet<Book> = hashSetOf()
var actionItem: Book? = null
fun selectAll(selectAll: Boolean) {
@ -40,6 +40,16 @@ class ArrangeBookAdapter(context: Context, val callBack: CallBack) :
callBack.upSelectCount()
}
fun selectedBooks(): Array<Book> {
val books = arrayListOf<Book>()
selectedBooks.forEach {
if (getItems().contains(it)) {
books.add(it)
}
}
return books.toTypedArray()
}
override fun convert(holder: ItemViewHolder, item: Book, payloads: MutableList<Any>) {
with(holder.itemView) {
tv_name.text = if (item.author.isEmpty()) {

@ -8,6 +8,15 @@ import io.legado.app.data.entities.Book
class ArrangeBookViewModel(application: Application) : BaseViewModel(application) {
fun upCanUpdate(books: Array<Book>, canUpdate: Boolean) {
execute {
books.forEach {
it.canUpdate = canUpdate
}
App.db.bookDao().update(*books)
}
}
fun updateBook(vararg book: Book) {
execute {
App.db.bookDao().update(*book)

@ -86,8 +86,13 @@ class BookInfoActivity :
}
}
R.id.menu_can_update -> {
viewModel.bookData.value?.let {
it.canUpdate = !it.canUpdate
if (viewModel.inBookshelf) {
viewModel.bookData.value?.let {
it.canUpdate = !it.canUpdate
viewModel.saveBook()
}
} else {
toast(R.string.after_add_bookshelf)
}
}
}

@ -152,10 +152,6 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
PaddingConfigDialog().show(supportFragmentManager, "paddingConfig")
}
fun showTypeConfig() {
ReadTypeDialog().show(supportFragmentManager, "readTypeDialog")
}
fun showBgTextConfig() {
BgTextConfigDialog().show(supportFragmentManager, "bgTextConfig")
}

@ -1,5 +1,6 @@
package io.legado.app.ui.book.read.config
import android.annotation.SuppressLint
import android.content.DialogInterface
import android.os.Bundle
import android.util.DisplayMetrics
@ -13,6 +14,7 @@ import io.legado.app.R
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.selector
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.bottomBackground
@ -20,12 +22,10 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.book.read.Help
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.widget.font.FontSelectDialog
import io.legado.app.utils.getIndexById
import io.legado.app.utils.getPrefString
import io.legado.app.utils.postEvent
import io.legado.app.utils.putPrefString
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_book_read.*
import kotlinx.android.synthetic.main.dialog_read_book_style.*
import kotlinx.android.synthetic.main.dialog_title_config.view.*
import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
@ -33,7 +33,6 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick
class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
val callBack get() = activity as? ReadBookActivity
lateinit var titleModes: Array<String>
override fun onStart() {
super.onStart()
@ -63,7 +62,6 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
titleModes = requireContext().resources.getStringArray(R.array.title_mode)
initView()
initData()
initViewEvent()
@ -76,6 +74,14 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
private fun initView() {
root_view.setBackgroundColor(requireContext().bottomBackground)
dsb_text_size.valueFormat = {
(it + 5).toString()
}
dsb_text_letter_spacing.valueFormat = {
((it - 50) / 100f).toString()
}
dsb_line_size.valueFormat = { ((it - 10) / 10f).toString() }
dsb_paragraph_spacing.valueFormat = { (it / 10f).toString() }
}
private fun initData() {
@ -95,11 +101,7 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
postEvent(EventBus.UP_CONFIG, true)
}
tv_title_mode.onClick {
requireContext().selector("标题模式", titleModes.toList()) { _, index ->
ReadBookConfig.titleMode = index
tv_title_mode.text = titleModes[index]
postEvent(EventBus.UP_CONFIG, true)
}
showTitleConfig()
}
tv_text_bold.onClick {
ReadBookConfig.apply {
@ -124,15 +126,9 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
dismiss()
callBack?.showPaddingConfig()
}
tv_type.onClick {
dismiss()
callBack?.showTypeConfig()
}
rg_page_anim.onCheckedChange { _, checkedId ->
rg_page_anim.getIndexById(checkedId).let {
ReadBookConfig.pageAnim = it
callBack?.page_view?.upPageAnim()
}
ReadBookConfig.pageAnim = rg_page_anim.getIndexById(checkedId)
callBack?.page_view?.upPageAnim()
}
cb_share_layout.onCheckedChangeListener = { checkBox, isChecked ->
if (checkBox.isPressed) {
@ -141,19 +137,20 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
postEvent(EventBus.UP_CONFIG, true)
}
}
iv_default1.onClick {
ReadBookConfig.lineSpacingExtra = 16
ReadBookConfig.paragraphSpacing = 6
dsb_text_size.onChanged = {
ReadBookConfig.textSize = it + 5
postEvent(EventBus.UP_CONFIG, true)
}
dsb_text_letter_spacing.onChanged = {
ReadBookConfig.letterSpacing = (it - 50) / 100f
postEvent(EventBus.UP_CONFIG, true)
}
iv_default2.onClick {
ReadBookConfig.lineSpacingExtra = 13
ReadBookConfig.paragraphSpacing = 3
dsb_line_size.onChanged = {
ReadBookConfig.lineSpacingExtra = it
postEvent(EventBus.UP_CONFIG, true)
}
iv_default3.onClick {
ReadBookConfig.lineSpacingExtra = 10
ReadBookConfig.paragraphSpacing = 0
dsb_paragraph_spacing.onChanged = {
ReadBookConfig.paragraphSpacing = it
postEvent(EventBus.UP_CONFIG, true)
}
bg0.onClick { changeBg(0) }
@ -168,6 +165,36 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
bg4.onLongClick { showBgTextConfig(4) }
}
@SuppressLint("InflateParams")
private fun showTitleConfig() = ReadBookConfig.apply {
requireContext().alert(R.string.title) {
val rootView = LayoutInflater.from(requireContext())
.inflate(R.layout.dialog_title_config, null).apply {
rg_title_mode.checkByIndex(titleMode)
dsb_title_size.progress = titleSize
dsb_title_top.progress = titleTopSpacing
dsb_title_bottom.progress = titleBottomSpacing
rg_title_mode.onCheckedChange { _, checkedId ->
titleMode = rg_title_mode.getIndexById(checkedId)
postEvent(EventBus.UP_CONFIG, true)
}
dsb_title_size.onChanged = {
titleSize = it
postEvent(EventBus.UP_CONFIG, true)
}
dsb_title_top.onChanged = {
titleTopSpacing = it
postEvent(EventBus.UP_CONFIG, true)
}
dsb_title_bottom.onChanged = {
titleBottomSpacing = it
postEvent(EventBus.UP_CONFIG, true)
}
}
customView = rootView
}.show()
}
private fun changeBg(index: Int) {
if (ReadBookConfig.styleSelect != index) {
ReadBookConfig.styleSelect = index
@ -187,17 +214,20 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
private fun upStyle() {
ReadBookConfig.let {
tv_title_mode.text = titleModes.getOrElse(it.titleMode) { titleModes[0] }
tv_text_bold.isSelected = it.textBold
dsb_text_size.progress = it.textSize - 5
dsb_text_letter_spacing.progress = (it.letterSpacing * 100).toInt() + 50
dsb_line_size.progress = it.lineSpacingExtra
dsb_paragraph_spacing.progress = it.paragraphSpacing
}
}
private fun setBg() {
bg0.setTextColor(ReadBookConfig.getConfig(0).textColor())
bg1.setTextColor(ReadBookConfig.getConfig(1).textColor())
bg2.setTextColor(ReadBookConfig.getConfig(2).textColor())
bg3.setTextColor(ReadBookConfig.getConfig(3).textColor())
bg4.setTextColor(ReadBookConfig.getConfig(4).textColor())
private fun setBg() = ReadBookConfig.apply {
bg0.setTextColor(getConfig(0).textColor())
bg1.setTextColor(getConfig(1).textColor())
bg2.setTextColor(getConfig(2).textColor())
bg3.setTextColor(getConfig(3).textColor())
bg4.setTextColor(getConfig(4).textColor())
for (i in 0..4) {
val iv = when (i) {
1 -> bg1
@ -206,22 +236,22 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
4 -> bg4
else -> bg0
}
iv.setImageDrawable(ReadBookConfig.getConfig(i).bgDrawable(100, 150))
iv.setImageDrawable(getConfig(i).bgDrawable(100, 150))
}
}
private fun upBg() {
bg0.borderColor = requireContext().primaryColor
bg1.borderColor = requireContext().primaryColor
bg2.borderColor = requireContext().primaryColor
bg3.borderColor = requireContext().primaryColor
bg4.borderColor = requireContext().primaryColor
private fun upBg() = requireContext().apply {
bg0.borderColor = primaryColor
bg1.borderColor = primaryColor
bg2.borderColor = primaryColor
bg3.borderColor = primaryColor
bg4.borderColor = primaryColor
when (ReadBookConfig.styleSelect) {
1 -> bg1.borderColor = requireContext().accentColor
2 -> bg2.borderColor = requireContext().accentColor
3 -> bg3.borderColor = requireContext().accentColor
4 -> bg4.borderColor = requireContext().accentColor
else -> bg0.borderColor = requireContext().accentColor
1 -> bg1.borderColor = accentColor
2 -> bg2.borderColor = accentColor
3 -> bg3.borderColor = accentColor
4 -> bg4.borderColor = accentColor
else -> bg0.borderColor = accentColor
}
}

@ -1,91 +0,0 @@
package io.legado.app.ui.book.read.config
import android.content.DialogInterface
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.EventBus
import io.legado.app.help.ReadBookConfig
import io.legado.app.ui.book.read.Help
import io.legado.app.utils.postEvent
import kotlinx.android.synthetic.main.dialog_read_type.*
class ReadTypeDialog : BaseDialogFragment() {
override fun onStart() {
super.onStart()
val dm = DisplayMetrics()
activity?.let {
Help.upSystemUiVisibility(it)
it.windowManager?.defaultDisplay?.getMetrics(dm)
}
dialog?.window?.let {
val attr = it.attributes
attr.dimAmount = 0.0f
it.attributes = attr
it.setLayout((dm.widthPixels * 0.9).toInt(), ViewGroup.LayoutParams.WRAP_CONTENT)
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_read_type, container)
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
ReadBookConfig.save()
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
initView()
initViewEvent()
upStyle()
}
private fun initView() {
dsb_text_size.valueFormat = {
(it + 5).toString()
}
dsb_text_letter_spacing.valueFormat = {
((it - 50) / 100f).toString()
}
dsb_line_size.valueFormat = { ((it - 10) / 10f).toString() }
dsb_paragraph_spacing.valueFormat = { (it / 10f).toString() }
}
private fun initViewEvent() {
dsb_text_size.onChanged = {
ReadBookConfig.textSize = it + 5
postEvent(EventBus.UP_CONFIG, true)
}
dsb_text_letter_spacing.onChanged = {
ReadBookConfig.letterSpacing = (it - 50) / 100f
postEvent(EventBus.UP_CONFIG, true)
}
dsb_line_size.onChanged = {
ReadBookConfig.lineSpacingExtra = it
postEvent(EventBus.UP_CONFIG, true)
}
dsb_paragraph_spacing.onChanged = {
ReadBookConfig.paragraphSpacing = it
postEvent(EventBus.UP_CONFIG, true)
}
}
private fun upStyle() {
ReadBookConfig.let {
dsb_text_size.progress = it.textSize - 5
dsb_text_letter_spacing.progress = (it.letterSpacing * 100).toInt() + 50
dsb_line_size.progress = it.lineSpacingExtra
dsb_paragraph_spacing.progress = it.paragraphSpacing
}
}
}

@ -28,6 +28,8 @@ object ChapterProvider {
var visibleBottom = 0
private var lineSpacingExtra = 0
private var paragraphSpacing = 0
private var titleTopSpacing = 0
private var titleBottomSpacing = 0
var typeface: Typeface = Typeface.SANS_SERIF
var titlePaint = TextPaint()
var contentPaint = TextPaint()
@ -97,7 +99,7 @@ object ChapterProvider {
stringBuilder: StringBuilder,
isTitle: Boolean
): Float {
var durY = y
var durY = if (isTitle) y + titleTopSpacing else y
val textPaint = if (isTitle) titlePaint else contentPaint
val layout = StaticLayout(
text, textPaint, visibleWidth,
@ -142,6 +144,7 @@ object ChapterProvider {
durY += textPaint.textHeight * lineSpacingExtra / 10f
textPages.last().height = durY
}
if (isTitle) durY += titleBottomSpacing
durY += textPaint.textHeight * paragraphSpacing / 10f
return durY
}
@ -262,18 +265,19 @@ object ChapterProvider {
titlePaint.color = ReadBookConfig.durConfig.textColor()
titlePaint.letterSpacing = ReadBookConfig.letterSpacing
titlePaint.typeface = Typeface.create(typeface, Typeface.BOLD)
titlePaint.textSize = with(ReadBookConfig) { textSize + titleSize }.sp.toFloat()
//正文
contentPaint.isAntiAlias = true
contentPaint.color = ReadBookConfig.durConfig.textColor()
contentPaint.letterSpacing = ReadBookConfig.letterSpacing
val bold = if (ReadBookConfig.textBold) Typeface.BOLD else Typeface.NORMAL
contentPaint.typeface = Typeface.create(typeface, bold)
contentPaint.textSize = ReadBookConfig.textSize.sp.toFloat()
//间距
lineSpacingExtra = ReadBookConfig.lineSpacingExtra
paragraphSpacing = ReadBookConfig.paragraphSpacing
titlePaint.textSize = (ReadBookConfig.textSize + 2).sp.toFloat()
contentPaint.textSize = ReadBookConfig.textSize.sp.toFloat()
titleTopSpacing = ReadBookConfig.titleTopSpacing.dp
titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp
upSize()
}

@ -11,6 +11,7 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.flexbox.FlexboxLayoutManager
import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
@ -31,6 +32,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.startActivity
import java.text.Collator
class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_search),
@ -49,7 +51,7 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
private var bookData: LiveData<List<Book>>? = null
private var menu: Menu? = null
private var precisionSearchMenuItem: MenuItem? = null
private var groups = hashSetOf<String>()
private var groups = linkedSetOf<String>()
private var refreshTime = System.currentTimeMillis()
override fun onActivityCreated(savedInstanceState: Bundle?) {
@ -133,11 +135,10 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
ATH.applyEdgeEffectColor(rv_bookshelf_search)
ATH.applyEdgeEffectColor(rv_history_key)
bookAdapter = BookAdapter(this, this)
rv_bookshelf_search.layoutManager =
LinearLayoutManager(this, RecyclerView.HORIZONTAL, false)
rv_bookshelf_search.layoutManager = FlexboxLayoutManager(this)
rv_bookshelf_search.adapter = bookAdapter
historyKeyAdapter = HistoryKeyAdapter(this, this)
rv_history_key.layoutManager = LinearLayoutManager(this, RecyclerView.HORIZONTAL, false)
rv_history_key.layoutManager = FlexboxLayoutManager(this)
rv_history_key.adapter = historyKeyAdapter
adapter = SearchAdapter(this, this)
recycler_view.layoutManager = LinearLayoutManager(this)
@ -229,12 +230,13 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
if (selectedGroup == "") {
item?.isChecked = true
}
groups.map {
item = menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it)
if (it == selectedGroup) {
item?.isChecked = true
groups.sortedWith(Collator.getInstance(java.util.Locale.CHINESE))
.map {
item = menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it)
if (it == selectedGroup) {
item?.isChecked = true
}
}
}
menu?.setGroupCheckable(R.id.source_group, true, true)
}
@ -266,7 +268,8 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
} else {
App.db.searchKeywordDao().liveDataSearch(key)
}
historyData?.observe(this, Observer { historyKeyAdapter.setItems(it)
historyData?.observe(this, Observer {
historyKeyAdapter.setItems(it)
if (it.isEmpty()) {
tv_clear_history.invisible()
} else {

@ -40,6 +40,7 @@ import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult
import org.jetbrains.anko.toast
import java.io.File
import java.text.Collator
class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity_book_source),
PopupMenu.OnMenuItemClickListener,
@ -197,9 +198,10 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
private fun upGroupMenu() {
groupMenu?.removeGroup(R.id.source_group)
groups.map {
groupMenu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it)
}
groups.sortedWith(Collator.getInstance(java.util.Locale.CHINESE))
.map {
groupMenu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it)
}
}
@SuppressLint("InflateParams")

@ -2,7 +2,6 @@ package io.legado.app.ui.config
import android.content.SharedPreferences
import android.os.Bundle
import android.os.Handler
import android.view.View
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
@ -170,14 +169,15 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar
private fun upTheme(isNightTheme: Boolean) {
if (AppConfig.isNightTheme == isNightTheme) {
App.INSTANCE.applyTheme()
recreateActivities()
listView.post {
App.INSTANCE.applyTheme()
recreateActivities()
}
}
}
private fun recreateActivities() {
postEvent(EventBus.RECREATE, "")
Handler().postDelayed({ activity?.recreate() }, 100L)
}
}

@ -7,7 +7,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.BaseFragment
@ -75,21 +74,6 @@ class BooksFragment : BaseFragment(R.layout.fragment_books),
booksAdapter = BooksAdapterGrid(requireContext(),this)
}
rv_bookshelf.adapter = booksAdapter
booksAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
super.onItemRangeInserted(positionStart, itemCount)
if (positionStart == 0) {
rv_bookshelf.scrollToPosition(0)
}
}
override fun onItemRangeMoved(fromPosition: Int, toPosition: Int, itemCount: Int) {
super.onItemRangeMoved(fromPosition, toPosition, itemCount)
if (toPosition == 0) {
rv_bookshelf.scrollToPosition(0)
}
}
})
}
private fun upRecyclerData() {

@ -17,14 +17,15 @@ import io.legado.app.base.VMBaseFragment
import io.legado.app.data.entities.BookSource
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
import io.legado.app.ui.book.explore.ExploreShowActivity
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
import io.legado.app.utils.getViewModel
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.startActivity
import kotlinx.android.synthetic.main.fragment_find_book.*
import kotlinx.android.synthetic.main.view_search.*
import kotlinx.android.synthetic.main.view_title_bar.*
import java.text.Collator
class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_find_book),
@ -119,9 +120,10 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_find_
private fun upGroupsMenu() {
groupsMenu?.let { subMenu ->
subMenu.removeGroup(R.id.menu_group_text)
groups.forEach {
subMenu.add(R.id.menu_group_text, Menu.NONE, Menu.NONE, it)
}
groups.sortedWith(Collator.getInstance(java.util.Locale.CHINESE))
.forEach {
subMenu.add(R.id.menu_group_text, Menu.NONE, Menu.NONE, it)
}
}
}

@ -39,6 +39,8 @@ import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult
import org.jetbrains.anko.toast
import java.io.File
import java.text.Collator
import java.util.*
class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_rss_source),
@ -190,9 +192,10 @@ class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_r
private fun upGroupMenu() {
groupMenu?.removeGroup(R.id.source_group)
groups.map {
groupMenu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it)
}
groups.sortedWith(Collator.getInstance(java.util.Locale.CHINESE))
.map {
groupMenu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it)
}
}
private fun initLiveDataSource(key: String? = null) {

@ -38,7 +38,7 @@ class LabelsBar(context: Context, attrs: AttributeSet?) : LinearLayout(context,
val tv = if (unUsedViews.isEmpty()) {
AccentBgTextView(context, null).apply {
setPadding(3.dp, 0, 3.dp, 0)
setRadios(2)
setRadius(2)
val lp = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
lp.setMargins(0, 0, 2.dp, 0)
layoutParams = lp

@ -14,31 +14,31 @@ import io.legado.app.utils.getCompatColor
class AccentBgTextView(context: Context, attrs: AttributeSet?) :
AppCompatTextView(context, attrs) {
private var radios = 0
private var radius = 0
init {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.AccentBgTextView)
radios = typedArray.getDimensionPixelOffset(R.styleable.AccentBgTextView_radius, radios)
radius = typedArray.getDimensionPixelOffset(R.styleable.AccentBgTextView_radius, radius)
typedArray.recycle()
upBackground()
setTextColor(Color.WHITE)
}
fun setRadios(radio: Int) {
this.radios = radio.dp
fun setRadius(radius: Int) {
this.radius = radius.dp
upBackground()
}
private fun upBackground() {
background = if (isInEditMode) {
Selector.shapeBuild()
.setCornerRadius(radios)
.setCornerRadius(radius)
.setDefaultBgColor(context.getCompatColor(R.color.colorAccent))
.setPressedBgColor(ColorUtils.darkenColor(context.getCompatColor(R.color.colorAccent)))
.create()
} else {
Selector.shapeBuild()
.setCornerRadius(radios)
.setCornerRadius(radius)
.setDefaultBgColor(ThemeStore.accentColor(context))
.setPressedBgColor(ColorUtils.darkenColor(ThemeStore.accentColor(context)))
.create()

@ -0,0 +1,22 @@
package io.legado.app.ui.widget.text
import android.content.Context
import android.graphics.Canvas
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
class MultilineTextView(context: Context?, attrs: AttributeSet?) :
AppCompatTextView(context, attrs) {
override fun onDraw(canvas: Canvas?) {
calculateLines()
super.onDraw(canvas)
}
private fun calculateLines() {
val mHeight = measuredHeight
val lHeight = lineHeight
val lines = mHeight / lHeight
setLines(lines)
}
}

@ -12,10 +12,24 @@ import io.legado.app.utils.getCompatColor
open class StrokeTextView(context: Context, attrs: AttributeSet?) :
AppCompatTextView(context, attrs) {
private var radius = 1.dp
init {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.StrokeTextView)
radius = typedArray.getDimensionPixelOffset(R.styleable.StrokeTextView_radius, radius)
typedArray.recycle()
upBackground()
}
fun setRadius(radius: Int) {
this.radius = radius.dp
upBackground()
}
private fun upBackground() {
if (isInEditMode) {
background = Selector.shapeBuild()
.setCornerRadius(1.dp)
.setCornerRadius(radius)
.setStrokeWidth(1.dp)
.setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500))
.setDefaultStrokeColor(context.getCompatColor(R.color.tv_text_secondary))
@ -31,7 +45,7 @@ open class StrokeTextView(context: Context, attrs: AttributeSet?) :
)
} else {
background = Selector.shapeBuild()
.setCornerRadius(1.dp)
.setCornerRadius(radius)
.setStrokeWidth(1.dp)
.setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500))
.setDefaultStrokeColor(ThemeStore.textColorSecondary(context))

@ -14,6 +14,10 @@ inline fun <reified EVENT> postEvent(tag: String, event: EVENT) {
LiveEventBus.get(tag).post(event)
}
inline fun <reified EVENT> postEventDelay(tag: String, event: EVENT, delay: Long) {
LiveEventBus.get(tag).postDelay(event, delay)
}
inline fun <reified EVENT> AppCompatActivity.observeEvent(
vararg tags: String,
noinline observer: (EVENT) -> Unit

@ -1,12 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="16"
android:viewportWidth="16"
android:width="24dp">
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,2h15C15.8,2 16,2.2 16,2.5l0,0C16,2.8 15.8,3 15.5,3h-15C0.2,3 0,2.8 0,2.5l0,0C0,2.2 0.2,2 0.5,2z" />
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,13h15c0.3,0 0.5,0.2 0.5,0.5l0,0c0,0.3 -0.2,0.5 -0.5,0.5h-15C0.2,14 0,13.8 0,13.5l0,0C0,13.2 0.2,13 0.5,13z" />
</vector>

@ -1,15 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="16"
android:viewportWidth="16"
android:width="24dp">
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,2h15C15.8,2 16,2.2 16,2.5l0,0C16,2.8 15.8,3 15.5,3h-15C0.2,3 0,2.8 0,2.5l0,0C0,2.2 0.2,2 0.5,2z" />
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,7.4h15c0.3,0 0.5,0.2 0.5,0.5l0,0c0,0.3 -0.2,0.5 -0.5,0.5h-15C0.2,8.4 0,8.2 0,7.9l0,0C0,7.7 0.2,7.4 0.5,7.4z" />
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,13h15c0.3,0 0.5,0.2 0.5,0.5l0,0c0,0.3 -0.2,0.5 -0.5,0.5h-15C0.2,14 0,13.8 0,13.5l0,0C0,13.2 0.2,13 0.5,13z" />
</vector>

@ -1,18 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="16"
android:viewportWidth="16"
android:width="24dp">
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,2h15C15.8,2 16,2.2 16,2.5l0,0C16,2.8 15.8,3 15.5,3h-15C0.2,3 0,2.8 0,2.5l0,0C0,2.2 0.2,2 0.5,2z" />
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,5.7h15c0.3,0 0.5,0.2 0.5,0.5l0,0c0,0.3 -0.2,0.5 -0.5,0.5h-15C0.2,6.7 0,6.5 0,6.2l0,0C0,5.9 0.2,5.7 0.5,5.7z" />
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,9.3h15c0.3,0 0.5,0.2 0.5,0.5l0,0c0,0.3 -0.2,0.5 -0.5,0.5h-15C0.2,10.3 0,10.1 0,9.8l0,0C0,9.5 0.2,9.3 0.5,9.3z" />
<path
android:fillColor="#3C3F43"
android:pathData="M0.5,13h15c0.3,0 0.5,0.2 0.5,0.5l0,0c0,0.3 -0.2,0.5 -0.5,0.5h-15C0.2,14 0,13.8 0,13.5l0,0C0,13.2 0.2,13 0.5,13z" />
</vector>

@ -27,9 +27,10 @@
android:paddingRight="6dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:text="@string/title_center"
android:text="@string/title"
android:gravity="center"
android:textSize="14sp" />
android:textSize="14sp"
app:radius="3dp" />
<Space
android:layout_width="0dp"
@ -46,7 +47,8 @@
android:paddingBottom="4dp"
android:text="@string/text_bold"
android:gravity="center"
android:textSize="14sp" />
android:textSize="14sp"
app:radius="3dp" />
<Space
android:layout_width="0dp"
@ -63,7 +65,8 @@
android:paddingBottom="4dp"
android:text="@string/text_font"
android:gravity="center"
android:textSize="14sp" />
android:textSize="14sp"
app:radius="3dp" />
<Space
android:layout_width="0dp"
@ -80,7 +83,8 @@
android:paddingBottom="4dp"
android:text="@string/text_indent"
android:gravity="center"
android:textSize="14sp" />
android:textSize="14sp"
app:radius="3dp" />
<Space
android:layout_width="0dp"
@ -96,83 +100,8 @@
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:gravity="center"
android:textSize="14sp" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:gravity="center_vertical">
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<ImageView
android:id="@+id/iv_default1"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="?attr/selectableItemBackground"
android:tint="@color/tv_text_default"
android:padding="6dp"
android:contentDescription="@string/default1"
android:src="@drawable/ic_type_default_1" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_default2"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="?attr/selectableItemBackground"
android:tint="@color/tv_text_default"
android:padding="6dp"
android:contentDescription="@string/default2"
android:src="@drawable/ic_type_default_2" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_default3"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="?attr/selectableItemBackground"
android:tint="@color/tv_text_default"
android:padding="6dp"
android:contentDescription="@string/default3"
android:src="@drawable/ic_type_default_3" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<io.legado.app.ui.widget.text.StrokeTextView
android:id="@+id/tv_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:text="@string/compose_type"
android:gravity="center"
android:textSize="14sp" />
android:textSize="14sp"
app:radius="3dp" />
<Space
android:layout_width="0dp"
@ -189,7 +118,8 @@
android:paddingBottom="4dp"
android:text="@string/padding"
android:gravity="center"
android:textSize="14sp" />
android:textSize="14sp"
app:radius="3dp" />
<Space
android:layout_width="0dp"
@ -198,6 +128,43 @@
</LinearLayout>
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="45"
app:title="@string/text_size" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_letter_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="100"
app:title="@string/text_letter_spacing" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_line_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="20"
app:title="@string/line_size" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_paragraph_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="20"
app:title="@string/paragraph_size" />
<View
android:id="@+id/vw_bg_fg"
android:layout_width="match_parent"
@ -208,6 +175,8 @@
android:id="@+id/tv_page_anim"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:text="@string/page_anim" />

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="45"
app:title="@string/text_size" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_letter_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="100"
app:title="@string/text_letter_spacing" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_line_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="20"
app:title="@string/line_size" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_paragraph_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
app:max="20"
app:title="@string/paragraph_size" />
</LinearLayout>

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<RadioGroup
android:id="@+id/rg_title_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_title_mode1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_left" />
<RadioButton
android:id="@+id/rb_title_mode2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_center" />
<RadioButton
android:id="@+id/rb_title_mode3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_hide" />
</RadioGroup>
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="10"
app:title="字号" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="100"
app:title="上间距" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="100"
app:title="下间距" />
</LinearLayout>

@ -7,8 +7,8 @@
<io.legado.app.ui.widget.image.CoverImageView
android:id="@+id/iv_cover"
android:layout_width="70dp"
android:layout_height="100dp"
android:layout_width="80dp"
android:layout_height="110dp"
android:layout_margin="8dp"
android:contentDescription="@string/img_cover"
android:scaleType="centerCrop"
@ -35,6 +35,7 @@
android:singleLine="true"
android:text="@string/app_name"
android:textColor="@color/tv_text_default"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@id/bv_originCount"
app:layout_constraintStart_toEndOf="@+id/iv_cover"
app:layout_constraintTop_toTopOf="parent" />
@ -43,7 +44,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_marginTop="8dp"
android:layout_marginTop="3dp"
app:layout_constraintBottom_toBottomOf="@id/iv_cover"
app:layout_constraintLeft_toLeftOf="@+id/tv_name"
app:layout_constraintRight_toRightOf="@id/tv_name"
@ -75,10 +76,10 @@
android:textColor="@color/tv_text_default"
android:textSize="12sp" />
<TextView
<io.legado.app.ui.widget.text.MultilineTextView
android:id="@+id/tv_introduce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:ellipsize="end"
android:text="@string/book_intro"
android:textColor="@color/tv_text_default"

@ -16,12 +16,14 @@
android:id="@+id/tv_top_left"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_weight="1"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_top_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:textSize="12sp" />
</LinearLayout>
@ -56,12 +58,14 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true" />
android:singleLine="true"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_bottom_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:textSize="12sp" />
</LinearLayout>

@ -5,4 +5,16 @@
android:id="@+id/menu_del_selection"
android:title="@string/delete" />
<item
android:id="@+id/menu_update_enable"
android:title="@string/allow_update" />
<item
android:id="@+id/menu_update_disable"
android:title="@string/disable_update" />
<item
android:id="@+id/menu_add_to_group"
android:title="@string/add_to_group" />
</menu>

@ -22,11 +22,6 @@
android:title="@string/disable_explore"
app:showAsAction="never" />
<item
android:id="@+id/menu_del_selection"
android:title="@string/del_select"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_selection"
android:title="@string/export_selection"

@ -12,11 +12,6 @@
android:title="@string/disable_selection"
app:showAsAction="never" />
<item
android:id="@+id/menu_del_selection"
android:title="@string/del_select"
app:showAsAction="never" />
<item
android:id="@+id/menu_export_selection"
android:title="@string/export_selection"

@ -93,10 +93,4 @@
<item>系统等宽字体</item>
</string-array>
<string-array name="title_mode">
<item>标题靠左</item>
<item>标题居中</item>
<item>标题隐藏</item>
</string-array>
</resources>

@ -159,6 +159,10 @@
<attr name="radius" />
</declare-styleable>
<declare-styleable name="StrokeTextView">
<attr name="radius" />
</declare-styleable>
<declare-styleable name="BadgeView">
<attr name="radius" />
<attr name="up_flat_angle" format="boolean" />

@ -330,6 +330,7 @@
<string name="volume_key_page_on_play">朗读时音量键翻页</string>
<string name="tip_margin_change">Tip边距跟随边距调整</string>
<string name="allow_update">允许更新</string>
<string name="disable_update">禁止更新</string>
<string name="revert_selection">反选</string>
<string name="search_book_key">搜索书名、作者</string>
<string name="debug_hint">书名、作者、URL</string>
@ -620,7 +621,6 @@
<string name="select_end">文本选择结束位置</string>
<string name="select_start">文本选择开始位置</string>
<string name="share_layout">共用布局</string>
<string name="title_center">标题居中</string>
<string name="browser">浏览器</string>
<string name="import_default_rule">导入默认规则</string>
<string name="name">名称</string>
@ -634,4 +634,9 @@
<string name="default1">预设一</string>
<string name="default2">预设二</string>
<string name="default3">预设三</string>
<string name="title">标题</string>
<string name="title_left">靠左</string>
<string name="title_center">居中</string>
<string name="title_hide">隐藏</string>
<string name="add_to_group">加入分组</string>
</resources>

Loading…
Cancel
Save