Example usage for android.widget HorizontalScrollView getChildCount

List of usage examples for android.widget HorizontalScrollView getChildCount

Introduction

In this page you can find the example usage for android.widget HorizontalScrollView getChildCount.

Prototype

public int getChildCount() 

Source Link

Document

Returns the number of children in the group.

Usage

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>
 *///  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;
}