Merge branch 'fix-12' into master

# Conflicts:
#	.github/ISSUE_TEMPLATE.md
#	.github/ISSUE_TEMPLATE/report_issue.yml
#	.github/ISSUE_TEMPLATE/request_feature.yml
This commit is contained in:
arkon 2021-08-06 17:33:24 -04:00
commit 2f94f62a56
10 changed files with 23 additions and 67 deletions

View File

@ -3,7 +3,7 @@
I acknowledge that: I acknowledge that:
- I have updated: - I have updated:
- To the latest version of the app (stable is v0.12.0) - To the latest version of the app (stable is v0.12.1)
- All extensions - All extensions
- I have tried the troubleshooting guide: https://tachiyomi.org/help/guides/troubleshooting-problems/ - I have tried the troubleshooting guide: https://tachiyomi.org/help/guides/troubleshooting-problems/
- If this is an issue with an extension, that I should be opening an issue in https://github.com/tachiyomiorg/tachiyomi-extensions - If this is an issue with an extension, that I should be opening an issue in https://github.com/tachiyomiorg/tachiyomi-extensions

View File

@ -15,7 +15,7 @@ body:
required: true required: true
- label: If this is an issue with an extension, I should be opening an issue in the [extensions repository](https://github.com/tachiyomiorg/tachiyomi-extensions/issues/new/choose). - label: If this is an issue with an extension, I should be opening an issue in the [extensions repository](https://github.com/tachiyomiorg/tachiyomi-extensions/issues/new/choose).
required: true required: true
- label: I have updated the app to version **[0.12.0](https://github.com/tachiyomiorg/tachiyomi/releases/tag/v0.12.0)**. - label: I have updated the app to version **[0.12.1](https://github.com/tachiyomiorg/tachiyomi/releases/latest)**.
required: true required: true
- label: I will fill out all of the requested information in this form. - label: I will fill out all of the requested information in this form.
required: true required: true

View File

@ -29,8 +29,8 @@ android {
minSdk = AndroidConfig.minSdk minSdk = AndroidConfig.minSdk
targetSdk = AndroidConfig.targetSdk targetSdk = AndroidConfig.targetSdk
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
versionCode = 66 versionCode = 67
versionName = "0.12.0" versionName = "0.12.1"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"") buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")

View File

@ -16,7 +16,6 @@ import android.graphics.Paint
import android.graphics.PorterDuff import android.graphics.PorterDuff
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.Gravity
import android.view.KeyEvent import android.view.KeyEvent
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
@ -25,7 +24,6 @@ import android.view.View.LAYER_TYPE_HARDWARE
import android.view.WindowManager import android.view.WindowManager
import android.view.animation.Animation import android.view.animation.Animation
import android.view.animation.AnimationUtils import android.view.animation.AnimationUtils
import android.widget.FrameLayout
import android.widget.SeekBar import android.widget.SeekBar
import android.widget.Toast import android.widget.Toast
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
@ -34,7 +32,6 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat import androidx.core.view.WindowInsetsControllerCompat
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
import com.google.android.material.shape.MaterialShapeDrawable import com.google.android.material.shape.MaterialShapeDrawable
@ -62,11 +59,9 @@ import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsSheet import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsSheet
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.GLUtil import eu.kanade.tachiyomi.util.system.GLUtil
import eu.kanade.tachiyomi.util.system.createReaderThemeContext
import eu.kanade.tachiyomi.util.system.hasDisplayCutout import eu.kanade.tachiyomi.util.system.hasDisplayCutout
import eu.kanade.tachiyomi.util.system.isNightMode import eu.kanade.tachiyomi.util.system.isNightMode
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
@ -142,8 +137,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
private val windowInsetsController by lazy { WindowInsetsControllerCompat(window, binding.root) } private val windowInsetsController by lazy { WindowInsetsControllerCompat(window, binding.root) }
private var loadingIndicator: ReaderProgressIndicator? = null
var isScrollingThroughPages = false var isScrollingThroughPages = false
private set private set
@ -607,13 +600,8 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
binding.rightChapter.setTooltip(R.string.action_next_chapter) binding.rightChapter.setTooltip(R.string.action_next_chapter)
} }
val loadingIndicatorContext = createReaderThemeContext(preferences.readerTheme().get()) binding.pleaseWait.isVisible = true
loadingIndicator = ReaderProgressIndicator(loadingIndicatorContext).apply { binding.pleaseWait.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in_long))
updateLayoutParams<FrameLayout.LayoutParams> {
gravity = Gravity.CENTER
}
}
binding.readerContainer.addView(loadingIndicator)
} }
private fun showReadingModeToast(mode: Int) { private fun showReadingModeToast(mode: Int) {
@ -632,7 +620,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
* hides or disables the reader prev/next buttons if there's a prev or next chapter * hides or disables the reader prev/next buttons if there's a prev or next chapter
*/ */
fun setChapters(viewerChapters: ViewerChapters) { fun setChapters(viewerChapters: ViewerChapters) {
binding.readerContainer.removeView(loadingIndicator) binding.pleaseWait.isVisible = false
viewer?.setChapters(viewerChapters) viewer?.setChapters(viewerChapters)
binding.toolbar.subtitle = viewerChapters.currChapter.chapter.name binding.toolbar.subtitle = viewerChapters.currChapter.chapter.name

View File

@ -23,9 +23,6 @@ class PagerConfig(
preferences: PreferencesHelper = Injekt.get() preferences: PreferencesHelper = Injekt.get()
) : ViewerConfig(preferences, scope) { ) : ViewerConfig(preferences, scope) {
var theme = preferences.readerTheme().get()
private set
var automaticBackground = false var automaticBackground = false
private set private set
@ -42,13 +39,7 @@ class PagerConfig(
init { init {
preferences.readerTheme() preferences.readerTheme()
.register( .register({ automaticBackground = it == 3 }, { imagePropertyChangedListener?.invoke() })
{
theme = it
automaticBackground = it == 3
},
{ imagePropertyChangedListener?.invoke() }
)
preferences.imageScaleType() preferences.imageScaleType()
.register({ imageScaleType = it }, { imagePropertyChangedListener?.invoke() }) .register({ imageScaleType = it }, { imagePropertyChangedListener?.invoke() })

View File

@ -30,7 +30,6 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig.ZoomType import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig.ZoomType
import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.system.ImageUtil import eu.kanade.tachiyomi.util.system.ImageUtil
import eu.kanade.tachiyomi.util.system.createReaderThemeContext
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.widget.ViewPagerAdapter import eu.kanade.tachiyomi.widget.ViewPagerAdapter
import rx.Observable import rx.Observable
@ -59,7 +58,11 @@ class PagerPageHolder(
/** /**
* Loading progress bar to indicate the current progress. * Loading progress bar to indicate the current progress.
*/ */
private val progressIndicator: ReaderProgressIndicator private val progressIndicator = ReaderProgressIndicator(context).apply {
updateLayoutParams<LayoutParams> {
gravity = Gravity.CENTER
}
}
/** /**
* Image view that supports subsampling on zoom. * Image view that supports subsampling on zoom.
@ -115,12 +118,6 @@ class PagerPageHolder(
} }
init { init {
val indicatorContext = context.createReaderThemeContext(viewer.config.theme)
progressIndicator = ReaderProgressIndicator(indicatorContext).apply {
updateLayoutParams<LayoutParams> {
gravity = Gravity.CENTER
}
}
addView(progressIndicator) addView(progressIndicator)
observeStatus() observeStatus()
viewer.activity.addOnMenuVisibilityListener(visibilityListener) viewer.activity.addOnMenuVisibilityListener(visibilityListener)

View File

@ -28,9 +28,6 @@ class WebtoonConfig(
var sidePadding = 0 var sidePadding = 0
private set private set
var theme = preferences.readerTheme().get()
private set
init { init {
preferences.cropBordersWebtoon() preferences.cropBordersWebtoon()
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() }) .register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
@ -53,9 +50,6 @@ class WebtoonConfig(
preferences.dualPageInvertWebtoon() preferences.dualPageInvertWebtoon()
.register({ dualPageInvert = it }, { imagePropertyChangedListener?.invoke() }) .register({ dualPageInvert = it }, { imagePropertyChangedListener?.invoke() })
preferences.readerTheme()
.register({ theme = it }, { imagePropertyChangedListener?.invoke() })
} }
override var navigator: ViewerNavigation = defaultNavigation() override var navigator: ViewerNavigation = defaultNavigation()

View File

@ -27,7 +27,6 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator
import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.system.ImageUtil import eu.kanade.tachiyomi.util.system.ImageUtil
import eu.kanade.tachiyomi.util.system.createReaderThemeContext
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import rx.Observable import rx.Observable
import rx.Subscription import rx.Subscription
@ -346,8 +345,7 @@ class WebtoonPageHolder(
progressContainer = FrameLayout(context) progressContainer = FrameLayout(context)
frame.addView(progressContainer, MATCH_PARENT, parentHeight) frame.addView(progressContainer, MATCH_PARENT, parentHeight)
val indicatorContext = context.createReaderThemeContext(viewer.config.theme) val progress = ReaderProgressIndicator(context).apply {
val progress = ReaderProgressIndicator(indicatorContext).apply {
updateLayoutParams<FrameLayout.LayoutParams> { updateLayoutParams<FrameLayout.LayoutParams> {
gravity = Gravity.CENTER_HORIZONTAL gravity = Gravity.CENTER_HORIZONTAL
updateMargins(top = parentHeight / 4) updateMargins(top = parentHeight / 4)

View File

@ -284,24 +284,3 @@ fun Context.isTablet(): Boolean {
fun Context.isNightMode(): Boolean { fun Context.isNightMode(): Boolean {
return resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES return resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
} }
/**
* Creates night mode Context depending on reader theme/background
*/
fun Context.createReaderThemeContext(readerThemeSelected: Int): Context {
val isDarkBackground = when (readerThemeSelected) {
1, 2 -> true // Black, Gray
3 -> isNightMode() // Automatic bg uses activity background by default
else -> false // White
}
val expected = if (isDarkBackground) Configuration.UI_MODE_NIGHT_YES else Configuration.UI_MODE_NIGHT_NO
if (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK != expected) {
val overrideConfig = Configuration(resources.configuration).apply {
uiMode = (uiMode and Configuration.UI_MODE_NIGHT_MASK.inv()) or expected
}
return createConfigurationContext(overrideConfig).also {
it.theme.setTo(theme)
}
}
return this
}

View File

@ -15,6 +15,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/please_wait"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
android:visibility="gone"
tools:visibility="visible" />
<eu.kanade.tachiyomi.ui.reader.PageIndicatorTextView <eu.kanade.tachiyomi.ui.reader.PageIndicatorTextView
android:id="@+id/page_number" android:id="@+id/page_number"
style="@style/TextAppearance.Regular.Caption" style="@style/TextAppearance.Regular.Caption"