List of usage examples for android.view ViewGroup getChildCount
public int getChildCount()
From source file:com.owncloud.android.ui.ThemeableSwitchPreference.java
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN) private void findSwitch(ViewGroup viewGroup) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (child instanceof Switch) { Switch switchView = (Switch) child; int color = ThemeUtils.primaryAccentColor(); int trackColor = Color.argb(77, Color.red(color), Color.green(color), Color.blue(color)); // setting the thumb color DrawableCompat.setTintList(switchView.getThumbDrawable(), new ColorStateList(new int[][] { new int[] { android.R.attr.state_checked }, new int[] {} }, new int[] { color, Color.WHITE })); // setting the track color DrawableCompat.setTintList(switchView.getTrackDrawable(), new ColorStateList(new int[][] { new int[] { android.R.attr.state_checked }, new int[] {} }, new int[] { trackColor, Color.parseColor("#4D000000") })); break; } else if (child instanceof ViewGroup) { findSwitch((ViewGroup) child); }// w w w. j a va2s.co m } }
From source file:com.microsoft.artcurator.ui.view.SwipeRefreshLayout.java
@Override public boolean canChildScrollUp() { // look at our inner frame and iterate over the children ViewGroup inner = (ViewGroup) getChildAt(0); View child;// w w w. jav a2 s .c o m for (int ii = 0; ii < inner.getChildCount(); ii++) { child = inner.getChildAt(ii); if (child.isShown()) { return ViewCompat.canScrollVertically(child, -1); } } return super.canChildScrollUp(); }
From source file:org.onebusaway.android.util.UIUtils.java
/** * Sets the line and fill colors for real-time indicator circles contained in the provided * realtime_indicator.xml layout. There are several circles, so each needs to be set * individually. The integer representation of the color to be used should be provided. * * @param vg realtime_indicator.xml layout * @param lineColor color to be used as line color, or null to use the default colors * @param fillColor color to be used as fill color, or null to use the default colors *//*from www . j av a 2 s.c o m*/ public static void setRealtimeIndicatorColor(ViewGroup vg, Integer lineColor, Integer fillColor) { for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); if (v instanceof RealtimeIndicatorView) { if (lineColor != null) { ((RealtimeIndicatorView) v).setLineColor(lineColor); } else { // Use default color ((RealtimeIndicatorView) v).setLineColor(R.color.realtime_indicator_line); } if (fillColor != null) { ((RealtimeIndicatorView) v).setFillColor(fillColor); } else { // Use default color ((RealtimeIndicatorView) v).setLineColor(R.color.realtime_indicator_fill); } } } }
From source file:com.netease.hearttouch.htimagepicker.core.view.photoview.ViewPagerAdapter.java
private void resetPhotoView(View v) { if (v instanceof ViewGroup) { ViewGroup vg = (ViewGroup) v; int childCount = vg.getChildCount(); for (int i = 0; i < childCount; ++i) { View subView = vg.getChildAt(i); if (subView instanceof HTPhotoView) { ((HTPhotoView) subView).resetToInit(true); }/* w w w .j a v a 2 s . c om*/ } } }
From source file:dev.vision.shopping.center.Splash.java
private void overrideFonts(final Context context, final View v) { try {/*from ww w . j ava 2 s . co m*/ if (v instanceof ViewGroup) { ViewGroup vg = (ViewGroup) v; for (int i = 0; i < vg.getChildCount(); i++) { View child = vg.getChildAt(i); overrideFonts(context, child); } } else if (v instanceof TextView) { ((TextView) v) .setTypeface(Typeface.createFromAsset(context.getAssets(), "AvantGardeITCbyBTBook.otf")); } } catch (Exception e) { } }
From source file:com.bryan.lib.util.TabUtils.java
private View getRealChild(View child) { View realChild = null;//from w w w.j a v a2 s. c o m //viewgroup,???? android:clickable="false" if (child instanceof ViewGroup) { ViewGroup group = (ViewGroup) child; if (group.getChildCount() == 1) { realChild = ((ViewGroup) child).getChildAt(0); } //viewgroup1?tag else if (group.getChildCount() > 1) { for (int i = 0; i < group.getChildCount(); i++) { if (group.getChildAt(i).getTag() != null) { realChild = group.getChildAt(i); break; } } } else { realChild = child; } } else if (child instanceof View) { realChild = child; } return realChild; }
From source file:org.tanrabad.survey.presenter.PlaceListActivity.java
private void changeTabsFont() { ViewGroup vg = (ViewGroup) placeListTabLayout.getChildAt(0); int tabsCount = vg.getChildCount(); for (int j = 0; j < tabsCount; j++) { ViewGroup vgTab = (ViewGroup) vg.getChildAt(j); int tabChildsCount = vgTab.getChildCount(); for (int i = 0; i < tabChildsCount; i++) { View tabViewChild = vgTab.getChildAt(i); if (tabViewChild instanceof TextView) { CalligraphyUtils.applyFontToTextView((TextView) tabViewChild, TypefaceUtils.load(this.getAssets(), "fonts/ThaiSansNeue-Regular.otf")); }//from w w w .java 2 s . co m } } }
From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.tablet.SessionsMultiPaneActivity.java
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_session_detail); if (detailContainer != null && detailContainer.getChildCount() > 0) { findViewById(R.id.fragment_container_session_detail).setBackgroundColor(0xffffffff); }/* ww w .ja v a 2 s .co m*/ }
From source file:com.goliathonline.android.kegbot.ui.tablet.SessionsMultiPaneActivity.java
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getActivityHelper().setupSubActivity(); ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_session_detail); if (detailContainer != null && detailContainer.getChildCount() > 0) { findViewById(R.id.fragment_container_session_detail).setBackgroundColor(0xffffffff); }//from w w w . jav a 2s.c o m }
From source file:com.goliathonline.android.kegbot.ui.tablet.VendorsMultiPaneActivity.java
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getActivityHelper().setupSubActivity(); ViewGroup detailContainer = (ViewGroup) findViewById(R.id.fragment_container_vendor_detail); if (detailContainer != null && detailContainer.getChildCount() > 0) { findViewById(R.id.fragment_container_vendor_detail).setBackgroundColor(0xffffffff); }//from w ww .j a va 2 s . com }