Animate the button ourselfs again

the show/hide messes up when called on the same frame after each other
multisite
Floens 10 years ago
parent 8c0d512d52
commit c873a4fdc5
  1. 24
      Clover/app/src/main/java/org/floens/chan/ui/layout/ThreadLayout.java
  2. 3
      Clover/app/src/main/res/layout/layout_thread.xml

@ -17,6 +17,8 @@
*/
package org.floens.chan.ui.layout;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
@ -31,6 +33,7 @@ import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
@ -471,11 +474,22 @@ public class ThreadLayout extends CoordinatorLayout implements ThreadPresenter.T
if (show != showingReplyButton && replyButtonEnabled) {
showingReplyButton = show;
if (show) {
replyButton.show();
} else {
replyButton.hide();
}
replyButton.animate()
.setInterpolator(new DecelerateInterpolator(2f))
.setStartDelay(show ? 100 : 0)
.setDuration(200)
.alpha(show ? 1f : 0f)
.scaleX(show ? 1f : 0f)
.scaleY(show ? 1f : 0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
replyButton.setAlpha(show ? 1f : 0f);
replyButton.setScaleX(show ? 1f : 0f);
replyButton.setScaleY(show ? 1f : 0f);
}
})
.start();
}
}

@ -31,6 +31,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:layout_margin="16dp"
android:alpha="0"
android:scaleX="0"
android:scaleY="0"
android:src="@drawable/ic_create_white_24dp"
tools:ignore="RtlHardcoded" />

Loading…
Cancel
Save