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
}
}
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
}
}
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);
}
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);
}
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;
}
Aggregations