| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.graphics.Color; |
| | | import android.text.Spannable; |
| | | import android.text.SpannableString; |
| | | import android.text.style.RelativeSizeSpan; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | } |
| | | ((ContentHolder) holder).tv_title.setText(info.getDetail().getTitle()); |
| | | BigDecimal money = new BigDecimal(info.getDetail().getMoney()); |
| | | String moneyDesc = ""; |
| | | if (money.compareTo(new BigDecimal(0)) < 0) { |
| | | money = money.abs(); |
| | | ((ContentHolder) holder).tv_money_info.setText("- ¥ " + money); |
| | | moneyDesc = "- ¥" + money; |
| | | ((ContentHolder) holder).tv_money_info.setTextColor(mContext.getResources().getColor(R.color.black)); |
| | | } else { |
| | | ((ContentHolder) holder).tv_money_info.setText("+ ¥ " + money); |
| | | ((ContentHolder) holder).tv_money_info.setTextColor(mContext.getResources().getColor(R.color.main_text_color)); |
| | | moneyDesc = "+ ¥" + money; |
| | | ((ContentHolder) holder).tv_money_info.setTextColor(Color.parseColor("#FF2B51")); |
| | | } |
| | | |
| | | |
| | | SpannableString spannableString = new SpannableString(moneyDesc); |
| | | spannableString.setSpan(new RelativeSizeSpan(2.0f), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | spannableString.setSpan(new RelativeSizeSpan(2.4f), moneyDesc.indexOf("¥") + 1, moneyDesc.indexOf(".") > -1 ? moneyDesc.indexOf(".") : moneyDesc.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | |
| | | ((ContentHolder) holder).tv_money_info.setText(spannableString); |
| | | |
| | | |
| | | if (StringUtils.isEmpty(info.getDetail().getDescInfo())) { |
| | | ((ContentHolder) holder).tv_desc_info.setVisibility(View.GONE); |
| | | } else { |