|  | @@ -1,6 +1,5 @@
 | 
	
		
			
				|  |  |  package eu.kanade.tachiyomi.ui.reader.viewer.webtoon
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import android.support.v7.widget.RecyclerView
 | 
	
		
			
				|  |  |  import android.view.MotionEvent
 | 
	
		
			
				|  |  |  import android.view.View
 | 
	
		
			
				|  |  |  import android.view.ViewGroup
 | 
	
	
		
			
				|  | @@ -11,10 +10,11 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
 | 
	
		
			
				|  |  |  import com.hippo.unifile.UniFile
 | 
	
		
			
				|  |  |  import eu.kanade.tachiyomi.R
 | 
	
		
			
				|  |  |  import eu.kanade.tachiyomi.source.model.Page
 | 
	
		
			
				|  |  | +import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder
 | 
	
		
			
				|  |  |  import eu.kanade.tachiyomi.ui.reader.ReaderActivity
 | 
	
		
			
				|  |  |  import eu.kanade.tachiyomi.ui.reader.viewer.base.PageDecodeErrorLayout
 | 
	
		
			
				|  |  |  import eu.kanade.tachiyomi.util.inflate
 | 
	
		
			
				|  |  | -import kotlinx.android.synthetic.main.reader_webtoon_item.view.*
 | 
	
		
			
				|  |  | +import kotlinx.android.synthetic.main.reader_webtoon_item.*
 | 
	
		
			
				|  |  |  import rx.Observable
 | 
	
		
			
				|  |  |  import rx.Subscription
 | 
	
		
			
				|  |  |  import rx.android.schedulers.AndroidSchedulers
 | 
	
	
		
			
				|  | @@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit
 | 
	
		
			
				|  |  |   * @constructor creates a new webtoon holder.
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter) :
 | 
	
		
			
				|  |  | -        RecyclerView.ViewHolder(view) {
 | 
	
		
			
				|  |  | +        BaseViewHolder(view) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * Page of a chapter.
 | 
	
	
		
			
				|  | @@ -54,7 +54,7 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
 | 
	
		
			
				|  |  |      private var decodeErrorLayout: View? = null
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      init {
 | 
	
		
			
				|  |  | -        with(view.image_view) {
 | 
	
		
			
				|  |  | +        with(image_view) {
 | 
	
		
			
				|  |  |              setMaxTileSize(readerActivity.maxBitmapSize)
 | 
	
		
			
				|  |  |              setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED)
 | 
	
		
			
				|  |  |              setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE)
 | 
	
	
		
			
				|  | @@ -78,11 +78,11 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
 | 
	
		
			
				|  |  |              })
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        view.progress_container.layoutParams = FrameLayout.LayoutParams(
 | 
	
		
			
				|  |  | +        progress_container.layoutParams = FrameLayout.LayoutParams(
 | 
	
		
			
				|  |  |                  MATCH_PARENT, webtoonReader.screenHeight)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          view.setOnTouchListener(adapter.touchListener)
 | 
	
		
			
				|  |  | -        view.retry_button.setOnTouchListener { _, event ->
 | 
	
		
			
				|  |  | +        retry_button.setOnTouchListener { _, event ->
 | 
	
		
			
				|  |  |              if (event.action == MotionEvent.ACTION_UP) {
 | 
	
		
			
				|  |  |                  readerActivity.presenter.retryPage(page)
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -111,9 +111,9 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
 | 
	
		
			
				|  |  |              (view as ViewGroup).removeView(it)
 | 
	
		
			
				|  |  |              decodeErrorLayout = null
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        view.image_view.recycle()
 | 
	
		
			
				|  |  | -        view.image_view.visibility = View.GONE
 | 
	
		
			
				|  |  | -        view.progress_container.visibility = View.VISIBLE
 | 
	
		
			
				|  |  | +        image_view.recycle()
 | 
	
		
			
				|  |  | +        image_view.visibility = View.GONE
 | 
	
		
			
				|  |  | +        progress_container.visibility = View.VISIBLE
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -150,7 +150,7 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
 | 
	
		
			
				|  |  |                  .onBackpressureLatest()
 | 
	
		
			
				|  |  |                  .observeOn(AndroidSchedulers.mainThread())
 | 
	
		
			
				|  |  |                  .subscribe { progress ->
 | 
	
		
			
				|  |  | -                    view.progress_text.text = if (progress > 0) {
 | 
	
		
			
				|  |  | +                    progress_text.text = if (progress > 0) {
 | 
	
		
			
				|  |  |                          view.context.getString(R.string.download_progress, progress)
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          view.context.getString(R.string.downloading)
 | 
	
	
		
			
				|  | @@ -279,14 +279,14 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
 | 
	
		
			
				|  |  |       * Called when the image is decoded and going to be displayed.
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private fun onImageDecoded() {
 | 
	
		
			
				|  |  | -        view.progress_container.visibility = View.GONE
 | 
	
		
			
				|  |  | +        progress_container.visibility = View.GONE
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * Called when the image fails to decode.
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private fun onImageDecodeError() {
 | 
	
		
			
				|  |  | -        view.progress_container.visibility = View.GONE
 | 
	
		
			
				|  |  | +        progress_container.visibility = View.GONE
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          val page = page ?: return
 | 
	
		
			
				|  |  |          if (decodeErrorLayout != null || !webtoonReader.isAdded) return
 |