mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Utilize fast-in-extra-slow-out interpolator.
This commit is contained in:
committed by
Greyson Parrelli
parent
969e763997
commit
a805f9b6b4
@@ -39,6 +39,7 @@ import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.LoggingFragment;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.animation.AnimationCompleteListener;
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaAnimations;
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaCountIndicatorButton;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
@@ -171,6 +172,7 @@ public class Camera1Fragment extends LoggingFragment implements CameraFragment,
|
||||
public void fadeOutControls(@NonNull Runnable onEndAction) {
|
||||
controlsContainer.setEnabled(false);
|
||||
controlsContainer.animate()
|
||||
.setInterpolator(MediaAnimations.getInterpolator())
|
||||
.setDuration(250)
|
||||
.alpha(0f)
|
||||
.setListener(new AnimationCompleteListener() {
|
||||
@@ -186,6 +188,7 @@ public class Camera1Fragment extends LoggingFragment implements CameraFragment,
|
||||
public void fadeInControls() {
|
||||
controlsContainer.setEnabled(false);
|
||||
controlsContainer.animate()
|
||||
.setInterpolator(MediaAnimations.getInterpolator())
|
||||
.setDuration(250)
|
||||
.alpha(1f)
|
||||
.setListener(new AnimationCompleteListener() {
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.thoughtcrime.securesms.animation.AnimationCompleteListener;
|
||||
import org.thoughtcrime.securesms.components.TooltipPopup;
|
||||
import org.thoughtcrime.securesms.mediasend.camerax.CameraXFlashToggleView;
|
||||
import org.thoughtcrime.securesms.mediasend.camerax.CameraXUtil;
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaAnimations;
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaCountIndicatorButton;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
|
||||
import org.thoughtcrime.securesms.mms.MediaConstraints;
|
||||
@@ -169,6 +170,7 @@ public class CameraXFragment extends LoggingFragment implements CameraFragment {
|
||||
controlsContainer.animate()
|
||||
.setDuration(250)
|
||||
.alpha(0f)
|
||||
.setInterpolator(MediaAnimations.getInterpolator())
|
||||
.setListener(new AnimationCompleteListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
@@ -184,6 +186,7 @@ public class CameraXFragment extends LoggingFragment implements CameraFragment {
|
||||
controlsContainer.animate()
|
||||
.setDuration(250)
|
||||
.alpha(1f)
|
||||
.setInterpolator(MediaAnimations.getInterpolator())
|
||||
.setListener(new AnimationCompleteListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
|
||||
@@ -1,44 +1,13 @@
|
||||
package org.thoughtcrime.securesms.mediasend.v2
|
||||
|
||||
import android.animation.Animator
|
||||
import android.view.View
|
||||
import org.thoughtcrime.securesms.animation.AnimationCompleteListener
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
import android.view.animation.Interpolator
|
||||
import androidx.core.graphics.PathParser
|
||||
import androidx.core.view.animation.PathInterpolatorCompat
|
||||
|
||||
object MediaAnimations {
|
||||
private const val FADE_ANIMATION_DURATION = 150L
|
||||
|
||||
fun fadeIn(view: View) {
|
||||
if (view.visible) {
|
||||
return
|
||||
}
|
||||
|
||||
view.visible = true
|
||||
view.animate()
|
||||
.setDuration(FADE_ANIMATION_DURATION)
|
||||
.alpha(1f)
|
||||
}
|
||||
|
||||
fun fadeOut(view: View) {
|
||||
if (!view.visible) {
|
||||
return
|
||||
}
|
||||
|
||||
view.animate()
|
||||
.setDuration(FADE_ANIMATION_DURATION)
|
||||
.setListener(object : AnimationCompleteListener() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
view.visible = false
|
||||
}
|
||||
})
|
||||
.alpha(0f)
|
||||
}
|
||||
|
||||
fun fade(view: View, fadeIn: Boolean) {
|
||||
if (fadeIn) {
|
||||
fadeIn(view)
|
||||
} else {
|
||||
fadeOut(view)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fast-In-Extra-Slow-Out Interpolator
|
||||
*/
|
||||
@JvmStatic
|
||||
val interpolator: Interpolator = PathInterpolatorCompat.create(PathParser.createPathFromPathData("M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1"))
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.thoughtcrime.securesms.conversation.mutiselect.forward.MultiselectFor
|
||||
import org.thoughtcrime.securesms.keyboard.findListener
|
||||
import org.thoughtcrime.securesms.mediasend.MediaSendActivityResult
|
||||
import org.thoughtcrime.securesms.mediasend.v2.HudCommand
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaAnimations
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaSelectionNavigator
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaSelectionNavigator.Companion.requestPermissionsForGallery
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaSelectionState
|
||||
@@ -273,6 +274,7 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment) {
|
||||
|
||||
val animatorSet = AnimatorSet()
|
||||
animatorSet.playTogether(animators)
|
||||
animatorSet.interpolator = MediaAnimations.interpolator
|
||||
animatorSet.start()
|
||||
|
||||
this.animatorSet = animatorSet
|
||||
|
||||
Reference in New Issue
Block a user