[6.4.0]
[fragment 内存泄漏]
This commit is contained in:
@@ -26,17 +26,10 @@ import com.mogo.och.shuttle.passenger.ui.widget.M2StatusBarView
|
||||
class ShuttlePassengerProvider : CommonServiceImpl() {
|
||||
|
||||
private val tag = ShuttlePassengerProvider::class.java.simpleName
|
||||
private lateinit var mPM2Fragment: Fragment
|
||||
private var mPM2Fragment: Fragment?=null
|
||||
|
||||
override fun init(context: Context) {
|
||||
TicketModel.load()
|
||||
mPM2Fragment = if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
PM2BaseFragment()
|
||||
}else if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
BusPassengerRouteFragment()
|
||||
}else{
|
||||
BusPassengerRouteFragment()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getStatusBarView(context: Context): View {
|
||||
@@ -56,7 +49,21 @@ class ShuttlePassengerProvider : CommonServiceImpl() {
|
||||
if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
MultiDisplayUtils.startActWithSecond(ActivityUtils.getTopActivity(), MediaPlayerActivity::class.java)
|
||||
}
|
||||
return mPM2Fragment
|
||||
if(mPM2Fragment==null){
|
||||
mPM2Fragment = if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
PM2BaseFragment()
|
||||
}else if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
BusPassengerRouteFragment()
|
||||
}else{
|
||||
BusPassengerRouteFragment()
|
||||
}
|
||||
}
|
||||
return mPM2Fragment!!
|
||||
}
|
||||
|
||||
override fun resetFragment() {
|
||||
super.resetFragment()
|
||||
mPM2Fragment = null
|
||||
}
|
||||
|
||||
}
|
||||
@@ -86,20 +86,26 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable() {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE));
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDisable() {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE));
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning() {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,14 +115,16 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (location != null){
|
||||
if (location != null && mView != null){
|
||||
runOnUIThread(() -> mView.onCarLocationChanged(location));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeOperationStatus(boolean changeStatus) {
|
||||
runOnUIThread(() -> mView.changeOperationStatus(changeStatus));
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.changeOperationStatus(changeStatus));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,27 +134,37 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
|
||||
@Override
|
||||
public void updateLineInfo(String lineName) {
|
||||
runOnUIThread(() -> mView.updateLineInfo(lineName));
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.updateLineInfo(lineName));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
runOnUIThread(() -> mView.updateStationsInfo(stations,currentStationIndex, isArrived));
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.updateStationsInfo(stations, currentStationIndex, isArrived));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNoTaskView() {
|
||||
runOnUIThread(() -> mView.showNoTaskView());
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.showNoTaskView());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideNoTaskView() {
|
||||
runOnUIThread(() -> mView.hideNoTaskView());
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.hideNoTaskView());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routePlanningToNextStationChanged(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> mView.updateRoutePlanningToNextStation(meters, timeInSecond));
|
||||
if(mView != null) {
|
||||
runOnUIThread(() -> mView.updateRoutePlanningToNextStation(meters, timeInSecond));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,6 +58,7 @@ class BusPTurnLightView @JvmOverloads constructor(
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerTurnLightListenerManager.removeListener(TAG)
|
||||
TurnLightManager.removeTurnLightStatusChangeListener(TAG)
|
||||
}
|
||||
|
||||
override fun hideTurnLightView() {
|
||||
|
||||
@@ -124,11 +124,9 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
overMapView?.let{
|
||||
it.onDestroy()
|
||||
}
|
||||
override fun onDestroyView() {
|
||||
overMapView?.onDestroy()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
fun updateSpeed(speed: Int){
|
||||
|
||||
@@ -58,6 +58,7 @@ class M2TurnLightView @JvmOverloads constructor(
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerTurnLightListenerManager.removeListener(TAG)
|
||||
TurnLightManager.removeTurnLightStatusChangeListener(TAG)
|
||||
}
|
||||
|
||||
override fun hideTurnLightView() {
|
||||
|
||||
Reference in New Issue
Block a user