Example usage for android.view ViewGroup getChildAt

List of usage examples for android.view ViewGroup getChildAt

Introduction

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

Prototype

public View getChildAt(int index) 

Source Link

Document

Returns the view at the specified position in the group.

Usage

From source file:io.selendroid.server.model.internal.AbstractNativeElementContext.java

private void addChildren(ViewGroup viewGroup, AndroidNativeElement parent) {
    if (viewGroup.getChildCount() == 0) {
        return;/*w  w  w  .  j a  v a 2  s. c  o m*/
    }
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        View childView = viewGroup.getChildAt(i);
        AndroidNativeElement child = newAndroidElement(childView);

        parent.addChild(child);
        child.setParent(parent);
        if (childView instanceof ViewGroup) {
            addChildren((ViewGroup) childView, child);
        }
    }
}

From source file:com.microsoft.office.integration.test.AbstractTest.java

private WebView getWebView(View rootView) {
    if (rootView instanceof WebView) {
        return (WebView) rootView;
    } else if (rootView instanceof ViewGroup) {
        ViewGroup rootViewGroup = (ViewGroup) rootView;
        for (int i = 0; i < rootViewGroup.getChildCount(); i++) {
            View view = getWebView(rootViewGroup.getChildAt(i));
            if (view != null) {
                return (WebView) view;
            }/*  w ww .  jav  a  2  s .c o  m*/
        }
    }
    return null;
}

From source file:net.openwatch.acluaz.fragment.FormFragment.java

public void clearForm(ViewGroup container) {
    View view;// w w w . j  a  v a 2s . c o  m
    for (int x = 0; x < container.getChildCount(); x++) {
        view = container.getChildAt(x);

        if (EditText.class.isInstance(view)) {
            if (view.getTag() != null) {
                ((EditText) view).setText("");
            }
        }
    }
}

From source file:net.openwatch.acluaz.fragment.FormFragment.java

public boolean validateForm(ViewGroup container) {
    View view;/*from  w  ww  . ja  v  a 2s.  c  o  m*/
    for (int x = 0; x < container.getChildCount(); x++) {
        view = container.getChildAt(x);

        if (ValidatedEditText.class.isInstance(view)) {
            //Log.i(TAG, "validating field: " +  ((EditText)view).getText().toString());
            if (((EditText) view).getText().toString().compareTo("") == 0) {
                //view.requestFocus();
                return false;
            }
        }
    }
    return true;
}

From source file:com.meiste.greg.ptw.RaceFragment.java

private boolean isWorkaroundNeeded(final ViewGroup vg) {
    boolean isNeeded = true;

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        return isNeeded;
    }/*from  w ww  .  ja  va  2 s.c  om*/

    for (int i = 0; (i < vg.getChildCount()) && isNeeded; ++i) {
        final View v = vg.getChildAt(i);
        if (v instanceof ViewGroup) {
            isNeeded = isWorkaroundNeeded((ViewGroup) v);
        } else {
            isNeeded = !(v instanceof TextureView);
        }
    }

    return isNeeded;
}

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

private void setVisibilityOfSiblingsWithLowerZOrder(int visibility) {
    ViewGroup parent = (ViewGroup) getParent();
    if (parent == null)
        return;//w  ww  . j  av  a2 s  .  co  m

    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:com.cicada.startup.common.ui.view.indicator.ViewPagerIndicator.java

private int getTabTextLeft(ViewGroup parentView) {
    View childView = parentView.getChildAt(0);

    return parentView.getLeft() + childView.getPaddingLeft();
}

From source file:com.cicada.startup.common.ui.view.indicator.ViewPagerIndicator.java

private int getTabTextRight(ViewGroup parentView) {
    View childView = parentView.getChildAt(0);

    return parentView.getRight() - childView.getPaddingRight();
}

From source file:kr.co.generic.wifianalyzer.wifi.ConnectionViewTest.java

private View withAccessPointDetailView(@NonNull WiFiDetail connection) {
    int layout = mainActivity.getCurrentAccessPointView().getLayout();
    ViewGroup parent = (ViewGroup) mainActivity.findViewById(R.id.connection)
            .findViewById(R.id.connectionDetail);
    View view = mainActivity.getLayoutInflater().inflate(layout, parent, false);
    when(accessPointDetail.makeView(null, parent, connection, false)).thenReturn(view);
    when(accessPointDetail.makeView(parent.getChildAt(0), parent, connection, false)).thenReturn(view);
    return view;/* w  w  w  . ja va2 s . c om*/
}

From source file:me.xiaopan.vpc.ViewPagerCompat.java

@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        // Count backwards - let topmost views consume scroll distance first.
        for (int i = count - 1; i >= 0; i--) {
            // TODO: Add versioned support here for transformed views.
            // This will not work for transformed views in Honeycomb+
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight()
                    && y + scrollY >= child.getTop() && y + scrollY < child.getBottom() && canScroll(child,
                            true, dx, x + scrollX - child.getLeft(), y + scrollY - child.getTop())) {
                return true;
            }/* www. ja va 2s  .com*/
        }
    }

    if (checkV) {
        // Direct call ViewPager.canScrollHorizontally(int)
        if (v instanceof ViewPager) {
            return ((ViewPager) v).canScrollHorizontally(-dx);
        } else {
            return ViewCompat.canScrollHorizontally(v, -dx);
        }
    } else {
        return false;
    }
}