| | |
| | | import android.graphics.Paint; |
| | | import android.graphics.Typeface; |
| | | import android.graphics.drawable.GradientDrawable; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.text.Spannable; |
| | | import android.text.SpannableString; |
| | | import android.text.Spanned; |
| | | import android.text.TextUtils; |
| | | import android.text.style.RelativeSizeSpan; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.view.WindowManager; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.GridView; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.PopupWindow; |
| | |
| | | info = mList.get(position); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(info.getHongBaoTypePic())) { |
| | | viewHolder.ll_no_data.setVisibility(View.VISIBLE); |
| | | viewHolder.tv_place_order_time.setVisibility(View.GONE); |
| | | viewHolder.ll_content.setVisibility(View.GONE); |
| | | viewHolder.tv_no_data_hint.setGravity(Gravity.CENTER_HORIZONTAL); |
| | | info.setRewardDetail(null); |
| | | |
| | | } else { |
| | | |
| | | viewHolder.ll_no_data.setVisibility(View.GONE); |
| | | viewHolder.tv_place_order_time.setVisibility(View.VISIBLE); |
| | | viewHolder.ll_content.setVisibility(View.VISIBLE); |
| | |
| | | if (viewHolder.ll_order_img.getChildCount() > 0) |
| | | viewHolder.ll_order_img.removeAllViews(); |
| | | |
| | | if (info.getSignList().size() > 0) { |
| | | for (int i = 0; i < info.getSignList().size(); i++) { |
| | | ImageView iv_order_type = new ImageView(mContext); |
| | | LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); |
| | | params1.gravity = Gravity.CENTER; |
| | | params1.rightMargin = 8; |
| | | // params1.setMargins(DimenUtils.dip2px(mContext, 8), 0, 0, 0); |
| | | iv_order_type.setLayoutParams(params1); |
| | | Glide.with(mContext).load(info.getSignList().get(i)).into(iv_order_type); |
| | | viewHolder.ll_order_img.addView(iv_order_type); |
| | | TextView tv_order_type = new TextView(mContext); |
| | | tv_order_type.setTextColor(Color.WHITE); |
| | | tv_order_type.setTextSize(12); |
| | | tv_order_type.setPadding(DimenUtils.dip2px(mContext, 7), 0, DimenUtils.dip2px(mContext, 7), DimenUtils.dip2px(mContext, 1)); |
| | | tv_order_type.setGravity(Gravity.CENTER); |
| | | switch (info.getOrderOrigin()) { |
| | | //返利订单 |
| | | case 1: |
| | | tv_order_type.setBackground(GradientDrawableUtil.getOrderType(mContext, "#55BE00")); |
| | | tv_order_type.setText("返利订单"); |
| | | break; |
| | | //分享订单 |
| | | case 2: |
| | | tv_order_type.setBackground(GradientDrawableUtil.getOrderType(mContext, "#3BAEFF")); |
| | | tv_order_type.setText("分享订单"); |
| | | break; |
| | | //邀请订单 |
| | | case 3: |
| | | tv_order_type.setBackground(GradientDrawableUtil.getOrderType(mContext, "#BC34FB")); |
| | | tv_order_type.setText("邀请订单"); |
| | | break; |
| | | } |
| | | } |
| | | viewHolder.ll_order_img.addView(tv_order_type); |
| | | |
| | | viewHolder.tv_order_state.setText(info.getOrderState().getContent()); |
| | | viewHolder.tv_order_state.setTextColor(Color.parseColor(info.getOrderState().getFontColor())); |
| | | viewHolder.tv_order_state.setVisibility(View.GONE); |
| | | if (viewHolder.ll_goods_info.getChildCount() > 0) |
| | | viewHolder.ll_goods_info.removeAllViews(); |
| | | for (int i = 0; i < info.getListOrderGoods().size(); i++) { |
| | |
| | | TextView tv_goods_title = view.findViewById(R.id.tv_goods_title); |
| | | TextView tv_goods_consume = view.findViewById(R.id.tv_goods_consume); |
| | | TextView tv_goods_num = view.findViewById(R.id.tv_goods_num); |
| | | TextView tv_order_time = view.findViewById(R.id.tv_order_time); |
| | | TextView tv_pay_state = view.findViewById(R.id.tv_pay_state); |
| | | ImageView iv_goods_img_cover = view.findViewById(R.id.iv_goods_img_cover); |
| | | final OrderGoods oInfo = info.getListOrderGoods().get(i); |
| | | tv_goods_consume.setText(oInfo.getActualPay()); |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | tv_order_time.setText("下单时间:" + oInfo.getPlaceOrderTime()); |
| | | tv_pay_state.setText(oInfo.getPayState()); |
| | | |
| | | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( |
| | | ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | int topMargin = DimenUtils.dip2px(mContext, 5); |
| | |
| | | view.setLayoutParams(params); |
| | | viewHolder.ll_goods_info.addView(view); |
| | | } |
| | | |
| | | String orderNo = info.getOrderNo().replaceAll(" ", ""); |
| | | viewHolder.tv_copy.setVisibility(orderNo.endsWith("*") ? View.GONE : View.VISIBLE); |
| | | viewHolder.tv_order_num.setText("订单号:" + info.getOrderNo()); |
| | | viewHolder.tv_order_time.setText(info.getDownTime()); |
| | | viewHolder.tv_order_time.setVisibility(View.GONE); |
| | | if (StringUtils.isEmpty(info.getReceiveTime())) { |
| | | viewHolder.tv_take_over_time.setVisibility(View.GONE); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | viewHolder.tv_estimate_reward.setText(info.getHongBaoInfo().getContent());//奖金 |
| | | viewHolder.tv_estimate_reward.setTextColor(Color.parseColor(info.getHongBaoInfo().getFontColor())); |
| | | viewHolder.tv_reward_state.setText(info.getAccountState().getContent());//到账状态 |
| | | viewHolder.tv_reward_state.setTextColor(Color.parseColor(info.getAccountState().getFontColor())); |
| | | if (!StringUtils.isEmpty(info.getRebateLink())) {//能进入订单详情 |
| | | viewHolder.tv_estimate_in.setVisibility(View.VISIBLE); |
| | | viewHolder.tv_estimate_in.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | if (!StringUtils.isEmpty(info.getRebateLink())) |
| | | mContext.startActivity(new Intent(mContext, ShareBrowserActivity.class).putExtra("url", info.getRebateLink())); |
| | | } |
| | | }); |
| | | int startIndex = info.getHongBaoInfo().getContent().indexOf("¥"); |
| | | Spannable span = new SpannableString(info.getHongBaoInfo().getContent()); |
| | | span.setSpan(new RelativeSizeSpan(1.667f), startIndex + 1, info.getHongBaoInfo().getContent().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | viewHolder.tv_estimate_reward.setText(span);//奖金 |
| | | // viewHolder.tv_estimate_reward.setTextColor(Color.parseColor(info.getHongBaoInfo().getFontColor())); |
| | | |
| | | viewHolder.tv_estimate_reward.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | if (!StringUtils.isEmpty(info.getRebateLink())) |
| | | mContext.startActivity(new Intent(mContext, ShareBrowserActivity.class).putExtra("url", info.getRebateLink())); |
| | | } |
| | | }); |
| | | } else {//不能进入订单详情 |
| | | |
| | | viewHolder.tv_reward_state.setText(info.getAccountState().getContent());//到账状态 |
| | | // viewHolder.tv_reward_state.setTextColor(Color.parseColor(info.getAccountState().getFontColor())); |
| | | // if (!StringUtils.isEmpty(info.getRebateLink())) {//能进入订单详情 |
| | | // viewHolder.tv_estimate_in.setVisibility(View.VISIBLE); |
| | | // viewHolder.tv_estimate_in.setOnClickListener(new View.OnClickListener() { |
| | | // @Override |
| | | // public void onClick(View view) { |
| | | // if (!StringUtils.isEmpty(info.getRebateLink())) |
| | | // mContext.startActivity(new Intent(mContext, ShareBrowserActivity.class).putExtra("url", info.getRebateLink())); |
| | | // } |
| | | // }); |
| | | // |
| | | // viewHolder.tv_estimate_reward.setOnClickListener(new View.OnClickListener() { |
| | | // @Override |
| | | // public void onClick(View view) { |
| | | // if (!StringUtils.isEmpty(info.getRebateLink())) |
| | | // mContext.startActivity(new Intent(mContext, ShareBrowserActivity.class).putExtra("url", info.getRebateLink())); |
| | | // } |
| | | // }); |
| | | // } else {//不能进入订单详情 |
| | | // viewHolder.tv_estimate_in.setVisibility(View.GONE); |
| | | // } |
| | | |
| | | viewHolder.tv_estimate_in.setVisibility(View.GONE); |
| | | } |
| | | viewHolder.tv_copy.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |