use of android.view.animation.Animation.AnimationListener in project android_packages_apps_Camera by CyanogenMod.
the class PieRenderer method openCurrentItem.
private void openCurrentItem() {
if ((mCurrentItem != null) && mCurrentItem.hasItems()) {
mCurrentItem.setSelected(false);
mOpenItem = mCurrentItem;
mOpening = true;
mXFade = new LinearAnimation(1, 0);
mXFade.setDuration(PIE_XFADE_DURATION);
mXFade.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mXFade = null;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
mXFade.startNow();
mOverlay.startAnimation(mXFade);
}
}
use of android.view.animation.Animation.AnimationListener in project android_packages_apps_Camera by CyanogenMod.
the class PieRenderer method fadeIn.
private void fadeIn() {
mFadeIn = new LinearAnimation(0, 1);
mFadeIn.setDuration(PIE_FADE_IN_DURATION);
mFadeIn.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mFadeIn = null;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
mFadeIn.startNow();
mOverlay.startAnimation(mFadeIn);
}
use of android.view.animation.Animation.AnimationListener in project android-toolbox by Knickedi.
the class ViewStateFlipper method initialize.
// PRIVATE ====================================================================================
private void initialize(AttributeSet attrs) {
mCachedState = new ImageView(getContext());
mCachedState.setVisibility(View.GONE);
super.addView(mCachedState, -1, new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
mAnimationListener = new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mCachedState.setVisibility(View.GONE);
}
};
if (attrs == null) {
return;
}
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ViewStateFlipper);
int res;
if ((res = a.getResourceId(R.styleable.ViewStateFlipper_animationIn, 0)) != 0) {
setAnimation(AnimType.IN, AnimationUtils.loadAnimation(getContext(), res));
}
if ((res = a.getResourceId(R.styleable.ViewStateFlipper_animationOut, 0)) != 0) {
setAnimation(AnimType.OUT, AnimationUtils.loadAnimation(getContext(), res));
}
if ((res = a.getResourceId(R.styleable.ViewStateFlipper_animationReverseIn, 0)) != 0) {
setAnimation(AnimType.IN_REVERSE, AnimationUtils.loadAnimation(getContext(), res));
}
if ((res = a.getResourceId(R.styleable.ViewStateFlipper_animationReverseOut, 0)) != 0) {
setAnimation(AnimType.OUT_REVERSE, AnimationUtils.loadAnimation(getContext(), res));
}
a.recycle();
}
use of android.view.animation.Animation.AnimationListener in project Android-SlideExpandableListView by tjerkw.
the class AbstractSlideExpandableListAdapter method animateView.
/**
* Performs either COLLAPSE or EXPAND animation on the target view
* @param target the view to animate
* @param type the animation type, either ExpandCollapseAnimation.COLLAPSE
* or ExpandCollapseAnimation.EXPAND
*/
private void animateView(final View target, final int type) {
Animation anim = new ExpandCollapseAnimation(target, type);
anim.setDuration(getAnimationDuration());
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (type == ExpandCollapseAnimation.EXPAND) {
if (parent instanceof ListView) {
ListView listView = (ListView) parent;
int movement = target.getBottom();
Rect r = new Rect();
boolean visible = target.getGlobalVisibleRect(r);
Rect r2 = new Rect();
listView.getGlobalVisibleRect(r2);
if (!visible) {
listView.smoothScrollBy(movement, getAnimationDuration());
} else {
if (r2.bottom == r.bottom) {
listView.smoothScrollBy(movement, getAnimationDuration());
}
}
}
}
}
});
target.startAnimation(anim);
}
use of android.view.animation.Animation.AnimationListener in project StandOut by pingpongboss.
the class StandOutWindow method hide.
/**
* Hide a window corresponding to the id. Show a notification for the hidden
* window.
*
* @param id
* The id of the window.
*/
public final synchronized void hide(int id) {
// get the view corresponding to the id
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to hide(" + id + ") a null window.");
}
// alert callbacks and cancel if instructed
if (onHide(id, window)) {
Log.d(TAG, "Window " + id + " hide cancelled by implementation.");
return;
}
// ignore if window is already hidden
if (window.visibility == Window.VISIBILITY_GONE) {
Log.d(TAG, "Window " + id + " is already hidden.");
}
// check if hide enabled
if (Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_HIDE_ENABLE)) {
window.visibility = Window.VISIBILITY_TRANSITION;
// get the hidden notification for this view
Notification notification = getHiddenNotification(id);
// get animation
Animation animation = getHideAnimation(id);
try {
// animate
if (animation != null) {
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// remove the window from the window manager
mWindowManager.removeView(window);
window.visibility = Window.VISIBILITY_GONE;
}
});
window.getChildAt(0).startAnimation(animation);
} else {
// remove the window from the window manager
mWindowManager.removeView(window);
}
} catch (Exception ex) {
ex.printStackTrace();
}
// display the notification
notification.flags = notification.flags | Notification.FLAG_NO_CLEAR | Notification.FLAG_AUTO_CANCEL;
mNotificationManager.notify(getClass().hashCode() + id, notification);
} else {
// if hide not enabled, close window
close(id);
}
}
Aggregations