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.example.leebeomwoo.viewbody_final.MainActivity.java

public static void startAlphaAnimation(View v, long duration, int visibility) {
    AlphaAnimation alphaAnimation = (visibility == View.VISIBLE) ? new AlphaAnimation(0f, 1f)
            : new AlphaAnimation(1f, 0f);
    alphaAnimation.setDuration(duration);
    alphaAnimation.setFillAfter(true);
    v.startAnimation(alphaAnimation);//www  . j av a2  s  . c o  m
}

From source file:com.eutectoid.dosomething.picker.PickerFragment.java

private static void setAlpha(View view, float alpha) {
    // Set the alpha appropriately (setAlpha is API >= 11, this technique works on all API levels).
    AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha);
    alphaAnimation.setDuration(0);//from   w ww.  ja v  a 2  s  . com
    alphaAnimation.setFillAfter(true);
    view.startAnimation(alphaAnimation);
}

From source file:com.todoroo.astrid.helper.ProgressBarSyncResultCallback.java

@Override
public void started() {
    if (providers.incrementAndGet() == 1) {
        activity.runOnUiThread(new Runnable() {
            @Override/*from  w w  w.  j a  v  a  2 s  .  c o m*/
            public void run() {
                progressBar.setVisibility(View.VISIBLE);
                AlphaAnimation animation = new AlphaAnimation(0, 1);
                animation.setFillAfter(true);
                animation.setDuration(1000L);
                progressBar.startAnimation(animation);
            }
        });
    }
}

From source file:com.nikola.despotoski.drawerlayouttoggles.FadingDrawerToggle.java

@SuppressLint("NewApi")
@Override// ww w  .  j av a 2  s  .c o m
public void onDrawerSlide(View drawerView, float slideOffset) {
    if (!mEnabled)
        return;
    float currentViewAlpha = slideOffset * MAX_VIEW_ALPHA;
    float currentDrawableAlpha = slideOffset * MAX_DRAWABLE_ALPHA;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        drawerView.setAlpha(currentViewAlpha);
    } else {
        AlphaAnimation alphaAnimation = new AlphaAnimation(mPreviousViewAlpha, currentViewAlpha);
        alphaAnimation.setFillAfter(true);
        alphaAnimation.setDuration(0);
        drawerView.startAnimation(alphaAnimation);
        mPreviousViewAlpha = currentViewAlpha;
    }
    drawerView.getBackground().setAlpha((int) currentDrawableAlpha);

}

From source file:com.todoroo.astrid.helper.ProgressBarSyncResultCallback.java

@Override
public void finished() {
    if (providers.decrementAndGet() == 0) {
        activity.runOnUiThread(new Runnable() {
            @Override//w ww .  ja v  a  2 s.c om
            public void run() {
                try {
                    progressBar.setMax(100);
                    progressBar.setProgress(100);
                    AlphaAnimation animation = new AlphaAnimation(1, 0);
                    animation.setFillAfter(true);
                    animation.setDuration(1000L);
                    progressBar.startAnimation(animation);

                    onFinished.run();
                } catch (Exception e) {
                    // ignore, view could have been destroyed
                }
            }
        });
        new Thread() {
            @Override
            public void run() {
                AndroidUtilities.sleepDeep(1000);
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            progressBar.setVisibility(View.GONE);
                        } catch (Exception e) {
                            // ignore
                        }
                    }
                });
            }
        }.start();
    }
}

From source file:org.ohmage.prompts.SurveyItemFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.prompt_basic, container, false);
    ((TextView) view.findViewById(R.id.text)).setText(getPromptText());
    mButtons = view.findViewById(R.id.buttons);
    skipButton = (TextView) view.findViewById(R.id.skip);
    okButton = (TextView) view.findViewById(R.id.ok);

    okButton.setOnClickListener(new OnClickListener() {
        @Override// w  w  w.  j  ava2 s  .c  om
        public void onClick(View v) {
            mAnswered = true;
            onOkPressed();
        }
    });
    skipButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAnswered = true;
            onSkipPressed();
        }
    });

    if (isSkippable()) {
        skipButton.setVisibility(View.VISIBLE);
    } else {
        skipButton.setVisibility(View.GONE);
    }

    if (isAnswered()) {
        mButtons.setVisibility(View.GONE);
    } else {
        updateCanContinue();
    }

    onCreatePromptView(inflater, (ViewGroup) view.findViewById(R.id.content), savedInstanceState);

    // Fade the prompt in
    if (!isAnswered()) {
        AlphaAnimation aa = new AlphaAnimation(0f, 1f);
        aa.setFillAfter(true);
        aa.setDuration(200);
        view.startAnimation(aa);
    }

    return view;
}

From source file:com.hookedonplay.decoviewsample.SampleFit2Fragment.java

private void showAvatar(boolean show, View view) {
    AlphaAnimation animation = new AlphaAnimation(show ? 0.0f : 1.0f, show ? 1.0f : 0.0f);
    animation.setDuration(2000);/*from   w w w.j ava  2  s  .c o m*/
    animation.setFillAfter(true);
    view.startAnimation(animation);
}

From source file:com.hookedonplay.decoviewsample.SamplePeopleFragment.java

private void showAvatar(boolean show, View view) {
    AlphaAnimation animation = new AlphaAnimation(show ? 0.0f : 1.0f, show ? 1.0f : 0.0f);
    animation.setDuration(1000);/*  w  w w  .  j  a  v a 2 s . c  o  m*/
    animation.setFillAfter(true);
    view.startAnimation(animation);
}

From source file:com.charbgr.BlurNavigationDrawer.v4.BlurActionBarDrawerToggle.java

private void setAlpha(View view, float alpha, long durationMillis) {
    if (Build.VERSION.SDK_INT < 11) {
        final AlphaAnimation animation = new AlphaAnimation(alpha, alpha);
        animation.setDuration(durationMillis);
        animation.setFillAfter(true);
        view.startAnimation(animation);/*from   ww  w.j av  a 2  s.  c  o m*/
    } else {
        view.setAlpha(alpha);
    }
}

From source file:com.justwayward.reader.view.recyclerview.adapter.BaseViewHolder.java

public BaseViewHolder setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getView(viewId).setAlpha(value);
    } else {//ww  w  .  java2s. c  om
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}