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.nhn.android.mapviewer.NMapFragment.java

/**
 * Fragment? ?? NMapView ? /*w  w  w  .j  a v a 2 s  . c  om*/
 */
private NMapView findMapView(View v) {

    if (!(v instanceof ViewGroup)) {
        return null;
    }

    ViewGroup vg = (ViewGroup) v;
    if (vg instanceof NMapView) {
        return (NMapView) vg;
    }

    for (int i = 0; i < vg.getChildCount(); i++) {

        View child = vg.getChildAt(i);
        if (!(child instanceof ViewGroup)) {
            continue;
        }

        NMapView mapView = findMapView(child);
        if (mapView != null) {
            return mapView;
        }
    }
    return null;
}

From source file:com.dante.girl.lib.MorphFabToDialog.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override//  w  w w  .ja  v a  2 s . c om
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        final TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null) {
        return null;
    }

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
    Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);

    if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
        return null;
    }

    MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);

    // ease in the dialog's child views (slide up & fade_fast in)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        float offset = vg.getHeight() / 3;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.setTranslationY(offset);
            v.setAlpha(0f);
            v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator(
                    AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in));
            offset *= 1.8f;
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setDuration(300);
    transition.setInterpolator(
            AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    return transition;
}

From source file:com.goliathonline.android.kegbot.ui.StarredActivity.java

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    getActivityHelper().setupSubActivity();

    ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_starred_detail);
    if (detailContainer != null && detailContainer.getChildCount() > 1) {
        findViewById(android.R.id.empty).setVisibility(View.GONE);
    }//from w w w .j ava  2  s .  c  om
}

From source file:com.caij.codehub.ui.transitions.MorphFabToDialog.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override/*w  ww.j ava 2s. co m*/
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        final TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null) {
        return null;
    }

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
    Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);

    if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
        return null;
    }

    MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius);

    // ease in the dialog's child views (slide up & fade in)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        float offset = vg.getHeight() / 3;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.setTranslationY(offset);
            v.setAlpha(0f);
            v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator(
                    AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in));
            offset *= 1.8f;
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setDuration(300);
    transition.setInterpolator(
            AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    return transition;
}

From source file:com.freshplanet.nativeExtensions.C2DMBroadcastReceiver.java

private boolean recurseGroup(Context context, ViewGroup gp) {
    final int count = gp.getChildCount();
    for (int i = 0; i < count; ++i) {
        if (gp.getChildAt(i) instanceof TextView) {
            final TextView text = (TextView) gp.getChildAt(i);
            final String szText = text.getText().toString();
            if (COLOR_SEARCH_RECURSE_TIP.equals(szText)) {
                notification_text_color = text.getTextColors().getDefaultColor();
                notification_text_size = text.getTextSize();
                DisplayMetrics metrics = new DisplayMetrics();
                WindowManager systemWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
                systemWM.getDefaultDisplay().getMetrics(metrics);
                notification_text_size /= metrics.scaledDensity;
                return true;
            }/*from   www  .  j a v a 2  s.c o  m*/
        } else if (gp.getChildAt(i) instanceof ViewGroup)
            return recurseGroup((Context) context, (ViewGroup) gp.getChildAt(i));
    }
    return false;
}

From source file:com.josecalles.porridge.transitions.MorphFabToDialog.java

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        final TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null) {
        return null;
    }//from   w  w  w .  j a v a  2 s  .  c o  m

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
    Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);

    if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
        return null;
    }

    MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius);

    // ease in the dialog's child views (slide up & fade in)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        float offset = vg.getHeight() / 3;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.setTranslationY(offset);
            v.setAlpha(0f);
            v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator(
                    AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in));
            offset *= 1.8f;
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setDuration(300);
    transition.setInterpolator(
            AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    return transition;
}

From source file:io.romain.passport.ui.transitions.MorphFabToDialog.java

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        final TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null) {
        return null;
    }//from  ww w  .j  a v  a2  s  . co m

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
    Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);

    if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
        return null;
    }

    MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);

    // ease in the dialog's child views (slide up & fade in)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        float offset = vg.getHeight() / 3;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.setTranslationY(offset);
            v.setAlpha(0f);
            v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150)
                    .setInterpolator(AnimUtils.getFastOutSlowInInterpolator(vg.getContext()));
            offset *= 1.8f;
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setDuration(300);
    transition.setInterpolator(AnimUtils.getFastOutSlowInInterpolator(sceneRoot.getContext()));
    return transition;
}

From source file:com.google.android.apps.iosched.ui.SearchActivity.java

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    getActivityHelper().setupSubActivity();

    ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_search_detail);
    if (detailContainer != null && detailContainer.getChildCount() > 1) {
        findViewById(android.R.id.empty).setVisibility(View.GONE);
    }/*w w w. ja va  2 s  .  c  o m*/
}

From source file:com.vuze.android.remote.dialog.DialogFragmentSessionSettings.java

public void setGroupEnabled(ViewGroup viewGroup, boolean enabled) {
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        View view = viewGroup.getChildAt(i);
        view.setEnabled(enabled);/*from  ww  w.jav  a  2  s .  c  o m*/
    }
}

From source file:jp.co.noxi.app.NXDatePickerDialog.java

DatePicker findDatePicker(View view) {
    if (view == null) {
        return null;
    }/*  w ww  .  j av  a2s  .  c  om*/
    if (view instanceof DatePicker) {
        return (DatePicker) view;
    }
    if (!(view instanceof ViewGroup)) {
        return null;
    }

    final ViewGroup viewGroup = (ViewGroup) view;
    final int count = viewGroup.getChildCount();
    if (count == 0) {
        return null;
    }
    for (int i = 0; i < count; i++) {
        DatePicker datePicker = findDatePicker(viewGroup.getChildAt(i));
        if (datePicker != null) {
            return datePicker;
        }
    }
    return null;
}