List of usage examples for android.view ViewGroup getChildAt
public View getChildAt(int index)
From source file:com.hitherejoe.animate.util.MorphButtonToDialog.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; Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR); Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR); if (startColor == null || endColor == null) return null; MorphDrawable background = new MorphDrawable(startColor, 0); endValues.view.setBackground(background); Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor); // 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);// w ww .java2 s. c om 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, color); transition.setDuration(300); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); return transition; }
From source file:com.yanzhenjie.nohttp.sample.activity.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DisplayUtils.initScreen(this); headViewSize = DisplayUtils.dip2px(42); setContentView(R.layout.activity_main); ButterKnife.bind(this); mIvHeadBackground.getLayoutParams().height = DisplayUtils.screenWidth * 12 / 13; mIvHeadBackground.requestLayout();//ww w .j ava 2s . com // toolbar? boolean isHigh = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; if (isHigh) { ViewGroup mContentView = (ViewGroup) findViewById(Window.ID_ANDROID_CONTENT); View mChildView = mContentView.getChildAt(0); if (mChildView != null) { ViewCompat.setFitsSystemWindows(mChildView, false); } } ((ViewGroup.MarginLayoutParams) mToolbarRoot.getLayoutParams()).setMargins(-headViewSize, isHigh ? DisplayUtils.statusBarHeight : 0, 0, 0); mAppBarLayout.addOnOffsetChangedListener(offsetChangedListener); initialize(); }
From source file:cn.edu.zucc.list.FabAnimation.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; }/* ww w.j ava 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)) .start(); 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.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 . ja va 2 s . co m*/ if (view instanceof ViewGroup) { enableDisableViewGroup((ViewGroup) view, enabled); } } }
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 w w w. j a v a 2 s . co m } else if (child instanceof ViewGroup) { TextureView textureView = findXWalkTextureView((ViewGroup) child); if (textureView != null) { return textureView; } } } return null; }
From source file:com.liyu.huahui.ui.widgets.MorphFabToDialog.java
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override/* w w w . ja v a 2 s. 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)) .start(); 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.sinyuk.jianyi.utils.morph.MorphFabToDialog.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override//from w w w.ja va 2s . 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, 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)) .start(); 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.hitherejoe.animate.util.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 . ja v a 2s . c om 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_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.github.windsekirun.navermaptest.NMapFragment.java
/** * Fragment? ?? NMapView ? // ww w . ja va 2s .co m */ public 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.nhn.android.mapviewer.NMapFragment.java
/** * Fragment? ?? NMapView ? /*w w w. ja v a 2 s. c o m*/ */ 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; }