Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from gedoor:master #196

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/src/main/java/io/legado/app/model/ReadBook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ object ReadBook : CoroutineScope by MainScope() {
appDb.bookSourceDao.getBookSource(book.origin)?.let {
bookSource = it
if (book.getImageStyle().isNullOrBlank()) {
book.setImageStyle(it.getContentRule().imageStyle)
val imageStyle = it.getContentRule().imageStyle
book.setImageStyle(imageStyle)
if (imageStyle.equals(Book.imgStyleSingle, true)) {
book.setPageAnim(0)
}
}
} ?: let {
bookSource = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ class AudioPlayService : BaseService(),
.setSmallIcon(R.drawable.ic_volume_up)
.setSubText(getString(R.string.audio))
.setOngoing(true)
.setOnlyAlertOnce(true)
.setContentTitle(nTitle)
.setContentText(nSubtitle)
.setContentIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ abstract class BaseReadAloudService : BaseService(),
.setSmallIcon(R.drawable.ic_volume_up)
.setSubText(getString(R.string.read_aloud))
.setOngoing(true)
.setOnlyAlertOnce(true)
.setContentTitle(nTitle)
.setContentText(nSubtitle)
.setContentIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CacheBookService : BaseService() {
val builder = NotificationCompat.Builder(this, AppConst.channelIdDownload)
.setSmallIcon(R.drawable.ic_download)
.setOngoing(true)
.setOnlyAlertOnce(true)
.setContentTitle(getString(R.string.offline_cache))
.setContentIntent(activityPendingIntent<CacheActivity>("cacheActivity"))
builder.addAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class CheckSourceService : BaseService() {
NotificationCompat.Builder(this, AppConst.channelIdReadAloud)
.setSmallIcon(R.drawable.ic_network_check)
.setOngoing(true)
.setOnlyAlertOnce(true)
.setContentTitle(getString(R.string.check_book_source))
.setContentIntent(
activityPendingIntent<BookSourceActivity>("activity")
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/io/legado/app/service/DownloadService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ class DownloadService : BaseService() {
.setSmallIcon(R.drawable.ic_download)
.setSubText(getString(R.string.action_download))
.setContentTitle(content)
.setOnlyAlertOnce(true)
.setContentIntent(
servicePendingIntent<DownloadService>(IntentAction.play, downloadId.toInt()) {
putExtra("downloadId", downloadId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class ExportBookService : BaseService() {
.setContentText(notificationContentText)
.setDeleteIntent(servicePendingIntent<ExportBookService>(IntentAction.stop))
.setGroup(groupKey)
.setOnlyAlertOnce(true)
if (!finish) {
notification.setOngoing(true)
notification.addAction(
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,20 @@ class ReadBookActivity : BaseReadBookActivity(),
R.id.menu_set_charset -> showCharsetConfig()
R.id.menu_image_style -> {
val imgStyles =
arrayListOf(Book.imgStyleDefault, Book.imgStyleFull, Book.imgStyleText, Book.imgStyleSingle)
arrayListOf(
Book.imgStyleDefault, Book.imgStyleFull, Book.imgStyleText,
Book.imgStyleSingle
)
selector(
R.string.image_style,
imgStyles
) { _, index ->
ReadBook.book?.setImageStyle(imgStyles[index])
val imageStyle = imgStyles[index]
ReadBook.book?.setImageStyle(imageStyle)
if (imageStyle == Book.imgStyleSingle) {
ReadBook.book?.setPageAnim(0) // 切换图片样式single后,自动切换为覆盖
binding.readView.upPageAnim()
}
ReadBook.loadContent(false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ReadStyleDialog : BaseDialogFragment(R.layout.dialog_read_book_style),
TipConfigDialog().show(childFragmentManager, "tipConfigDialog")
}
rgPageAnim.setOnCheckedChangeListener { _, checkedId ->
ReadBook.book?.setPageAnim(null)
ReadBook.book?.setPageAnim(-1)
ReadBookConfig.pageAnim = binding.rgPageAnim.getIndexById(checkedId)
callBack?.upPageAnim()
ReadBook.loadContent(false)
Expand Down Expand Up @@ -202,7 +202,7 @@ class ReadStyleDialog : BaseDialogFragment(R.layout.dialog_read_book_style),
get() = ReadBookConfig.textFont

override fun selectFont(path: String) {
if (path != ReadBookConfig.textFont) {
if (path != ReadBookConfig.textFont || path.isEmpty()) {
ReadBookConfig.textFont = path
postEvent(EventBus.UP_CONFIG, arrayListOf(2, 5))
}
Expand Down
Loading