List of usage examples for android.widget GridLayout getChildCount
public int getChildCount()
From source file:com.retroteam.studio.retrostudio.EditorLandscape.java
/** * Find a measure view object by its coordinates. * @param row//from w w w .ja v a2s . c om * @param column * @return */ private View findMeasureByCoords(int row, int column) { LinearLayout track_layout = (LinearLayout) findViewById(R.id.track_layout); // HorizontalScrollView track_container = (HorizontalScrollView) track_layout.getChildAt(row + 1); GridLayout track = (GridLayout) track_container.getChildAt(0); int numChildren = track.getChildCount(); for (int i = 0; i < numChildren; i++) { View child = track.getChildAt(i); if (child.getTag(R.id.TAG_ROW) == row && child.getTag(R.id.TAG_COLUMN) == column) { return child; } } return null; }
From source file:com.retroteam.studio.retrostudio.EditorLandscape.java
/** * Iterate through all the measures and return a list of measure tag group objects. * The list is serialized out to the .retro project file. * @return ArrayList<MeasureTagGroup> *///from w ww .j a v a 2 s . c o m private ArrayList<MeasureTagGroup> getMeasureTags() { ArrayList<MeasureTagGroup> mtaglist = new ArrayList<>(); LinearLayout track_layout = (LinearLayout) findViewById(R.id.track_layout); //iterate through all the measures for (int t = 0; t < track_layout.getChildCount(); t++) { //get hscrollview HorizontalScrollView hchild = (HorizontalScrollView) track_layout.getChildAt(t); for (int h = 0; h < hchild.getChildCount(); h++) { //get gridlayout GridLayout gchild = (GridLayout) hchild.getChildAt(h); for (int g = 0; g < gchild.getChildCount(); g++) { //get measure if (gchild.getChildAt(g) instanceof ImageView) { ImageView ivchild = (ImageView) gchild.getChildAt(g); Drawable measureFill = ivchild.getDrawable(); if (measureFill.getConstantState() .equals(ContextCompat .getDrawable(getApplicationContext(), R.drawable.measure_new_empty) .getConstantState())) { mtaglist.add(new MeasureTagGroup((int) ivchild.getTag(R.id.TAG_ROW), (int) ivchild.getTag(R.id.TAG_COLUMN), false, (int) ivchild.getTag(R.id.TAG_GUISNAP), (ArrayList<int[]>) ivchild.getTag(R.id.TAG_FILLED_NOTES))); } else if (measureFill.getConstantState() .equals(ContextCompat .getDrawable(getApplicationContext(), R.drawable.measure_new_filled) .getConstantState())) { mtaglist.add(new MeasureTagGroup((int) ivchild.getTag(R.id.TAG_ROW), (int) ivchild.getTag(R.id.TAG_COLUMN), true, (int) ivchild.getTag(R.id.TAG_GUISNAP), (ArrayList<int[]>) ivchild.getTag(R.id.TAG_FILLED_NOTES))); } } } } } return mtaglist; }