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.geozen.smarttrail.ui.tablet.NowPlayingMultiPaneActivity.java

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

    ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_now_playing_detail);
    if (detailContainer != null && detailContainer.getChildCount() > 1) {
        findViewById(android.R.id.empty).setVisibility(View.GONE);
    }/* w  w w.  ja  v a 2 s  . com*/
}

From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.NewSessionsActivity.java

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

    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 av a  2s  .c om*/
}

From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.tablet.NowPlayingMultiPaneActivity.java

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

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

From source file:cn.edu.zucc.list.FabAnimation.MorphDialogToFab.java

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        TransitionValues endValues) {/*from   w  ww. ja  v a  2 s.co m*/
    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);

    // hide child views (offset down & fade out)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
                            android.R.interpolator.fast_out_linear_in))
                    .start();
        }
    }

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

From source file:com.android.launcher2.HideFromAccessibilityHelper.java

private void setImportantForAccessibilityToNoHelper(View v) {
    mPreviousValues.put(v, ViewCompat.getImportantForAccessibility(v));
    ViewCompat.setImportantForAccessibility(v, View.IMPORTANT_FOR_ACCESSIBILITY_NO);

    // Call method on children recursively
    if (v instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) v;
        vg.setOnHierarchyChangeListener(this);
        for (int i = 0; i < vg.getChildCount(); i++) {
            View child = vg.getChildAt(i);

            if (includeView(child)) {
                setImportantForAccessibilityToNoHelper(child);
            }//  ww w .  j  a v a2 s.c  o m
        }
    }
}

From source file:com.liyu.huahui.ui.widgets.MorphDialogToFab.java

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override//  w ww .ja  v a  2s. c  o m
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        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);

    // hide child views (offset down & fade out)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
                            android.R.interpolator.fast_out_linear_in))
                    .start();
        }
    }

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

From source file:com.wolski_msk.collector.sample.transition.MorphDialogToFab.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override/*from w ww . j a v  a  2s .  com*/
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        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);

    // hide child views (offset down & fade out)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
                            android.R.interpolator.fast_out_linear_in))
                    .start();
        }
    }

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

From source file:com.christophergs.mbientbasic.ModuleFragmentBase.java

protected void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) {
    int childCount = viewGroup.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View view = viewGroup.getChildAt(i);
        view.setEnabled(enabled);/*  ww w . j ava 2s  .co  m*/
        if (view instanceof ViewGroup) {
            enableDisableViewGroup((ViewGroup) view, enabled);
        }
    }
}

From source file:com.geozen.smarttrail.ui.tablet.AreasMultiPaneActivity.java

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

    ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_trail_detail);
    if (detailContainer != null && detailContainer.getChildCount() > 0) {
        findViewById(R.id.fragment_container_trail_detail).setBackgroundColor(0xffffffff);
    }/* w w  w  . ja v a2s  .c  om*/
}

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

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override//from   w ww.  j av  a  2 s .  co m
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        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);

    // hide child views (offset down & fade out)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
                            android.R.interpolator.fast_out_linear_in))
                    .start();
        }
    }

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