Skip to content

Commit

Permalink
Fix crash and incorrect visualization in the manga reader
Browse files Browse the repository at this point in the history
  • Loading branch information
rubengees committed May 3, 2019
1 parent bac0ccb commit 98ffb71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/kotlin/me/proxer/app/manga/MangaAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import com.bumptech.glide.request.target.ImageViewTarget
import com.bumptech.glide.request.transition.Transition
import com.davemorrissey.labs.subscaleview.ImageSource
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.PAN_LIMIT_INSIDE
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.ZOOM_FOCUS_CENTER
import com.davemorrissey.labs.subscaleview.decoder.SkiaImageDecoder
import com.davemorrissey.labs.subscaleview.decoder.SkiaPooledImageRegionDecoder
import com.gojuno.koptional.rxjava2.filterSome
Expand Down Expand Up @@ -236,12 +238,11 @@ class MangaAdapter(savedInstanceState: Bundle?, var isVertical: Boolean) : BaseA
private val shortAnimationTime = itemView.context.resources.getInteger(android.R.integer.config_shortAnimTime)

init {
image.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER)
image.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_START)
image.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE)
image.setDoubleTapZoomDuration(shortAnimationTime)
image.setExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
image.setDoubleTapZoomStyle(ZOOM_FOCUS_CENTER)
image.setMaxTileSize(GLUtil.maxTextureSize)
image.setPanLimit(PAN_LIMIT_INSIDE)
image.setMinimumTileDpi(180)
image.setMinimumDpi(90)

Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/me/proxer/app/manga/MangaFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ class MangaFragment : BaseContentFragment<MangaChapterInfo>(R.layout.fragment_ma
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)

innerAdapter.saveInstanceState(outState)

outState.putParcelable(LAST_POSITION_STATE, recyclerView.safeLayoutManager.onSaveInstanceState())
outState.putByte(LOW_MEMORY_STATE, if (hasLowMemory) 1 else 0)
}
Expand Down

0 comments on commit 98ffb71

Please sign in to comment.