Переглянути джерело

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

master
huting 2 роки тому
джерело
коміт
2c1077770a

+ 25
- 10
app/src/main/java/com/huntersun/vkyes/etcopencard/project/ui/activity/BusinessDetectionActivity.java Переглянути файл

@@ -29,6 +29,7 @@ import com.huntersun.vkyes.etcopencard.project.ui.activity.order.OrderDetailsAct
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.FunHelper;
import com.huntersun.vkyes.etcopencard.project.utils.SearchCarInfoUtils;
import com.huntersun.vkyes.etcopencard.src.action.StatusAction;
import com.huntersun.vkyes.etcopencard.src.aop.SingleClick;
import com.huntersun.vkyes.etcopencard.src.app.AppActivity;
@@ -41,6 +42,7 @@ import java.util.List;
import retrofit2.Response;

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

@Override
@@ -63,18 +66,32 @@ public class BusinessDetectionActivity extends AppActivity
binding.rvStatusList.setAdapter(adapter);
binding.rlStatusRefresh.setOnRefreshLoadMoreListener(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
protected void initData() {
refreshData();
}

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

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

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

+ 34
- 7
app/src/main/java/com/huntersun/vkyes/etcopencard/project/utils/SearchCarInfoUtils.java Переглянути файл

@@ -7,6 +7,7 @@ import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.hjq.toast.ToastUtils;
@@ -40,12 +41,17 @@ public class SearchCarInfoUtils {
private InputView inputView;
private LinearLayout LLQuote;
private Button btnSearch;

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 boolean isShowExpand = false;
//展开还是显示
private boolean isExpand = true;
//选择的车牌颜色
private int vehiclePlateColor = 0;
//请求code
@@ -108,8 +114,20 @@ public class SearchCarInfoUtils {
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() {
@@ -129,6 +147,9 @@ public class SearchCarInfoUtils {
LLWhite = mContext.findViewById(R.id.layout4);
LLYellowGreen = mContext.findViewById(R.id.layout5);
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);
btnYellow.setOnClickListener(this::initClick);
@@ -137,6 +158,7 @@ public class SearchCarInfoUtils {
btnYellowGreen.setOnClickListener(this::initClick);
btnGreen.setOnClickListener(this::initClick);
btnSearch.setOnClickListener(this::initClick);
ivExpand.setOnClickListener(this::initClick);

//回显信息并走查询接口
if (!TextUtils.isEmpty(vehiclePlate) && !TextUtils.isEmpty(PlateColor)) {
@@ -191,7 +213,7 @@ public class SearchCarInfoUtils {
}

private void initClick(View view) {
if (view != btnSearch) {
if (view != btnSearch || view != ivExpand) {
LLBlue.setBackground(null);
LLYellow.setBackground(null);
LLBlack.setBackground(null);
@@ -219,7 +241,10 @@ public class SearchCarInfoUtils {
LLYellowGreen.setBackground(mContext.getDrawable(R.drawable.item_home_frame4));
vehiclePlateColor = 5;

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

}else if (view == btnSearch) {
if (FunHelper.isEmpty(inputView.getNumber())) {
ToastUtils.show("车牌号不能为空");
return;
@@ -242,6 +267,7 @@ public class SearchCarInfoUtils {

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

@@ -284,6 +310,7 @@ public class SearchCarInfoUtils {

//自定义请求
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 Переглянути файл

@@ -15,6 +15,8 @@
app:lineVisible="false"
app:titleColor="@color/black01" />

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

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

+ 30
- 13
app/src/main/res/layout/layout_vehicleplate.xml Переглянути файл

@@ -56,8 +56,9 @@
android:padding="@dimen/dp_15">

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

<FrameLayout
@@ -71,7 +72,7 @@

<LinearLayout
android:id="@+id/LLQuote"
android:layout_width="@dimen/dp_38"
android:layout_width="@dimen/dp_35"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@drawable/pwk_input_item_border_gray4"
@@ -96,10 +97,13 @@
</LinearLayout>

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

<LinearLayout
@@ -236,16 +240,29 @@
</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>

Завантаження…
Відмінити
Зберегти