lmw
2023-03-11 4df5bb59e5fe9f9d140e5610f7772dd8a05a28d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.beloo.widget.chipslayoutmanager;
 
import android.view.View;
 
import androidx.recyclerview.widget.RecyclerView;
 
import java.util.Iterator;
 
public class ChildViewsIterable implements Iterable<View> {
 
    private RecyclerView.LayoutManager layoutManager;
 
    public ChildViewsIterable(RecyclerView.LayoutManager layoutManager) {
        this.layoutManager = layoutManager;
    }
 
    @Override
    public Iterator<View> iterator() {
        return new Iterator<View>() {
            int i = 0;
 
            @Override
            public boolean hasNext() {
                return i < layoutManager.getChildCount();
            }
 
            @Override
            public View next() {
                return layoutManager.getChildAt(i++);
            }
        };
    }
 
    public int size() {
        return layoutManager.getChildCount();
    }
}