新增手动添加的工作票列表页面
parent
431774ac49
commit
2e1a751f48
@ -0,0 +1,126 @@
|
|||||||
|
package com.rehome.zhdcoa.adapter;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.rehome.zhdcoa.App;
|
||||||
|
import com.rehome.zhdcoa.R;
|
||||||
|
import com.rehome.zhdcoa.base.BaseViewBindingAdapter;
|
||||||
|
import com.rehome.zhdcoa.bean.WorkRiskLevelListBean;
|
||||||
|
import com.rehome.zhdcoa.databinding.AdapterWorkTicketCustomListBinding;
|
||||||
|
import com.rehome.zhdcoa.databinding.AdapterWorkTicketSelectListBinding;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WorkTickerCustomListAdapter extends BaseViewBindingAdapter<AdapterWorkTicketCustomListBinding> {
|
||||||
|
private final Context context;
|
||||||
|
private final List<WorkRiskLevelListBean.RowsBean> data;
|
||||||
|
private CallBack mCallBack;
|
||||||
|
|
||||||
|
public interface CallBack {
|
||||||
|
void Click(@NonNull View view,int position);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OnWorkTicketModifyClickListener onWorkTicketModifyClickListener;
|
||||||
|
private OnWorkTicketDeleteClickListener onWorkTicketDeleteClickListener;
|
||||||
|
|
||||||
|
public WorkTickerCustomListAdapter(Context context, List<WorkRiskLevelListBean.RowsBean> datas, CallBack mCallBack,OnWorkTicketModifyClickListener onWorkTicketModifyClickListener,OnWorkTicketDeleteClickListener onWorkTicketDeleteClickListener) {
|
||||||
|
super(context);
|
||||||
|
this.context=context;
|
||||||
|
this.data=datas;
|
||||||
|
this.mCallBack = mCallBack;
|
||||||
|
this.onWorkTicketModifyClickListener=onWorkTicketModifyClickListener;
|
||||||
|
this.onWorkTicketDeleteClickListener=onWorkTicketDeleteClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleData(int position, @NonNull AdapterWorkTicketCustomListBinding binding) {
|
||||||
|
WorkRiskLevelListBean.RowsBean item = data.get(position);
|
||||||
|
|
||||||
|
binding.tvPaiHao.setText(item.getCode());
|
||||||
|
binding.tvContent.setText(item.getContent());
|
||||||
|
binding.tvLevel.setText(item.getLevel());
|
||||||
|
if(!TextUtils.isEmpty(item.getMajor())){
|
||||||
|
binding.tvZy.setText(item.getMajor());
|
||||||
|
}
|
||||||
|
binding.cb.setChecked(item.isChecked());
|
||||||
|
binding.cb.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
mCallBack.Click(view,position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
binding.tvModify.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
onWorkTicketModifyClickListener.onItemClick(position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
binding.tvDelete.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
onWorkTicketDeleteClickListener.onItemClick(position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int color = ContextCompat.getColor(context, R.color.colorPrimary);
|
||||||
|
int colorRed = ContextCompat.getColor(context, R.color.red);
|
||||||
|
if(TextUtils.isEmpty(item.getJobNo())){
|
||||||
|
binding.cb.setEnabled(true);
|
||||||
|
binding.tvModify.setEnabled(true);
|
||||||
|
binding.tvDelete.setEnabled(true);
|
||||||
|
binding.llModify.setBackgroundColor(color);
|
||||||
|
binding.llDelete.setBackgroundColor(colorRed);
|
||||||
|
}else{
|
||||||
|
if(item.getJobNo().equals(App.getInstance().getUserInfo().getManid())){
|
||||||
|
binding.cb.setEnabled(true);
|
||||||
|
binding.tvModify.setEnabled(true);
|
||||||
|
binding.tvDelete.setEnabled(true);
|
||||||
|
binding.llModify.setBackgroundColor(color);
|
||||||
|
binding.llDelete.setBackgroundColor(colorRed);
|
||||||
|
}else{
|
||||||
|
//不是本人选中的,不允许修改
|
||||||
|
binding.cb.setEnabled(false);
|
||||||
|
binding.tvPaiHao.setTextColor(Color.GRAY);
|
||||||
|
binding.tvContent.setTextColor(Color.GRAY);
|
||||||
|
binding.tvLevel.setTextColor(Color.GRAY);
|
||||||
|
binding.tvModify.setEnabled(false);
|
||||||
|
binding.tvDelete.setEnabled(false);
|
||||||
|
binding.llModify.setBackgroundColor(Color.GRAY);
|
||||||
|
binding.llDelete.setBackgroundColor(Color.GRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AdapterWorkTicketCustomListBinding getBinding(@NonNull LayoutInflater inflater, ViewGroup parent) {
|
||||||
|
return AdapterWorkTicketCustomListBinding.inflate(inflater, parent, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return data.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return data.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return Long.valueOf(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnWorkTicketModifyClickListener {
|
||||||
|
void onItemClick(int position);
|
||||||
|
}
|
||||||
|
public interface OnWorkTicketDeleteClickListener {
|
||||||
|
void onItemClick(int position);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".ui.activity.WorkTickerCustomListActivity">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbarView"
|
||||||
|
layout="@layout/layout_base" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#dddddd"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:minHeight="30px">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_zxsj"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5px"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minHeight="50px"
|
||||||
|
android:text="作业风险清单日期:"
|
||||||
|
android:textSize="24px" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_st"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="50px"
|
||||||
|
android:textColor="@color/colorPrimaryDark"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="24px" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/item_head"
|
||||||
|
layout="@layout/header_work_ticket_custom_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginStart="10px"
|
||||||
|
android:layout_marginEnd="10px"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="10px"
|
||||||
|
android:layout_marginEnd="10px"
|
||||||
|
android:layout_marginBottom="10px"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/lv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:divider="#00000000"
|
||||||
|
android:dividerHeight="0px"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_nodata"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textColor="@color/viewfinder_mask"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="暂无数据"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_submit"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="提交"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
@ -0,0 +1,176 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minHeight="62px"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/head"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:background="#524658"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="60px">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3.1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="3dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="工作票号:" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_paiHao"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="PTW-202508-0134" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="3dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="工作内容:" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="工作内容" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="3dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="风险等级:" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_level"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="风险等级" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="3dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="专业" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="专业:" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_zy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="机械" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1.2"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_modify"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_modify"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:text="修改"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_delete"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:background="@color/red"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_delete"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:text="删除"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minHeight="62px"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/head"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="#524658"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="60px">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3.1"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="手动添加" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1.2"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="操作" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="#524658" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
Loading…
Reference in New Issue