Fix pages max scale

pull/1/head
Koitharu 6 years ago
parent 418d0247f5
commit 798ae6aeb7

@ -62,7 +62,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
implementation 'androidx.core:core-ktx:1.3.0-alpha02' implementation 'androidx.core:core-ktx:1.3.0-alpha02'
implementation 'androidx.fragment:fragment-ktx:1.2.2' implementation 'androidx.fragment:fragment-ktx:1.2.3'
implementation 'androidx.appcompat:appcompat:1.2.0-alpha03' implementation 'androidx.appcompat:appcompat:1.2.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-beta01' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-beta01'
@ -70,9 +70,9 @@ dependencies {
implementation 'androidx.preference:preference:1.1.0' implementation 'androidx.preference:preference:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha05' implementation 'com.google.android.material:material:1.2.0-alpha05'
implementation 'androidx.room:room-runtime:2.2.4' implementation 'androidx.room:room-runtime:2.2.5'
implementation 'androidx.room:room-ktx:2.2.4' implementation 'androidx.room:room-ktx:2.2.5'
kapt 'androidx.room:room-compiler:2.2.4' kapt 'androidx.room:room-compiler:2.2.5'
implementation 'com.github.moxy-community:moxy:2.1.1' implementation 'com.github.moxy-community:moxy:2.1.1'
implementation 'com.github.moxy-community:moxy-androidx:2.1.1' implementation 'com.github.moxy-community:moxy-androidx:2.1.1'
@ -80,9 +80,9 @@ dependencies {
implementation 'com.github.moxy-community:moxy-ktx:2.1.1' implementation 'com.github.moxy-community:moxy-ktx:2.1.1'
kapt 'com.github.moxy-community:moxy-compiler:2.1.1' kapt 'com.github.moxy-community:moxy-compiler:2.1.1'
implementation 'com.squareup.okhttp3:okhttp:4.4.0' implementation 'com.squareup.okhttp3:okhttp:4.4.1'
implementation 'com.squareup.okio:okio:2.4.3' implementation 'com.squareup.okio:okio:2.5.0'
implementation 'org.jsoup:jsoup:1.12.2' implementation 'org.jsoup:jsoup:1.13.1'
implementation 'org.koin:koin-android:2.1.3' implementation 'org.koin:koin-android:2.1.3'
implementation 'io.coil-kt:coil:0.9.5' implementation 'io.coil-kt:coil:0.9.5'

@ -49,7 +49,10 @@ class PageHolder(parent: ViewGroup, private val loader: PageLoader) :
} }
} }
override fun onReady() = Unit override fun onReady() {
ssiv.maxScale = 2f * maxOf(ssiv.width / ssiv.sWidth.toFloat(), ssiv.height / ssiv.sHeight.toFloat())
ssiv.resetScaleAndCenter()
}
override fun onImageLoadError(e: Exception) = onError(e) override fun onImageLoadError(e: Exception) = onError(e)

@ -52,6 +52,7 @@ class WebtoonHolder(parent: ViewGroup, private val loader: PageLoader) :
} }
override fun onReady() { override fun onReady() {
ssiv.maxScale = 2f * ssiv.width / ssiv.sWidth.toFloat()
ssiv.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM) ssiv.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM)
ssiv.minScale = ssiv.width / ssiv.sWidth.toFloat() ssiv.minScale = ssiv.width / ssiv.sWidth.toFloat()
ssiv.setScaleAndCenter( ssiv.setScaleAndCenter(

@ -16,6 +16,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:scaleType="centerInside"
app:layout_constraintDimensionRatio="13:18" app:layout_constraintDimensionRatio="13:18"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"

@ -16,6 +16,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:scaleType="centerCrop"
app:layout_constraintDimensionRatio="13:18" app:layout_constraintDimensionRatio="13:18"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"

@ -10,6 +10,7 @@
android:id="@+id/imageView_cover" android:id="@+id/imageView_cover"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop"
android:orientation="vertical" /> android:orientation="vertical" />
<LinearLayout <LinearLayout

@ -20,6 +20,7 @@
android:id="@+id/imageView_cover" android:id="@+id/imageView_cover"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop"
android:orientation="vertical" /> android:orientation="vertical" />
<LinearLayout <LinearLayout

@ -6,7 +6,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-beta02' classpath 'com.android.tools.build:gradle:4.0.0-beta03'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

Loading…
Cancel
Save