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