List of usage examples for android.view ViewGroup getChildCount
public int getChildCount()
From source file:org.sufficientlysecure.keychain.ui.EditKeyActivity.java
private ArrayList<Calendar> getKeysExpiryDates(SectionView keysView) throws PgpGeneralException { ArrayList<Calendar> keysExpiryDates = new ArrayList<Calendar>(); ViewGroup keyEditors = keysView.getEditors(); if (keyEditors.getChildCount() == 0) { throw new PgpGeneralException(getString(R.string.error_key_needs_master_key)); }/*from w w w . jav a 2 s .c o m*/ for (int i = 0; i < keyEditors.getChildCount(); ++i) { KeyEditor editor = (KeyEditor) keyEditors.getChildAt(i); keysExpiryDates.add(editor.getExpiryDate()); } return keysExpiryDates; }
From source file:org.sufficientlysecure.keychain.ui.EditKeyActivity.java
/** * Returns keys from the SectionView//from w w w . j a v a 2 s. c o m * * @param keysView * @return */ private ArrayList<UncachedSecretKey> getKeys(SectionView keysView) throws PgpGeneralException { ArrayList<UncachedSecretKey> keys = new ArrayList<UncachedSecretKey>(); ViewGroup keyEditors = keysView.getEditors(); if (keyEditors.getChildCount() == 0) { throw new PgpGeneralException(getString(R.string.error_key_needs_master_key)); } for (int i = 0; i < keyEditors.getChildCount(); ++i) { KeyEditor editor = (KeyEditor) keyEditors.getChildAt(i); keys.add(editor.getValue()); } return keys; }
From source file:org.sufficientlysecure.keychain.ui.EditKeyActivity.java
/** * Returns usage selections of keys from the SectionView * * @param keysView// w w w. j a v a 2s . c o m * @return */ private ArrayList<Integer> getKeysUsages(SectionView keysView) throws PgpGeneralException { ArrayList<Integer> keysUsages = new ArrayList<Integer>(); ViewGroup keyEditors = keysView.getEditors(); if (keyEditors.getChildCount() == 0) { throw new PgpGeneralException(getString(R.string.error_key_needs_master_key)); } for (int i = 0; i < keyEditors.getChildCount(); ++i) { KeyEditor editor = (KeyEditor) keyEditors.getChildAt(i); keysUsages.add(editor.getUsage()); } return keysUsages; }
From source file:org.thialfihar.android.apg.ui.EditKeyActivity.java
/** * Returns keys from the SectionView/*from ww w. j a va 2 s . co m*/ * * @param keysView * @return */ private ArrayList<PGPSecretKey> getKeys(SectionView keysView) throws PgpGeneralException { ArrayList<PGPSecretKey> keys = new ArrayList<PGPSecretKey>(); ViewGroup keyEditors = keysView.getEditors(); if (keyEditors.getChildCount() == 0) { throw new PgpGeneralException(getString(R.string.error_key_needs_master_key)); } for (int i = 0; i < keyEditors.getChildCount(); ++i) { KeyEditor editor = (KeyEditor) keyEditors.getChildAt(i); keys.add(editor.getValue()); } return keys; }
From source file:gr.plushost.prototypeapp.widgets.LabelView.java
private boolean replaceLayout(View target) { if (getParent() != null || target == null || target.getParent() == null || _labelViewContainerID != -1) { return false; }//from w w w . j a v a 2 s.co m ViewGroup parentContainer = (ViewGroup) target.getParent(); if (target.getParent() instanceof FrameLayout) { ((FrameLayout) target.getParent()).addView(this); } else if (target.getParent() instanceof ViewGroup) { int groupIndex = parentContainer.indexOfChild(target); _labelViewContainerID = generateViewId(); // relativeLayout need copy rule if (target.getParent() instanceof RelativeLayout) { for (int i = 0; i < parentContainer.getChildCount(); i++) { if (i == groupIndex) { continue; } View view = parentContainer.getChildAt(i); RelativeLayout.LayoutParams para = (RelativeLayout.LayoutParams) view.getLayoutParams(); for (int j = 0; j < para.getRules().length; j++) { if (para.getRules()[j] == target.getId()) { para.getRules()[j] = _labelViewContainerID; } } view.setLayoutParams(para); } } parentContainer.removeView(target); // new dummy layout FrameLayout labelViewContainer = new FrameLayout(getContext()); ViewGroup.LayoutParams targetLayoutParam = target.getLayoutParams(); labelViewContainer.setLayoutParams(targetLayoutParam); target.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // add target and label in dummy layout labelViewContainer.addView(target); labelViewContainer.addView(this); labelViewContainer.setId(_labelViewContainerID); // add dummy layout in parent container parentContainer.addView(labelViewContainer, groupIndex, targetLayoutParam); } return true; }
From source file:android.support.v7.internal.view.menu.ActionMenuPresenter.java
private View findViewForItem(MenuItem item) { final ViewGroup parent = (ViewGroup) mMenuView; if (parent == null) { return null; }/*from w w w. jav a2s . c o m*/ final int count = parent.getChildCount(); for (int i = 0; i < count; i++) { final View child = parent.getChildAt(i); if (child instanceof MenuView.ItemView && ((MenuView.ItemView) child).getItemData() == item) { return child; } } return null; }
From source file:android.support.car.app.CarFragmentActivity.java
private void dumpViewHierarchy(String prefix, PrintWriter writer, View view) { writer.print(prefix);//from w w w . ja v a2 s .c o m if (view == null) { writer.println("null"); return; } writer.println(viewToString(view)); if (!(view instanceof ViewGroup)) { return; } ViewGroup grp = (ViewGroup) view; final int N = grp.getChildCount(); if (N <= 0) { return; } prefix = prefix + " "; for (int i = 0; i < N; i++) { dumpViewHierarchy(prefix, writer, grp.getChildAt(i)); } }
From source file:com.dahl.brendan.wordsearch.view.WordSearchActivity.java
/** * creates a grid of textViews from layout files based on the gridSize * and sets the new textViews to use the controller as their listener * //w ww.j a v a 2 s .c om * @param gridSize square size of the new grid to make * @param controller the onkeyListener used for the grid's textViews, also holds the gridView an array of the new textView's in the grid */ public void setupViewGrid() { control.setLetter(null); int gridSize = control.getGridSize(); TextViewGridController controller = control.getGridManager(); ViewGroup gridTable = (ViewGroup) this.findViewById(R.id.gridTable); if (gridTable.getChildCount() != gridSize) { if (gridTable.getChildCount() == 0) { gridTable.setKeepScreenOn(true); gridTable.setOnTouchListener(controller); } controller.clearPointDemension(); gridTable.removeAllViews(); Point point = new Point(); controller.setGridView(new TextView[gridSize][]); TextView[][] gridView = controller.getGridView(); for (point.y = 0; point.y < gridSize; point.y++) { this.getLayoutInflater().inflate(R.layout.grid_row, gridTable, true); ViewGroup row = (ViewGroup) gridTable.getChildAt(point.y); TextView[] rowText = new TextView[gridSize]; for (point.x = 0; point.x < gridSize; point.x++) { this.getLayoutInflater().inflate(R.layout.grid_text_view, row, true); TextView view = (TextView) row.getChildAt(point.x); view.setId(ConversionUtil.convertPointToID(point, control.getGridSize())); view.setOnKeyListener(controller); rowText[point.x] = view; } gridView[point.y] = rowText; } gridTable.requestLayout(); } }
From source file:ws.crandell.newspaperpuzzles.wordsearch.view.WordSearchActivity.java
/** * creates a grid of textViews from layout files based on the gridSize * and sets the new textViews to use the controller as their listener * /*from w w w.jav a 2s. c o m*/ * @param gridSize square size of the new grid to make * @param controller the onkeyListener used for the grid's textViews, also holds the gridView an array of the new textView's in the grid */ public void setupViewGrid() { control.setLetter(null); int gridSize = control.getGridSize(); TextViewGridController controller = control.getGridManager(); ViewGroup gridTable = (ViewGroup) this.findViewById(R.id.gridTable); if (gridTable.getChildCount() != gridSize) { if (gridTable.getChildCount() == 0) { gridTable.setKeepScreenOn(true); gridTable.setOnTouchListener(controller); } controller.clearPointDemension(); gridTable.removeAllViews(); Point point = new Point(); controller.setGridView(new TextView[gridSize][]); TextView[][] gridView = controller.getGridView(); for (point.y = 0; point.y < gridSize; point.y++) { this.getLayoutInflater().inflate(R.layout.ws_grid_row, gridTable, true); ViewGroup row = (ViewGroup) gridTable.getChildAt(point.y); TextView[] rowText = new TextView[gridSize]; for (point.x = 0; point.x < gridSize; point.x++) { this.getLayoutInflater().inflate(R.layout.ws_grid_text_view, row, true); TextView view = (TextView) row.getChildAt(point.x); view.setId(ConversionUtil.convertPointToID(point, control.getGridSize())); view.setOnKeyListener(controller); rowText[point.x] = view; } gridView[point.y] = rowText; } gridTable.requestLayout(); } }
From source file:com.efan.notlonely_android.view.PagerSlidingTabStrip.java
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); ViewGroup tabViewGroup = getTabsLayout(); FirstPositionOffset = (float) tabViewGroup.getLeft(); if (tabViewGroup != null) { currentPosition = viewPager != null ? viewPager.getCurrentItem() : 0; if (!disableViewPager) { scrollToChild(currentPosition, 0); selectedTab(currentPosition); }/* w ww . j av a 2 s .c o m*/ for (int w = 0; w < tabViewGroup.getChildCount(); w++) { View itemView = tabViewGroup.getChildAt(w); itemView.setTag(w); itemView.setClickable(true); itemView.setOnClickListener(this); } } }