Java Code Examples for android.view.animation.ScaleAnimation#setFillEnabled()

The following examples show how to use android.view.animation.ScaleAnimation#setFillEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicRotationGuideView.java    From AndroidStudyDemo with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 中间的View动画播放
 */
private void playCenter() {
    AnimationSet animationSet = new AnimationSet(false);
    ScaleAnimation scaleSmall = new ScaleAnimation(1.0f, 0.6f, 1.0f, 0.6f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    ScaleAnimation scaleBig = new ScaleAnimation(1.0f, 5.0f/3, 1.0f, 5.0f/3,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleBig.setDuration(2*1000);
    scaleBig.setInterpolator(interpolator);
    scaleSmall.setDuration(2*1000);
    scaleSmall.setStartOffset(2*1000);
    scaleSmall.setRepeatCount(-1);
    scaleSmall.setFillEnabled(true);
    scaleSmall.setFillAfter(true);
    scaleBig.setStartOffset(2*1000);
    scaleBig.setRepeatCount(-1);
    scaleBig.setFillEnabled(true);
    scaleBig.setFillAfter(true);
    scaleSmall.setInterpolator(interpolator);
    animationSet.addAnimation(scaleBig);
    animationSet.addAnimation(scaleSmall);
    center.startAnimation(animationSet);
}
 
Example 2
Source File: HeadImageView.java    From glass_snippets with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void setScaleFactor(float factor) {
  if (getAnimation() != null && !getAnimation().hasEnded())
    getAnimation().cancel();
  
  if (factor < 1)
    factor=1;
  
  deactivate();
  
  ScaleAnimation a = new ScaleAnimation(mScaleFactor, factor, mScaleFactor, factor,
      Animation.RELATIVE_TO_SELF, .5F, Animation.RELATIVE_TO_SELF, .5F);

  a.setDuration(500);
  a.setFillAfter(true);
  a.setFillEnabled(true);
  setAnimation(a);

  mScaleFactor = factor;
  MAX_SCROLL_X = MAX_SCROLL_Y = null;
  
  activate();
}
 
Example 3
Source File: AnimUtils.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
public static ScaleAnimation getScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY, pivotXType, pivotXValue, pivotYType, pivotYValue);
    scaleAnimation.setDuration(300L);
    scaleAnimation.setFillEnabled(true);
    scaleAnimation.setFillAfter(true);
    return scaleAnimation;
}
 
Example 4
Source File: EffectsButton.java    From In77Camera with MIT License 5 votes vote down vote up
ScaleAnimation createUpAnim() {
    ScaleAnimation localScaleAnimation = new ScaleAnimation(1.2F, 1.0F, 1.2F, 1.0F, 1, 0.5F, 1, 0.5F);
    localScaleAnimation.setDuration(50L);
    localScaleAnimation.setFillEnabled(true);
    localScaleAnimation.setFillEnabled(false);
    localScaleAnimation.setFillAfter(true);
    return localScaleAnimation;
}
 
Example 5
Source File: EffectsButton.java    From In77Camera with MIT License 5 votes vote down vote up
ScaleAnimation createDownAnim() {
    ScaleAnimation localScaleAnimation = new ScaleAnimation(1.0F, 1.2F, 1.0F, 1.2F, 1, 0.5F, 1, 0.5F);
    localScaleAnimation.setDuration(50L);
    localScaleAnimation.setFillEnabled(true);
    localScaleAnimation.setFillBefore(false);
    localScaleAnimation.setFillAfter(true);
    return localScaleAnimation;
}
 
Example 6
Source File: EffectsButton.java    From Fatigue-Detection with MIT License 5 votes vote down vote up
ScaleAnimation createUpAnim() {
    ScaleAnimation localScaleAnimation = new ScaleAnimation(1.2F, 1.0F, 1.2F, 1.0F, 1, 0.5F, 1, 0.5F);
    localScaleAnimation.setDuration(50L);
    localScaleAnimation.setFillEnabled(true);
    localScaleAnimation.setFillEnabled(false);
    localScaleAnimation.setFillAfter(true);
    return localScaleAnimation;
}
 
Example 7
Source File: EffectsButton.java    From Fatigue-Detection with MIT License 5 votes vote down vote up
ScaleAnimation createDownAnim() {
    ScaleAnimation localScaleAnimation = new ScaleAnimation(1.0F, 1.2F, 1.0F, 1.2F, 1, 0.5F, 1, 0.5F);
    localScaleAnimation.setDuration(50L);
    localScaleAnimation.setFillEnabled(true);
    localScaleAnimation.setFillBefore(false);
    localScaleAnimation.setFillAfter(true);
    return localScaleAnimation;
}
 
Example 8
Source File: Animations.java    From droidconat-2016 with Apache License 2.0 5 votes vote down vote up
public static void scale(View view, float ratioFrom, float ratioTo, long durationMillis) {
    ScaleAnimation anim = new ScaleAnimation(ratioFrom, ratioTo, ratioFrom, ratioTo, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    anim.setFillBefore(true);
    anim.setFillAfter(true);
    anim.setFillEnabled(true);
    anim.setDuration(durationMillis);
    anim.setInterpolator(new OvershootInterpolator());
    view.startAnimation(anim);
}
 
Example 9
Source File: MapActions.java    From PocketMaps with MIT License 5 votes vote down vote up
/**
 * start button: control button handler FAB
 */

private void initControlBtnHandler() {
    final ScaleAnimation anim = new ScaleAnimation(0, 1, 0, 1);
    anim.setFillBefore(true);
    anim.setFillAfter(true);
    anim.setFillEnabled(true);
    anim.setDuration(300);
    anim.setInterpolator(new OvershootInterpolator());

    controlBtn.setOnClickListener(new View.OnClickListener() {
        @Override public void onClick(View v) {
            if (isMenuVisible()) {
                setMenuVisible(false);
                sideBarMenuVP.setVisibility(View.INVISIBLE);
                favourBtn.setVisibility(View.INVISIBLE);
                settingsBtn.setVisibility(View.INVISIBLE);
                controlBtn.setImageResource(R.drawable.ic_keyboard_arrow_up_white_24dp);
                controlBtn.startAnimation(anim);
            } else {
                setMenuVisible(true);
                sideBarMenuVP.setVisibility(View.VISIBLE);
                favourBtn.setVisibility(View.VISIBLE);
                settingsBtn.setVisibility(View.VISIBLE);
                controlBtn.setImageResource(R.drawable.ic_keyboard_arrow_down_white_24dp);
                controlBtn.startAnimation(anim);
            }
        }
    });
}
 
Example 10
Source File: DragDropGrid.java    From android-draggable-viewpager with Apache License 2.0 5 votes vote down vote up
private void animateDragged() {

        ScaleAnimation scale = new ScaleAnimation(1f, 1.4f, 1f, 1.4f, displayWidth / 2, ROW_HEIGHT / 2);
        scale.setDuration(200);
        scale.setFillAfter(true);
        scale.setFillEnabled(true);

        if (aViewIsDragged()) {
            View draggedView = getDraggedView();
//			Log.e("animateDragged", ((TextView)draggedView.findViewWithTag("text")).getText().toString());

            draggedView.clearAnimation();
            draggedView.startAnimation(scale);
        }
    }