Example usage for android.view View getVisibility

List of usage examples for android.view View getVisibility

Introduction

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

Prototype

@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"),
        @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"),
        @ViewDebug.IntToString(from = GONE, to = "GONE") })
@Visibility
public int getVisibility() 

Source Link

Document

Returns the visibility status for this view.

Usage

From source file:Main.java

public static boolean isInvisible(View v) {
    return v.getVisibility() == View.INVISIBLE;
}

From source file:Main.java

public static boolean isVisible(View v) {
    return v.getVisibility() == View.VISIBLE;
}

From source file:Main.java

public static void hide(View view) {
    if (view.getVisibility() == View.GONE)
        return;//from   w w  w .j av a  2 s . c om

    view.setVisibility(View.VISIBLE);
    view.animate().translationY(view.getHeight() * 2f).alpha(0f)
            .withEndAction(() -> view.setVisibility(View.GONE)).start();
}

From source file:Main.java

public static void show(View view) {
    if (view.getVisibility() == View.VISIBLE)
        return;//from w ww .j a v a2 s.  c  o  m

    view.setVisibility(View.VISIBLE);
    view.setAlpha(0f);
    view.setTranslationY(view.getHeight() * 2f);
    view.animate().translationY(0f).alpha(1f).start();
}

From source file:Main.java

public static boolean isVisible(View view) {
    return view != null && view.getVisibility() == View.VISIBLE;
}

From source file:Main.java

public static void setVisibility(View view, int visibility) {
    if (view.getVisibility() == visibility) {
        return;//from  w w  w . ja  va2s.  c  o m
    }
    view.setVisibility(visibility);
}

From source file:Main.java

public static void showViewFromBottom(View view) {
    if (view.getVisibility() == View.VISIBLE) {
        return;/*from  ww  w  .  jav a2 s.  c  o  m*/
    }
    view.setVisibility(View.VISIBLE);
    int height = view.getHeight();
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0,
            Animation.ABSOLUTE, height, Animation.ABSOLUTE, 0);
    translateAnimation.setDuration(ANIMATION_DURATION);
    translateAnimation.setInterpolator(sAnimationInterpolator);
    view.startAnimation(translateAnimation);
}

From source file:Main.java

public static void fadeOut(View view) {
    if (view.getVisibility() != View.VISIBLE)
        return;// www  .j ava2  s .c  o  m

    Animation animation = new AlphaAnimation(1F, 0F);
    animation.setDuration(400);
    view.startAnimation(animation);
    view.setVisibility(View.GONE);
}

From source file:Main.java

public static void fadeIn(View view) {
    if (view.getVisibility() == View.VISIBLE)
        return;/*www  .ja v  a  2s.  c  o  m*/

    view.setVisibility(View.VISIBLE);
    Animation animation = new AlphaAnimation(0F, 1F);
    animation.setDuration(400);
    view.startAnimation(animation);
}

From source file:Main.java

public static void hidden(Context context, View view, int resAnimId) {
    if (view.getVisibility() == View.VISIBLE) {
        view.startAnimation(loadAnimation(context, resAnimId));
        view.setVisibility(View.GONE);
    }//  ww w  .  j a v  a 2  s .c om
}