Search in sources :

Example 61 with AnimationSet

use of android.view.animation.AnimationSet in project c-geo by just-radovan.

the class cgCacheListAdapter method moveLeft.

private void moveLeft(cgCacheView holder, cgCache cache, boolean force) {
    if (cache == null) {
        return;
    }
    try {
        holder.checkbox.setChecked(cache.statusChecked);
        // slide cache info
        Animation hideCheckbox = new TranslateAnimation((int) (SWIPE_DISTANCE * pixelDensity), 0, 0, 0);
        hideCheckbox.setRepeatCount(0);
        if (force == true) {
            hideCheckbox.setDuration(0);
        } else {
            hideCheckbox.setDuration(400);
        }
        hideCheckbox.setFillEnabled(true);
        hideCheckbox.setFillAfter(true);
        hideCheckbox.setInterpolator(new AccelerateDecelerateInterpolator());
        // brighten cache info
        Animation brightenInfo = new AlphaAnimation(SWIPE_OPACITY, 1.0f);
        brightenInfo.setRepeatCount(0);
        if (force == true) {
            brightenInfo.setDuration(0);
        } else {
            brightenInfo.setDuration(400);
        }
        brightenInfo.setFillEnabled(true);
        brightenInfo.setFillAfter(true);
        brightenInfo.setInterpolator(new AccelerateDecelerateInterpolator());
        // animation set (container)
        AnimationSet selectAnimation = new AnimationSet(true);
        selectAnimation.setFillEnabled(true);
        selectAnimation.setFillAfter(true);
        selectAnimation.addAnimation(hideCheckbox);
        selectAnimation.addAnimation(brightenInfo);
        holder.oneInfo.startAnimation(selectAnimation);
        cache.statusCheckedView = false;
    } catch (Exception e) {
    // nothing
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 62 with AnimationSet

use of android.view.animation.AnimationSet in project c-geo by just-radovan.

the class cgCacheListAdapter method moveRight.

private void moveRight(cgCacheView holder, cgCache cache, boolean force) {
    if (cache == null) {
        return;
    }
    try {
        holder.checkbox.setChecked(cache.statusChecked);
        // slide cache info
        Animation showCheckbox = new TranslateAnimation(0, (int) (SWIPE_DISTANCE * pixelDensity), 0, 0);
        showCheckbox.setRepeatCount(0);
        if (force == true) {
            showCheckbox.setDuration(0);
        } else {
            showCheckbox.setDuration(400);
        }
        showCheckbox.setFillEnabled(true);
        showCheckbox.setFillAfter(true);
        showCheckbox.setInterpolator(new AccelerateDecelerateInterpolator());
        // dim cache info
        Animation dimInfo = new AlphaAnimation(1.0f, SWIPE_OPACITY);
        dimInfo.setRepeatCount(0);
        if (force == true) {
            dimInfo.setDuration(0);
        } else {
            dimInfo.setDuration(400);
        }
        dimInfo.setFillEnabled(true);
        dimInfo.setFillAfter(true);
        dimInfo.setInterpolator(new AccelerateDecelerateInterpolator());
        // animation set (container)
        AnimationSet selectAnimation = new AnimationSet(true);
        selectAnimation.setFillEnabled(true);
        selectAnimation.setFillAfter(true);
        selectAnimation.addAnimation(showCheckbox);
        selectAnimation.addAnimation(dimInfo);
        holder.oneInfo.startAnimation(selectAnimation);
        cache.statusCheckedView = true;
    } catch (Exception e) {
    // nothing
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 63 with AnimationSet

use of android.view.animation.AnimationSet in project OneClickAndroid by cyngn.

the class HTCFastBootActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OneClickStats.sendEvent(this, OneClickStats.Categories.PAGE_SHOWN, OneClickStats.Actions.PAGE_HTC_FASTBOOT);
    if (fastBootIsDisabled()) {
        startActivity(new Intent(getBaseContext(), UnplugDeviceActivity.class));
        finish();
        return;
    }
    setContentView(R.layout.htc_fast_boot);
    ImageView instructionView = (ImageView) findViewById(R.id.htc_fast_boot_instructions);
    DecelerateInterpolator interpolator = new DecelerateInterpolator(2.0f);
    AnimationSet instructionAnimations = new AnimationSet(true);
    instructionAnimations.setInterpolator(interpolator);
    TranslateAnimation instructionMoveAnimation = new TranslateAnimation(0, 0, 250, 0);
    instructionMoveAnimation.setDuration(1000);
    instructionMoveAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionMoveAnimation);
    // we want them to read the instructions first! so we give them a few seconds
    AlphaAnimation instructionFadeAnimation = new AlphaAnimation(0.0f, 1.0f);
    instructionFadeAnimation.setDuration(1000);
    instructionFadeAnimation.setStartOffset(500);
    instructionFadeAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionFadeAnimation);
    instructionView.setAnimation(instructionAnimations);
    // continue button should take even longer
    AlphaAnimation buttonAnimation = new AlphaAnimation(0.0f, 1.0f);
    buttonAnimation.setDuration(750);
    buttonAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    buttonAnimation.setStartOffset(1000);
    findViewById(R.id.next).setAnimation(buttonAnimation);
    OnClickListener openHtcFastBootListener = new OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setComponent(htcPowerManager);
            try {
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.BUTTON_CLICK, OneClickStats.Actions.BTN_HTC_FASTBOOT);
                startActivity(intent);
                startService(new Intent(getBaseContext(), HTCFastBootMonitorService.class));
            } catch (ActivityNotFoundException e) {
                // we want to know if this happens, right?
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.SWITCH_ERROR, OneClickStats.Actions.ERR_HTC_FASTBOOT);
            }
        }
    };
    findViewById(R.id.next).setOnClickListener(openHtcFastBootListener);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ActivityNotFoundException(android.content.ActivityNotFoundException) TranslateAnimation(android.view.animation.TranslateAnimation) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) ImageView(android.widget.ImageView) AnimationSet(android.view.animation.AnimationSet) ImageView(android.widget.ImageView) View(android.view.View) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 64 with AnimationSet

use of android.view.animation.AnimationSet in project OneClickAndroid by cyngn.

the class PtpActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OneClickStats.sendEvent(this, OneClickStats.Categories.PAGE_SHOWN, OneClickStats.Actions.PAGE_PTP);
    if (ptpIsEnabled()) {
        startActivity(new Intent(getBaseContext(), HTCFastBootActivity.class));
        finish();
        return;
    }
    setContentView(R.layout.ptp);
    ImageView instructionView = (ImageView) findViewById(R.id.ptp_instructions);
    DecelerateInterpolator interpolator = new DecelerateInterpolator(2.0f);
    AnimationSet instructionAnimations = new AnimationSet(true);
    instructionAnimations.setInterpolator(interpolator);
    TranslateAnimation instructionMoveAnimation = new TranslateAnimation(0, 0, 250, 0);
    instructionMoveAnimation.setDuration(1000);
    instructionMoveAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionMoveAnimation);
    // we want them to read the instructions first! so we give them a few seconds
    AlphaAnimation instructionFadeAnimation = new AlphaAnimation(0.0f, 1.0f);
    instructionFadeAnimation.setDuration(1000);
    instructionFadeAnimation.setStartOffset(500);
    instructionFadeAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionFadeAnimation);
    instructionView.setAnimation(instructionAnimations);
    // continue button should take even longer
    AlphaAnimation buttonAnimation = new AlphaAnimation(0.0f, 1.0f);
    buttonAnimation.setDuration(750);
    buttonAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    buttonAnimation.setStartOffset(1000);
    findViewById(R.id.next).setAnimation(buttonAnimation);
    OnClickListener openPtpListener = new OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setClassName("com.android.settings", "com.android.settings.UsbSettings");
            try {
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.BUTTON_CLICK, OneClickStats.Actions.BTN_PTP);
                startActivity(intent);
                startService(new Intent(getBaseContext(), PtpMonitorService.class));
            } catch (ActivityNotFoundException e) {
                // we want to know if this happens, right?
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.SWITCH_ERROR, OneClickStats.Actions.ERR_PTP);
            }
        }
    };
    findViewById(R.id.next).setOnClickListener(openPtpListener);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ActivityNotFoundException(android.content.ActivityNotFoundException) TranslateAnimation(android.view.animation.TranslateAnimation) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) ImageView(android.widget.ImageView) AnimationSet(android.view.animation.AnimationSet) ImageView(android.widget.ImageView) View(android.view.View) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 65 with AnimationSet

use of android.view.animation.AnimationSet in project ArcMenu by daCapricorn.

the class ArcMenu method createItemDisapperAnimation.

private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
    animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));
    animationSet.setDuration(duration);
    animationSet.setInterpolator(new DecelerateInterpolator());
    animationSet.setFillAfter(true);
    return animationSet;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Aggregations

AnimationSet (android.view.animation.AnimationSet)118 AlphaAnimation (android.view.animation.AlphaAnimation)86 TranslateAnimation (android.view.animation.TranslateAnimation)75 Animation (android.view.animation.Animation)71 ScaleAnimation (android.view.animation.ScaleAnimation)69 ClipRectAnimation (android.view.animation.ClipRectAnimation)32 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)32 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)30 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)30 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)30 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)30 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)30 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)30 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)30 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)30 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)30 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)30 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)30 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)30 WindowAnimation_wallpaperCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation)30