opt
This commit is contained in:
@@ -2,6 +2,8 @@ package com.mogo.module.main;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -28,6 +30,7 @@ import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.cards.OnPageChangeListenerAdapter;
|
||||
import com.mogo.module.main.cards.OrientedViewPager;
|
||||
import com.mogo.module.main.cards.VerticalStackTransformer;
|
||||
import com.mogo.module.main.constants.MainConstants;
|
||||
import com.mogo.module.main.windowview.WindowViewHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -48,7 +51,7 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述:加载各个模块
|
||||
*/
|
||||
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
|
||||
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener {
|
||||
|
||||
@@ -83,8 +86,35 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
private long mCardStartShowTime = 0;
|
||||
|
||||
// 埋点接口
|
||||
private IMogoAnalytics mAnalytics;
|
||||
|
||||
private Handler mMsgHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
switch ( msg.what ) {
|
||||
case MainConstants.MSG_LOAD_CARD_MODULES:
|
||||
loadCardModules();
|
||||
mMsgHandler.sendEmptyMessageDelayed( MainConstants.MSG_LOAD_INVOKE_FIRST_CARD_PERFORM_EVENT, 1_000L );
|
||||
break;
|
||||
case MainConstants.MSG_LOAD_INVOKE_FIRST_CARD_PERFORM_EVENT:
|
||||
if ( mOnPageChangeListener != null ) {
|
||||
// 默认触发第一个卡片
|
||||
mOnPageChangeListener.onPageSelected( 0 );
|
||||
}
|
||||
break;
|
||||
case MainConstants.MSG_TRACK_LAST_CARD_DISPLAY_EVENT:
|
||||
trackLastCardShowEvent( ( IMogoModuleProvider ) msg.obj );
|
||||
break;
|
||||
case MainConstants.MSG_TRACK_CARD_FLIP_EVENT:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private ViewPager.OnPageChangeListener mOnPageChangeListener;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_main_activity_main;
|
||||
@@ -92,193 +122,200 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mCardsContainer = findViewById(R.id.module_main_id_cards_container);
|
||||
mCardsContainer.setOrientation(OrientedViewPager.Orientation.VERTICAL);
|
||||
mCardsContainer = findViewById( R.id.module_main_id_cards_container );
|
||||
mCardsContainer.setOrientation( OrientedViewPager.Orientation.VERTICAL );
|
||||
|
||||
mCardsContainer.setOnPageChangeListener(new OnPageChangeListenerAdapter() {
|
||||
mCardsContainer.setOnPageChangeListener( mOnPageChangeListener = new OnPageChangeListenerAdapter() {
|
||||
private boolean mIsLast = true;
|
||||
private boolean mCardFlipStatus = false;
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
public void onPageSelected( int position ) {
|
||||
final long start = System.currentTimeMillis();
|
||||
try {
|
||||
IMogoModuleProvider provider = mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
trackLastCardShowEvent(provider);
|
||||
IMogoModuleProvider provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MainConstants.MSG_TRACK_LAST_CARD_DISPLAY_EVENT;
|
||||
msg.obj = provider;
|
||||
mMsgHandler.sendMessage(msg );
|
||||
|
||||
mCurrentPosition = position;
|
||||
provider = mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
mMogoModuleHandler.setModuleEnable(provider.getModuleName());
|
||||
if (!isClickMarker) {
|
||||
mMogoCardManager.invoke(position, mMogoModuleHandler.getCurrentModuleName());
|
||||
provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
mMogoModuleHandler.setModuleEnable( provider.getModuleName() );
|
||||
if ( !isClickMarker ) {
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i(TAG, "onPageSelected cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i( TAG, "onPageSelected cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
public void onPageScrollStateChanged( int state ) {
|
||||
final long start = System.currentTimeMillis();
|
||||
super.onPageScrollStateChanged(state);
|
||||
if (state == ViewPager.SCROLL_STATE_DRAGGING) {
|
||||
if (!mCardFlipStatus) {
|
||||
super.onPageScrollStateChanged( state );
|
||||
if ( state == ViewPager.SCROLL_STATE_DRAGGING ) {
|
||||
if ( !mCardFlipStatus ) {
|
||||
mCardFlipStatus = true;
|
||||
final IMogoModuleProvider provider = mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
trackCardFlipEvent(provider);
|
||||
final IMogoModuleProvider provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MainConstants.MSG_TRACK_CARD_FLIP_EVENT;
|
||||
msg.obj = provider;
|
||||
mMsgHandler.sendMessage(msg );
|
||||
}
|
||||
} else if (state == ViewPager.SCROLL_STATE_IDLE) {
|
||||
} else if ( state == ViewPager.SCROLL_STATE_IDLE ) {
|
||||
mCardFlipStatus = false;
|
||||
}
|
||||
|
||||
int cardSize = mCardModulesAdapter.getCount();
|
||||
|
||||
if (state == ViewPager.SCROLL_STATE_SETTLING) {
|
||||
if ( state == ViewPager.SCROLL_STATE_SETTLING ) {
|
||||
mIsLast = false;
|
||||
} else if (state == ViewPager.SCROLL_STATE_IDLE && mIsLast) {
|
||||
} else if ( state == ViewPager.SCROLL_STATE_IDLE && mIsLast ) {
|
||||
//此处为你需要的情况,再加入当前页码判断可知道是第一页还是最后一页
|
||||
if (cardSize != 1 && mCurrentPosition == (cardSize - 1)) {
|
||||
mCardsContainer.setCurrentItem(0, false);
|
||||
} else if (cardSize != 1 && mCurrentPosition == 0) {
|
||||
mCardsContainer.setCurrentItem(cardSize - 1, false);
|
||||
if ( cardSize != 1 && mCurrentPosition == ( cardSize - 1 ) ) {
|
||||
mCardsContainer.setCurrentItem( 0, false );
|
||||
} else if ( cardSize != 1 && mCurrentPosition == 0 ) {
|
||||
mCardsContainer.setCurrentItem( cardSize - 1, false );
|
||||
}
|
||||
} else {
|
||||
mIsLast = true;
|
||||
}
|
||||
Log.i(TAG, "onPageScrollStateChanged cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i( TAG, "onPageScrollStateChanged cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* 卡片展示时长埋点
|
||||
* @param provider
|
||||
*/
|
||||
private void trackLastCardShowEvent(IMogoModuleProvider provider) {
|
||||
if (provider == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("appname", provider.getAppName());
|
||||
properties.put("packagename", provider.getAppPackage());
|
||||
properties.put("activeTime", System.currentTimeMillis() - mCardStartShowTime);
|
||||
properties.put("type", provider.getModuleName());
|
||||
mAnalytics.track("Launcher_Card_Show", properties);
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片滑动埋点,WTF
|
||||
*/
|
||||
private void trackCardFlipEvent(IMogoModuleProvider provider) {
|
||||
if (provider == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("appname", provider.getAppName());
|
||||
properties.put("packagename", provider.getAppPackage());
|
||||
properties.put("type", provider.getModuleName());
|
||||
mAnalytics.track("Launcher_Card_Slide", properties);
|
||||
}
|
||||
});
|
||||
|
||||
mMogoFragmentManager = (IMogoFragmentManager) ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation(this);
|
||||
mMogoFragmentManager.init(this, R.id.module_main_id_search_fragment);
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener((size) -> {
|
||||
if (size == 0) {
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( this );
|
||||
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> {
|
||||
if ( size == 0 ) {
|
||||
showLayout();
|
||||
} else if (size == 1) {
|
||||
} else if ( size == 1 ) {
|
||||
hideLayout();
|
||||
}
|
||||
});
|
||||
mHeader = findViewById(R.id.module_main_id_header_fragment_container);
|
||||
mCards = findViewById(R.id.module_main_id_cards_container);
|
||||
mApps = findViewById(R.id.module_main_id_apps_fragment_container);
|
||||
mEntrance = findViewById(R.id.module_main_id_entrance_fragment_container);
|
||||
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
|
||||
mLeftShadowFrame = findViewById(R.id.module_main_id_map_left_shadow_frame);
|
||||
mTopShadowFrame = findViewById(R.id.module_main_id_map_top_shadow_frame);
|
||||
} );
|
||||
mHeader = findViewById( R.id.module_main_id_header_fragment_container );
|
||||
mCards = findViewById( R.id.module_main_id_cards_container );
|
||||
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
|
||||
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
|
||||
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
|
||||
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
|
||||
mTopShadowFrame = findViewById( R.id.module_main_id_map_top_shadow_frame );
|
||||
|
||||
WindowViewHandler.init(mFloatingLayout);
|
||||
WindowViewHandler.init( mFloatingLayout );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 卡片展示时长埋点
|
||||
*
|
||||
* @param provider
|
||||
*/
|
||||
private void trackLastCardShowEvent( IMogoModuleProvider provider ) {
|
||||
if ( provider == null ) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", provider.getAppName() );
|
||||
properties.put( "packagename", provider.getAppPackage() );
|
||||
properties.put( "activeTime", System.currentTimeMillis() - mCardStartShowTime );
|
||||
properties.put( "type", provider.getModuleName() );
|
||||
mAnalytics.track( "Launcher_Card_Show", properties );
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片滑动埋点,WTF
|
||||
*/
|
||||
private void trackCardFlipEvent( IMogoModuleProvider provider ) {
|
||||
if ( provider == null ) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", provider.getAppName() );
|
||||
properties.put( "packagename", provider.getAppPackage() );
|
||||
properties.put( "type", provider.getModuleName() );
|
||||
mAnalytics.track( "Launcher_Card_Slide", properties );
|
||||
}
|
||||
|
||||
// 隐藏布局
|
||||
private void hideLayout() {
|
||||
mHeader.setVisibility(View.GONE);
|
||||
mCards.setVisibility(View.GONE);
|
||||
mApps.setVisibility(View.GONE);
|
||||
mEntrance.setVisibility(View.GONE);
|
||||
mFloatingLayout.setVisibility(View.GONE);
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
mHeader.setVisibility( View.GONE );
|
||||
mCards.setVisibility( View.GONE );
|
||||
mApps.setVisibility( View.GONE );
|
||||
mEntrance.setVisibility( View.GONE );
|
||||
mFloatingLayout.setVisibility( View.GONE );
|
||||
mLeftShadowFrame.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
// 显示布局
|
||||
private void showLayout() {
|
||||
mHeader.setVisibility(View.VISIBLE);
|
||||
mCards.setVisibility(View.VISIBLE);
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
mEntrance.setVisibility(View.VISIBLE);
|
||||
mFloatingLayout.setVisibility(View.VISIBLE);
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
mHeader.setVisibility( View.VISIBLE );
|
||||
mCards.setVisibility( View.VISIBLE );
|
||||
mApps.setVisibility( View.VISIBLE );
|
||||
mEntrance.setVisibility( View.VISIBLE );
|
||||
mFloatingLayout.setVisibility( View.VISIBLE );
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
MogoModulePaths.addModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
|
||||
mMogoModuleHandler = new MogoModulesManager(this);
|
||||
mMogoMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation();
|
||||
if (mMogoMapService != null) {
|
||||
mMogoMapService.getHostListenerRegister().registerHostMapListener(mMogoModuleHandler);
|
||||
mMogoMapService.getHostListenerRegister().registerHostNaviListener(mMogoModuleHandler);
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener(this);
|
||||
mMogoModuleHandler = new MogoModulesManager( this );
|
||||
mMogoMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation();
|
||||
if ( mMogoMapService != null ) {
|
||||
mMogoMapService.getHostListenerRegister().registerHostMapListener( mMogoModuleHandler );
|
||||
mMogoMapService.getHostListenerRegister().registerHostNaviListener( mMogoModuleHandler );
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
|
||||
}
|
||||
|
||||
mMogoModuleHandler.setMapLoadedCallback(() -> {
|
||||
Logger.d(TAG, "map loaded." + Thread.currentThread().getName());
|
||||
mMogoModuleHandler.setMapLoadedCallback( () -> {
|
||||
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
mMogoModuleHandler.loadModules();
|
||||
loadContainerModules();
|
||||
new Handler().postDelayed(() -> loadCardModules(), 5000);
|
||||
mMsgHandler.sendEmptyMessageDelayed( MainConstants.MSG_LOAD_CARD_MODULES, 5_000L );
|
||||
|
||||
// 显示左边遮罩
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
mTopShadowFrame.setVisibility(View.VISIBLE);
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mTopShadowFrame.setVisibility( View.VISIBLE );
|
||||
|
||||
// 右移地图中心点
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
mMogoMapUIController.setPointToCenter(0.66145, 0.590688);
|
||||
mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
|
||||
// 开启定位
|
||||
startLocation();
|
||||
});
|
||||
mMogoModuleHandler.loadMapModule(R.id.module_main_id_map_fragment_container);
|
||||
} );
|
||||
mMogoModuleHandler.loadMapModule( R.id.module_main_id_map_fragment_container );
|
||||
|
||||
mMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(this);
|
||||
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(this);
|
||||
mMogoCardManager = ( IMogoCardManager ) ARouter.getInstance().build( MogoServicePaths.PATH_CARD_MANAGER ).navigation( this );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( this );
|
||||
}
|
||||
|
||||
private void startLocation() {
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient(getApplicationContext());
|
||||
mLocationClient.addLocationListener(this);
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start();
|
||||
}
|
||||
|
||||
private void loadContainerModules() {
|
||||
mMogoModuleHandler.loadAppsListModule(R.id.module_main_id_apps_fragment_container);
|
||||
mMogoModuleHandler.loadExtensionsModule(R.id.module_main_id_header_fragment_container);
|
||||
mMogoModuleHandler.loadEntrancesModule(R.id.module_main_id_entrance_fragment_container);
|
||||
mMogoModuleHandler.loadAppsListModule( R.id.module_main_id_apps_fragment_container );
|
||||
mMogoModuleHandler.loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
mMogoModuleHandler.loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
}
|
||||
|
||||
private void loadCardModules() {
|
||||
|
||||
List<IMogoModuleProvider> providers = mMogoModuleHandler.loadCardsModule();
|
||||
mCardModulesAdapter = new CardModulesAdapter(this, providers);
|
||||
mCardsContainer.setOffscreenPageLimit(providers.size());
|
||||
mCardsContainer.setPageTransformer(true, new VerticalStackTransformer(this));
|
||||
mCardsContainer.setAdapter(mCardModulesAdapter);
|
||||
mCardsContainer.setCurrentItem(mCurrentPosition);
|
||||
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
||||
mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
||||
mCardsContainer.setOffscreenPageLimit( providers.size() );
|
||||
mCardsContainer.setPageTransformer( true, new VerticalStackTransformer( this ) );
|
||||
mCardsContainer.setAdapter( mCardModulesAdapter );
|
||||
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
}
|
||||
@@ -287,62 +324,62 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
@NonNull
|
||||
@Override
|
||||
protected MainPresenter createPresenter() {
|
||||
return new MainPresenter(this);
|
||||
return new MainPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.onLocationChanged(location);
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
isClickMarker = true;
|
||||
switch2(marker.getOwner());
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.onMarkerClicked(marker);
|
||||
switch2( marker.getOwner() );
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onMarkerClicked( marker );
|
||||
}
|
||||
isClickMarker = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switch2(String cardType) {
|
||||
if (mCardModulesAdapter != null) {
|
||||
public void switch2( String cardType ) {
|
||||
if ( mCardModulesAdapter != null ) {
|
||||
|
||||
int position = mCardModulesAdapter.getProviderPosition(cardType);
|
||||
if (position != -1) {
|
||||
int lastFactPosition = mCardModulesAdapter.getFactPosition(mCurrentPosition);
|
||||
mCardsContainer.setCurrentItem(mCurrentPosition + position - lastFactPosition, Math.abs(lastFactPosition - position) == 1);
|
||||
if (!isClickMarker) {
|
||||
mMogoCardManager.invoke(position, mMogoModuleHandler.getCurrentModuleName());
|
||||
int position = mCardModulesAdapter.getProviderPosition( cardType );
|
||||
if ( position != -1 ) {
|
||||
int lastFactPosition = mCardModulesAdapter.getFactPosition( mCurrentPosition );
|
||||
mCardsContainer.setCurrentItem( mCurrentPosition + position - lastFactPosition, Math.abs( lastFactPosition - position ) == 1 );
|
||||
if ( !isClickMarker ) {
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "Can't find type of %s's position", cardType);
|
||||
Logger.e( TAG, "Can't find type of %s's position", cardType );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
MapBroadCastHelper.getInstance(this).mapFrount();
|
||||
MapBroadCastHelper.getInstance( this ).mapFrount();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
MapBroadCastHelper.getInstance(this).mapBackground();
|
||||
MapBroadCastHelper.getInstance( this ).mapBackground();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mMogoFragmentManager.getStackSize() == 0) {
|
||||
if ( mMogoFragmentManager.getStackSize() == 0 ) {
|
||||
return;
|
||||
}
|
||||
if (mMogoFragmentManager != null) {
|
||||
if ( mMogoFragmentManager != null ) {
|
||||
mMogoFragmentManager.pop();
|
||||
}
|
||||
}
|
||||
@@ -351,12 +388,12 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.removeLocationListener(this);
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
mLocationClient.destroy();
|
||||
}
|
||||
mLocationClient = null;
|
||||
if (mMogoModuleHandler != null) {
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.destroy();
|
||||
}
|
||||
mMogoModuleHandler = null;
|
||||
@@ -365,6 +402,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
mMogoCardManager = null;
|
||||
mMogoFragmentManager = null;
|
||||
|
||||
AIAssist.getInstance(this).release();
|
||||
AIAssist.getInstance( this ).release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.module.main.constants;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MainConstants {
|
||||
|
||||
/**
|
||||
* 消息:加载卡片模块
|
||||
*/
|
||||
public static final int MSG_LOAD_CARD_MODULES = 5000;
|
||||
|
||||
/**
|
||||
* 消息:触发第一张卡片的onPerform 时间
|
||||
*/
|
||||
public static final int MSG_LOAD_INVOKE_FIRST_CARD_PERFORM_EVENT = 5001;
|
||||
|
||||
/**
|
||||
* 消息:卡片展示事件
|
||||
*/
|
||||
public static final int MSG_TRACK_LAST_CARD_DISPLAY_EVENT = 5002;
|
||||
|
||||
/**
|
||||
* 消息:卡片滑动事件
|
||||
*/
|
||||
public static final int MSG_TRACK_CARD_FLIP_EVENT = 5003;
|
||||
}
|
||||
Reference in New Issue
Block a user