|
@@ -25,18 +25,18 @@ import com.emato.ich.entity.vo.PreparedOrderResponseVo;
|
|
|
import com.emato.ich.entity.vo.PreparedOrderVo;
|
|
|
import com.emato.ich.local.LocalStorage;
|
|
|
import com.emato.ich.utils.BaseUtils;
|
|
|
-import com.emato.ich.utils.ButtonUtils;
|
|
|
import com.emato.ich.utils.JacksonUtils;
|
|
|
import com.emato.ich.utils.StringUtils;
|
|
|
import com.emato.ich.utils.TimeOutUtils;
|
|
|
-import com.emato.ich.utils.ToastUtils;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.google.android.material.snackbar.Snackbar;
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
@@ -92,11 +92,6 @@ public class InputInfoFragment extends Fragment {
|
|
|
// 扫码成功回调
|
|
|
Log.d(TAG, "onScanSuccess: " + s);
|
|
|
|
|
|
- if (timer == null) {
|
|
|
- // 防止连续扫描时, 倒计时已经到0了, 导致非法参数异常
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
if (mailNoLock.get() == 1) {
|
|
|
Editable text = binding.mailNo.getText();
|
|
|
text.clear();
|
|
@@ -107,8 +102,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
@Override
|
|
|
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
|
|
// 请求失败
|
|
|
- mailNoLock.set(1);
|
|
|
- ToastUtils.make(getContext(), "服务器异常! 请手动输入! ");
|
|
|
+ Snackbar.make(view, "服务器异常! 请手动输入! ", Snackbar.LENGTH_LONG).show();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -126,17 +120,17 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.delivererPhoneConfirm.setText(collectorPhone);
|
|
|
}
|
|
|
|
|
|
- ICSPResponseCodeEnum.responseHint(getContext(), responseData);
|
|
|
+ ICSPResponseCodeEnum.responseHint(view, responseData);
|
|
|
|
|
|
} catch (JsonProcessingException e) {
|
|
|
Log.e(TAG, "onResponse: 服务器响应错误! 自动获取用户手机号失败! ", e);
|
|
|
- ToastUtils.make(getContext(), "网络异常! 请手动输入手机号!");
|
|
|
+ Snackbar.make(view, "网络异常! 请手动输入手机号! ", Snackbar.LENGTH_LONG).show();
|
|
|
} catch (RuntimeException e) {
|
|
|
Log.e(TAG, "onResponse: 获取用户手机号未知错误! ", e);
|
|
|
- ToastUtils.make(getContext(), "未查询到手机号! 请手动输入! ");
|
|
|
+ Snackbar.make(view, "未查询到手机号! 请手动输入! ", Snackbar.LENGTH_LONG).show();
|
|
|
}
|
|
|
});
|
|
|
- mailNoLock.set(1);
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -154,17 +148,14 @@ public class InputInfoFragment extends Fragment {
|
|
|
if (submitLock.get() == 1) {
|
|
|
submitLock.incrementAndGet();
|
|
|
binding.buttonConfirm.setOnClickListener(view1 -> {
|
|
|
- if (ButtonUtils.isFastClick()) {
|
|
|
- return;
|
|
|
- }
|
|
|
Bundle bundle = new Bundle();
|
|
|
String mailNo = binding.mailNo.getText().toString();
|
|
|
// String phone = binding.delivererPhone.getText().toString();
|
|
|
String phoneConfirm = binding.delivererPhoneConfirm.getText().toString();
|
|
|
if (!phonePattern.matcher(phoneConfirm).matches()) {
|
|
|
- ToastUtils.make(getContext(), "请输入正确的手机号!");
|
|
|
+ Snackbar.make(view1, "请输入正确的手机号!", Snackbar.LENGTH_LONG).show();
|
|
|
} else if (StringUtils.isNullOrEmpty(mailNo)) {
|
|
|
- ToastUtils.make(getContext(), "运单号不能为空!请扫描运单号!");
|
|
|
+ Snackbar.make(view1, "运单号不能为空!请扫描运单号!", Snackbar.LENGTH_LONG).show();
|
|
|
} else {
|
|
|
// 验证完 预下单
|
|
|
PreparedOrderVo preparedOrderVo = new PreparedOrderVo();
|
|
@@ -179,8 +170,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
@Override
|
|
|
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
|
|
// TODO 预下单调用失败
|
|
|
- submitLock.set(1);
|
|
|
- ToastUtils.make(getContext(), "请求服务器失败!网络异常!");
|
|
|
+ Snackbar.make(view, "请求服务器失败!网络异常!", Snackbar.LENGTH_LONG).show();
|
|
|
Log.e(TAG, "onFailure: 预下单失败! call: " + call.timeout().toString(), e);
|
|
|
}
|
|
|
|
|
@@ -208,7 +198,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
timer.cancel();
|
|
|
NavHostFragment.findNavController(InputInfoFragment.this).navigate(R.id.action_inputInfoFragment_to_sendInfoConfirmFragment);
|
|
|
} else {
|
|
|
- ICSPResponseCodeEnum.responseHint(getContext(), responseData);
|
|
|
+ ICSPResponseCodeEnum.responseHint(view, responseData);
|
|
|
Log.e(TAG, "onResponse: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), new RuntimeException("系统异常"));
|
|
|
}
|
|
|
} catch (JsonProcessingException e) {
|
|
@@ -231,7 +221,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton0.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -240,7 +230,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton1.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -249,7 +239,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton2.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -258,7 +248,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton3.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -267,7 +257,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton4.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -276,7 +266,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton5.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -285,7 +275,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton6.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -294,7 +284,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton7.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -303,7 +293,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton8.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -312,7 +302,7 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.inputButton9.setOnClickListener(v -> {
|
|
|
int length = binding.delivererPhoneConfirm.getText().length();
|
|
|
if (length >= 11) {
|
|
|
- ToastUtils.make(getContext(), "手机号不能超过11位!");
|
|
|
+ Snackbar.make(view1, "手机号不能超过11位", Snackbar.LENGTH_LONG).show();
|
|
|
return;
|
|
|
}
|
|
|
int start = binding.delivererPhoneConfirm.getSelectionStart();
|
|
@@ -326,11 +316,6 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.delivererPhoneConfirm.setSelection(binding.delivererPhoneConfirm.getText().length());
|
|
|
}
|
|
|
});
|
|
|
- // 长按删除
|
|
|
- binding.inputButtonCancel.setOnLongClickListener(v -> {
|
|
|
- binding.delivererPhoneConfirm.getText().clear();
|
|
|
- return false;
|
|
|
- });
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -384,18 +369,10 @@ public class InputInfoFragment extends Fragment {
|
|
|
binding.mailNo.setSelection(binding.mailNo.getText().length());
|
|
|
}
|
|
|
});
|
|
|
- // 长按删除
|
|
|
- binding.inputButtonCancel.setOnLongClickListener(v -> {
|
|
|
- binding.mailNo.getText().clear();
|
|
|
- return false;
|
|
|
- });
|
|
|
}
|
|
|
});
|
|
|
|
|
|
binding.returnBtn.setOnClickListener(view1 -> {
|
|
|
- if (ButtonUtils.isFastClick()) {
|
|
|
- return;
|
|
|
- }
|
|
|
timer.cancel();
|
|
|
NavHostFragment.findNavController(InputInfoFragment.this)
|
|
|
.navigate(R.id.action_inputInfoFragment_to_chooseCabinetFragment);
|