From 01e23be6118d68d38a71d186296d440eadcaa197 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 07 六月 2021 18:23:41 +0800 Subject: [PATCH] 特价bug修复 --- app/src/main/java/com/tejia/lijin/app/util/ui/GoodsDetailUtil.java | 66 +++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/app/src/main/java/com/tejia/lijin/app/util/ui/GoodsDetailUtil.java b/app/src/main/java/com/tejia/lijin/app/util/ui/GoodsDetailUtil.java index 1419941..1179e9f 100644 --- a/app/src/main/java/com/tejia/lijin/app/util/ui/GoodsDetailUtil.java +++ b/app/src/main/java/com/tejia/lijin/app/util/ui/GoodsDetailUtil.java @@ -3,12 +3,16 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.graphics.Color; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.tejia.lijin.app.ShoppingApplication; +import com.wpc.library.util.common.DimenUtils; import com.wpc.library.util.common.StringUtils; import com.tejia.lijin.app.BasicTextHttpResponseHandler; import com.tejia.lijin.app.ShoppingApi; @@ -122,4 +126,66 @@ } } + + public static String getSalesTypeDesc(int salesType) { + switch (salesType) { + case 1: + return "鏈堥攢"; + case 2: + return "2灏忔椂閿�"; + case 3: + return "浠婃棩閿�"; + default: + return "鎬婚攢"; + + } + } + + + /** + * 鏍规嵁鍟嗗搧鐢ㄦ埛绫诲瀷鑾峰彇搴楅摵绫诲瀷鍥炬爣 + * + * @return + */ + private static GradientDrawable getUserTypeDrawable(Context context, int color) { + GradientDrawable gd = new GradientDrawable(); + gd.setColor(Color.TRANSPARENT); + gd.setCornerRadius(100); + gd.setStroke(DimenUtils.dip2px(context, 1), color); + return gd; + } + + + public static String getShopTypeName(int userType) { + switch (userType) { + case 10: + return "娣樺疂"; + case 11: + return "澶╃尗"; + case 20: + case 21: + return "浜笢"; + case 30: + return "鎷煎澶�"; + case 40: + return "鍞搧浼�"; + case 50: + return "鑻忓畞鏄撹喘"; + } + return ""; + } + + public static void fillShopType(TextView tv_shop_type, int userType) { + int color = Color.parseColor("#FF2C4A"); + GradientDrawable bg = getUserTypeDrawable(tv_shop_type.getContext(), color); + tv_shop_type.setBackground(bg); + tv_shop_type.setText(getShopTypeName(userType)); + tv_shop_type.setTextColor(color); + tv_shop_type.setTextSize(10); + tv_shop_type.setPadding(DimenUtils.dip2px(tv_shop_type.getContext(), 5), 2, + DimenUtils.dip2px(tv_shop_type.getContext(), 5), 3); + } + + + } -- Gitblit v1.8.0