TunnelListFragment: Allocate interpolators outside scroll listener

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2018-07-18 10:28:57 +05:30 committed by Jason A. Donenfeld
parent d33e322b67
commit b1d1e3b436

View File

@ -6,6 +6,7 @@
package com.wireguard.android.fragment; package com.wireguard.android.fragment;
import android.animation.TimeInterpolator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.ContentResolver; import android.content.ContentResolver;
@ -61,6 +62,8 @@ import java9.util.stream.StreamSupport;
public class TunnelListFragment extends BaseFragment { public class TunnelListFragment extends BaseFragment {
private static final int REQUEST_IMPORT = 1; private static final int REQUEST_IMPORT = 1;
private static final String TAG = "WireGuard/" + TunnelListFragment.class.getSimpleName(); private static final String TAG = "WireGuard/" + TunnelListFragment.class.getSimpleName();
private static final TimeInterpolator FAB_SHOW_ANIMATION = new DecelerateInterpolator(2);
private static final TimeInterpolator FAB_HIDE_ANIMATION = new AccelerateInterpolator(2);
private final ActionModeListener actionModeListener = new ActionModeListener(); private final ActionModeListener actionModeListener = new ActionModeListener();
@Nullable private ActionMode actionMode; @Nullable private ActionMode actionMode;
@ -198,7 +201,7 @@ public class TunnelListFragment extends BaseFragment {
public void show() { public void show() {
binding.createMenu.animate() binding.createMenu.animate()
.translationY(0) .translationY(0)
.setInterpolator(new DecelerateInterpolator(2)) .setInterpolator(FAB_SHOW_ANIMATION)
.start(); .start();
} }
@ -206,7 +209,7 @@ public class TunnelListFragment extends BaseFragment {
public void hide() { public void hide() {
binding.createMenu.animate() binding.createMenu.animate()
.translationY(binding.createMenu.getHeight() + getResources().getDimension(R.dimen.fab_margin)) .translationY(binding.createMenu.getHeight() + getResources().getDimension(R.dimen.fab_margin))
.setInterpolator(new AccelerateInterpolator(2)) .setInterpolator(FAB_HIDE_ANIMATION)
.start(); .start();
} }
}); });