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;
|
}
|
|
|
}
|