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.amitupadhyay.aboutexample.ui.transitions.MorphDialogToFab.java

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        TransitionValues endValues) {//from w ww. j  ava 2 s.c  o 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(getFastOutLinearInInterpolator(vg.getContext())).start();
        }
    }

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

From source file:com.darktalker.cordova.screenshot.Screenshot.java

private TextureView findXWalkTextureView(ViewGroup group) {

    int childCount = group.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = group.getChildAt(i);
        if (child instanceof TextureView) {
            String parentClassName = child.getParent().getClass().toString();
            boolean isRightKindOfParent = (parentClassName.contains("XWalk"));
            if (isRightKindOfParent) {
                return (TextureView) child;
            }//from www .  j a v a2s .  co  m
        } else if (child instanceof ViewGroup) {
            TextureView textureView = findXWalkTextureView((ViewGroup) child);
            if (textureView != null) {
                return textureView;
            }
        }
    }

    return null;
}

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

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        TransitionValues endValues) {//  w w w  .  ja v a2s  .  c om
    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);

    // 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(AnimUtils.getFastOutSlowInInterpolator(vg.getContext())).start();
        }
    }

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

    return transition;
}

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

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        TransitionValues endValues) {//from w w w  . j a va 2 s .  c  o 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.setDuration(300);
    transition.setInterpolator(
            AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    return transition;
}

From source file:com.syllabes.v2.activities.games.SoundSyllabesActivity.java

private void prepareButtons(ViewGroup v) {
    for (int i = 0; i < v.getChildCount(); i++) {
        View child = v.getChildAt(i);
        if (child instanceof ViewGroup)
            prepareButtons((ViewGroup) child);
        else if (child instanceof Button) {
            final Button b = (Button) child;
            b.setTypeface(customFont);//from   w  ww. ja v  a2s. c  o m
            buttons.add(b);
            b.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View view) {
                    toggleClick(false);
                    clickCounter++;
                    userInput.setText(TextUtils.concat(userInput.getText(), b.getText()));
                    Player.playSound(b.getText().toString().toLowerCase(), SoundSyllabesActivity.this)
                            .setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                                @Override
                                public void onCompletion(MediaPlayer mediaPlayer) {
                                    checkWin();
                                }
                            });
                }
            });
        }
    }
}

From source file:de.persoapp.android.activity.fragment.DataFragment.java

@SuppressWarnings("ConstantConditions")
protected void increaseIds(ViewGroup viewGroup) {
    for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
        View view = viewGroup.getChildAt(i);
        view.setId(view.getId() + 100);//w  ww .  j a va  2 s. co  m
    }
}

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

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

    ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_schedule_detail);
    if (detailContainer != null && detailContainer.getChildCount() > 0) {
        findViewById(R.id.fragment_container_schedule_detail).setBackgroundColor(0);
    }/*  w ww  .j av a  2s  .co  m*/
}

From source file:org.arasthel.almeribus.fragments.CustomMapFragment.java

private void setMapTransparent(ViewGroup group) {
    int childCount = group.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = group.getChildAt(i);
        if (child instanceof ViewGroup) {
            setMapTransparent((ViewGroup) child);
        } else if (child instanceof SurfaceView) {
            child.setBackgroundColor(0x00000000);
            break;
        }/*from  www .  j  a  v  a  2 s . c  o m*/
    }
}

From source file:com.google.vr.sdk.samples.video360.VideoActivity.java

/** Initializes the Activity only if the permission has been granted. */
private void initializeActivity() {
    ViewGroup root = (ViewGroup) findViewById(R.id.activity_root);
    for (int i = 0; i < root.getChildCount(); ++i) {
        root.getChildAt(i).setVisibility(View.VISIBLE);
    }/*from   w  w w. j  av a  2s  .c  o m*/
    findViewById(R.id.permission_button).setVisibility(View.GONE);
    videoView.loadMedia(getIntent());
}

From source file:com.lullabot.android.apps.iosched.ui.tablet.ScheduleMultiPaneActivity.java

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

    ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_schedule_detail);
    if (detailContainer != null && detailContainer.getChildCount() > 0) {
        findViewById(R.id.fragment_container_schedule_detail).setBackgroundColor(0);
        ;//from ww w.  j a  v  a  2  s .co m
    }
}