List of usage examples for android.view ViewGroup getChildCount
public int getChildCount()
From source file:io.github.prefanatic.cleantap.util.AnimUtils.java
public static void showChildren(ViewGroup group) { FastOutLinearInInterpolator interpolator = new FastOutLinearInInterpolator(); for (int i = 0; i < group.getChildCount(); i++) { View view = group.getChildAt(i); view.setTranslationY(view.getHeight() / 3); view.setAlpha(0f);//from ww w.j a v a 2 s . c o m view.animate().alpha(1f).translationY(0f).setStartDelay(0L).setDuration(150L) //.setInterpolator(interpolator) .start(); } }
From source file:android.support.transition.ViewOverlay.java
public static ViewOverlay createFrom(View view) { ViewGroup contentView = getContentView(view); if (contentView != null) { final int numChildren = contentView.getChildCount(); for (int i = 0; i < numChildren; ++i) { View child = contentView.getChildAt(i); if (child instanceof OverlayViewGroup) { return ((OverlayViewGroup) child).mViewOverlay; }/*from ww w .j a v a2 s . co m*/ } return new ViewGroupOverlay(contentView.getContext(), contentView, view); } return null; }
From source file:dev.drsoran.moloko.util.UIUtils.java
public final static int getTaggedViewPos(ViewGroup container, String tag) { int pos = -1; for (int i = 0, cnt = container.getChildCount(); i < cnt && pos == -1; ++i) { if (tag.equals(container.getChildAt(i).getTag())) pos = i;/* www . java 2 s .co m*/ } return pos; }
From source file:com.google.android.apps.common.testing.accessibility.framework.ViewAccessibilityUtils.java
/** * Determines if the supplied {@link View} has child view(s) which are not independently * accessibility focusable and also have a spoken description. Put another way, this method * determines if {@code view} has at least one child which should be included in {@code view}'s * spoken description if {@code view} were to be accessibility focused. * * @param view The {@link View} to evaluate * @return {@code true} if {@code view} has non-actionable speaking children within its subtree *//* w w w . j av a 2s . co m*/ private static boolean hasNonActionableSpeakingChildren(View view) { if ((view == null) || !(view instanceof ViewGroup)) { return false; } ViewGroup group = (ViewGroup) view; for (int i = 0; i < group.getChildCount(); ++i) { View child = group.getChildAt(i); if ((child == null) || (child.getVisibility() != View.VISIBLE) || isAccessibilityFocusable(child)) { continue; } if (isImportantForAccessibility(child) && isSpeakingView(child)) { return true; } } return false; }
From source file:com.facebook.appevents.codeless.internal.ViewHierarchy.java
public static List<View> getChildrenOfView(View view) { ArrayList<View> children = new ArrayList<>(); if (view != null && view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; int count = viewGroup.getChildCount(); for (int i = 0; i < count; i++) { children.add(viewGroup.getChildAt(i)); }//from w w w .j a v a 2 s . c o m } return children; }
From source file:com.google.android.apps.common.testing.accessibility.framework.ViewAccessibilityUtils.java
private static View lookForLabelForViewInViewAndChildren(View view, View childToSkip, int idToFind) { if (view.getLabelFor() == idToFind) { return view; }//from w w w . ja va 2 s.c om if (!(view instanceof ViewGroup)) { return null; } ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); ++i) { View child = viewGroup.getChildAt(i); if (!child.equals(childToSkip)) { View labelingView = lookForLabelForViewInViewAndChildren(child, null, idToFind); if (labelingView != null) { return labelingView; } } } return null; }
From source file:com.google.android.apps.common.testing.accessibility.framework.ViewAccessibilityUtils.java
/** * Add all children in the view tree rooted at rootView to a set * * @param rootView The root of the view tree desired * @param theSet The set to add views to *//*from w ww . ja v a 2 s .co m*/ private static void addAllChildrenToSet(View rootView, Set<View> theSet) { if (!(rootView instanceof ViewGroup)) { return; } ViewGroup rootViewGroup = (ViewGroup) rootView; for (int i = 0; i < rootViewGroup.getChildCount(); ++i) { View nextView = rootViewGroup.getChildAt(i); theSet.add(nextView); addAllChildrenToSet(nextView, theSet); } }
From source file:dev.drsoran.moloko.util.UIUtils.java
public final static void removeTaggedViews(ViewGroup container, String tag) { List<View> views = null; for (int i = 0, cnt = container.getChildCount(); i < cnt; ++i) { final View v = container.getChildAt(i); if (v != null && tag.equals(v.getTag())) { if (views == null) views = new LinkedList<View>(); views.add(v);/*from w w w . j ava 2s . co m*/ } } if (views != null) for (View view : views) container.removeView(view); }
From source file:com.adkdevelopment.earthquakesurvival.utils.Utilities.java
/** * Makes sliding from the bottom effect on elements in a RecyclerView. * @param context from which call is made. * @param viewGroup on which to perform the animation. *///from ww w. j a va2s . c om public static void animateViewsIn(Context context, ViewGroup viewGroup) { if (viewGroup != null) { int count = viewGroup.getChildCount(); float offset = context.getResources().getDimensionPixelSize(R.dimen.offset_y); Interpolator interpolator; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { interpolator = AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in); } else { interpolator = AnimationUtils.loadInterpolator(context, android.R.interpolator.linear); } // loop over the children setting an increasing translation y but the same animation // duration + interpolation for (int i = 0; i < count; i++) { View view = viewGroup.getChildAt(i); view.setVisibility(View.VISIBLE); view.setTranslationY(offset); view.setAlpha(0.85f); // then animate back to natural position view.animate().translationY(0f).alpha(1f).setInterpolator(interpolator).setDuration(300L).start(); // increase the offset distance for the next view offset *= 1.5f; } } }
From source file:com.facebook.litho.utils.IncrementalMountUtils.java
/** * Performs incremental mount on the children views of the given ViewGroup. * @param scrollingViewParent ViewGroup container of views that will be incrementally mounted. * @param force whether the incremental mount should always take place, or only if * {@link ComponentsConfiguration.isIncrementalMountOnOffsetOrTranslationChangeEnabled} returns * false./*www . j a v a2 s .c o m*/ */ public static void performIncrementalMount(ViewGroup scrollingViewParent, boolean force) { assertMainThread(); if (!force && ComponentsConfiguration.isIncrementalMountOnOffsetOrTranslationChangeEnabled) { return; } final int viewGroupWidth = scrollingViewParent.getWidth(); final int viewGroupHeight = scrollingViewParent.getHeight(); for (int i = 0; i < scrollingViewParent.getChildCount(); i++) { maybePerformIncrementalMountOnView(viewGroupWidth, viewGroupHeight, scrollingViewParent.getChildAt(i)); } }