Example usage for android.view View INVISIBLE

List of usage examples for android.view View INVISIBLE

Introduction

In this page you can find the example usage for android.view View INVISIBLE.

Prototype

int INVISIBLE

To view the source code for android.view View INVISIBLE.

Click Source Link

Document

This view is invisible, but it still takes up space for layout purposes.

Usage

From source file:Main.java

public static void postAnimationBottom(final View childLayout, int delay, final int duration) {
    int visibility = childLayout.getVisibility();
    if (visibility != View.VISIBLE) {
        return;/*from  www  .j  av  a  2 s.c  o m*/
    }
    childLayout.setVisibility(View.INVISIBLE);
    childLayout.postDelayed(new Runnable() {
        @Override
        public void run() {
            childLayout.setVisibility(View.VISIBLE);
            AnimationSet animationSet = new AnimationSet(true);
            animationSet.setDuration(duration);
            animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
            int pivotXType = Animation.RELATIVE_TO_SELF;
            animationSet.addAnimation(
                    new TranslateAnimation(pivotXType, 0, pivotXType, 0, pivotXType, 1, pivotXType, 0));
            animationSet.addAnimation(new AlphaAnimation(0, 1));
            childLayout.startAnimation(animationSet);
        }
    }, delay);
}

From source file:Main.java

public static void showEmpty(Context activity, boolean show, View emptyView) {
    if (emptyView != null) {

        Animation anim = AnimationUtils.loadAnimation(activity,
                show ? android.R.anim.fade_in : android.R.anim.fade_out);
        if (show && (emptyView.getVisibility() == View.GONE || emptyView.getVisibility() == View.INVISIBLE)) {
            emptyView.setAnimation(anim);
            emptyView.setVisibility(View.VISIBLE);
        } else if (!show && emptyView.getVisibility() == View.VISIBLE) {
            emptyView.setAnimation(anim);
            emptyView.setVisibility(View.GONE);
        }/*  w w w .j  a  v a 2s  .c om*/
    }
}

From source file:com.example.kyle.myapplication.MainActivity.java

private static void toggle(View... views) {
    for (View v : views) {
        boolean isVisible = v.getVisibility() == View.VISIBLE;
        v.setVisibility(isVisible ? View.INVISIBLE : View.VISIBLE);
    }//  w  ww.  java2s.c  o m
}

From source file:Main.java

private static AnimationListener getFadeOutListener(final View view) {
    final AnimationListener fadeOutListener = new AnimationListener() {

        public void onAnimationEnd(final Animation animation) {
            view.setVisibility(View.INVISIBLE);
        }// ww w  .  j a va 2  s  .  c  o m

        public void onAnimationRepeat(final Animation animation) {

        }

        public void onAnimationStart(final Animation animation) {

        }
    };

    return fadeOutListener;
}

From source file:Main.java

public static void setVisivilty(ImageView mArrow1, ImageView mArrow2, ImageView mArrow3, ImageView mArrow4,
        ImageView mArrow5, int position) {
    Arrow1 = mArrow1;/*  w  w  w .  jav  a2 s. co  m*/
    Arrow2 = mArrow2;
    Arrow3 = mArrow3;
    Arrow4 = mArrow4;
    Arrow5 = mArrow5;

    switch (position) {
    case 0:
        Arrow1.setVisibility(View.VISIBLE);
        Arrow2.setVisibility(View.INVISIBLE);
        Arrow3.setVisibility(View.INVISIBLE);
        Arrow4.setVisibility(View.INVISIBLE);
        Arrow5.setVisibility(View.INVISIBLE);
        break;
    case 1:
        Arrow1.setVisibility(View.INVISIBLE);
        Arrow2.setVisibility(View.VISIBLE);
        Arrow3.setVisibility(View.INVISIBLE);
        Arrow4.setVisibility(View.INVISIBLE);
        Arrow5.setVisibility(View.INVISIBLE);
        break;
    case 2:
        Arrow1.setVisibility(View.INVISIBLE);
        Arrow2.setVisibility(View.INVISIBLE);
        Arrow3.setVisibility(View.VISIBLE);
        Arrow4.setVisibility(View.INVISIBLE);
        Arrow5.setVisibility(View.INVISIBLE);
        break;
    case 3:
        Arrow1.setVisibility(View.INVISIBLE);
        Arrow2.setVisibility(View.INVISIBLE);
        Arrow3.setVisibility(View.INVISIBLE);
        Arrow4.setVisibility(View.VISIBLE);
        Arrow5.setVisibility(View.INVISIBLE);
        break;
    case 4:
        Arrow1.setVisibility(View.INVISIBLE);
        Arrow2.setVisibility(View.INVISIBLE);
        Arrow3.setVisibility(View.INVISIBLE);
        Arrow4.setVisibility(View.INVISIBLE);
        Arrow5.setVisibility(View.VISIBLE);
        break;
    default:
        break;
    }

}

From source file:Main.java

public static void hide(final View view, final boolean makeInvisible) {
    if (Build.VERSION.SDK_INT >= 11) {
        final Animation animation = new Animation() {
            @TargetApi(11)//from  w w w .ja  v a  2s. co  m
            @Override
            protected void applyTransformation(final float interpolatedTime, final Transformation t) {
                view.setAlpha(1.f - interpolatedTime);
            }
        };

        animation.setDuration(ANIMATION_DURATION);
        // return animation;
        view.startAnimation(animation);
    } else {
        view.setVisibility(View.INVISIBLE);
    }
}

From source file:Main.java

public static void alphaHide(@NonNull final View view, final Runnable rWhenDone) {
    if (view.getWindowToken() == null) {
        if (rWhenDone != null)
            rWhenDone.run();/*from   ww  w  . j a va 2  s  .  c  o m*/
        return;
    }
    ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f);
    alpha.setDuration(DURATION_MID);
    alpha.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {
            view.setVisibility(View.INVISIBLE);
            if (rWhenDone != null)
                rWhenDone.run();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            view.setVisibility(View.INVISIBLE);
            if (rWhenDone != null)
                rWhenDone.run();
        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });
    alpha.start();
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void hide(final View view, int cornerType, int animRes, final boolean goneOrInvisible,
        final AnimatorListenerAdapter listener) {
    int[] amaya = calulateCorner(view, cornerType);
    //            if(view)
    Animator anim = ViewAnimationUtils.createCircularReveal(view, amaya[0], amaya[1], amaya[2], 0);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override//from  w  w w  . j a v a  2s.com
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(goneOrInvisible ? View.GONE : View.INVISIBLE);
            if (listener != null)
                listener.onAnimationEnd(animation);
        }
    });
    anim.setDuration(300);
    anim.start();
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public static ViewPropertyAnimator fadeOut(final View from, int duration) {
    if (from.getVisibility() == View.VISIBLE) {
        from.clearAnimation();//from   ww w .j av a2  s  .  c  o  m
        final ViewPropertyAnimator animator = from.animate();
        animator.alpha(0f).setDuration(duration).setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                from.setVisibility(View.INVISIBLE);
                from.setAlpha(1f);
            }
        });
        return animator;
    }
    return null;
}

From source file:Main.java

public static void fadeIn(final View view) {
    Animation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
    alphaAnimation.setDuration(FADE_DURATION);
    alphaAnimation.setAnimationListener(new AnimationListener() {

        @Override//ww  w  . j  a va  2 s . c  o m
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.setVisibility(View.INVISIBLE);

        }
    });
    view.startAnimation(alphaAnimation);
}