Example usage for android.view ViewGroup setVisibility

List of usage examples for android.view ViewGroup setVisibility

Introduction

In this page you can find the example usage for android.view ViewGroup setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:Main.java

public static void hideProgress(ViewGroup mCover) {
    if (null == mCover)
        return;//from   w  w  w .ja  v  a 2s.  c  om

    if (mCover.getVisibility() == View.VISIBLE) {
        mCover.setVisibility(View.GONE);
    }
}

From source file:Main.java

public static void dismissChildren(ViewGroup viewgroup) {
    int i1 = viewgroup.getChildCount();
    for (int j1 = 0; j1 < i1; j1++) {
        viewgroup.getChildAt(j1).setVisibility(4);
    }/*  w w w .  ja va2  s  .  c o  m*/

    viewgroup.setVisibility(8);
}

From source file:Main.java

public static void showChildren(ViewGroup viewgroup) {
    int i1 = viewgroup.getChildCount();
    for (int j1 = 0; j1 < i1; j1++) {
        viewgroup.getChildAt(j1).setVisibility(0);
    }//from www.j av  a  2  s .c om

    viewgroup.setVisibility(0);
}

From source file:Main.java

public static void collapse(final ViewGroup v) {
    final int initialHeight = v.getMeasuredHeight();

    Animation a = new Animation() {
        @Override//from  w w w. j a  v  a 2 s.  c  o m
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
                v.setVisibility(View.GONE);
            } else {
                v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
                v.setAlpha(1 - interpolatedTime);
                v.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}

From source file:Main.java

public static void expand(final ViewGroup v) {
    v.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    final int targetHeight = v.getMeasuredHeight();

    // Older versions of android (pre API 21) cancel animations for views with a height of 0.
    v.getLayoutParams().height = 1;//  www  .j av  a2s.com
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1 ? ViewGroup.LayoutParams.WRAP_CONTENT
                    : (int) (targetHeight * interpolatedTime);
            v.setAlpha(interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}

From source file:info.papdt.blacklight.support.Utility.java

public static View addActionViewToCustom(View v, ViewGroup custom) {
    if (v != null) {
        ViewGroup parent = (ViewGroup) v.getParent();
        parent.removeView(v);/*from w  w  w. j av a 2s  .c om*/
        parent.setVisibility(View.GONE);
        ViewGroup.LayoutParams params = parent.getLayoutParams();
        params.width = 0;
        params.height = 0;
        parent.setLayoutParams(params);
        custom.addView(v);
    }

    return v;
}

From source file:android.support.wear.widget.drawer.WearableDrawerLayout.java

private static void animatePeekVisibleAfterBeingClosed(WearableDrawerView drawer) {
    final View content = drawer.getDrawerContent();
    if (content != null) {
        content.animate().setDuration(PEEK_FADE_DURATION_MS).alpha(0).withEndAction(new Runnable() {
            @Override/* www .ja  va  2s. co  m*/
            public void run() {
                content.setVisibility(GONE);
            }
        }).start();
    }

    ViewGroup peek = drawer.getPeekContainer();
    peek.setVisibility(VISIBLE);
    peek.animate().setStartDelay(PEEK_FADE_DURATION_MS).setDuration(PEEK_FADE_DURATION_MS).alpha(1).scaleX(1)
            .scaleY(1).start();

    drawer.setIsPeeking(true);
}

From source file:org.solovyev.android.messenger.ListViewFilter.java

private void setFilterBoxVisible(boolean visible, @Nonnull ViewGroup filterBox) {
    if (visible) {
        filterBox.setVisibility(View.VISIBLE);
    } else {/*from  w w  w. j  a v  a2s  .  c o m*/
        filterBox.setVisibility(View.GONE);
    }
}

From source file:org.alfresco.mobile.android.application.ui.form.picker.DocumentPickerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setRetainInstance(true);/*from w w  w  . j  a  v a 2  s .c o  m*/

    container.setVisibility(View.VISIBLE);
    setSession(SessionUtils.getSession(getActivity()));
    SessionUtils.checkSession(getActivity(), getSession());
    setRootView(inflater.inflate(R.layout.app_document_picker, container, false));

    if (getSession() == null) {
        return getRootView();
    }

    // BUTTONS
    Button b = (Button) viewById(R.id.picker_root);
    b.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            DocumentFolderBrowserFragment.with(getActivity()).folder(getSession().getRootFolder()).display();
        }
    });

    b = (Button) viewById(R.id.picker_sites);
    b.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            BrowserSitesPagerFragment.with(getActivity()).display();
        }
    });

    b = (Button) viewById(R.id.picker_favorites);
    b.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            FavoritesFragment.with(getActivity()).setMode(FavoriteNodesRequest.MODE_FOLDERS).display();
        }
    });

    return getRootView();
}

From source file:com.grokkingandroid.sampleapp.samples.SampleBaseFragment.java

public void onCreateContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    //TODO: temporary solution;
    // either generate it or do it in a better way
    // works for now, though
    container.setVisibility(View.GONE);
}