use of android.view.animation.Animation.AnimationListener in project Fairphone by Kwamecorp.
the class PeaceOfMindActivity method scrollEnded.
@Override
public synchronized void scrollEnded(float percentage) {
if (mTotalTimeText.getVisibility() == View.VISIBLE) {
Animation fadeOut = AnimationUtils.loadAnimation(this, R.anim.fade_out_fast);
mTotalTimeText.startAnimation(fadeOut);
fadeOut.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mTotalTimeText.setVisibility(View.INVISIBLE);
updateScreenTexts();
}
});
}
long targetTime = roundToInterval((long) (percentage * PeaceOfMindStats.MAX_TIME));
Intent intent = new Intent(getApplicationContext(), PeaceOfMindBroadCastReceiver.class);
intent.setAction(PeaceOfMindActivity.UPDATE_PEACE_OF_MIND);
intent.putExtra(PeaceOfMindActivity.BROADCAST_TARGET_PEACE_OF_MIND, targetTime);
FlurryAgent.logEvent(FlurryHelper.PEACE_OF_MIND_SET_TIME, FlurryHelper.getInstance().setFlurryParams("Target Time", "" + targetTime, true));
sendBroadcast(intent);
}
use of android.view.animation.Animation.AnimationListener in project MaterialDesignLibrary by navasmdc.
the class ColorSelector method dismiss.
@Override
public void dismiss() {
Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
view.post(new Runnable() {
@Override
public void run() {
ColorSelector.super.dismiss();
}
});
}
});
Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
view.startAnimation(anim);
backView.startAnimation(backAnim);
}
use of android.view.animation.Animation.AnimationListener in project MaterialDesignLibrary by navasmdc.
the class ProgressDialog method dismiss.
@Override
public void dismiss() {
Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
view.post(new Runnable() {
@Override
public void run() {
ProgressDialog.super.dismiss();
}
});
}
});
Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
view.startAnimation(anim);
backView.startAnimation(backAnim);
}
use of android.view.animation.Animation.AnimationListener in project ABPlayer by winkstu.
the class MediaController method initResources.
@SuppressLint("NewApi")
private void initResources() {
mHandler = new MHandler(this);
mAM = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mMaxVolume = mAM.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
mGestures = new CommonGestures(mContext);
mGestures.setTouchListener(mTouchListener, true);
mAnimSlideOutBottom = AnimationUtils.loadAnimation(mContext, R.anim.slide_out_bottom);
mAnimSlideOutTop = AnimationUtils.loadAnimation(mContext, R.anim.slide_out_top);
mAnimSlideInBottom = AnimationUtils.loadAnimation(mContext, R.anim.slide_in_bottom);
mAnimSlideInTop = AnimationUtils.loadAnimation(mContext, R.anim.slide_in_top);
mAnimSlideOutBottom.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mMediaController.setVisibility(View.GONE);
showButtons(false);
mHandler.removeMessages(MSG_HIDE_SYSTEM_UI);
mHandler.sendEmptyMessageDelayed(MSG_HIDE_SYSTEM_UI, DEFAULT_TIME_OUT);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
removeAllViews();
mRoot = inflateLayout();
mWindow.setContentView(mRoot);
mWindow.setWidth(android.view.ViewGroup.LayoutParams.MATCH_PARENT);
mWindow.setHeight(android.view.ViewGroup.LayoutParams.MATCH_PARENT);
findViewItems(mRoot);
showSystemUi(false);
if (DeviceUtils.hasHoneycomb()) {
mRoot.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
mHandler.sendEmptyMessageDelayed(MSG_HIDE_SYSTEM_UI, DEFAULT_TIME_OUT);
}
}
});
}
}
use of android.view.animation.Animation.AnimationListener in project android_frameworks_base by DirtyUnicorns.
the class SlidingTab method startAnimating.
void startAnimating(final boolean holdAfter) {
mAnimating = true;
final Animation trans1;
final Animation trans2;
final Slider slider = mCurrentSlider;
final Slider other = mOtherSlider;
final int dx;
final int dy;
if (isHorizontal()) {
int right = slider.tab.getRight();
int width = slider.tab.getWidth();
int left = slider.tab.getLeft();
int viewWidth = getWidth();
// how much of tab to show at the end of anim
int holdOffset = holdAfter ? 0 : width;
dx = slider == mRightSlider ? -(right + viewWidth - holdOffset) : (viewWidth - left) + viewWidth - holdOffset;
dy = 0;
} else {
int top = slider.tab.getTop();
int bottom = slider.tab.getBottom();
int height = slider.tab.getHeight();
int viewHeight = getHeight();
// how much of tab to show at end of anim
int holdOffset = holdAfter ? 0 : height;
dx = 0;
dy = slider == mRightSlider ? (top + viewHeight - holdOffset) : -((viewHeight - bottom) + viewHeight - holdOffset);
}
trans1 = new TranslateAnimation(0, dx, 0, dy);
trans1.setDuration(ANIM_DURATION);
trans1.setInterpolator(new LinearInterpolator());
trans1.setFillAfter(true);
trans2 = new TranslateAnimation(0, dx, 0, dy);
trans2.setDuration(ANIM_DURATION);
trans2.setInterpolator(new LinearInterpolator());
trans2.setFillAfter(true);
trans1.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
Animation anim;
if (holdAfter) {
anim = new TranslateAnimation(dx, dx, dy, dy);
// plenty of time for transitions
anim.setDuration(1000);
mAnimating = false;
} else {
anim = new AlphaAnimation(0.5f, 1.0f);
anim.setDuration(ANIM_DURATION);
resetView();
}
anim.setAnimationListener(mAnimationDoneListener);
/* Animation can be the same for these since the animation just holds */
mLeftSlider.startAnimation(anim, anim);
mRightSlider.startAnimation(anim, anim);
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
}
});
slider.hideTarget();
slider.startAnimation(trans1, trans2);
}
Aggregations