[2.10.0] taxi司机端个人中心偶现内存泄漏处理
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user