|
|
@@ -34,20 +34,24 @@ public class DiscountUtils {
|
|
|
* @param discount 打折的文本
|
|
|
*/
|
|
|
public void showDiscount(View view, String logo, String discount) {
|
|
|
-// Glide.with(view.getContext()).load(logo)
|
|
|
-// .into((ImageView) view.findViewById(R.id.img_logo));
|
|
|
-// if (TextUtils.isEmpty(discount)
|
|
|
-// || discount.startsWith("10")) {
|
|
|
-// view.findViewById(R.id.img_discount)
|
|
|
-// .setVisibility(View.GONE);
|
|
|
-// ((TextView) view.findViewById(R.id.txt_logo_discount)
|
|
|
-// ).setText("");
|
|
|
-// } else {
|
|
|
-// ((TextView) view.findViewById(R.id.txt_logo_discount)
|
|
|
-// ).setText((discount.length() == 4?discount.substring(0, 3):discount) + "折");
|
|
|
-// view.findViewById(R.id.img_discount)
|
|
|
-// .setVisibility(View.VISIBLE);
|
|
|
-// }
|
|
|
+ Glide.with(view.getContext()).load(logo)
|
|
|
+ .into((ImageView) view.findViewById(R.id.img_logo));
|
|
|
+ if (TextUtils.isEmpty(discount)
|
|
|
+ || discount.startsWith("10")) {
|
|
|
+ view.findViewById(R.id.img_discount)
|
|
|
+ .setVisibility(View.GONE);
|
|
|
+ ((TextView) view.findViewById(R.id.txt_logo_discount)
|
|
|
+ ).setText("");
|
|
|
+ } else {
|
|
|
+ ((TextView) view.findViewById(R.id.txt_logo_discount)
|
|
|
+ ).setText((discount.length() == 4?discount.substring(0, 3):discount) + "折");
|
|
|
+ view.findViewById(R.id.img_discount)
|
|
|
+ .setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
+ view.findViewById(R.id.img_discount)
|
|
|
+ .setVisibility(View.GONE);
|
|
|
+ ((TextView) view.findViewById(R.id.txt_logo_discount)
|
|
|
+ ).setText("");
|
|
|
showDiscountNew(view, logo, discount);
|
|
|
}
|
|
|
/**
|
|
|
@@ -57,19 +61,13 @@ public class DiscountUtils {
|
|
|
* @param discount 打折的文本
|
|
|
*/
|
|
|
public void showDiscountNew(View view, String logo, String discount) {
|
|
|
- Glide.with(view.getContext()).load(logo)
|
|
|
- .into((ImageView) view.findViewById(R.id.img_logo));
|
|
|
if (TextUtils.isEmpty(discount)
|
|
|
|| discount.startsWith("10")) {
|
|
|
- view.findViewById(R.id.img_discount)
|
|
|
+ view.findViewById(R.id.discount_tv)
|
|
|
.setVisibility(View.GONE);
|
|
|
- ((TextView) view.findViewById(R.id.txt_logo_discount)
|
|
|
- ).setText("");
|
|
|
} else {
|
|
|
- ((TextView) view.findViewById(R.id.txt_logo_discount)
|
|
|
+ ((TextView) view.findViewById(R.id.discount_tv)
|
|
|
).setText((discount.length() == 4?discount.substring(0, 3):discount) + "折");
|
|
|
- view.findViewById(R.id.img_discount)
|
|
|
- .setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
}
|
|
|
|