admin
2021-06-05 ddff7888bf7e754d12fb5fc85a58f3012f456490
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
package com.tejia.lijin.app.util.ui;
 
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
 
import com.tejia.lijin.app.util.SystemParamsUtil;
import com.wpc.library.util.common.DimenUtils;
import com.wpc.library.util.common.StringUtils;
 
public class HomeUIUtil {
 
 
    public static GradientDrawable getHomeTopBg(Context context) {
        String color = SystemParamsUtil.getHomePageBgColors(context);
        if (StringUtils.isNullOrEmpty(color)) {
            color = "#FF227B,#FF2A3E";
        }
        return getHomeTopBg(color.split(",")[0], color.split(",")[1]);
    }
 
 
    /**
     * 首页顶部背景
     *
     * @param startColor
     * @param endColor
     * @return
     */
    public static GradientDrawable getHomeTopBg(String startColor, String endColor) {
        GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT,
                new int[]{Color.parseColor(startColor), Color.parseColor(endColor)});
        return gd;
    }
 
 
    /**
     * 获取圆形专题背景
     *
     * @param bgColor
     * @return
     */
    public static GradientDrawable getCircleSpecialBg(Context context, String bgColor) {
        GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT,
                new int[]{Color.parseColor(bgColor), Color.parseColor(bgColor)});
        gd.setCornerRadius(DimenUtils.dip2px(context, 20));
        return gd;
    }
 
 
}