1. 高德导航引导按钮白天模式
2. 解决后台被杀后无法操作地图的问题
This commit is contained in:
@@ -956,6 +956,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
SpStorage.setNavigationTarget( "" );
|
||||
Logger.d( TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg" );
|
||||
mHandler.removeMessages( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
|
||||
}
|
||||
|
||||
@@ -22,4 +22,6 @@ interface IOnlineCarPanelView extends IView {
|
||||
void renderNoNavigationInfoUi();
|
||||
|
||||
void renderErrorUi();
|
||||
|
||||
void removeSelf();
|
||||
}
|
||||
|
||||
@@ -30,10 +30,14 @@ class OnlineCarListPanelProvider implements IMogoOnlineCarListPanelProvider {
|
||||
|
||||
@Override
|
||||
public void showPanel() {
|
||||
if ( isFragmentExist( ContainerHandler.sAttachContext ) ) {
|
||||
Fragment fragment = null;
|
||||
if ( ( fragment = isFragmentAdded( ContainerHandler.sAttachContext ) ) != null ) {
|
||||
if ( fragment instanceof OnlineCarPanelFragment ) {
|
||||
( ( OnlineCarPanelFragment ) fragment ).refreshPanel();
|
||||
}
|
||||
return;
|
||||
}
|
||||
Fragment fragment = new OnlineCarPanelFragment();
|
||||
fragment = new OnlineCarPanelFragment();
|
||||
ContainerHandler.sAttachContext
|
||||
.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -41,15 +45,16 @@ class OnlineCarListPanelProvider implements IMogoOnlineCarListPanelProvider {
|
||||
.commitNowAllowingStateLoss();
|
||||
}
|
||||
|
||||
private boolean isFragmentExist( Context context ) {
|
||||
private Fragment isFragmentAdded( Context context ) {
|
||||
if ( !( context instanceof FragmentActivity ) ) {
|
||||
Logger.w( TAG, "context is not a instance of FragmentActivity" );
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
Fragment fragment = null;
|
||||
return ( fragment = ( ( FragmentActivity ) context )
|
||||
.getSupportFragmentManager()
|
||||
.findFragmentByTag( TAG ) ) != null && fragment.isAdded();
|
||||
.findFragmentByTag( TAG ) ) != null && fragment.isAdded()
|
||||
? fragment : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, On
|
||||
@Override
|
||||
protected void initViews() {
|
||||
findViewById( R.id.module_services_id_close ).setOnClickListener( view -> {
|
||||
MarkerServiceHandler.getApis().getOnlineCarPanelApi().hidePanel();
|
||||
removeSelf();
|
||||
} );
|
||||
mList = findViewById( R.id.module_services_id_recycler_view );
|
||||
mRefreshPanel = findViewById( R.id.module_services_id_load_strategy_container );
|
||||
@@ -70,6 +70,10 @@ public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, On
|
||||
} );
|
||||
}
|
||||
|
||||
public void refreshPanel(){
|
||||
mPresenter.refreshPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLoading( boolean visible ) {
|
||||
if ( visible ) {
|
||||
@@ -147,4 +151,17 @@ public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, On
|
||||
mLoading.setVisibility( View.GONE );
|
||||
mErrorPanel.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSelf() {
|
||||
MarkerServiceHandler.getApis().getOnlineCarPanelApi().hidePanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if ( mPresenter != null ) {
|
||||
mPresenter.destroy();
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,14 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
@@ -19,7 +23,12 @@ import com.mogo.utils.network.utils.GsonUtil;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implements RefreshCallback< MarkerResponse > {
|
||||
class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implements
|
||||
RefreshCallback< MarkerResponse >,
|
||||
IMogoNaviListener2,
|
||||
IDestroyable {
|
||||
|
||||
private static final String TAG = "OnlineCarPanelPresenter";
|
||||
|
||||
public static final int LIMIT = 20;
|
||||
private RefreshModel mRefreshModel;
|
||||
@@ -31,19 +40,18 @@ class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implement
|
||||
public OnlineCarPanelPresenter( IOnlineCarPanelView view ) {
|
||||
super( view );
|
||||
mRefreshModel = new RefreshModel( getContext() );
|
||||
mStrategy = OnlineCarStrategy.Default;
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoNaviListener( TAG, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mView.removeSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
String json = SpStorage.getNavigationTarget();
|
||||
if ( TextUtils.isEmpty( json ) ) {
|
||||
mView.renderNoNavigationInfoUi();
|
||||
return;
|
||||
}
|
||||
mNavigationTargetInfo = GsonUtil.objectFromJson( json, NavigationTargetInfo.class );
|
||||
loadOnlineCar();
|
||||
refreshPanel();
|
||||
}
|
||||
|
||||
public void nextStrategy() {
|
||||
@@ -55,8 +63,21 @@ class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implement
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshPanel() {
|
||||
mStrategy = OnlineCarStrategy.Default;
|
||||
String json = SpStorage.getNavigationTarget();
|
||||
if ( TextUtils.isEmpty( json ) ) {
|
||||
mView.renderNoNavigationInfoUi();
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, json );
|
||||
mNavigationTargetInfo = GsonUtil.objectFromJson( json, NavigationTargetInfo.class );
|
||||
loadOnlineCar();
|
||||
}
|
||||
|
||||
public void loadOnlineCar() {
|
||||
if ( mNavigationTargetInfo == null ) {
|
||||
mView.renderNoNavigationInfoUi();
|
||||
return;
|
||||
}
|
||||
mView.showLoading( true );
|
||||
@@ -92,4 +113,9 @@ class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implement
|
||||
public void onFail() {
|
||||
mView.renderErrorUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoNaviListener( TAG );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user