Compare commits

...

4 Commits
v4.0 ... v4.0.2

Author SHA1 Message Date
cec19c3db3 Fix crash related to slider 2022-10-23 09:18:14 +03:00
J. Lavoie
ff58539e2e Translated using Weblate (French)
Currently translated at 100.0% (398 of 398 strings)

Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Translate-URL: https://hosted.weblate.org/projects/kotatsu/strings/fr/
Translation: Kotatsu/Strings
2022-10-22 18:33:34 +03:00
d8e7689a94 Update ssiv 2022-10-22 17:53:53 +03:00
32cfbb327c Fix potential crash related to slider 2022-10-21 17:57:35 +03:00
7 changed files with 24 additions and 11 deletions

View File

@@ -15,8 +15,8 @@ android {
applicationId 'org.koitharu.kotatsu' applicationId 'org.koitharu.kotatsu'
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 33 targetSdkVersion 33
versionCode 500 versionCode 502
versionName '4.0' versionName '4.0.2'
generatedDensities = [] generatedDensities = []
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -125,7 +125,7 @@ dependencies {
implementation 'io.coil-kt:coil-base:2.2.2' implementation 'io.coil-kt:coil-base:2.2.2'
implementation 'io.coil-kt:coil-svg:2.2.2' implementation 'io.coil-kt:coil-svg:2.2.2'
implementation 'com.github.KotatsuApp:subsampling-scale-image-view:0ff0278f0f' implementation 'com.github.KotatsuApp:subsampling-scale-image-view:f8a38b08fe'
implementation 'com.github.solkin:disk-lru-cache:1.4' implementation 'com.github.solkin:disk-lru-cache:1.4'
implementation 'ch.acra:acra-http:5.9.6' implementation 'ch.acra:acra-http:5.9.6'

View File

@@ -58,6 +58,7 @@ import org.koitharu.kotatsu.utils.ext.isReportable
import org.koitharu.kotatsu.utils.ext.observeWithPrevious import org.koitharu.kotatsu.utils.ext.observeWithPrevious
import org.koitharu.kotatsu.utils.ext.postDelayed import org.koitharu.kotatsu.utils.ext.postDelayed
import org.koitharu.kotatsu.utils.ext.report import org.koitharu.kotatsu.utils.ext.report
import org.koitharu.kotatsu.utils.ext.setValueRounded
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
@@ -388,7 +389,7 @@ class ReaderActivity :
} }
if (uiState.isSliderAvailable()) { if (uiState.isSliderAvailable()) {
binding.slider.valueTo = uiState.totalPages.toFloat() - 1 binding.slider.valueTo = uiState.totalPages.toFloat() - 1
binding.slider.value = uiState.currentPage.toFloat() binding.slider.setValueRounded(uiState.currentPage.toFloat())
binding.slider.isVisible = true binding.slider.isVisible = true
} else { } else {
binding.slider.isVisible = false binding.slider.isVisible = false

View File

@@ -103,8 +103,8 @@ class ColorFilterConfigActivity :
} }
private fun onColorFilterChanged(readerColorFilter: ReaderColorFilter?) { private fun onColorFilterChanged(readerColorFilter: ReaderColorFilter?) {
binding.sliderBrightness.value = readerColorFilter?.brightness ?: 0f binding.sliderBrightness.setValueRounded(readerColorFilter?.brightness ?: 0f)
binding.sliderContrast.value = readerColorFilter?.contrast ?: 0f binding.sliderContrast.setValueRounded(readerColorFilter?.contrast ?: 0f)
binding.imageViewAfter.colorFilter = readerColorFilter?.toColorFilter() binding.imageViewAfter.colorFilter = readerColorFilter?.toColorFilter()
} }

View File

@@ -23,6 +23,7 @@ import org.koitharu.kotatsu.reader.ui.ReaderViewModel
import org.koitharu.kotatsu.reader.ui.colorfilter.ColorFilterConfigActivity import org.koitharu.kotatsu.reader.ui.colorfilter.ColorFilterConfigActivity
import org.koitharu.kotatsu.settings.SettingsActivity import org.koitharu.kotatsu.settings.SettingsActivity
import org.koitharu.kotatsu.utils.ScreenOrientationHelper import org.koitharu.kotatsu.utils.ScreenOrientationHelper
import org.koitharu.kotatsu.utils.ext.setValueRounded
import org.koitharu.kotatsu.utils.ext.viewLifecycleScope import org.koitharu.kotatsu.utils.ext.viewLifecycleScope
import org.koitharu.kotatsu.utils.ext.withArgs import org.koitharu.kotatsu.utils.ext.withArgs
@@ -65,7 +66,7 @@ class ReaderConfigBottomSheet :
binding.sliderTimer.setLabelFormatter(PageSwitchTimer.DelayLabelFormatter(view.resources)) binding.sliderTimer.setLabelFormatter(PageSwitchTimer.DelayLabelFormatter(view.resources))
findCallback()?.run { findCallback()?.run {
binding.sliderTimer.value = pageSwitchDelay binding.sliderTimer.setValueRounded(pageSwitchDelay)
} }
} }
@@ -75,13 +76,16 @@ class ReaderConfigBottomSheet :
startActivity(SettingsActivity.newReaderSettingsIntent(v.context)) startActivity(SettingsActivity.newReaderSettingsIntent(v.context))
dismissAllowingStateLoss() dismissAllowingStateLoss()
} }
R.id.button_save_page -> { R.id.button_save_page -> {
val page = viewModel.getCurrentPage() ?: return val page = viewModel.getCurrentPage() ?: return
viewModel.saveCurrentPage(page, savePageRequest) viewModel.saveCurrentPage(page, savePageRequest)
} }
R.id.button_screen_rotate -> { R.id.button_screen_rotate -> {
orientationHelper?.toggleOrientation() orientationHelper?.toggleOrientation()
} }
R.id.button_color_filter -> { R.id.button_color_filter -> {
val page = viewModel.getCurrentPage() ?: return val page = viewModel.getCurrentPage() ?: return
val manga = viewModel.manga ?: return val manga = viewModel.manga ?: return

View File

@@ -8,13 +8,13 @@ import androidx.fragment.app.FragmentManager
import com.google.android.material.slider.LabelFormatter import com.google.android.material.slider.LabelFormatter
import com.google.android.material.slider.Slider import com.google.android.material.slider.Slider
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import org.koitharu.kotatsu.R import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.base.ui.BaseBottomSheet import org.koitharu.kotatsu.base.ui.BaseBottomSheet
import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.prefs.AppSettings
import org.koitharu.kotatsu.databinding.SheetShelfSizeBinding import org.koitharu.kotatsu.databinding.SheetShelfSizeBinding
import org.koitharu.kotatsu.utils.ext.setValueRounded import org.koitharu.kotatsu.utils.ext.setValueRounded
import org.koitharu.kotatsu.utils.progress.IntPercentLabelFormatter import org.koitharu.kotatsu.utils.progress.IntPercentLabelFormatter
import javax.inject.Inject
@AndroidEntryPoint @AndroidEntryPoint
class ShelfSizeBottomSheet : class ShelfSizeBottomSheet :
@@ -51,9 +51,10 @@ class ShelfSizeBottomSheet :
} }
override fun onClick(v: View) { override fun onClick(v: View) {
val slider = binding.sliderGrid
when (v.id) { when (v.id) {
R.id.button_small -> binding.sliderGrid.value -= binding.sliderGrid.stepSize R.id.button_small -> slider.setValueRounded(slider.value - slider.stepSize)
R.id.button_large -> binding.sliderGrid.value += binding.sliderGrid.stepSize R.id.button_large -> slider.setValueRounded(slider.value + slider.stepSize)
} }
} }

View File

@@ -127,7 +127,11 @@ fun <T> RecyclerView.ViewHolder.getItem(clazz: Class<T>): T? {
fun Slider.setValueRounded(newValue: Float) { fun Slider.setValueRounded(newValue: Float) {
val step = stepSize val step = stepSize
val roundedValue = (newValue / step).roundToInt() * step val roundedValue = if (step <= 0f) {
newValue
} else {
(newValue / step).roundToInt() * step
}
value = roundedValue.coerceIn(valueFrom, valueTo) value = roundedValue.coerceIn(valueFrom, valueTo)
} }

View File

@@ -392,4 +392,7 @@
<string name="network_unavailable_hint">Activez le Wi-Fi ou le réseau mobile pour lire les mangas en ligne</string> <string name="network_unavailable_hint">Activez le Wi-Fi ou le réseau mobile pour lire les mangas en ligne</string>
<string name="different_languages">Différentes langues</string> <string name="different_languages">Différentes langues</string>
<string name="network_unavailable">Le réseau n\'est pas disponible</string> <string name="network_unavailable">Le réseau n\'est pas disponible</string>
<string name="compact">Compact</string>
<string name="server_error">Erreur côté serveur (%1$d). Veuillez réessayer plus tard</string>
<string name="clear_new_chapters_counters">Effacer aussi les informations sur les nouveaux chapitres</string>
</resources> </resources>