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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.mylhyl.circledialog.view;
 
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;
 
import com.mylhyl.circledialog.internal.CircleParams;
 
/**
 * 广告
 * Created by hupei on 2019/1/11 11:10.
 */
public final class BuildViewAdImpl extends AbsBuildView {
    private BodyAdView mBodyAdView;
 
    public BuildViewAdImpl(Context context, CircleParams params) {
        super(context, params);
    }
 
    @Override
    public void buildRootView() {
        mRoot = createLinearLayout();
    }
 
    @Override
    public void buildBodyView() {
        buildRootView();
        buildTitleView();
        if (mBodyAdView == null) {
            mBodyAdView = new BodyAdView(mContext, mParams);
            addViewByBody(mBodyAdView);
        }
    }
 
    @Override
    public BodyAdView getBodyView() {
        return mBodyAdView;
    }
 
    @Override
    public void refreshContent() {
 
    }
 
    public static class SelectorPointDrawable extends StateListDrawable {
 
        public SelectorPointDrawable(int color, int size) {
 
            //选中
            GradientDrawable selectedDrawable = new GradientDrawable();
            selectedDrawable.setShape(GradientDrawable.OVAL);
            selectedDrawable.setColor(color);
            selectedDrawable.setSize(size, size);
 
            //默认
            GradientDrawable defaultDrawable = new GradientDrawable();
            defaultDrawable.setShape(GradientDrawable.OVAL);
            defaultDrawable.setStroke(2, color);
            defaultDrawable.setSize(size, size);
 
            addState(new int[]{android.R.attr.state_selected}, selectedDrawable);
            addState(new int[]{-android.R.attr.state_selected}, defaultDrawable);
        }
    }
}