IOS
hefeixia
2021-02-18 49f3c1374873f73dbde2983ca0fcf1fb10bfedbf
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
38
39
40
41
42
43
44
45
46
47
48
49
package com.mylhyl.circledialog.view;
 
import android.content.Context;
import android.view.View;
 
import com.mylhyl.circledialog.internal.BackgroundHelper;
import com.mylhyl.circledialog.internal.CircleParams;
import com.mylhyl.circledialog.internal.Controller;
 
/**
 * 列表对话框的取消按钮视图
 * Created by hupei on 2017/3/30.
 */
final class ItemsButton extends AbsButton {
 
    public ItemsButton(Context context, CircleParams circleParams) {
        super(context, circleParams);
    }
 
    @Override
    protected void initView() {
        setOrientation(HORIZONTAL);
 
        LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        //设置列表与按钮之间的上距离
        int topMargin = mNegativeParams == null ? mNeutralParams == null ? mPositiveParams == null ?
                0 : mPositiveParams.topMargin : mNeutralParams.topMargin : mNegativeParams.topMargin;
        if (topMargin > 0) {
            layoutParams.topMargin = Controller.dp2px(getContext(), topMargin);
        }
        setLayoutParams(layoutParams);
    }
 
    @Override
    protected void setNegativeButtonBackground(View view, int backgroundColor, CircleParams circleParams) {
        BackgroundHelper.handleItemsNegativeButtonBackground(view, backgroundColor, circleParams);
    }
 
    @Override
    protected void setNeutralButtonBackground(View view, int backgroundColor, CircleParams circleParams) {
        BackgroundHelper.handleItemsNeutralButtonBackground(view, backgroundColor, circleParams);
    }
 
    @Override
    protected void setPositiveButtonBackground(View view, int backgroundColor, CircleParams circleParams) {
        BackgroundHelper.handleItemsPositiveButtonBackground(view, backgroundColor, circleParams);
    }
 
}