mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01: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> {
|
public class ViewHidingBehaviourAnimation extends CoordinatorLayout.Behavior<View> {
|
||||||
|
|
||||||
private int height;
|
private int height;
|
||||||
|
private boolean slidingDown = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLayoutChild(CoordinatorLayout parent, View child, int layoutDirection) {
|
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) {
|
private void slideUp(View child) {
|
||||||
child.clearAnimation();
|
if (slidingDown) {
|
||||||
child.animate().translationY(0).setDuration(200);
|
slidingDown = false;
|
||||||
|
child.clearAnimation();
|
||||||
|
child.animate().translationY(0).setDuration(200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void slideDown(View child) {
|
private void slideDown(View child) {
|
||||||
child.clearAnimation();
|
if (!slidingDown) {
|
||||||
child.animate().translationY(height).setDuration(200);
|
slidingDown = true;
|
||||||
|
child.clearAnimation();
|
||||||
|
child.animate().translationY(height).setDuration(200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user