|
|
@@ -80,57 +80,56 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { |
|
|
|
if (holder instanceof MyViewHolder) { |
|
|
|
MyViewHolder myViewHolder = (MyViewHolder) holder; |
|
|
|
ResGoodsMake goodsMake =datas.get(position); |
|
|
|
// 设置要显示的图片和文字 |
|
|
|
myViewHolder.loading_ProgressBar.setProgress(goodsMake.makeProcess); |
|
|
|
myViewHolder.loading_name.setText(goodsMake.good.name); |
|
|
|
myViewHolder.loading_status.setText(goodsMake.makeStatus.name()); |
|
|
|
myViewHolder.loading_zuofa.setText(goodsMake.subOrder.exp); |
|
|
|
|
|
|
|
DecimalFormat decimalFormat =new DecimalFormat("00"); |
|
|
|
myViewHolder.loading_xuhao.setText(decimalFormat.format(position+1)); |
|
|
|
LogUtils.error("****","刷新 position="+position); |
|
|
|
MyViewHolder myViewHolder = (MyViewHolder) holder; |
|
|
|
ResGoodsMake goodsMake =datas.get(position); |
|
|
|
// 设置要显示的图片和文字 |
|
|
|
myViewHolder.loading_ProgressBar.setProgress(goodsMake.makeProcess); |
|
|
|
myViewHolder.loading_name.setText(goodsMake.good.name); |
|
|
|
myViewHolder.loading_status.setText(goodsMake.makeStatus.name()); |
|
|
|
myViewHolder.loading_zuofa.setText(goodsMake.subOrder.exp); |
|
|
|
|
|
|
|
DecimalFormat decimalFormat =new DecimalFormat("00"); |
|
|
|
myViewHolder.loading_xuhao.setText(decimalFormat.format(position+1)); |
|
|
|
// myViewHolder.loading_time.setText(new SimpleDateFormat("HH:mm:ss").format(Date.parse(goodsMake.subOrder.createTime))); |
|
|
|
switch (goodsMake.makeStatus.name()) |
|
|
|
{ |
|
|
|
case "等待中": |
|
|
|
//myViewHolder.quxiaozhizuo.setVisibility(View.GONE); |
|
|
|
//myViewHolder.loading_status.setTextColor(conmain.getResources().getColor(R.color.text4)); |
|
|
|
break; |
|
|
|
case "制作中": |
|
|
|
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作 |
|
|
|
myViewHolder.loading_status.setTextColor(myViewHolder.loading_status.getContext().getResources().getColor(R.color.green_primary_dark)); |
|
|
|
break; |
|
|
|
case "制作完成": |
|
|
|
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作 |
|
|
|
//myViewHolder.loading_status.setTextColor(conmain.getResources().getColor(R.color.tab_text_normal)); |
|
|
|
break; |
|
|
|
switch (goodsMake.makeStatus.name()) |
|
|
|
{ |
|
|
|
case "等待中": |
|
|
|
//myViewHolder.quxiaozhizuo.setVisibility(View.GONE); |
|
|
|
//myViewHolder.loading_status.setTextColor(conmain.getResources().getColor(R.color.text4)); |
|
|
|
break; |
|
|
|
case "制作中": |
|
|
|
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作 |
|
|
|
myViewHolder.loading_status.setTextColor(myViewHolder.loading_status.getContext().getResources().getColor(R.color.green_primary_dark)); |
|
|
|
break; |
|
|
|
case "制作完成": |
|
|
|
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作 |
|
|
|
//myViewHolder.loading_status.setTextColor(conmain.getResources().getColor(R.color.tab_text_normal)); |
|
|
|
break; |
|
|
|
} |
|
|
|
myViewHolder.loading_main.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
if(mListener!=null) mListener.clickListener(view,goodsMake); |
|
|
|
} |
|
|
|
myViewHolder.loading_main.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
if(mListener!=null) mListener.clickListener(view,goodsMake); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
myViewHolder.quxiaozhizuo.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
String title = "温馨提示!"; |
|
|
|
String message = "客官确定要取消制作【"+goodsMake.good.name+"】吗?"; |
|
|
|
AlertDialogUtils.showDialog( mLayoutInflater.getContext(), title, message, new QMUIDialogAction.ActionListener() { |
|
|
|
@Override |
|
|
|
public void onClick(QMUIDialog dialog, int index) { |
|
|
|
DataBus.getInstance().DeleteGoodsMake(goodsMake.subOrder.id); |
|
|
|
ToastUtils.info("取消订单制作成功!"); |
|
|
|
dialog.dismiss(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
myViewHolder.quxiaozhizuo.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
String title = "温馨提示!"; |
|
|
|
String message = "客官确定要取消制作【"+goodsMake.good.name+"】吗?"; |
|
|
|
AlertDialogUtils.showDialog( myViewHolder.quxiaozhizuo.getContext(), title, message, new QMUIDialogAction.ActionListener() { |
|
|
|
@Override |
|
|
|
public void onClick(QMUIDialog dialog, int index) { |
|
|
|
DataBus.getInstance().DeleteGoodsMake(goodsMake.subOrder.id); |
|
|
|
ToastUtils.info("取消订单制作成功!"); |
|
|
|
dialog.dismiss(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private Activity findActivity(@NonNull Context context) { |
|
|
@@ -149,14 +148,16 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH |
|
|
|
*/ |
|
|
|
public void refresh() { |
|
|
|
if(handler!=null){ |
|
|
|
datas = DataBus.getInstance().GoodsMake; |
|
|
|
|
|
|
|
handler.postDelayed(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
datas= DataBus.getInstance().GoodsMake; |
|
|
|
notifyDataSetChanged(); |
|
|
|
|
|
|
|
LogUtils.error("****","刷新 size="+datas.size()); |
|
|
|
} |
|
|
|
},500); |
|
|
|
},200); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|