Refactoring

This commit is contained in:
Jay 2020-05-03 01:59:12 -04:00
parent 64c9e4bd3e
commit 5ff107361c
2 changed files with 13 additions and 9 deletions

View File

@ -343,8 +343,12 @@ abstract class HttpSource : CatalogueSource {
return try { return try {
val uri = URI(orig) val uri = URI(orig)
var out = uri.path var out = uri.path
if (uri.query != null) out += "?" + uri.query if (uri.query != null) {
if (uri.fragment != null) out += "#" + uri.fragment out += "?" + uri.query
}
if (uri.fragment != null) {
out += "#" + uri.fragment
}
out out
} catch (e: URISyntaxException) { } catch (e: URISyntaxException) {
orig orig

View File

@ -339,7 +339,7 @@ class PagerPageHolder(
return ReaderProgressBar(context, null).apply { return ReaderProgressBar(context, null).apply {
val size = 48.dpToPx val size = 48.dpToPx
layoutParams = FrameLayout.LayoutParams(size, size).apply { layoutParams = LayoutParams(size, size).apply {
gravity = Gravity.CENTER gravity = Gravity.CENTER
} }
} }
@ -354,7 +354,7 @@ class PagerPageHolder(
val config = viewer.config val config = viewer.config
subsamplingImageView = SubsamplingScaleImageView(context).apply { subsamplingImageView = SubsamplingScaleImageView(context).apply {
layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT)
setMaxTileSize(viewer.activity.maxBitmapSize) setMaxTileSize(viewer.activity.maxBitmapSize)
setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER) setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER)
setDoubleTapZoomDuration(config.doubleTapAnimDuration) setDoubleTapZoomDuration(config.doubleTapAnimDuration)
@ -389,7 +389,7 @@ class PagerPageHolder(
if (imageView != null) return imageView!! if (imageView != null) return imageView!!
imageView = PhotoView(context, null).apply { imageView = PhotoView(context, null).apply {
layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT)
adjustViewBounds = true adjustViewBounds = true
setZoomTransitionDuration(viewer.config.doubleTapAnimDuration) setZoomTransitionDuration(viewer.config.doubleTapAnimDuration)
setScaleLevels(1f, 2f, 3f) setScaleLevels(1f, 2f, 3f)
@ -416,7 +416,7 @@ class PagerPageHolder(
if (retryButton != null) return retryButton!! if (retryButton != null) return retryButton!!
retryButton = PagerButton(context, viewer).apply { retryButton = PagerButton(context, viewer).apply {
layoutParams = FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
gravity = Gravity.CENTER gravity = Gravity.CENTER
} }
setText(R.string.retry) setText(R.string.retry)
@ -453,7 +453,7 @@ class PagerPageHolder(
} }
PagerButton(context, viewer).apply { PagerButton(context, viewer).apply {
layoutParams = FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
setMargins(margins, margins, margins, margins) setMargins(margins, margins, margins, margins)
} }
setText(R.string.retry) setText(R.string.retry)
@ -465,9 +465,9 @@ class PagerPageHolder(
} }
val imageUrl = page.imageUrl val imageUrl = page.imageUrl
if (imageUrl.orEmpty().startsWith("http")) { if (imageUrl.orEmpty().startsWith("http", true)) {
PagerButton(context, viewer).apply { PagerButton(context, viewer).apply {
layoutParams = FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
setMargins(margins, margins, margins, margins) setMargins(margins, margins, margins, margins)
} }
setText(R.string.open_in_browser) setText(R.string.open_in_browser)