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:com.aretha.slidemenu.SlideMenu.java

private void invalidateViewVisibility(View view, int visibility) {
    if (null != view && view.getVisibility() != visibility) {
        view.setVisibility(visibility);/*from w  ww .  j av a  2  s .  co m*/
    }
}

From source file:com.aincc.libtest.activity.flip.FlipViewGroup.java

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    Logger.i("--------------------------------------------------------------------");
    Logger.i("FlipViewGroup::onLayout() " + changed + " " + l + ", " + t + ", " + r + ", " + b + "; child "
            + (null != adapter ? adapter.getCount() : 0));

    inLayout = true;/*from www .  j  a v  a2  s .co  m*/
    populate();
    inLayout = false;

    final int count = getChildCount();
    flipviews.clear();
    for (int ii = 0; ii < count; ii++) {
        View child = getChildAt(ii);
        ItemInfo info = null;
        if (child.getVisibility() != GONE && (info = infoForChild(child)) != null) {
            child.layout(0, 0, r - l, b - t);
        }

        if (null != info) {
            flipviews.put(Integer.valueOf(info.position), child);
        }
    }

    int w = r - l;
    int h = b - t;
    surfaceView.layout(0, 0, w, h);

    if (null != adapter && adapter.getCount() >= 2) {
        Logger.i("FlipViewGroup::onLayout() firstLayout = " + firstLayout);
        if (firstLayout) {
            firstLayout = renderer.updateTexture(getCurrentView(), getPrevView(), getNextView());
            renderer.getCards().reloadFirstTexture();
        }
    }

    if (null != pageChangeListener && renderer.isCreated()) {
        if (prevItem != currentItem) {
            pageChangeListener.onPageSelected(currentItem);
        }
    }
}

From source file:com.android.mail.browse.ConversationContainer.java

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    if (LogUtils.isLoggable(TAG, LogUtils.DEBUG)) {
        LogUtils.d(TAG, "*** IN header container onMeasure spec for w/h=%s/%s",
                MeasureSpec.toString(widthMeasureSpec), MeasureSpec.toString(heightMeasureSpec));
    }/*from   w  w  w  .j a  va 2  s .com*/

    for (View nonScrollingChild : mNonScrollingChildren) {
        if (nonScrollingChild.getVisibility() != GONE) {
            measureChildWithMargins(nonScrollingChild, widthMeasureSpec, 0 /* widthUsed */, heightMeasureSpec,
                    0 /* heightUsed */);
        }
    }
    mWidthMeasureSpec = widthMeasureSpec;

    // onLayout will re-measure and re-position overlays for the new container size, but the
    // spacer offsets would still need to be updated to have them draw at their new locations.
}

From source file:com.android.mail.browse.ConversationContainer.java

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    LogUtils.d(TAG, "*** IN header container onLayout");

    for (View nonScrollingChild : mNonScrollingChildren) {
        if (nonScrollingChild.getVisibility() != GONE) {
            final int w = nonScrollingChild.getMeasuredWidth();
            final int h = nonScrollingChild.getMeasuredHeight();

            final MarginLayoutParams lp = (MarginLayoutParams) nonScrollingChild.getLayoutParams();

            final int childLeft = lp.leftMargin;
            final int childTop = lp.topMargin;
            nonScrollingChild.layout(childLeft, childTop, childLeft + w, childTop + h);
        }/*from www.j  a v a 2s .  com*/
    }

    if (mOverlayAdapter != null) {
        // being in a layout pass means overlay children may require measurement,
        // so invalidate them
        for (int i = 0, len = mOverlayAdapter.getCount(); i < len; i++) {
            mOverlayAdapter.getItem(i).invalidateMeasurement();
        }
    }

    positionOverlays(mOffsetY, false /* postAddView */);
}

From source file:com.devbrackets.android.recyclerext.decoration.ReorderDecoration.java

/**
 * Updates the stored position for the start of the view.  This will be the
 * top when Vertical and left when Horizontal.
 *
 * @param childPosition The position of the view in the RecyclerView
 * @param draggedUp True if the view has been moved up or to the left
 *///from   www .  java  2s.com
private void updateNewViewStart(int childPosition, boolean draggedUp) {
    View view = recyclerView.getLayoutManager().getChildAt(childPosition);
    if (view == null) {
        return;
    }

    int start = orientation == LayoutOrientation.VERTICAL ? view.getTop() : view.getLeft();
    int viewDimen = orientation == LayoutOrientation.VERTICAL ? view.getHeight() : view.getWidth();
    viewDimen *= draggedUp ? -1 : 1;

    newViewStart = start + (view.getVisibility() == View.VISIBLE ? viewDimen : 0);
}

From source file:com.coleman.demo.view.page.DirectionalViewPager.java

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // For simple implementation, or internal size is always 0.
    // We depend on the container to specify the layout size of
    // our view. We can't really know what it is since we will be
    // adding and removing different arbitrary views and do not
    // want the layout to change as this happens.
    setMeasuredDimension(getDefaultSize(0, widthMeasureSpec), getDefaultSize(0, heightMeasureSpec));

    // Children are just made to fill our space.
    mChildWidthMeasureSpec = MeasureSpec
            .makeMeasureSpec(getMeasuredWidth() - getPaddingLeft() - getPaddingRight(), MeasureSpec.EXACTLY);
    mChildHeightMeasureSpec = MeasureSpec
            .makeMeasureSpec(getMeasuredHeight() - getPaddingTop() - getPaddingBottom(), MeasureSpec.EXACTLY);

    // Make sure we have created all fragments that we need to have shown.
    mInLayout = true;//from  w  w w .  ja  v a 2s  .com
    populate();
    mInLayout = false;

    // Make sure all children have been properly measured.
    final int size = getChildCount();
    for (int i = 0; i < size; ++i) {
        final View child = getChildAt(i);
        if (child.getVisibility() != GONE) {
            if (DEBUG)
                Log.v(TAG, "Measuring #" + i + " " + child + ": " + mChildWidthMeasureSpec + " x "
                        + mChildHeightMeasureSpec);
            child.measure(mChildWidthMeasureSpec, mChildHeightMeasureSpec);
        }
    }
}

From source file:cn.com.zzwfang.view.directionalviewpager.DirectionalViewPager.java

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // For simple implementation, or internal size is always 0.
    // We depend on the container to specify the layout size of
    // our view.  We can't really know what it is since we will be
    // adding and removing different arbitrary views and do not
    // want the layout to change as this happens.
    setMeasuredDimension(getDefaultSize(0, widthMeasureSpec), getDefaultSize(0, heightMeasureSpec));

    // Children are just made to fill our space.
    mChildWidthMeasureSpec = MeasureSpec
            .makeMeasureSpec(getMeasuredWidth() - getPaddingLeft() - getPaddingRight(), MeasureSpec.EXACTLY);
    mChildHeightMeasureSpec = MeasureSpec
            .makeMeasureSpec(getMeasuredHeight() - getPaddingTop() - getPaddingBottom(), MeasureSpec.EXACTLY);

    // Make sure we have created all fragments that we need to have shown.
    mInLayout = true;/*from  w  ww. ja v a 2s  . c  om*/
    populate();
    mInLayout = false;

    // Make sure all children have been properly measured.
    final int size = getChildCount();
    for (int i = 0; i < size; ++i) {
        final View child = getChildAt(i);
        if (child.getVisibility() != GONE) {
            if (DEBUG)
                Log.v(TAG, "Measuring #" + i + " " + child + ": " + mChildWidthMeasureSpec + " x "
                        + mChildHeightMeasureSpec);
            child.measure(mChildWidthMeasureSpec, mChildHeightMeasureSpec);
        }
    }
}

From source file:com.grottworkshop.gwsmaterialcalendarview.MaterialCalendarView.java

/**
 * {@inheritDoc}//from  w ww  . j  a  v a 2  s  .  c o  m
 */
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final int count = getChildCount();

    final int parentLeft = getPaddingLeft();
    final int parentWidth = right - left - parentLeft - getPaddingRight();

    int childTop = getPaddingTop();

    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == View.GONE) {
            continue;
        }

        final int width = child.getMeasuredWidth();
        final int height = child.getMeasuredHeight();

        int delta = (parentWidth - width) / 2;
        int childLeft = parentLeft + delta;

        child.layout(childLeft, childTop, childLeft + width, childTop + height);

        childTop += height;
    }
}

From source file:cn.com.zzwfang.view.directionalviewpager.DirectionalViewPager.java

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    mInLayout = true;/* w w w .  j  av a 2  s .co  m*/
    populate();
    mInLayout = false;

    final int count = getChildCount();
    final int size = (mOrientation == HORIZONTAL) ? r - l : b - t;

    for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        ItemInfo ii;
        if (child.getVisibility() != GONE && (ii = infoForChild(child)) != null) {
            int off = size * ii.position;
            int childLeft = getPaddingLeft();
            int childTop = getPaddingTop();
            if (mOrientation == HORIZONTAL) {
                childLeft += off;
            } else {
                childTop += off;
            }
            if (DEBUG)
                Log.v(TAG, "Positioning #" + i + " " + child + " f=" + ii.object + ":" + childLeft + ","
                        + childTop + " " + child.getMeasuredWidth() + "x" + child.getMeasuredHeight());
            child.layout(childLeft, childTop, childLeft + child.getMeasuredWidth(),
                    childTop + child.getMeasuredHeight());
        }
    }
}

From source file:ca.mymenuapp.ui.widgets.SlidingUpPanelLayout.java

public boolean isPaneVisible() {
    if (getChildCount() < 2) {
        return false;
    }//from  w w  w.ja v  a  2  s. c  o  m
    View slidingPane = getChildAt(1);
    return slidingPane.getVisibility() == View.VISIBLE;
}