添加显示未读开关

pull/981/head 3.21.051220
gedoor 4 years ago
parent 0917221b83
commit 5b7903fb90
  1. 1
      app/src/main/assets/updateLog.md
  2. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  3. 6
      app/src/main/java/io/legado/app/help/AppConfig.kt
  4. 6
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt
  5. 9
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt
  6. 9
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt
  7. 10
      app/src/main/res/layout/dialog_bookshelf_config.xml
  8. 1
      app/src/main/res/values-zh-rHK/strings.xml
  9. 1
      app/src/main/res/values-zh-rTW/strings.xml
  10. 1
      app/src/main/res/values-zh/strings.xml
  11. 1
      app/src/main/res/values/strings.xml

@ -5,6 +5,7 @@
**2021/05/12**
* 修复预下载bug
* 添加显示未读开关,书架布局中
**2021/05/11**
* 修复部分webDav bug

@ -4,6 +4,7 @@ object PreferKey {
const val language = "language"
const val themeMode = "themeMode"
const val userAgent = "userAgent"
const val showUnread = "showUnread"
const val hideStatusBar = "hideStatusBar"
const val clickActionTL = "clickActionTopLeft"
const val clickActionTC = "clickActionTopCenter"

@ -72,6 +72,12 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
}
}
var showUnread: Boolean
get() = appCtx.getPrefBoolean(PreferKey.showUnread, true)
set(value) {
appCtx.putPrefBoolean(PreferKey.showUnread, value)
}
val isTransparentStatusBar: Boolean
get() = appCtx.getPrefBoolean(PreferKey.transparentStatusBar, true)

@ -22,6 +22,7 @@ import io.legado.app.data.entities.BookGroup
import io.legado.app.databinding.DialogBookshelfConfigBinding
import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.databinding.FragmentBookshelfBinding
import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
@ -170,6 +171,7 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
.apply {
rgLayout.checkByIndex(bookshelfLayout)
rgSort.checkByIndex(bookshelfSort)
swShowUnread.isChecked = AppConfig.showUnread
}
customView { alertBinding.root }
okButton {
@ -183,6 +185,10 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
putPrefInt(PreferKey.bookshelfSort, rgSort.getCheckedIndex())
changed = true
}
if (AppConfig.showUnread != swShowUnread.isChecked) {
AppConfig.showUnread = swShowUnread.isChecked
changed = true
}
if (changed) {
activity?.recreate()
}

@ -7,6 +7,7 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.constant.BookType
import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemBookshelfGridBinding
import io.legado.app.help.AppConfig
import io.legado.app.utils.invisible
import splitties.views.onLongClick
@ -45,8 +46,12 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
binding.rlLoading.show()
} else {
binding.rlLoading.hide()
binding.bvUnread.setBadgeCount(item.getUnreadChapterNum())
binding.bvUnread.setHighlight(item.lastCheckCount > 0)
if (AppConfig.showUnread) {
binding.bvUnread.setBadgeCount(item.getUnreadChapterNum())
binding.bvUnread.setHighlight(item.lastCheckCount > 0)
} else {
binding.bvUnread.invisible()
}
}
}

@ -7,6 +7,7 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.constant.BookType
import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemBookshelfListBinding
import io.legado.app.help.AppConfig
import io.legado.app.utils.invisible
import splitties.views.onLongClick
@ -51,8 +52,12 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
binding.rlLoading.show()
} else {
binding.rlLoading.hide()
binding.bvUnread.setHighlight(item.lastCheckCount > 0)
binding.bvUnread.setBadgeCount(item.getUnreadChapterNum())
if (AppConfig.showUnread) {
binding.bvUnread.setHighlight(item.lastCheckCount > 0)
binding.bvUnread.setBadgeCount(item.getUnreadChapterNum())
} else {
binding.bvUnread.invisible()
}
}
}

@ -101,5 +101,15 @@
</LinearLayout>
<io.legado.app.lib.theme.view.ATESwitch
android:id="@+id/sw_show_unread"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/show_unread"
app:layout_constraintTop_toBottomOf="@+id/ll_layout"
app:layout_constraintLeft_toLeftOf="@+id/ll_layout"
app:layout_constraintRight_toRightOf="@id/ll_layout" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -824,5 +824,6 @@
<string name="high_brush_summary">使用屏幕最高刷新率</string>
<string name="export_all">导出所有</string>
<string name="complete">完成</string>
<string name="show_unread">显示未读标志</string>
</resources>

@ -828,5 +828,6 @@
<string name="high_brush_summary">使用螢幕最高刷新率</string>
<string name="export_all">导出所有</string>
<string name="complete">完成</string>
<string name="show_unread">显示未读标志</string>
</resources>

@ -828,5 +828,6 @@
<string name="high_brush_summary">使用屏幕最高刷新率</string>
<string name="export_all">导出所有</string>
<string name="complete">完成</string>
<string name="show_unread">显示未读标志</string>
</resources>

@ -829,5 +829,6 @@
<string name="high_brush_summary">使用屏幕最高刷新率</string>
<string name="export_all">export_all</string>
<string name="complete">complete</string>
<string name="show_unread">Show unread</string>
</resources>

Loading…
Cancel
Save