[6.4.0]
[内存泄漏问题]
This commit is contained in:
@@ -81,20 +81,32 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable() {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDisable() {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning() {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,14 +116,20 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (location != null){
|
||||
runOnUIThread(() -> mView.onCarLocationChanged(location));
|
||||
}
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null&&location!=null) {
|
||||
mView.onCarLocationChanged(location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeOperationStatus(boolean changeStatus) {
|
||||
runOnUIThread(() -> mView.changeOperationStatus(changeStatus));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.changeOperationStatus(changeStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,37 +139,65 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
|
||||
@Override
|
||||
public void updateDriverSn(String sn) {
|
||||
runOnUIThread(() -> mView.updateDriverSn(sn));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.updateDriverSn(sn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLineInfo(String lineName, String lineDurTime) {
|
||||
runOnUIThread(() -> mView.updateLineInfo(lineName, lineDurTime));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.updateLineInfo(lineName, lineDurTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
runOnUIThread(() -> mView.updateStationsInfo(stations,currentStationIndex, isArrived));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.updateStationsInfo(stations, currentStationIndex, isArrived);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNoTaskView() {
|
||||
runOnUIThread(() -> mView.showNoTaskView());
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.showNoTaskView();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideNoTaskView() {
|
||||
runOnUIThread(() -> mView.hideNoTaskView());
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.hideNoTaskView();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeResult(List<LatLng> routeArrived,List<LatLng> routeArriving,MogoLocation location) {
|
||||
runOnUIThread(() ->mView.routeResult(routeArrived,routeArriving,location));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.routeResult(routeArrived, routeArriving, location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routePlanningToNextStationChanged(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> mView.updateRoutePlanningToNextStation(meters, timeInSecond));
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.updateRoutePlanningToNextStation(meters, timeInSecond);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
mapBizView.onDestroy();
|
||||
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
||||
@@ -124,11 +124,12 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
override fun onDestroyView() {
|
||||
overMapView?.let{
|
||||
it.onDestroy()
|
||||
}
|
||||
super.onDestroyView()
|
||||
|
||||
}
|
||||
|
||||
fun updateSpeed(speed: Int){
|
||||
|
||||
@@ -25,6 +25,7 @@ class MusicListViewModel : ViewModel(),
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
AuditionManager.removeDataChangeListener(TAG)
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class MusicPlayingViewModel : ViewModel(), AuditionManager.MusicDataChangeListen
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
AuditionManager.removeDataChangeListener(TAG)
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.och.taxi.passenger.widget.indicator.IndicatorView
|
||||
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorOrientation
|
||||
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorSlideMode
|
||||
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorStyle
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import kotlin.math.floor
|
||||
|
||||
@@ -229,5 +230,6 @@ internal class InfoVideoView @JvmOverloads constructor(
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class RightBarView : ConstraintLayout, AuditionManager.MusicDataChangeListener {
|
||||
private var normalSize = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),76f)
|
||||
|
||||
init {
|
||||
AuditionManager.addDataChangeListener(TAG,this)
|
||||
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
@@ -149,6 +149,7 @@ class RightBarView : ConstraintLayout, AuditionManager.MusicDataChangeListener {
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerLogger.d(TAG, "onAttachedToWindow")
|
||||
AuditionManager.addDataChangeListener(TAG,this)
|
||||
// RightBarView启动的时候必须把MusicPlayingViewModel初始化了,否则和AuditionManager的回掉及逻辑会有问题
|
||||
try {
|
||||
val musicPlayingViewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
@@ -161,6 +162,11 @@ class RightBarView : ConstraintLayout, AuditionManager.MusicDataChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
AuditionManager.removeDataChangeListener(TAG)
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
|
||||
@@ -25,6 +25,7 @@ class MusicListViewModel : ViewModel(),
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
AuditionManager.removeDataChangeListener(TAG)
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.mogo.och.taxi.passenger.widget.indicator.IndicatorView
|
||||
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorOrientation
|
||||
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorSlideMode
|
||||
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorStyle
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import kotlin.math.floor
|
||||
|
||||
@@ -254,6 +255,7 @@ internal class InfoVideoView @JvmOverloads constructor(
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
MediaDataSourceManager.unInit(TAG)
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user