From 5ff107361c6cf9746dd5ef5b165c65751b4f8f14 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 3 May 2020 01:59:12 -0400 Subject: [PATCH] Refactoring --- .../kanade/tachiyomi/source/online/HttpSource.kt | 8 ++++++-- .../ui/reader/viewer/pager/PagerPageHolder.kt | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt index 1c89199d61..259ea92f0b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt @@ -343,8 +343,12 @@ abstract class HttpSource : CatalogueSource { return try { val uri = URI(orig) var out = uri.path - if (uri.query != null) out += "?" + uri.query - if (uri.fragment != null) out += "#" + uri.fragment + if (uri.query != null) { + out += "?" + uri.query + } + if (uri.fragment != null) { + out += "#" + uri.fragment + } out } catch (e: URISyntaxException) { orig diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index e392a945ed..1a93e2ea0c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -339,7 +339,7 @@ class PagerPageHolder( return ReaderProgressBar(context, null).apply { val size = 48.dpToPx - layoutParams = FrameLayout.LayoutParams(size, size).apply { + layoutParams = LayoutParams(size, size).apply { gravity = Gravity.CENTER } } @@ -354,7 +354,7 @@ class PagerPageHolder( val config = viewer.config subsamplingImageView = SubsamplingScaleImageView(context).apply { - layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) + layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT) setMaxTileSize(viewer.activity.maxBitmapSize) setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER) setDoubleTapZoomDuration(config.doubleTapAnimDuration) @@ -389,7 +389,7 @@ class PagerPageHolder( if (imageView != null) return imageView!! imageView = PhotoView(context, null).apply { - layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) + layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT) adjustViewBounds = true setZoomTransitionDuration(viewer.config.doubleTapAnimDuration) setScaleLevels(1f, 2f, 3f) @@ -416,7 +416,7 @@ class PagerPageHolder( if (retryButton != null) return retryButton!! retryButton = PagerButton(context, viewer).apply { - layoutParams = FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { + layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { gravity = Gravity.CENTER } setText(R.string.retry) @@ -453,7 +453,7 @@ class PagerPageHolder( } PagerButton(context, viewer).apply { - layoutParams = FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { + layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { setMargins(margins, margins, margins, margins) } setText(R.string.retry) @@ -465,9 +465,9 @@ class PagerPageHolder( } val imageUrl = page.imageUrl - if (imageUrl.orEmpty().startsWith("http")) { + if (imageUrl.orEmpty().startsWith("http", true)) { PagerButton(context, viewer).apply { - layoutParams = FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { + layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { setMargins(margins, margins, margins, margins) } setText(R.string.open_in_browser)