Merge branch 'dev_robotaxi-d-app-module_2100_220816_2.10.0' into 'test_robotaxi-d-app-module_2100_220816_2.10.0.1'
Dev robotaxi d app module 2100 220816 2.10.0 See merge request zhjt/AndroidApp/MoGoEagleEye!141
This commit is contained in:
@@ -71,7 +71,7 @@ object TaxiLoginModel{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 获取验证码成功
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.module_och_taxi_login_get_code_success))
|
||||
ToastUtils.showShort(mContext?.getString(R.string.module_och_taxi_login_get_code_success))
|
||||
iTaxiLoginCallback?.getPhoneCodeSuccess()
|
||||
} else {
|
||||
if (data != null) {
|
||||
@@ -82,9 +82,9 @@ object TaxiLoginModel{
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
ToastUtils.showShort(mContext?.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
ToastUtils.showShort(mContext?.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ object TaxiLoginModel{
|
||||
override fun onSuccess(data: TaxiLoginRespBean?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 获取验证码成功
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.module_och_taxi_login_login_success))
|
||||
ToastUtils.showShort(mContext?.getString(R.string.module_och_taxi_login_login_success))
|
||||
StatusManager.setLoginStatus(TaxiLoginStatusEnum.Login)
|
||||
iTaxiLoginCallback?.loginSuccess()
|
||||
} else {
|
||||
@@ -113,9 +113,9 @@ object TaxiLoginModel{
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
ToastUtils.showShort(mContext?.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
ToastUtils.showShort(mContext?.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@@ -203,23 +202,6 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
personalDialogFragment.get().show(getActivity().getSupportFragmentManager(), "service_data");
|
||||
}
|
||||
|
||||
// public void routeResult(List<AutopilotRouteInfo.RouteModels> routeList) {
|
||||
// if (routeList == null ) return;
|
||||
// double distance = calculateTravelDistance(mogoLocation,routeList);
|
||||
// if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
|
||||
// updateOrderBaseStatusInfo();
|
||||
// }
|
||||
// CallerLogger.INSTANCE.d(M_TAXI + "lianglihui","routeResult 剩余导航距离:"+distance);
|
||||
// if (routeList != null && routeList.size() >0){
|
||||
// CallerLogger.INSTANCE.d(M_TAXI + "lianglihui","routeResult:"+routeList.size());
|
||||
// //adas回调导航路径 绘制引导线
|
||||
// if ( ochTaxiOverlayManager == null){
|
||||
// ochTaxiOverlayManager = new TaxiOverlayManager(this.getContext());
|
||||
// }
|
||||
// ochTaxiOverlayManager.draw(mogoLocation,routeList);
|
||||
// }
|
||||
// }
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -53,6 +54,11 @@ public class TaxiOperationDatasFragment extends BaseTaxiUIFragment {
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
mAdapter = new OperationDataAdapter(mContext, mData);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
initDatas();
|
||||
}
|
||||
|
||||
private void initDatas() {
|
||||
TaxiModel.getInstance().queryDriverServiceData();
|
||||
}
|
||||
|
||||
public void setmType(int type) {
|
||||
@@ -73,7 +79,7 @@ public class TaxiOperationDatasFragment extends BaseTaxiUIFragment {
|
||||
mDurationData.add(dailyTimeDuration);
|
||||
mOrderNumData.add(dailyOrderNum);
|
||||
mData.addAll(mDurationData);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
if (mAdapter != null) mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
class OperationDataAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
@@ -36,6 +37,7 @@ import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderTypeEnum;
|
||||
import com.mogo.och.taxi.ui.base.AvoidLeakDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -74,6 +76,15 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
public TaxiPersonalDialogFragment(TaxiFragment taxiFragment){
|
||||
mTaxiFragment = taxiFragment;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
AvoidLeakDialog dialog = new AvoidLeakDialog(getContext());
|
||||
dialog.setHostFragmentReference(this);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -82,6 +93,11 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissAllowingStateLoss() {
|
||||
super.dismissAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@@ -182,14 +198,15 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
}
|
||||
});
|
||||
mOperationViewPager.setAdapter(new OrdersOperationFragmentAdapter(getChildFragmentManager(), FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT));
|
||||
mOperationViewPager.setAdapter(new OrdersOperationFragmentAdapter(
|
||||
getChildFragmentManager(), FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT));
|
||||
fragments.get(0).setmType(0);
|
||||
|
||||
if (mTaxiFragment == null){
|
||||
dismiss();
|
||||
}else {
|
||||
mTaxiFragment.queryDriverServiceData();
|
||||
}
|
||||
// if (mTaxiFragment == null){
|
||||
// dismiss();
|
||||
// }else {
|
||||
// mTaxiFragment.queryDriverServiceData();
|
||||
// }
|
||||
}
|
||||
|
||||
public void onServiceDataUpdate(long dailyTimeDuration, long dailyOrderNum){
|
||||
@@ -430,14 +447,6 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
orderTypeBt = itemView.findViewById(R.id.order_type_bt);
|
||||
dividerLine = itemView.findViewById(R.id.module_och_taxi_order_divider);
|
||||
mBootNoDataView = itemView.findViewById(R.id.boot_refresh_no_data_view);
|
||||
|
||||
//orderId已经换成orderNo,所以显示
|
||||
// if (DebugConfig.isDebug()){
|
||||
//
|
||||
// orderNumTv.setVisibility(View.GONE);
|
||||
// }else {
|
||||
// orderNumTv.setVisibility(View.GONE);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.mogo.och.taxi.ui.base;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/1
|
||||
*/
|
||||
public class AvoidLeakDialog extends Dialog {
|
||||
|
||||
private WeakReference<DialogFragment> hostFragmentReference;
|
||||
|
||||
public void setHostFragmentReference(DialogFragment hostFragment) {
|
||||
this.hostFragmentReference = new WeakReference<>(hostFragment);
|
||||
}
|
||||
|
||||
public AvoidLeakDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AvoidLeakDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
protected AvoidLeakDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
|
||||
super(context, cancelable, cancelListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnCancelListener(@Nullable OnCancelListener listener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDismissListener(@Nullable OnDismissListener listener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnShowListener(@Nullable OnShowListener listener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
if (null != hostFragmentReference && null != hostFragmentReference.get()) {
|
||||
hostFragmentReference.get().dismissAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ buildscript {
|
||||
classpath "com.bytedance.android.byteX:base-plugin:0.3.0"
|
||||
classpath "com.mogo.cloud:hook:${HOOK_LOG_VERSION}"
|
||||
classpath 'com.volcengine:apm_insight_plugin:1.4.1'
|
||||
classpath 'com.mogo.thread.opt:plg:2.1.2'
|
||||
classpath 'com.mogo.thread.opt:plg:2.1.3'
|
||||
classpath 'com.mogo.cloud:systrace:1.0.1'
|
||||
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
|
||||
|
||||
|
||||
@@ -151,8 +151,9 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int) {
|
||||
location ?: return
|
||||
executor.get()?.updateLocation(
|
||||
location.longitude,
|
||||
location.latitude,
|
||||
location.longitude,
|
||||
location.latitude,
|
||||
location.altitude,
|
||||
location.bearing,
|
||||
location.speed,
|
||||
location.provider == "GPS_RTK")
|
||||
|
||||
@@ -50,7 +50,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
private static final String TAG = FpgaSocket.class.getSimpleName();
|
||||
private OkHttpClient client;
|
||||
|
||||
private WebSocket mWebSocket;
|
||||
private volatile WebSocket mWebSocket;
|
||||
|
||||
private EchoWebSocketListener listener;
|
||||
private IWebSocketConnectListener mWebSocketConnectListener;
|
||||
@@ -68,6 +68,10 @@ public class FpgaSocket implements IWebSocket {
|
||||
* 是否是被动关闭
|
||||
*/
|
||||
private final AtomicBoolean isPassiveClose = new AtomicBoolean(false);
|
||||
/**
|
||||
* 是否已经连接成功
|
||||
*/
|
||||
private final AtomicBoolean isConnected = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* 接收数据超时原因 null时表示不是接收数据超时的原因
|
||||
@@ -111,14 +115,14 @@ public class FpgaSocket implements IWebSocket {
|
||||
connect("连接中");
|
||||
}
|
||||
|
||||
private void connect(String msg) {
|
||||
private synchronized void connect(String msg) {
|
||||
if (mWebSocket == null) {
|
||||
if (mWebSocketConnectListener != null)
|
||||
mWebSocketConnectListener.onConnecting(msg);
|
||||
Request request = new Request.Builder()
|
||||
.url(wsHost)
|
||||
.build();
|
||||
client.newWebSocket(request, listener);
|
||||
mWebSocket = client.newWebSocket(request, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +155,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
|
||||
@Override
|
||||
public boolean sendDataWebSocket(String data) {
|
||||
if (mWebSocket != null) {
|
||||
if (mWebSocket != null && isConnected.get()) {
|
||||
boolean result = mWebSocket.send(data);
|
||||
CupidLogUtils.i(TAG, "WebSocket send String= " + data + ", result= " + result);
|
||||
return result;
|
||||
@@ -161,7 +165,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
|
||||
@Override
|
||||
public boolean sendDataWebSocket(ByteString data) {
|
||||
if (mWebSocket != null) {
|
||||
if (mWebSocket != null && isConnected.get()) {
|
||||
boolean result = mWebSocket.send(data);
|
||||
CupidLogUtils.i(TAG, "WebSocket send ByteString=" + ByteUtil.byteArrToHex(data.toByteArray()) + ", result= " + result);
|
||||
return result;
|
||||
@@ -200,8 +204,9 @@ public class FpgaSocket implements IWebSocket {
|
||||
@Override
|
||||
public void onOpen(@NonNull WebSocket webSocket, @NonNull Response response) {
|
||||
super.onOpen(webSocket, response);
|
||||
mWebSocket = webSocket;
|
||||
// mWebSocket = webSocket;
|
||||
boolean isConnect = response.code() == 101;
|
||||
isConnected.set(isConnect);
|
||||
if (!isConnect) {
|
||||
onPassiveClose(1001, "協議不匹配");
|
||||
} else {
|
||||
@@ -342,6 +347,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
* @param code code
|
||||
*/
|
||||
private void close(boolean isInitiative, int code) {
|
||||
isConnected.set(false);
|
||||
String closeReason = null;
|
||||
if (isInitiative) {
|
||||
closeReason = "用户主动关闭";
|
||||
|
||||
Reference in New Issue
Block a user