Revert some seekbar event listener changes
This commit is contained in:
parent
d371b093d8
commit
134dbd2f1d
@ -19,6 +19,7 @@ import android.view.View
|
|||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.view.animation.Animation
|
import android.view.animation.Animation
|
||||||
import android.view.animation.AnimationUtils
|
import android.view.animation.AnimationUtils
|
||||||
|
import android.widget.SeekBar
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
@ -51,6 +52,7 @@ import eu.kanade.tachiyomi.util.view.isDefaultBar
|
|||||||
import eu.kanade.tachiyomi.util.view.showBar
|
import eu.kanade.tachiyomi.util.view.showBar
|
||||||
import eu.kanade.tachiyomi.util.view.visible
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import eu.kanade.tachiyomi.widget.SimpleAnimationListener
|
import eu.kanade.tachiyomi.widget.SimpleAnimationListener
|
||||||
|
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
@ -59,7 +61,6 @@ import kotlinx.coroutines.flow.launchIn
|
|||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.flow.sample
|
import kotlinx.coroutines.flow.sample
|
||||||
import nucleus.factory.RequiresPresenter
|
import nucleus.factory.RequiresPresenter
|
||||||
import reactivecircus.flowbinding.android.widget.progressChanges
|
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
import rx.subscriptions.CompositeSubscription
|
import rx.subscriptions.CompositeSubscription
|
||||||
@ -283,13 +284,13 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init listeners on bottom menu
|
// Init listeners on bottom menu
|
||||||
binding.pageSeekbar.progressChanges()
|
binding.pageSeekbar.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||||
.onEach {
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
if (viewer != null) {
|
if (viewer != null && fromUser) {
|
||||||
moveToPageIndex(it)
|
moveToPageIndex(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.launchIn(scope)
|
})
|
||||||
binding.leftChapter.setOnClickListener {
|
binding.leftChapter.setOnClickListener {
|
||||||
if (viewer != null) {
|
if (viewer != null) {
|
||||||
if (viewer is R2LPagerViewer)
|
if (viewer is R2LPagerViewer)
|
||||||
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.reader
|
|||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.SeekBar
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
@ -11,6 +12,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
import eu.kanade.tachiyomi.util.view.visible
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener
|
import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener
|
||||||
|
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlinx.android.synthetic.main.reader_color_filter.brightness_seekbar
|
import kotlinx.android.synthetic.main.reader_color_filter.brightness_seekbar
|
||||||
import kotlinx.android.synthetic.main.reader_color_filter.color_filter_mode
|
import kotlinx.android.synthetic.main.reader_color_filter.color_filter_mode
|
||||||
@ -27,13 +29,9 @@ import kotlinx.android.synthetic.main.reader_color_filter.txt_color_filter_green
|
|||||||
import kotlinx.android.synthetic.main.reader_color_filter.txt_color_filter_red_value
|
import kotlinx.android.synthetic.main.reader_color_filter.txt_color_filter_red_value
|
||||||
import kotlinx.android.synthetic.main.reader_color_filter_sheet.brightness_overlay
|
import kotlinx.android.synthetic.main.reader_color_filter_sheet.brightness_overlay
|
||||||
import kotlinx.android.synthetic.main.reader_color_filter_sheet.color_overlay
|
import kotlinx.android.synthetic.main.reader_color_filter_sheet.color_overlay
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.flow.sample
|
import kotlinx.coroutines.flow.sample
|
||||||
import reactivecircus.flowbinding.android.widget.progressChanges
|
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,8 +39,6 @@ import uy.kohesive.injekt.injectLazy
|
|||||||
*/
|
*/
|
||||||
class ReaderColorFilterSheet(private val activity: ReaderActivity) : BottomSheetDialog(activity) {
|
class ReaderColorFilterSheet(private val activity: ReaderActivity) : BottomSheetDialog(activity) {
|
||||||
|
|
||||||
private val scope = CoroutineScope(Job() + Dispatchers.Main)
|
|
||||||
|
|
||||||
private val preferences by injectLazy<PreferencesHelper>()
|
private val preferences by injectLazy<PreferencesHelper>()
|
||||||
|
|
||||||
private var sheetBehavior: BottomSheetBehavior<*>? = null
|
private var sheetBehavior: BottomSheetBehavior<*>? = null
|
||||||
@ -97,25 +93,45 @@ class ReaderColorFilterSheet(private val activity: ReaderActivity) : BottomSheet
|
|||||||
}
|
}
|
||||||
color_filter_mode.setSelection(preferences.colorFilterMode().get(), false)
|
color_filter_mode.setSelection(preferences.colorFilterMode().get(), false)
|
||||||
|
|
||||||
seekbar_color_filter_alpha.progressChanges()
|
seekbar_color_filter_alpha.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||||
.onEach { setColorValue(it, ALPHA_MASK, 24) }
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
.launchIn(scope)
|
if (fromUser) {
|
||||||
|
setColorValue(value, ALPHA_MASK, 24)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
seekbar_color_filter_red.progressChanges()
|
seekbar_color_filter_red.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||||
.onEach { setColorValue(it, RED_MASK, 16) }
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
.launchIn(scope)
|
if (fromUser) {
|
||||||
|
setColorValue(value, RED_MASK, 16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
seekbar_color_filter_green.progressChanges()
|
seekbar_color_filter_green.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||||
.onEach { setColorValue(it, GREEN_MASK, 8) }
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
.launchIn(scope)
|
if (fromUser) {
|
||||||
|
setColorValue(value, GREEN_MASK, 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
seekbar_color_filter_blue.progressChanges()
|
seekbar_color_filter_blue.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||||
.onEach { setColorValue(it, BLUE_MASK, 0) }
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
.launchIn(scope)
|
if (fromUser) {
|
||||||
|
setColorValue(value, BLUE_MASK, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
brightness_seekbar.progressChanges()
|
brightness_seekbar.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||||
.onEach { preferences.customBrightnessValue().set(it) }
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
.launchIn(scope)
|
if (fromUser) {
|
||||||
|
preferences.customBrightnessValue().set(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package eu.kanade.tachiyomi.widget
|
||||||
|
|
||||||
|
import android.widget.SeekBar
|
||||||
|
|
||||||
|
open class SimpleSeekBarListener : SeekBar.OnSeekBarChangeListener {
|
||||||
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStartTrackingTouch(seekBar: SeekBar) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user