Fix reader crash on Android 9 (#5789)

* Fix failed reader context creation on v28

* Re-apply the reader styles manually after overriding night mode

This commit replaces the ThemeCompat.rebase() call since the private API used is
in dark greylist max target P, thus making it unreachable.

* Revert "Fix failed reader context creation on v28"

This reverts commit 6e2104d7
This commit is contained in:
Ivan Iskandar
2021-08-26 04:27:34 +07:00
committed by GitHub
parent 5f5fc77877
commit b3854ad382
4 changed files with 15 additions and 12 deletions

View File

@@ -610,7 +610,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
binding.rightChapter.setTooltip(R.string.action_next_chapter)
}
val loadingIndicatorContext = createReaderThemeContext(preferences.readerTheme().get())
val loadingIndicatorContext = createReaderThemeContext()
loadingIndicator = ReaderProgressIndicator(loadingIndicatorContext).apply {
updateLayoutParams<FrameLayout.LayoutParams> {
gravity = Gravity.CENTER

View File

@@ -37,7 +37,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
* Context that has been wrapped to use the correct theme values based on the
* current app theme and reader background color
*/
private var readerThemedContext = viewer.activity.createReaderThemeContext(viewer.config.theme)
private var readerThemedContext = viewer.activity.createReaderThemeContext()
/**
* Updates this adapter with the given [chapters]. It handles setting a few pages of the
@@ -197,6 +197,6 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
}
fun refresh() {
readerThemedContext = viewer.activity.createReaderThemeContext(viewer.config.theme)
readerThemedContext = viewer.activity.createReaderThemeContext()
}
}

View File

@@ -29,7 +29,7 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter<RecyclerV
* Context that has been wrapped to use the correct theme values based on the
* current app theme and reader background color
*/
private var readerThemedContext = viewer.activity.createReaderThemeContext(viewer.config.theme)
private var readerThemedContext = viewer.activity.createReaderThemeContext()
/**
* Updates this adapter with the given [chapters]. It handles setting a few pages of the
@@ -85,7 +85,7 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter<RecyclerV
}
fun refresh() {
readerThemedContext = viewer.activity.createReaderThemeContext(viewer.config.theme)
readerThemedContext = viewer.activity.createReaderThemeContext()
}
/**