lmw
2023-04-03 16ea883d3c03fd8b910f9282aa1bc08378d40d54
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.beloo.widget.chipslayoutmanager.gravity;
 
import android.graphics.Rect;
 
class BottomGravityModifier implements IGravityModifier {
    @Override
    public Rect modifyChildRect(int minStart, int maxEnd, Rect childRect) {
        if (childRect.top < minStart) {
            throw new IllegalArgumentException("top point of input rect can't be lower than minTop");
        }
        if (childRect.bottom > maxEnd) {
            throw new IllegalArgumentException("bottom point of input rect can't be bigger than maxTop");
        }
        Rect modified = new Rect(childRect);
 
        if (modified.bottom < maxEnd) {
            modified.top += maxEnd - modified.bottom;
            modified.bottom = maxEnd;
        }
        return modified;
    }
}