com.hippo.yorozuya.SimpleAnimatorListener Java Examples
The following examples show how to use
com.hippo.yorozuya.SimpleAnimatorListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PopupTextView.java From Nimingban with Apache License 2.0 | 6 votes |
public boolean popupText(String text) { final TextView tv = mFreePool.pop(); if (tv == null) { return false; } tv.setTranslationY(0); tv.setAlpha(1.0f); tv.setVisibility(VISIBLE); tv.setText(text); // Start animate tv.animate().y(0.0f).alpha(0.0f).setDuration(1000) .setInterpolator(AnimationUtils2.FAST_SLOW_INTERPOLATOR) .setListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator animation) { tv.setVisibility(INVISIBLE); mFreePool.push(tv); } }).start(); return true; }
Example #2
Source File: GalleryCommentsScene.java From MHViewer with Apache License 2.0 | 5 votes |
private void showEditPanelWithAnimation() { if (null == mFab || null == mEditPanel) { return; } mInAnimation = true; mFab.setTranslationX(0.0f); mFab.setTranslationY(0.0f); mFab.setScaleX(1.0f); mFab.setScaleY(1.0f); int fabEndX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2); int fabEndY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2); mFab.animate().x(fabEndX).y(fabEndY).scaleX(0.0f).scaleY(0.0f) .setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR) .setDuration(300L).setListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator animation) { if (null == mFab || null == mEditPanel) { return; } ((View) mFab).setVisibility(View.INVISIBLE); mEditPanel.setVisibility(View.VISIBLE); int halfW = mEditPanel.getWidth() / 2; int halfH = mEditPanel.getHeight() / 2; Animator animator = ViewAnimationUtils.createCircularReveal(mEditPanel, halfW, halfH, 0, (float) Math.hypot(halfW, halfH)).setDuration(300L); animator.addListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator a) { mInAnimation = false; } }); animator.start(); } }).start(); }
Example #3
Source File: GalleryCommentsScene.java From EhViewer with Apache License 2.0 | 5 votes |
private void showEditPanelWithAnimation() { if (null == mFab || null == mEditPanel) { return; } mInAnimation = true; mFab.setTranslationX(0.0f); mFab.setTranslationY(0.0f); mFab.setScaleX(1.0f); mFab.setScaleY(1.0f); int fabEndX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2); int fabEndY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2); mFab.animate().x(fabEndX).y(fabEndY).scaleX(0.0f).scaleY(0.0f) .setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR) .setDuration(300L).setListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator animation) { if (null == mFab || null == mEditPanel) { return; } ((View) mFab).setVisibility(View.INVISIBLE); mEditPanel.setVisibility(View.VISIBLE); int halfW = mEditPanel.getWidth() / 2; int halfH = mEditPanel.getHeight() / 2; Animator animator = ViewAnimationUtils.createCircularReveal(mEditPanel, halfW, halfH, 0, (float) Math.hypot(halfW, halfH)).setDuration(300L); animator.addListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator a) { mInAnimation = false; } }); animator.start(); } }).start(); }
Example #4
Source File: GalleryCommentsScene.java From MHViewer with Apache License 2.0 | 4 votes |
private void hideEditPanelWithAnimation() { if (null == mFab || null == mEditPanel) { return; } mInAnimation = true; int halfW = mEditPanel.getWidth() / 2; int halfH = mEditPanel.getHeight() / 2; Animator animator = ViewAnimationUtils.createCircularReveal(mEditPanel, halfW, halfH, (float) Math.hypot(halfW, halfH), 0.0f).setDuration(300L); animator.addListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator a) { if (null == mFab || null == mEditPanel) { return; } if (Looper.myLooper() != Looper.getMainLooper()) { // Some devices may run this block in non-UI thread. // It might be a bug of Android OS. // Check it here to avoid crash. return; } mEditPanel.setVisibility(View.GONE); ((View) mFab).setVisibility(View.VISIBLE); int fabStartX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2); int fabStartY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2); mFab.setX(fabStartX); mFab.setY(fabStartY); mFab.setScaleX(0.0f); mFab.setScaleY(0.0f); mFab.setRotation(-45.0f); mFab.animate().translationX(0.0f).translationY(0.0f).scaleX(1.0f).scaleY(1.0f).rotation(0.0f) .setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR) .setDuration(300L).setListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator animation) { mInAnimation = false; } }).start(); } }); animator.start(); }
Example #5
Source File: GalleryCommentsScene.java From EhViewer with Apache License 2.0 | 4 votes |
private void hideEditPanelWithAnimation() { if (null == mFab || null == mEditPanel) { return; } mInAnimation = true; int halfW = mEditPanel.getWidth() / 2; int halfH = mEditPanel.getHeight() / 2; Animator animator = ViewAnimationUtils.createCircularReveal(mEditPanel, halfW, halfH, (float) Math.hypot(halfW, halfH), 0.0f).setDuration(300L); animator.addListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator a) { if (null == mFab || null == mEditPanel) { return; } if (Looper.myLooper() != Looper.getMainLooper()) { // Some devices may run this block in non-UI thread. // It might be a bug of Android OS. // Check it here to avoid crash. return; } mEditPanel.setVisibility(View.GONE); ((View) mFab).setVisibility(View.VISIBLE); int fabStartX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2); int fabStartY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2); mFab.setX(fabStartX); mFab.setY(fabStartY); mFab.setScaleX(0.0f); mFab.setScaleY(0.0f); mFab.setRotation(-45.0f); mFab.animate().translationX(0.0f).translationY(0.0f).scaleX(1.0f).scaleY(1.0f).rotation(0.0f) .setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR) .setDuration(300L).setListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator animation) { mInAnimation = false; } }).start(); } }); animator.start(); }