Do not retry loading pages
GIF support in non-vertical pagers Fix cache being double-opened
This commit is contained in:
parent
2fd4204db8
commit
840e571917
@ -40,8 +40,8 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
versionCode 7402
|
versionCode 7404
|
||||||
versionName "v7.4.2-EH"
|
versionName "v7.4.4-EH"
|
||||||
|
|
||||||
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
||||||
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
|
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
|
||||||
|
@ -52,7 +52,7 @@ class ChapterCache(private val context: Context) {
|
|||||||
// --> EH
|
// --> EH
|
||||||
private var diskCache = setupDiskCache(prefs.eh_cacheSize().getOrDefault().toLong())
|
private var diskCache = setupDiskCache(prefs.eh_cacheSize().getOrDefault().toLong())
|
||||||
init {
|
init {
|
||||||
prefs.eh_cacheSize().asObservable().subscribe {
|
prefs.eh_cacheSize().asObservable().skip(1).subscribe {
|
||||||
// Save old cache for destruction later
|
// Save old cache for destruction later
|
||||||
val oldCache = diskCache
|
val oldCache = diskCache
|
||||||
diskCache = setupDiskCache(it.toLong())
|
diskCache = setupDiskCache(it.toLong())
|
||||||
|
@ -246,5 +246,5 @@ class PreferencesHelper(val context: Context) {
|
|||||||
|
|
||||||
fun eh_utilAutoscrollInterval() = rxPrefs.getFloat(Keys.eh_utilAutoscrollInterval, 3f)
|
fun eh_utilAutoscrollInterval() = rxPrefs.getFloat(Keys.eh_utilAutoscrollInterval, 3f)
|
||||||
|
|
||||||
fun eh_cacheSize() = rxPrefs.getString(Keys.eh_utilAutoscrollInterval, "75")
|
fun eh_cacheSize() = rxPrefs.getString(Keys.eh_cacheSize, "75")
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,9 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
|||||||
var shouldQueuePage = false
|
var shouldQueuePage = false
|
||||||
if(page.status == Page.ERROR) {
|
if(page.status == Page.ERROR) {
|
||||||
shouldQueuePage = true
|
shouldQueuePage = true
|
||||||
|
} else if(page.status == Page.LOAD_PAGE
|
||||||
|
|| page.status == Page.DOWNLOAD_IMAGE) {
|
||||||
|
// Do nothing
|
||||||
} else if (page.uri == null) {
|
} else if (page.uri == null) {
|
||||||
shouldQueuePage = true
|
shouldQueuePage = true
|
||||||
} else if (!UniFile.fromUri(this, page.uri).exists()) {
|
} else if (!UniFile.fromUri(this, page.uri).exists()) {
|
||||||
|
@ -15,13 +15,16 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|||||||
import eu.kanade.tachiyomi.ui.reader.viewer.base.PageDecodeErrorLayout
|
import eu.kanade.tachiyomi.ui.reader.viewer.base.PageDecodeErrorLayout
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.horizontal.RightToLeftReader
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.horizontal.RightToLeftReader
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.vertical.VerticalReader
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.vertical.VerticalReader
|
||||||
|
import eu.kanade.tachiyomi.util.gone
|
||||||
import eu.kanade.tachiyomi.util.inflate
|
import eu.kanade.tachiyomi.util.inflate
|
||||||
|
import eu.kanade.tachiyomi.util.visible
|
||||||
import kotlinx.android.synthetic.main.reader_pager_item.view.*
|
import kotlinx.android.synthetic.main.reader_pager_item.view.*
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
import rx.subjects.PublishSubject
|
import rx.subjects.PublishSubject
|
||||||
import rx.subjects.SerializedSubject
|
import rx.subjects.SerializedSubject
|
||||||
|
import java.net.URLConnection
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
|
class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
|
||||||
@ -59,6 +62,19 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
rotation = -180f
|
rotation = -180f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --> EH
|
||||||
|
with(gif_view) {
|
||||||
|
setOnTouchListener { _, motionEvent -> reader.gestureDetector.onTouchEvent(motionEvent) }
|
||||||
|
setOnLongClickListener { reader.onLongClick(page) }
|
||||||
|
settings.loadWithOverviewMode = true
|
||||||
|
settings.useWideViewPort = true
|
||||||
|
settings.builtInZoomControls = true
|
||||||
|
settings.displayZoomControls = false
|
||||||
|
settings.setSupportZoom(true)
|
||||||
|
gone()
|
||||||
|
}
|
||||||
|
// <-- EH
|
||||||
|
|
||||||
with(image_view) {
|
with(image_view) {
|
||||||
setMaxTileSize((reader.activity as ReaderActivity).maxBitmapSize)
|
setMaxTileSize((reader.activity as ReaderActivity).maxBitmapSize)
|
||||||
setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED)
|
setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED)
|
||||||
@ -82,6 +98,9 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
onImageDecodeError(reader)
|
onImageDecodeError(reader)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// --> EH
|
||||||
|
visible()
|
||||||
|
// <-- EH
|
||||||
}
|
}
|
||||||
|
|
||||||
retry_button.setOnTouchListener { _, event ->
|
retry_button.setOnTouchListener { _, event ->
|
||||||
@ -100,6 +119,9 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
unsubscribeStatus()
|
unsubscribeStatus()
|
||||||
image_view.setOnTouchListener(null)
|
image_view.setOnTouchListener(null)
|
||||||
image_view.setOnImageEventListener(null)
|
image_view.setOnImageEventListener(null)
|
||||||
|
// --> EH
|
||||||
|
gif_view.setOnTouchListener(null)
|
||||||
|
// <-- EH
|
||||||
super.onDetachedFromWindow()
|
super.onDetachedFromWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,6 +209,9 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
progress_container.visibility = View.VISIBLE
|
progress_container.visibility = View.VISIBLE
|
||||||
progress_text.visibility = View.INVISIBLE
|
progress_text.visibility = View.INVISIBLE
|
||||||
retry_button.visibility = View.GONE
|
retry_button.visibility = View.GONE
|
||||||
|
// --> EH
|
||||||
|
gif_view.gone()
|
||||||
|
// <-- EH
|
||||||
decodeErrorLayout?.let {
|
decodeErrorLayout?.let {
|
||||||
removeView(it)
|
removeView(it)
|
||||||
decodeErrorLayout = null
|
decodeErrorLayout = null
|
||||||
@ -200,6 +225,9 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
progress_container.visibility = View.VISIBLE
|
progress_container.visibility = View.VISIBLE
|
||||||
progress_text.visibility = View.VISIBLE
|
progress_text.visibility = View.VISIBLE
|
||||||
progress_text.setText(R.string.downloading)
|
progress_text.setText(R.string.downloading)
|
||||||
|
// --> EH
|
||||||
|
gif_view.gone()
|
||||||
|
// <-- EH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,6 +236,9 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
private fun setDownloading() {
|
private fun setDownloading() {
|
||||||
progress_container.visibility = View.VISIBLE
|
progress_container.visibility = View.VISIBLE
|
||||||
progress_text.visibility = View.VISIBLE
|
progress_text.visibility = View.VISIBLE
|
||||||
|
// --> EH
|
||||||
|
gif_view.gone()
|
||||||
|
// <-- EH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,8 +257,26 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --> EH
|
||||||
|
val guessedType = file.openInputStream().buffered().use {
|
||||||
|
URLConnection.guessContentTypeFromStream(it)
|
||||||
|
}
|
||||||
|
// <-- EH
|
||||||
|
|
||||||
progress_text.visibility = View.INVISIBLE
|
progress_text.visibility = View.INVISIBLE
|
||||||
image_view.setImage(ImageSource.uri(file.uri))
|
// --> EH
|
||||||
|
if(guessedType == "image/gif") {
|
||||||
|
gif_view.loadUrl(uri.toString())
|
||||||
|
gif_view.visible()
|
||||||
|
progress_container.gone()
|
||||||
|
image_view.gone()
|
||||||
|
} else {
|
||||||
|
// <-- EH
|
||||||
|
image_view.setImage(ImageSource.uri(file.uri))
|
||||||
|
// --> EH
|
||||||
|
gif_view.gone()
|
||||||
|
}
|
||||||
|
// <-- EH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -236,6 +285,9 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
private fun setError() {
|
private fun setError() {
|
||||||
progress_container.visibility = View.GONE
|
progress_container.visibility = View.GONE
|
||||||
retry_button.visibility = View.VISIBLE
|
retry_button.visibility = View.VISIBLE
|
||||||
|
// --> EH
|
||||||
|
gif_view.gone()
|
||||||
|
// <-- EH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,6 +34,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/gif_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user