Pārlūkot izejas kodu

feat: 业务检测添加车牌搜索

master
huting pirms 2 gadiem
vecāks
revīzija
2c1077770a

+ 25
- 10
app/src/main/java/com/huntersun/vkyes/etcopencard/project/ui/activity/BusinessDetectionActivity.java Parādīt failu

import com.huntersun.vkyes.etcopencard.project.ui.activity.order.OrderUtils; import com.huntersun.vkyes.etcopencard.project.ui.activity.order.OrderUtils;
import com.huntersun.vkyes.etcopencard.project.utils.Constants; import com.huntersun.vkyes.etcopencard.project.utils.Constants;
import com.huntersun.vkyes.etcopencard.project.utils.FunHelper; import com.huntersun.vkyes.etcopencard.project.utils.FunHelper;
import com.huntersun.vkyes.etcopencard.project.utils.SearchCarInfoUtils;
import com.huntersun.vkyes.etcopencard.src.action.StatusAction; import com.huntersun.vkyes.etcopencard.src.action.StatusAction;
import com.huntersun.vkyes.etcopencard.src.aop.SingleClick; import com.huntersun.vkyes.etcopencard.src.aop.SingleClick;
import com.huntersun.vkyes.etcopencard.src.app.AppActivity; import com.huntersun.vkyes.etcopencard.src.app.AppActivity;
import retrofit2.Response; import retrofit2.Response;


/** /**
* 业务检测
* @author admin * @author admin
*/ */
public class BusinessDetectionActivity extends AppActivity public class BusinessDetectionActivity extends AppActivity
private ActivityBusinessDetectionBinding binding; private ActivityBusinessDetectionBinding binding;
private int page = 1; private int page = 1;
private int orderStep = 0; private int orderStep = 0;
private String licensePlate;
private String licensePlate; //车牌
private int licensePlateColor; //车牌颜色
private boolean hasMore; private boolean hasMore;


@Override @Override
binding.rvStatusList.setAdapter(adapter); binding.rvStatusList.setAdapter(adapter);
binding.rlStatusRefresh.setOnRefreshLoadMoreListener(this); binding.rlStatusRefresh.setOnRefreshLoadMoreListener(this);
binding.rlStatusRefresh.setOnRefreshListener(this); binding.rlStatusRefresh.setOnRefreshListener(this);
SearchCarInfoUtils searchUtils = new SearchCarInfoUtils(this, new SearchCarInfoUtils.OnCustomReqCallback() {
@Override
public void request(String vehicle, int vehicleColor) {
licensePlate = vehicle;
licensePlateColor = vehicleColor;
}
});
searchUtils.setExpandParams(true,true);
} }


@Override @Override
protected void initData() { protected void initData() {
refreshData();
}

private void refreshData(){
page = 1;
hasMore = true;
LoadData(); LoadData();
binding.rlStatusRefresh.finishRefresh();
} }


/**
* 加载数据
*/
public void LoadData() { public void LoadData() {
if (page == 1) {
hasMore = true;
}

List<String> list = null; List<String> list = null;
Parameters parameters = new Parameters(); Parameters parameters = new Parameters();
//0 - 全部 1 - 申办中 2 - 待发货 3 - 待激活 4 - 已完成 //0 - 全部 1 - 申办中 2 - 待发货 3 - 待激活 4 - 已完成
parameters.setPageNo(page + ""); parameters.setPageNo(page + "");
parameters.setPageSize("10"); parameters.setPageSize("10");
parameters.setVehiclePlate(licensePlate); //车牌 parameters.setVehiclePlate(licensePlate); //车牌
parameters.setVehiclePlate("0"); //车牌颜色
parameters.setVehiclePlate(String.valueOf(licensePlateColor)); //车牌颜色
RequestParameters parameters1 = RequestParameters parameters1 =
new RequestParameters(IFCode.IFCODE36, new Gson().toJson(parameters)); new RequestParameters(IFCode.IFCODE36, new Gson().toJson(parameters));
if (page == 1) { if (page == 1) {
showError(new StatusLayout.OnRetryListener() { showError(new StatusLayout.OnRetryListener() {
@Override @Override
public void onRetry(StatusLayout layout) { public void onRetry(StatusLayout layout) {
LoadData();
refreshData();
} }
}); });
} }
public void onRefresh(@NonNull RefreshLayout refreshLayout) { public void onRefresh(@NonNull RefreshLayout refreshLayout) {
licensePlate = ""; licensePlate = "";
postDelayed(() -> { postDelayed(() -> {
page = 1;
LoadData();
binding.rlStatusRefresh.finishRefresh();
refreshData();
}, 1000); }, 1000);
} }
} }

+ 34
- 7
app/src/main/java/com/huntersun/vkyes/etcopencard/project/utils/SearchCarInfoUtils.java Parādīt failu

import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;


import com.hjq.toast.ToastUtils; import com.hjq.toast.ToastUtils;
private InputView inputView; private InputView inputView;
private LinearLayout LLQuote; private LinearLayout LLQuote;
private Button btnSearch; private Button btnSearch;

private Button btnBlue, btnYellow, btnBlack, btnWhite, btnYellowGreen, btnGreen; private Button btnBlue, btnYellow, btnBlack, btnWhite, btnYellowGreen, btnGreen;
private LinearLayout LLBlue, LLYellow, LLBlack, LLWhite, LLYellowGreen, LLGreen;
private LinearLayout LLBlue, LLYellow, LLBlack, LLWhite, LLYellowGreen, LLGreen,LLInputView,LLColorLayout;
private ImageView ivExpand;


//传进来的数据
private String vehiclePlate, PlateColor; private String vehiclePlate, PlateColor;


//是否显示收起展开按钮
private boolean isShowExpand = false;
//展开还是显示
private boolean isExpand = true;
//选择的车牌颜色 //选择的车牌颜色
private int vehiclePlateColor = 0; private int vehiclePlateColor = 0;
//请求code //请求code
initId(); initId();
} }


public void setParams(String orderStep) {
this.orderStep = orderStep;
/**
* 设置展开还是收缩
* @param isShowExpand
* @param isExpand
*/
public void setExpandParams(boolean isShowExpand,boolean isExpand) {
this.isShowExpand = isShowExpand;
this.isExpand = isExpand;
ivExpand.setVisibility(isShowExpand ? View.VISIBLE : View.GONE);
if (isShowExpand){
LLInputView.setVisibility(isExpand ? View.VISIBLE : View.GONE);
LLColorLayout.setVisibility(isExpand ? View.VISIBLE : View.GONE);
ivExpand.setImageResource(isExpand ? R.mipmap.icon_up_grey : R.mipmap.icon_down_grey);
}
} }


public void initId() { public void initId() {
LLWhite = mContext.findViewById(R.id.layout4); LLWhite = mContext.findViewById(R.id.layout4);
LLYellowGreen = mContext.findViewById(R.id.layout5); LLYellowGreen = mContext.findViewById(R.id.layout5);
LLGreen = mContext.findViewById(R.id.layout6); LLGreen = mContext.findViewById(R.id.layout6);
LLInputView = mContext.findViewById(R.id.LLInputView);
LLColorLayout = mContext.findViewById(R.id.LLColorLayout);
ivExpand = mContext.findViewById(R.id.ivExpand);


btnBlue.setOnClickListener(this::initClick); btnBlue.setOnClickListener(this::initClick);
btnYellow.setOnClickListener(this::initClick); btnYellow.setOnClickListener(this::initClick);
btnYellowGreen.setOnClickListener(this::initClick); btnYellowGreen.setOnClickListener(this::initClick);
btnGreen.setOnClickListener(this::initClick); btnGreen.setOnClickListener(this::initClick);
btnSearch.setOnClickListener(this::initClick); btnSearch.setOnClickListener(this::initClick);
ivExpand.setOnClickListener(this::initClick);


//回显信息并走查询接口 //回显信息并走查询接口
if (!TextUtils.isEmpty(vehiclePlate) && !TextUtils.isEmpty(PlateColor)) { if (!TextUtils.isEmpty(vehiclePlate) && !TextUtils.isEmpty(PlateColor)) {
} }


private void initClick(View view) { private void initClick(View view) {
if (view != btnSearch) {
if (view != btnSearch || view != ivExpand) {
LLBlue.setBackground(null); LLBlue.setBackground(null);
LLYellow.setBackground(null); LLYellow.setBackground(null);
LLBlack.setBackground(null); LLBlack.setBackground(null);
LLYellowGreen.setBackground(mContext.getDrawable(R.drawable.item_home_frame4)); LLYellowGreen.setBackground(mContext.getDrawable(R.drawable.item_home_frame4));
vehiclePlateColor = 5; vehiclePlateColor = 5;


} else if (view == btnSearch) {
}else if (view == ivExpand){//展开还是搜索
setExpandParams(isShowExpand,!isExpand);

}else if (view == btnSearch) {
if (FunHelper.isEmpty(inputView.getNumber())) { if (FunHelper.isEmpty(inputView.getNumber())) {
ToastUtils.show("车牌号不能为空"); ToastUtils.show("车牌号不能为空");
return; return;


if (reqCallback != null) { if (reqCallback != null) {
reqCallback.request(inputView.getNumber() + "_" + vehiclePlateColor); reqCallback.request(inputView.getNumber() + "_" + vehiclePlateColor);
reqCallback.request(inputView.getNumber() , vehiclePlateColor);
return; return;
} }




//自定义请求 //自定义请求
public interface OnCustomReqCallback { public interface OnCustomReqCallback {
void request(String vehicleId);
default void request(String vehicleId){};
default void request(String vehicle,int vehicleColor){};
} }
} }

+ 2
- 0
app/src/main/res/layout/activity_business_detection.xml Parādīt failu

app:lineVisible="false" app:lineVisible="false"
app:titleColor="@color/black01" /> app:titleColor="@color/black01" />


<include layout="@layout/layout_vehicleplate" />

<com.huntersun.vkyes.etcopencard.src.widget.StatusLayout <com.huntersun.vkyes.etcopencard.src.widget.StatusLayout
android:id="@+id/hl_status_hint" android:id="@+id/hl_status_hint"
android:layout_width="match_parent" android:layout_width="match_parent"

+ 30
- 13
app/src/main/res/layout/layout_vehicleplate.xml Parādīt failu

android:padding="@dimen/dp_15"> android:padding="@dimen/dp_15">


<LinearLayout <LinearLayout
android:id="@+id/LLInputView"
android:visibility="visible"
style="@style/MatchWrap.Horizontal" style="@style/MatchWrap.Horizontal"
android:layout_marginBottom="@dimen/dp_15"
android:gravity="center_vertical"> android:gravity="center_vertical">


<FrameLayout <FrameLayout


<LinearLayout <LinearLayout
android:id="@+id/LLQuote" android:id="@+id/LLQuote"
android:layout_width="@dimen/dp_38"
android:layout_width="@dimen/dp_35"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="right" android:layout_gravity="right"
android:background="@drawable/pwk_input_item_border_gray4" android:background="@drawable/pwk_input_item_border_gray4"
</LinearLayout> </LinearLayout>


<LinearLayout <LinearLayout
android:id="@+id/LLColorLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:animationCache="true" android:animationCache="true"
android:layout_marginTop="@dimen/dp_10"
android:visibility="visible"
android:orientation="vertical"> android:orientation="vertical">


<LinearLayout <LinearLayout
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>


<Button
android:id="@+id/btnSearch"
style="@style/BtnShortStyle"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:layout_gravity="center_vertical|right"
android:text="搜索"
android:layout_marginLeft="@dimen/dp_5"
android:textSize="@dimen/sp_12" />

<RelativeLayout
style="@style/MatchWrap.Horizontal"
android:layout_marginTop="@dimen/dp_10"
android:gravity="center_vertical">
<ImageView
android:id="@+id/ivExpand"
style="@style/WrapWrap"
android:visibility="gone"
android:layout_centerVertical="true"
android:src="@mipmap/icon_up_grey"
android:layout_alignParentLeft="true"
android:padding="@dimen/dp_10"/>
<Button
android:id="@+id/btnSearch"
style="@style/BtnShortStyle"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_30"
android:layout_gravity="center_vertical|right"
android:text="搜索"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="@dimen/dp_5"
android:textSize="@dimen/sp_12" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

Notiek ielāde…
Atcelt
Saglabāt