diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-02-28 01:17:45 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-02-28 01:17:53 +0100 |
commit | d64b8f47d10b15903978a378bc6acf998ae3f890 (patch) | |
tree | d93782361c7ec7589752cc3688b37f8e1bca5742 /OpenKeychain/src/main/java/org | |
parent | c8f5dc5cf3c93a744ca0af4d7a1bf6afa6b46495 (diff) | |
download | open-keychain-d64b8f47d10b15903978a378bc6acf998ae3f890.tar.gz open-keychain-d64b8f47d10b15903978a378bc6acf998ae3f890.tar.bz2 open-keychain-d64b8f47d10b15903978a378bc6acf998ae3f890.zip |
animate FAB to move up and down when a snackbar appears
Diffstat (limited to 'OpenKeychain/src/main/java/org')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index bf3498f2f..6e2b46da0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.ui; +import android.animation.ObjectAnimator; import android.annotation.TargetApi; import android.app.ProgressDialog; import android.content.Context; @@ -619,23 +620,21 @@ public class KeyListFragment extends LoaderFragment } } - LayoutParams mFabOrigin = null; @Override public void fabMoveUp(int height) { - if (mFabOrigin == null) { - mFabOrigin = mFab.getLayoutParams(); - } - - // TODO reposition properly! - MarginLayoutParams marginParams = new MarginLayoutParams(mFabOrigin); - marginParams.setMargins(0, 0, 16, 16+height); - RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(marginParams); - mFab.setLayoutParams(layoutParams); + ObjectAnimator anim = ObjectAnimator.ofFloat(mFab, "translationY", 0, -height); + // we're a little behind, so skip 1/10 of the time + anim.setDuration(270); + anim.start(); } @Override public void fabRestorePosition() { - mFab.setLayoutParams(mFabOrigin); + ObjectAnimator anim = ObjectAnimator.ofFloat(mFab, "translationY", 0); + // we're a little ahead, so wait a few ms + anim.setStartDelay(70); + anim.setDuration(300); + anim.start(); } /** |