mirror of
https://github.com/nextcloud/talk-android
synced 2025-02-02 12:42:20 +00:00
Improve animation
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
51390edf2b
commit
08534574d2
@ -32,6 +32,7 @@ import android.view.View;
|
||||
public class ViewHidingBehaviourAnimation extends CoordinatorLayout.Behavior<View> {
|
||||
|
||||
private int height;
|
||||
private boolean slidingDown = false;
|
||||
|
||||
@Override
|
||||
public boolean onLayoutChild(CoordinatorLayout parent, View child, int layoutDirection) {
|
||||
@ -56,13 +57,19 @@ public class ViewHidingBehaviourAnimation extends CoordinatorLayout.Behavior<Vie
|
||||
}
|
||||
|
||||
private void slideUp(View child) {
|
||||
child.clearAnimation();
|
||||
child.animate().translationY(0).setDuration(200);
|
||||
if (slidingDown) {
|
||||
slidingDown = false;
|
||||
child.clearAnimation();
|
||||
child.animate().translationY(0).setDuration(200);
|
||||
}
|
||||
}
|
||||
|
||||
private void slideDown(View child) {
|
||||
child.clearAnimation();
|
||||
child.animate().translationY(height).setDuration(200);
|
||||
if (!slidingDown) {
|
||||
slidingDown = true;
|
||||
child.clearAnimation();
|
||||
child.animate().translationY(height).setDuration(200);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user