Example usage for android.view ViewGroup getChildCount

List of usage examples for android.view ViewGroup getChildCount

Introduction

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

Prototype

public int getChildCount() 

Source Link

Document

Returns the number of children in the group.

Usage

From source file:com.twotoasters.jazzylistview.JazzyHelper.java

/**
 * Initializes the item view and triggers the animation.
 *
 * @param item            The view to be animated.
 * @param position        The index of the view in the list.
 * @param scrollDirection Positive number indicating scrolling down, or negative number indicating scrolling up.
 *//*from ww  w.ja  v a 2 s  .c o m*/
private void doJazziness(View item, int position, int scrollDirection) {
    if (mIsScrolling) {
        if (mOnlyAnimateNewItems && mAlreadyAnimatedItems.contains(position))
            return;

        if (mOnlyAnimateOnFling && !mIsFlingEvent)
            return;

        if (mMaxVelocity > MAX_VELOCITY_OFF && mMaxVelocity < mSpeed)
            return;

        if (mSimulateGridWithList) {
            ViewGroup itemRow = (ViewGroup) item;
            for (int i = 0; i < itemRow.getChildCount(); i++)
                doJazzinessImpl(itemRow.getChildAt(i), position, scrollDirection);
        } else {
            doJazzinessImpl(item, position, scrollDirection);
        }

        mAlreadyAnimatedItems.add(position);
    }
}

From source file:g7.bluesky.launcher3.AppsCustomizeTabHost.java

private void setVisibilityOfSiblingsWithLowerZOrder(int visibility) {
    ViewGroup parent = (ViewGroup) getParent();
    if (parent == null)
        return;//from w w  w  .  ja v a  2 s . com

    View overviewPanel = ((Launcher) getContext()).getOverviewPanel();
    final int count = parent.getChildCount();
    if (!isChildrenDrawingOrderEnabled()) {
        for (int i = 0; i < count; i++) {
            final View child = parent.getChildAt(i);
            if (child == this) {
                break;
            } else {
                if (child.getVisibility() == GONE || child == overviewPanel) {
                    continue;
                }
                child.setVisibility(visibility);
            }
        }
    } else {
        throw new RuntimeException("Failed; can't get z-order of views");
    }
}

From source file:fr.julienvermet.bugdroid.ui.phone.BugActivity.java

/**
 * Searches the view hierarchy excluding the content view for a possible
 * Spinner in the ActionBar.//from   w w  w.j a v  a 2  s  .c o  m
 * 
 * @param root
 *            The parent of the content view
 * @param position
 *            The position that should be selected
 * @return if the spinner was found and adjusted
 */
private boolean findAndUpdateSpinner(Object root, int position) {
    if (root instanceof android.widget.Spinner) {
        // Found the Spinner
        Spinner spinner = (Spinner) root;
        spinner.setSelection(position);
        return true;
    } else if (root instanceof ViewGroup) {
        ViewGroup group = (ViewGroup) root;
        if (group.getId() != android.R.id.content) {
            // Found a container that isn't the container holding our screen
            // layout
            for (int i = 0; i < group.getChildCount(); i++) {
                if (findAndUpdateSpinner(group.getChildAt(i), position)) {
                    // Found and done searching the View tree
                    return true;
                }
            }
        }
    }
    // Nothing found
    return false;
}

From source file:com.quinsoft.zeidon.android.ZeidonAndroidViewDelegate.java

/**
 * Loop through all the children of viewGroup and copy values from an OI to the view.
 *
 * @param viewGroup/*from ww  w  . j ava2  s.c  om*/
 */
public void setChildrenFromOi(ViewGroup viewGroup) {
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        android.view.View child = viewGroup.getChildAt(i);
        if (child instanceof ZeidonDisplayView)
            ((ZeidonDisplayView) child).setFromOi();
        else if (child instanceof ViewGroup)
            setChildrenFromOi((ViewGroup) child);
    }
}

From source file:com.quinsoft.zeidon.android.ZeidonAndroidViewDelegate.java

/**
 * Loop through all the children of viewGroup and copy values from the Android
 * views to the OI./*from w  w  w.j a va 2 s.  co  m*/
 *
 * @param viewGroup
 */
public void copyValuesToOi(ViewGroup viewGroup) {
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        android.view.View child = viewGroup.getChildAt(i);
        if (child instanceof ZeidonInputView)
            ((ZeidonInputView) child).copyValuesToOi();
        else if (child instanceof ViewGroup)
            copyValuesToOi((ViewGroup) child);
    }
}

From source file:com.learn.mobile.customview.henrytao.SmoothAppBarLayout.java

protected void initViews() {
    if (mViewPagerId > 0) {
        vViewPager = (ViewPager) getRootView().findViewById(mViewPagerId);
    } else {/*www . j ava  2  s . c  o  m*/
        int i = 0;
        ViewGroup parent = (ViewGroup) getParent();
        View child;
        for (int z = parent.getChildCount(); i < z; i++) {
            child = parent.getChildAt(i);
            if (child instanceof ViewPager) {
                vViewPager = (ViewPager) child;
                break;
            }
        }
    }
}

From source file:com.yanzhenjie.recyclerview.swipe.widget.StickyNestedScrollView.java

private void findStickyViews(View v) {
    if (!detainStickyView(v) && (v instanceof ViewGroup)) {
        ViewGroup vg = (ViewGroup) v;
        for (int i = 0; i < vg.getChildCount(); i++)
            findStickyViews(vg.getChildAt(i));
    }/*from w  ww . ja v  a2  s  .c  o m*/
}

From source file:com.landenlabs.all_UiDemo.frag.ImageScalesFrag.java

private void setImage(int imageRes) {
    for (int idx = 0; idx < mImageHolder.getChildCount(); idx++) {
        View view = mImageHolder.getChildAt(idx);
        if (view instanceof ImageView) {
            ImageView imageView = (ImageView) view;
            if (imageView.getScaleType() != ImageView.ScaleType.MATRIX) {
                setImage(imageView, imageRes);
            }//w  w  w  .  j  a v a  2  s. c  o  m
        } else if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int childIdx = 0; childIdx != viewGroup.getChildCount(); childIdx++) {
                View child = viewGroup.getChildAt(childIdx);
                if (child instanceof ImageView) {
                    ImageView imageView = (ImageView) child;
                    if (imageView.getScaleType() != ImageView.ScaleType.MATRIX) {
                        setImage(imageView, imageRes);
                    }
                }
            }
        }
    }

    mPrevBm1 = fillUpperLeft(getDrawable(imageRes), mUpperLeftFill, mPrevBm1);
    mPrevBm2 = fillLowerLeft(getDrawable(imageRes), mLowerLeftFill, mPrevBm2);
    mPrevBm3 = setScaledImage(getDrawable(imageRes), mCenterFill, mPrevBm3);
}

From source file:com.quinsoft.zeidon.android.ZeidonAndroidViewDelegate.java

public void setParentViewForChildViews(android.view.View parent, android.view.View child) {
    if (child instanceof ZeidonDisplayView) {
        ((ZeidonDisplayView) child).setZeidonParent(parent);
        return;//from ww w .  j av a2  s  .co m
    }

    if (child instanceof ViewGroup) {
        ViewGroup viewGroup = (ViewGroup) child;
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            android.view.View tempChild = viewGroup.getChildAt(i);
            setParentViewForChildViews(parent, tempChild);
        }
    }
}

From source file:org.odk.collect.android.widgets.QuestionWidget.java

private void recycleDrawablesRecursive(ViewGroup viewGroup, List<ImageView> images) {

    int childCount = viewGroup.getChildCount();
    for (int index = 0; index < childCount; index++) {
        View child = viewGroup.getChildAt(index);
        if (child instanceof ImageView) {
            images.add((ImageView) child);
        } else if (child instanceof ViewGroup) {
            recycleDrawablesRecursive((ViewGroup) child, images);
        }//from ww  w  .  j  a v a 2 s  . com
    }
    viewGroup.destroyDrawingCache();
}