mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-25 04:06:14 +00:00
Add vertical translation to the bottom actionbar animation.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package org.thoughtcrime.securesms.components.menu
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
/**
|
||||
* Represents an action to be rendered via [SignalContextMenu] or [SignalBottomActionBar]
|
||||
|
||||
@@ -6,9 +6,12 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.util.ViewUtil
|
||||
|
||||
@@ -22,6 +25,20 @@ class SignalBottomActionBar(context: Context, attributeSet: AttributeSet) : Line
|
||||
|
||||
val items: MutableList<ActionItem> = mutableListOf()
|
||||
|
||||
val enterAnimation: Animation by lazy {
|
||||
AnimationUtils.loadAnimation(context, R.anim.slide_fade_from_bottom).apply {
|
||||
duration = 250
|
||||
interpolator = FastOutSlowInInterpolator()
|
||||
}
|
||||
}
|
||||
|
||||
val exitAnimation: Animation by lazy {
|
||||
AnimationUtils.loadAnimation(context, R.anim.slide_fade_to_bottom).apply {
|
||||
duration = 250
|
||||
interpolator = FastOutSlowInInterpolator()
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
orientation = HORIZONTAL
|
||||
setBackgroundResource(R.drawable.signal_bottom_action_bar_background)
|
||||
|
||||
@@ -963,7 +963,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||
|
||||
private void startActionMode() {
|
||||
actionMode = ((AppCompatActivity) getActivity()).startSupportActionMode(ConversationListFragment.this);
|
||||
ViewUtil.fadeIn(bottomActionBar, 250);
|
||||
ViewUtil.animateIn(bottomActionBar, bottomActionBar.getEnterAnimation());
|
||||
ViewUtil.fadeOut(fab, 250);
|
||||
ViewUtil.fadeOut(cameraFab, 250);
|
||||
if (megaphoneContainer.resolved()) {
|
||||
@@ -980,7 +980,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||
private void endActionMode() {
|
||||
actionMode.finish();
|
||||
actionMode = null;
|
||||
ViewUtil.fadeOut(bottomActionBar, 250);
|
||||
ViewUtil.animateOut(bottomActionBar, bottomActionBar.getExitAnimation());
|
||||
ViewUtil.fadeIn(fab, 250);
|
||||
ViewUtil.fadeIn(cameraFab, 250);
|
||||
if (megaphoneContainer.resolved()) {
|
||||
|
||||
@@ -303,14 +303,14 @@ public final class MediaOverviewPageFragment extends Fragment
|
||||
FragmentActivity activity = requireActivity();
|
||||
actionMode = ((AppCompatActivity) activity).startSupportActionMode(actionModeCallback);
|
||||
((MediaOverviewActivity) activity).onEnterMultiSelect();
|
||||
ViewUtil.fadeIn(bottomActionBar, 250);
|
||||
ViewUtil.animateIn(bottomActionBar, bottomActionBar.getEnterAnimation());
|
||||
updateMultiSelect();
|
||||
}
|
||||
|
||||
private void exitMultiSelect() {
|
||||
actionMode.finish();
|
||||
actionMode = null;
|
||||
ViewUtil.fadeOut(bottomActionBar, 250);
|
||||
ViewUtil.animateOut(bottomActionBar, bottomActionBar.getExitAnimation());
|
||||
}
|
||||
|
||||
private void updateMultiSelect() {
|
||||
|
||||
@@ -119,6 +119,10 @@ public final class ViewUtil {
|
||||
return animateOut(view, getAlphaAnimation(1f, 0f, duration), visibility);
|
||||
}
|
||||
|
||||
public static ListenableFuture<Boolean> animateOut(final @NonNull View view, final @NonNull Animation animation) {
|
||||
return animateOut(view, animation, View.GONE);
|
||||
}
|
||||
|
||||
public static ListenableFuture<Boolean> animateOut(final @NonNull View view, final @NonNull Animation animation, final int visibility) {
|
||||
final SettableFuture future = new SettableFuture();
|
||||
if (view.getVisibility() == visibility) {
|
||||
|
||||
Reference in New Issue
Block a user