Example usage for android.view.animation AlphaAnimation setFillAfter

List of usage examples for android.view.animation AlphaAnimation setFillAfter

Introduction

In this page you can find the example usage for android.view.animation AlphaAnimation setFillAfter.

Prototype

public void setFillAfter(boolean fillAfter) 

Source Link

Document

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

Usage

From source file:com.zhangyp.higo.drawingboard.fragment.SketchFragment.java

void setAlpha(View v, float alpha) {
    if (Build.VERSION.SDK_INT < 11) {
        AlphaAnimation animation = new AlphaAnimation(1.0F, alpha);
        animation.setFillAfter(true);
        v.startAnimation(animation);/*from  ww w.j  a  v a2 s .  c  o m*/
    } else {
        v.setAlpha(alpha);
    }

}

From source file:net.bither.fragment.hot.AddAddressHotHDMFragment.java

private void finalAnimation() {
    final int fadeDuration = 400;
    final int zoomDuration = 500;

    AlphaAnimation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setDuration(fadeDuration);//from   w w  w  .  jav  a  2s .c  o m
    fadeOut.setFillAfter(true);
    vBg.startAnimation(fadeOut);
    tvHot.startAnimation(fadeOut);
    tvCold.startAnimation(fadeOut);
    tvServer.startAnimation(fadeOut);
    if (llSingularRunning.getVisibility() == View.VISIBLE) {
        llSingularRunning.startAnimation(fadeOut);
    }
    flContainer.postDelayed(new Runnable() {
        @Override
        public void run() {
            vBg.setVisibility(View.GONE);
            tvHot.setVisibility(View.INVISIBLE);
            tvCold.setVisibility(View.INVISIBLE);
            tvServer.setVisibility(View.INVISIBLE);

            int[] size = getCompactContainerSize();
            WrapLayoutParamsForAnimator animWrapper = new WrapLayoutParamsForAnimator(flContainer);
            ObjectAnimator animatorWidth = ObjectAnimator.ofInt(animWrapper, "width", size[0])
                    .setDuration(zoomDuration);
            ObjectAnimator animatorHeight = ObjectAnimator.ofInt(animWrapper, "height", size[1])
                    .setDuration(zoomDuration);
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.playTogether(animatorWidth, animatorHeight);
            animatorSet.start();

            flContainer.postDelayed(new Runnable() {
                @Override
                public void run() {
                    Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.hdm_keychain_add_spin);
                    anim.setFillAfter(true);
                    flContainer.startAnimation(anim);

                    ArrayList<String> addresses = getAddresses();
                    Intent intent = new Intent();
                    intent.putExtra(BitherSetting.INTENT_REF.ADDRESS_POSITION_PASS_VALUE_TAG, addresses);
                    getActivity().setResult(Activity.RESULT_OK, intent);

                    flContainer.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (getActivity() != null) {
                                ((AddPrivateKeyActivity) getActivity()).save();
                            }
                        }
                    }, anim.getDuration());
                }
            }, zoomDuration);
        }
    }, fadeDuration);
}

From source file:com.cleanwiz.applock.ui.activity.LockMainActivity.java

private void initAnim() {

    long duration = 300;
    long durationS = 160;
    float alpha = 0.3f;
    AccelerateInterpolator accInterpolator = new AccelerateInterpolator();

    tab_left = new TranslateAnimation(tabW, 0, 0, 0);
    tab_right = new TranslateAnimation(0, tabW, 0, 0);
    tab_alpha_1 = new AlphaAnimation(1.0f, alpha);
    tab_alpha_2 = new AlphaAnimation(alpha, 1.0f);
    pop_in = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0);
    pop_out = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0);

    pop_in.setDuration(durationS);// w  w w . j a  v a2s .  c om
    pop_in.setInterpolator(accInterpolator);
    pop_in.setAnimationListener(new PopListener(popView, PopListener.TYPE_IN));

    pop_out.setDuration(durationS);
    pop_out.setInterpolator(accInterpolator);
    pop_out.setAnimationListener(new PopListener(popView, PopListener.TYPE_OUT));

    tab_left.setFillAfter(true);
    tab_left.setFillEnabled(true);
    tab_left.setDuration(duration);
    tab_left.setInterpolator(accInterpolator);

    tab_right.setFillAfter(true);
    tab_right.setFillEnabled(true);
    tab_right.setDuration(duration);
    tab_right.setInterpolator(accInterpolator);

    tab_alpha_1.setFillAfter(true);
    tab_alpha_1.setFillEnabled(true);
    tab_alpha_1.setDuration(duration);
    tab_alpha_1.setInterpolator(accInterpolator);

    tab_alpha_2.setFillAfter(true);
    tab_alpha_2.setFillEnabled(true);
    tab_alpha_2.setDuration(duration);
    tab_alpha_2.setInterpolator(accInterpolator);

    AlphaAnimation alphaInit = new AlphaAnimation(alpha, alpha);
    alphaInit.setFillAfter(true);
    alphaInit.setFillEnabled(true);
    tv_tab_box.startAnimation(alphaInit);
}

From source file:com.crearo.gpslogger.ui.fragments.display.GpsSimpleViewFragment.java

public void setSatelliteCount(int count) {
    ImageView imgSatelliteCount = (ImageView) rootView.findViewById(R.id.simpleview_imgSatelliteCount);
    TextView txtSatelliteCount = (TextView) rootView.findViewById(R.id.simpleview_txtSatelliteCount);

    if (count > -1) {
        setColor(imgSatelliteCount, IconColorIndicator.Good);

        AlphaAnimation fadeIn = new AlphaAnimation(0.6f, 1.0f);
        fadeIn.setDuration(1200);//from w  ww.  j  ava 2s. c  o m
        fadeIn.setFillAfter(true);
        txtSatelliteCount.startAnimation(fadeIn);
        txtSatelliteCount.setText(String.valueOf(count));
    } else {
        clearColor(imgSatelliteCount);
        txtSatelliteCount.setText("");
    }

}

From source file:com.kubotaku.android.sample.sensordataviewer.SensorDataActivity.java

private void setShowValueAnimation(View view) {
    final AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(750);//from  w ww. j a  v a  2s. c o  m
    alphaAnimation.setFillAfter(true);
    view.setAnimation(alphaAnimation);
}

From source file:com.cicada.yuanxiaobao.common.BaseAdapterHelper.java

/**
 * Add an action to set the alpha of a view. Can be called multiple times.
 * Alpha between 0-1.// w ww .  ja  v a  2 s. com
 */
public BaseAdapterHelper setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        retrieveView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        retrieveView(viewId).startAnimation(alpha);
    }
    return this;
}

From source file:com.devbrackets.android.exomedia.DefaultControls.java

/**
 * Performs the control visibility animation for showing or hiding
 * this view//from   w  w w .jav  a 2 s  .c o m
 *
 * @param toVisible True if the view should be visible at the end of the animation
 */
private void animateVisibility(boolean toVisible) {
    if (isVisible == toVisible) {
        return;
    }

    float startAlpha = toVisible ? 0 : 1;
    float endAlpha = toVisible ? 1 : 0;

    AlphaAnimation animation = new AlphaAnimation(startAlpha, endAlpha);
    animation.setDuration(CONTROL_VISIBILITY_ANIMATION_LENGTH);
    animation.setFillAfter(true);
    startAnimation(animation);

    isVisible = toVisible;
    onVisibilityChanged();
}

From source file:git.egatuts.nxtremotecontroller.fragment.OnlineControllerFragment.java

public AlphaAnimation getShowAnimation(final View view0, final long time) {
    AlphaAnimation show = new AlphaAnimation(0.0f, 1.0f);
    show.setFillAfter(true);
    show.setDuration(time);//from   w  w w  . j  ava2  s .c  o  m
    show.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            view0.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    return show;
}

From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java

public void animateExit() {
    RelativeLayout layout = (RelativeLayout) findViewById(R.id.map_layout);
    AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
    animation.setFillAfter(true);
    animation.setDuration(1000);/*from   w  w  w  . j a  v a2s. c  o  m*/
    //apply the animation ( fade In ) to your LAyout
    layout.startAnimation(animation);

}

From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java

public void fadeSplashScreen() {
    // Set Runnable to remove splash screen just in case
    final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override//from w ww  .ja  va2  s  .c  om
        public void run() {
            removeSplashScreen();
        }
    }, 1000);

    if (!permissionJustGranted) {
        RelativeLayout layout = (RelativeLayout) findViewById(R.id.map_layout);
        AlphaAnimation animation = new AlphaAnimation(-2f, 1.0f);
        animation.setFillAfter(true);
        animation.setDuration(1500);

        //apply the animation ( fade In ) to your LAyout
        layout.startAnimation(animation);
    }

}