kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add chat filter pill fade out on slide close.
rodzic
7b3d8d01ae
commit
f387785a46
|
@ -103,6 +103,10 @@ class ConversationListFilterPullView @JvmOverloads constructor(
|
||||||
} else {
|
} else {
|
||||||
binding.filterText.translationY = 0f
|
binding.filterText.translationY = 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state == FilterPullState.CLOSE_APEX) {
|
||||||
|
binding.filterText.alpha = FilterLerp.getPillCloseApexAlphaLerp(progress)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onUserDragFinished() {
|
fun onUserDragFinished() {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.conversationlist.chatfilter
|
||||||
import android.animation.FloatEvaluator
|
import android.animation.FloatEvaluator
|
||||||
import androidx.annotation.FloatRange
|
import androidx.annotation.FloatRange
|
||||||
import org.signal.core.util.dp
|
import org.signal.core.util.dp
|
||||||
|
import org.thoughtcrime.securesms.util.Util
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Centralized location for filter view linear interpolations.
|
* Centralized location for filter view linear interpolations.
|
||||||
|
@ -37,6 +38,11 @@ object FilterLerp {
|
||||||
Point(1f, FILTER_APEX * 0.55f)
|
Point(1f, FILTER_APEX * 0.55f)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val PILL_CLOSE_APEX_ALPHA_LERP = getFn(
|
||||||
|
Point(0.35f * FILTER_APEX / 100, 0f),
|
||||||
|
Point(0.7f * FILTER_APEX / 100, 1f)
|
||||||
|
)
|
||||||
|
|
||||||
private fun helpTextAlphaLerp(@FloatRange(from = 0.0, to = 1.0) startFraction: Float) = getFn(
|
private fun helpTextAlphaLerp(@FloatRange(from = 0.0, to = 1.0) startFraction: Float) = getFn(
|
||||||
Point(startFraction, 0f),
|
Point(startFraction, 0f),
|
||||||
Point(1f, 1f)
|
Point(1f, 1f)
|
||||||
|
@ -46,6 +52,10 @@ object FilterLerp {
|
||||||
return getLerp(fraction, helpTextAlphaLerp(startFraction))
|
return getLerp(fraction, helpTextAlphaLerp(startFraction))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getPillCloseApexAlphaLerp(fraction: Float): Float {
|
||||||
|
return Util.clamp(getLerp(fraction, PILL_CLOSE_APEX_ALPHA_LERP), 0f, 1f)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the LERP for the "Filter enabled" pill.
|
* Get the LERP for the "Filter enabled" pill.
|
||||||
*/
|
*/
|
||||||
|
|
Ładowanie…
Reference in New Issue