use of android.view.animation.AnimationSet in project KJFrameForAndroid by kymjs.
the class KJAnimations method openLoginAnim.
public static void openLoginAnim(View v) {
AnimationSet set = new AnimationSet(true);
v.measure(0, 0);
set.addAnimation(getTranslateAnimation(0, 0, v.getMeasuredHeight(), 0, 600));
set.addAnimation(getAlphaAnimation(0.8F, 1, 600));
v.setAnimation(set);
}
use of android.view.animation.AnimationSet in project KJFrameForAndroid by kymjs.
the class KJAnimations method clickCurtain.
public static void clickCurtain(View v) {
AnimationSet set = new AnimationSet(false);
Animation anim1 = getTranslateAnimation(0, 0, 0, -50, 110);
Animation anim2 = getTranslateAnimation(0, 0, -50, 0, 80);
Animation anim3 = getTranslateAnimation(0, 0, 0, -25, 25);
Animation anim4 = getTranslateAnimation(0, 0, -25, 0, 25);
anim1.setStartOffset(20);
anim2.setStartOffset(230);
anim3.setStartOffset(360);
anim4.setStartOffset(400);
set.addAnimation(anim1);
set.addAnimation(anim2);
set.addAnimation(anim3);
set.addAnimation(anim4);
v.startAnimation(set);
}
use of android.view.animation.AnimationSet in project KJFrameForAndroid by kymjs.
the class KJAnimations method closeAnimation.
/**
* 关闭的动画
*
* @param relativeLayout
* 子菜单容器
* @param background
* 子菜单背景
* @param menu
* 菜单按钮
* @param durationMillis
* 动画时间
*/
public static void closeAnimation(final RelativeLayout relativeLayout, final ImageView menu, long durationMillis) {
for (int i = 1; i < relativeLayout.getChildCount(); i++) {
ImageView imageView = null;
if (relativeLayout.getChildAt(i) instanceof ImageView) {
imageView = (ImageView) relativeLayout.getChildAt(i);
} else {
continue;
}
AnimationSet set = new AnimationSet(true);
set.addAnimation(getRotateAnimation(0, -360, durationMillis));
set.addAnimation(getAlphaAnimation(1.0f, 0.5f, durationMillis));
set.addAnimation(getTranslateAnimation(0, menu.getLeft() - imageView.getLeft(), 0, menu.getTop() - imageView.getTop(), durationMillis));
set.setFillAfter(true);
set.setDuration(durationMillis);
set.setStartOffset(((relativeLayout.getChildCount() - i) * 100) / (-1 + relativeLayout.getChildCount()));
set.setInterpolator(new AnticipateInterpolator(1f));
set.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation arg0) {
}
@Override
public void onAnimationRepeat(Animation arg0) {
}
@Override
public void onAnimationEnd(Animation arg0) {
relativeLayout.setVisibility(View.GONE);
}
});
imageView.startAnimation(set);
}
}
use of android.view.animation.AnimationSet in project android-satellite-menu by siyamed.
the class SatelliteAnimationCreator method createItemOutAnimation.
public static Animation createItemOutAnimation(Context context, int index, long expandDuration, int x, int y) {
AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
long alphaDuration = 60;
if (expandDuration < 60) {
alphaDuration = expandDuration / 4;
}
alphaAnimation.setDuration(alphaDuration);
alphaAnimation.setStartOffset(0);
TranslateAnimation translate = new TranslateAnimation(0, x, 0, y);
translate.setStartOffset(0);
translate.setDuration(expandDuration);
translate.setInterpolator(context, R.anim.sat_item_overshoot_interpolator);
RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setInterpolator(context, R.anim.sat_item_out_rotate_interpolator);
long duration = 100;
if (expandDuration <= 150) {
duration = expandDuration / 3;
}
rotate.setDuration(expandDuration - duration);
rotate.setStartOffset(duration);
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(false);
animationSet.setFillBefore(true);
animationSet.setFillEnabled(true);
//animationSet.addAnimation(alphaAnimation);
//animationSet.addAnimation(rotate);
animationSet.addAnimation(translate);
animationSet.setStartOffset(30 * index);
return animationSet;
}
use of android.view.animation.AnimationSet in project platform_frameworks_base by android.
the class ListWithDisappearingItemBug method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toast.makeText(this, "Make sure you rotate screen to see bug", Toast.LENGTH_LONG).show();
// Get a cursor with all people
Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
startManagingCursor(c);
ListAdapter adapter = new SimpleCursorAdapter(this, // Use a template that displays a text view
R.layout.list_with_disappearing_item_bug_item, // Give the cursor to the list adatper
c, // Map the NAME column in the people database to...
new String[] { People.NAME }, // The "text1" view defined in the XML template
new int[] { R.id.text1 });
setListAdapter(adapter);
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(50);
set.addAnimation(animation);
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setDuration(100);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f);
ListView listView = getListView();
listView.setLayoutAnimation(controller);
}
Aggregations