Java Code Examples for android.view.ViewGroup#getVisibility()

The following examples show how to use android.view.ViewGroup#getVisibility() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BookFloatingActionMenu.java    From HaoReader with GNU General Public License v3.0 6 votes vote down vote up
private void expandInternal() {
    if (!isExpanded) {
        isExpanded = true;

        int index = 0;
        for (int i = getChildCount() - 2; i >= 0; i--) {
            ViewGroup childGroup = (ViewGroup) getChildAt(i);
            if (childGroup.getVisibility() != VISIBLE) {
                childGroup.setVisibility(VISIBLE);
            }
            View labelView = childGroup.getChildAt(0);
            FloatingActionButton btnView = (FloatingActionButton) childGroup.getChildAt(1);
            postDelayed(() -> {
                btnView.show();
                animateShowLabelView(labelView);
            }, 50 * index);
            index++;
        }
    }
}
 
Example 2
Source File: SwipeItemTouchListener.java    From Tangram-Android with MIT License 6 votes vote down vote up
private View findCanScrollView(View v) {
    if (v instanceof ViewGroup) {
        ViewGroup target = (ViewGroup) v;
        if ((target instanceof UltraViewPager || target instanceof RecyclerView)
            && target.getVisibility() == View.VISIBLE) {
            return target;
        } else {
            for (int i = 0; i < target.getChildCount(); ++i) {
                View view = findCanScrollView(target.getChildAt(i));
                if (view != null) {
                    return view;
                }
            }
            return null;
        }
    } else {
        return null;
    }
}
 
Example 3
Source File: SwipeItemTouchListener.java    From Tangram-Android with MIT License 6 votes vote down vote up
private View findCanScrollView(View v) {
    if (v instanceof ViewGroup) {
        ViewGroup target = (ViewGroup) v;
        if ((target instanceof UltraViewPager || target instanceof RecyclerView)
                && target.getVisibility() == View.VISIBLE) {
            return target;
        } else {
            for (int i = 0; i < target.getChildCount(); ++i) {
                View view = findCanScrollView(target.getChildAt(i));
                if (view != null) {
                    return view;
                }
            }
            return null;
        }
    } else {
        return null;
    }
}
 
Example 4
Source File: WidgetHelper.java    From Android_accordion_view with MIT License 6 votes vote down vote up
/***
 * This function returns the actual height the layout. The getHeight() function returns the current height which might be zero if
 * the layout's visibility is GONE
 * @param layout
 * @return
 */
public static int getFullHeight(ViewGroup layout) {
    int specWidth = View.MeasureSpec.makeMeasureSpec(0 /* any */, View.MeasureSpec.UNSPECIFIED);
    int specHeight = View.MeasureSpec.makeMeasureSpec(0 /* any */, View.MeasureSpec.UNSPECIFIED);


    layout.measure(specWidth,specHeight);
    int totalHeight = 0;//layout.getMeasuredHeight();
    int initialVisibility = layout.getVisibility();
    layout.setVisibility(View.VISIBLE);
    int numberOfChildren = layout.getChildCount();
    for(int i = 0;i<numberOfChildren;i++) {
        View child = layout.getChildAt(i);
        if(child instanceof ViewGroup) {
            totalHeight+=getFullHeight((ViewGroup)child);
        }else {
            int desiredWidth = View.MeasureSpec.makeMeasureSpec(layout.getWidth(),
                    View.MeasureSpec.AT_MOST);
            child.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
            totalHeight+=child.getMeasuredHeight();
        }

    }
    layout.setVisibility(initialVisibility);
    return totalHeight;
}
 
Example 5
Source File: BlurBehindView.java    From BlurView with Apache License 2.0 6 votes vote down vote up
private void printViewsBehind(ViewGroup rootView) {
    if (!this.isInEditMode() && !(rootView instanceof BlurBehindView) && rootView.getVisibility() == View.VISIBLE && rootView.getAlpha() != 0.0F) {
        if (rootView.getBackground() != null) {
            this.blurCanvas.save();
            this.blurCanvas.translate((float) (this.childPositionInWindow[0] - this.thisPositionInWindow[0] + this.halfPaddingOnSides), (float) (this.halfPaddingOnSides + this.childPositionInWindow[1] - this.thisPositionInWindow[1]));
            rootView.getBackground().draw(this.blurCanvas);
            this.blurCanvas.restore();
        }

        for (int i = 0; i < rootView.getChildCount(); ++i) {
            View childView = rootView.getChildAt(i);
            if (childView.findViewWithTag(TAG_VIEW) != null & rootView.getVisibility() == View.VISIBLE) {
                this.printViewsBehind((ViewGroup) childView);
            } else if (childView.getVisibility() == View.VISIBLE) {
                this.blurCanvas.save();
                childView.getLocationOnScreen(this.childPositionInWindow);
                this.blurCanvas.translate((float) (this.halfPaddingOnSides + this.childPositionInWindow[0] - this.thisPositionInWindow[0]), (float) (this.halfPaddingOnSides + this.childPositionInWindow[1] - this.thisPositionInWindow[1]));
                this.blurCanvas.scale(childView.getScaleX(), childView.getScaleY());
                childView.draw(this.blurCanvas);
                this.blurCanvas.restore();
            }
        }
    }
}
 
Example 6
Source File: BlurDrawable.java    From BlurView with Apache License 2.0 6 votes vote down vote up
private void printView(View bluredView) {
    if (!(bluredView instanceof ViewGroup)) {
        bluredView.draw(mBlurCanvas);
        return;
    }

    ViewGroup rootView = (ViewGroup) bluredView;

    if (rootView.getVisibility() == View.VISIBLE && rootView.getAlpha() != 0.0F) {
        if (rootView.findViewById(mDrawableContainerId) == null) {
            rootView.draw(mBlurCanvas);
            return;
        }

        for (int i = 0; i < rootView.getChildCount(); ++i) {
            View childView = rootView.getChildAt(i);

            if (childView.findViewById(mDrawableContainerId) != null & rootView.getVisibility() == View.VISIBLE) {
                this.printView(childView);
            } else if (childView.getVisibility() == View.VISIBLE) {
                childView.draw(mBlurCanvas);
            }
        }
    }
}
 
Example 7
Source File: SwipeLayout.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * prevent bottom view get any touch event. Especially in LayDown mode.
 */
private void safeBottomView() {
    Status status = getOpenStatus();
    ViewGroup bottom = getBottomView();

    if (status == Status.Close) {
        if (bottom.getVisibility() != INVISIBLE)
            bottom.setVisibility(INVISIBLE);
    } else {
        if (bottom.getVisibility() != VISIBLE)
            bottom.setVisibility(VISIBLE);
    }
}
 
Example 8
Source File: SwipeLayoutConv.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * prevent bottom view get any touch event. Especially in LayDown mode.
 */
private void safeBottomView() {
    Status status = getOpenStatus();
    ViewGroup bottom = getBottomView();

    if (status == Status.Close) {
        if (bottom.getVisibility() != INVISIBLE)
            bottom.setVisibility(INVISIBLE);
    } else {
        if (bottom.getVisibility() != VISIBLE)
            bottom.setVisibility(VISIBLE);
    }
}
 
Example 9
Source File: ZSwipeItem.java    From AutoLoadListView with Apache License 2.0 5 votes vote down vote up
/**
 * 防止底布局获取到任何的触摸事件,特别是在LayDown模式
 */
private void safeBottomView() {
	Status status = getOpenStatus();
	ViewGroup bottom = getBottomView();

	if (status == Status.Close) {
		if (bottom.getVisibility() != INVISIBLE)
			bottom.setVisibility(INVISIBLE);
	} else {
		if (bottom.getVisibility() != VISIBLE)
			bottom.setVisibility(VISIBLE);
	}
}
 
Example 10
Source File: ZSwipeItem.java    From ZListVIew with Apache License 2.0 5 votes vote down vote up
/**
 * 防止底布局获取到任何的触摸事件,特别是在LayDown模式
 */
private void safeBottomView() {
	Status status = getOpenStatus();
	ViewGroup bottom = getBottomView();

	if (status == Status.Close) {
		if (bottom.getVisibility() != INVISIBLE)
			bottom.setVisibility(INVISIBLE);
	} else {
		if (bottom.getVisibility() != VISIBLE)
			bottom.setVisibility(VISIBLE);
	}
}
 
Example 11
Source File: SwipeLayout.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * prevent bottom view get any touch event. Especially in LayDown mode.
 */
private void safeBottomView(){
    Status status = getOpenStatus();
    ViewGroup bottom = getBottomView();

    if(status == Status.Close){
        if(bottom.getVisibility() != INVISIBLE)
            bottom.setVisibility(INVISIBLE);
    }else {
        if(bottom.getVisibility() != VISIBLE)
            bottom.setVisibility(VISIBLE);
    }
}