Merge remote-tracking branch 'origin/feature/v1.0.2' into feature/v1.0.2
This commit is contained in:
@@ -34,7 +34,6 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
private View mCarSettings;
|
||||
private View mApps;
|
||||
|
||||
private AppsFragment mAppsFragment;
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -39,6 +40,8 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
super.onCreate( owner );
|
||||
mIntentManager = ( IMogoIntentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_INTENT_MANAGER ).navigation( getContext() );
|
||||
mMogoStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( getContext() );
|
||||
// 预加载应用列表,空间换时间
|
||||
AppsModel.getInstance(getContext()).load( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AppsAdapter extends BaseAdapter {
|
||||
}
|
||||
AppInfo appInfo = getItem( position );
|
||||
if ( appInfo.getIconResId() <= 0 ) {
|
||||
holder.mIcon.setImageDrawable( appInfo.getIcon() );
|
||||
holder.mIcon.setImageResource( R.drawable.module_apps_ic_default_icon );
|
||||
} else {
|
||||
holder.mIcon.setImageResource( appInfo.getIconResId() );
|
||||
}
|
||||
|
||||
@@ -16,68 +16,70 @@ import com.mogo.module.apps.R;
|
||||
public enum AppEnum {
|
||||
|
||||
//"QQ音乐",
|
||||
QQMusic( "com.pvetec.musics", R.drawable.module_apps_ic_qq_music ),
|
||||
QQMusic( "QQ音乐","com.pvetec.musics", R.drawable.module_apps_ic_qq_music ),
|
||||
|
||||
//"车聊聊",
|
||||
Im( "com.zhidao.imdemo", R.drawable.module_apps_ic_im ),
|
||||
Im( "车聊聊","com.zhidao.imdemo", R.drawable.module_apps_ic_im ),
|
||||
|
||||
//"探路",
|
||||
RoadCondition( "com.zhidao.roadcondition", R.drawable.module_apps_ic_road_condition ),
|
||||
RoadConditionSlit( "com.zhidao.roadcondition.split", R.drawable.module_apps_ic_road_condition ),
|
||||
RoadCondition( "探路","com.zhidao.roadcondition", R.drawable.module_apps_ic_road_condition ),
|
||||
RoadConditionSlit( "探路","com.zhidao.roadcondition.split", R.drawable.module_apps_ic_road_condition ),
|
||||
|
||||
//"福利",
|
||||
Welfare( "com.zhidaohulian.welfare.car", R.drawable.module_apps_ic_welfare ),
|
||||
Welfare( "福利","com.zhidaohulian.welfare.car", R.drawable.module_apps_ic_welfare ),
|
||||
|
||||
//"蘑菇小队",
|
||||
Fleet( "com.zhidao.fleet", R.drawable.module_apps_ic_fleet ),
|
||||
Fleet( "蘑菇小队","com.zhidao.fleet", R.drawable.module_apps_ic_fleet ),
|
||||
|
||||
//"行车记录仪",
|
||||
CarCorder( "com.zhidao.carcorder", R.drawable.module_apps_ic_carcorder ),
|
||||
CarCorder( "行车记录仪","com.zhidao.carcorder", R.drawable.module_apps_ic_carcorder ),
|
||||
|
||||
//"懒人听书",
|
||||
Lrts( "com.zhidao.lrts", R.drawable.module_apps_ic_lrts ),
|
||||
Lrts( "懒人听书","com.zhidao.lrts", R.drawable.module_apps_ic_lrts ),
|
||||
|
||||
//"一键清理",
|
||||
CleanMaster( "com.zhidao.cleanmaster", R.drawable.module_apps_ic_clean_master ),
|
||||
CleanMaster( "一键清理","com.zhidao.cleanmaster", R.drawable.module_apps_ic_clean_master ),
|
||||
|
||||
//"系统升级",
|
||||
Fota( "com.abupdate.fota_demo_iot", R.drawable.module_apps_ic_fota ),
|
||||
Fota( "系统升级","com.abupdate.fota_demo_iot", R.drawable.module_apps_ic_fota ),
|
||||
|
||||
//"微信车机助手",
|
||||
WechatHelper( "com.zhidao.wechathelper", R.drawable.module_apps_ic_wechat ),
|
||||
WechatHelper( "微信车机助手","com.zhidao.wechathelper", R.drawable.module_apps_ic_wechat ),
|
||||
|
||||
//"爱奇艺HD",
|
||||
Qiyi( "com.qiyi.video.pad", R.drawable.module_apps_ic_qiyi ),
|
||||
Qiyi( "爱奇艺HD","com.qiyi.video.pad", R.drawable.module_apps_ic_qiyi ),
|
||||
|
||||
//"喜马拉雅",
|
||||
Ximalaya( "com.ximalaya.ting.android.car", R.drawable.module_apps_ic_ximalaya ),
|
||||
Ximalaya( "喜马拉雅","com.ximalaya.ting.android.car", R.drawable.module_apps_ic_ximalaya ),
|
||||
|
||||
//"均衡器",
|
||||
Equlizer( "com.zhidao.equalizer", R.drawable.module_apps_ic_equlizer ),
|
||||
Equlizer( "均衡器","com.zhidao.equalizer", R.drawable.module_apps_ic_equlizer ),
|
||||
|
||||
//"方控学习",
|
||||
SteerProduct( "com.zd.steerproduct", R.drawable.module_apps_ic_stee_product ),
|
||||
SteerProduct( "方控学习","com.zd.steerproduct", R.drawable.module_apps_ic_stee_product ),
|
||||
|
||||
//"蓝牙音乐",
|
||||
BTMusic( "com.nwd.bt.music", R.drawable.module_apps_ic_bt ),
|
||||
BTMusic( "蓝牙音乐","com.nwd.bt.music", R.drawable.module_apps_ic_bt ),
|
||||
|
||||
//"车载设置",
|
||||
CarSettings( "com.zhidao.settings", R.drawable.module_apps_ic_car_setting ),
|
||||
CarSettings( "车载设置","com.zhidao.settings", R.drawable.module_apps_ic_car_setting ),
|
||||
|
||||
//"AUX",
|
||||
AUX( "com.nwd.auxin", R.drawable.module_apps_ic_aux ),
|
||||
AUX( "AUX","com.nwd.auxin", R.drawable.module_apps_ic_aux ),
|
||||
|
||||
//FM
|
||||
FM( " com.nwd.radio", R.drawable.module_apps_ic_fm ),
|
||||
FM( "FM","com.nwd.radio", R.drawable.module_apps_ic_fm ),
|
||||
|
||||
// 新鲜事
|
||||
FreshThings( "com.zhidao.fresh.things", R.drawable.module_apps_ic_fresh_things ),
|
||||
FreshThings( "新鲜事","com.zhidao.fresh.things", R.drawable.module_apps_ic_fresh_things ),
|
||||
;
|
||||
|
||||
private String mName;
|
||||
private String mPkg;
|
||||
private int mIconResId;
|
||||
|
||||
AppEnum( String pkg, int iconResId ) {
|
||||
AppEnum( String name, String pkg, int iconResId ) {
|
||||
this.mName = name;
|
||||
this.mPkg = pkg;
|
||||
this.mIconResId = iconResId;
|
||||
}
|
||||
@@ -89,4 +91,8 @@ public enum AppEnum {
|
||||
public int getIconResId() {
|
||||
return mIconResId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,4 +31,12 @@ public class AppEnumHelper {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static String getTargetName(String pkg){
|
||||
AppEnum appEnum = sCustomizedApps.get( pkg );
|
||||
if ( appEnum != null ) {
|
||||
return appEnum.getName();
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +74,13 @@ public class AppsModel {
|
||||
if ( !mPagedApps.containsKey( page ) ) {
|
||||
mPagedApps.put( page, new ArrayList<>() );
|
||||
}
|
||||
String appName = packageInfo.applicationInfo.loadLabel( packageManager ).toString();
|
||||
String appName = getApplicationName( packageManager, packageInfo );
|
||||
String packageName = packageInfo.packageName;
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon, AppEnumHelper.getCustomizedAppIconResId( packageName ) );
|
||||
// 不加载默认图标,避免不必要的开销,因为现在应用列表图标都是定制的啊~~~~
|
||||
// Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, null, AppEnumHelper.getCustomizedAppIconResId( packageName ) );
|
||||
mPagedApps.get( page ).add( appInfo );
|
||||
}
|
||||
if ( callback != null ) {
|
||||
@@ -102,7 +103,7 @@ public class AppsModel {
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo( packageName, 0 );
|
||||
if ( !mAppFilter.filter( packageInfo ) ) {
|
||||
String appName = packageInfo.applicationInfo.loadLabel( packageManager ).toString();
|
||||
String appName = getApplicationName( packageManager, packageInfo );
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
@@ -119,6 +120,14 @@ public class AppsModel {
|
||||
}
|
||||
}
|
||||
|
||||
private String getApplicationName( PackageManager packageManager, PackageInfo packageInfo ) {
|
||||
String name = packageManager.getApplicationLabel( packageInfo.applicationInfo ).toString();
|
||||
if ( name.startsWith( "com." ) || name.split( "." ).length > 3 ) {
|
||||
return AppEnumHelper.getTargetName( packageInfo.packageName );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private int getPageIndex( String packageName, boolean add ) {
|
||||
int totalPages = mPagedApps.size();
|
||||
if ( add ) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@@ -132,15 +132,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mMogoAddressManager.goCompany();
|
||||
});
|
||||
|
||||
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
|
||||
mUploadRoadCondition.setOnClickListener(view -> {
|
||||
ShareControl.getInstance(getActivity()).showDialog();
|
||||
traceData("1");
|
||||
});
|
||||
|
||||
mVRMode = findViewById(R.id.module_entrance_id_vr_mode);
|
||||
mVRMode.setOnClickListener(view -> {
|
||||
});
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
ShareControl.getInstance( getActivity() ).showDialog();
|
||||
traceData( "1" );
|
||||
} );
|
||||
mVRMode = findViewById( R.id.module_entrance_id_vr_mode );
|
||||
mVRMode.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
|
||||
mMove2CurrentLocation.setOnClickListener(view -> {
|
||||
|
||||
@@ -12,7 +12,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
@@ -33,6 +32,7 @@ import com.mogo.module.main.cards.VerticalStackTransformer;
|
||||
import com.mogo.module.main.constants.VoiceConstants;
|
||||
import com.mogo.module.main.windowview.WindowViewHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
@@ -42,22 +42,24 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 描述:加载各个模块
|
||||
*/
|
||||
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener, IMogoIntentListener {
|
||||
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener, IMogoIntentListener {
|
||||
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
private IMogoServiceApis mServiceApis;
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoMapUIController mMogoMapUIController;
|
||||
private MogoModulesHandler mMogoModuleHandler;
|
||||
@@ -95,110 +97,110 @@ 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);
|
||||
mTransformer = new VerticalStackTransformer(this);
|
||||
mCardsContainer = findViewById( R.id.module_main_id_cards_container );
|
||||
mCardsContainer.setOrientation( OrientedViewPager.Orientation.VERTICAL );
|
||||
mTransformer = new VerticalStackTransformer( this );
|
||||
mCardsContainer.setOnPageChangeListener(
|
||||
mOnPageChangeListener = new OnPageChangeListenerAdapter() {
|
||||
private boolean mIsLast = true;
|
||||
private boolean mCardFlipStatus = false;
|
||||
mOnPageChangeListener = new OnPageChangeListenerAdapter() {
|
||||
private boolean mIsLast = true;
|
||||
private boolean mCardFlipStatus = false;
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
final long start = System.currentTimeMillis();
|
||||
try {
|
||||
IMogoModuleProvider provider =
|
||||
mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
mPresenter.postTrackLastCardShowEvent(provider);
|
||||
mCurrentPosition = position;
|
||||
provider = mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
mMogoModuleHandler.setModuleEnable(provider.getModuleName());
|
||||
mMogoCardManager.invoke(position,
|
||||
mMogoModuleHandler.getCurrentModuleName());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Logger.i(TAG,
|
||||
"onPageSelected cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
super.onPageScrollStateChanged(state);
|
||||
if (state == ViewPager.SCROLL_STATE_DRAGGING) {
|
||||
if (!mCardFlipStatus) {
|
||||
mCardFlipStatus = true;
|
||||
final IMogoModuleProvider provider =
|
||||
mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
mPresenter.postTrackCardFlipEvent(provider);
|
||||
@Override
|
||||
public void onPageSelected( int position ) {
|
||||
final long start = System.currentTimeMillis();
|
||||
try {
|
||||
IMogoModuleProvider provider =
|
||||
mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
mPresenter.postTrackLastCardShowEvent( provider );
|
||||
mCurrentPosition = position;
|
||||
provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
mMogoModuleHandler.setModuleEnable( provider.getModuleName() );
|
||||
mMogoCardManager.invoke( position,
|
||||
mMogoModuleHandler.getCurrentModuleName() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (state == ViewPager.SCROLL_STATE_IDLE) {
|
||||
mCardFlipStatus = false;
|
||||
mTransformer.resetOffsetScroll();
|
||||
Logger.i( TAG,
|
||||
"onPageSelected cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
int cardSize = mCardModulesAdapter.getCount();
|
||||
|
||||
if (state == ViewPager.SCROLL_STATE_SETTLING) {
|
||||
mIsLast = false;
|
||||
} 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);
|
||||
@Override
|
||||
public void onPageScrollStateChanged( int state ) {
|
||||
final long start = System.currentTimeMillis();
|
||||
super.onPageScrollStateChanged( state );
|
||||
if ( state == ViewPager.SCROLL_STATE_DRAGGING ) {
|
||||
if ( !mCardFlipStatus ) {
|
||||
mCardFlipStatus = true;
|
||||
final IMogoModuleProvider provider =
|
||||
mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
mPresenter.postTrackCardFlipEvent( provider );
|
||||
}
|
||||
} else if ( state == ViewPager.SCROLL_STATE_IDLE ) {
|
||||
mCardFlipStatus = false;
|
||||
mTransformer.resetOffsetScroll();
|
||||
}
|
||||
} else {
|
||||
mIsLast = true;
|
||||
|
||||
int cardSize = mCardModulesAdapter.getCount();
|
||||
|
||||
if ( state == ViewPager.SCROLL_STATE_SETTLING ) {
|
||||
mIsLast = false;
|
||||
} 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 );
|
||||
}
|
||||
} else {
|
||||
mIsLast = true;
|
||||
}
|
||||
Logger.i( TAG, "onPageScrollStateChanged cost "
|
||||
+ ( System.currentTimeMillis() - start )
|
||||
+ "ms" );
|
||||
}
|
||||
Logger.i(TAG, "onPageScrollStateChanged cost "
|
||||
+ (System.currentTimeMillis() - start)
|
||||
+ "ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset,
|
||||
int positionOffsetPixels) {
|
||||
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
|
||||
Logger.d(TAG, "pageScrolled : offset --- " + positionOffset);
|
||||
mTransformer.offsetScrollChanged(positionOffset);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onPageScrolled( int position, float positionOffset,
|
||||
int positionOffsetPixels ) {
|
||||
super.onPageScrolled( position, positionOffset, positionOffsetPixels );
|
||||
Logger.d( TAG, "pageScrolled : offset --- " + positionOffset );
|
||||
mTransformer.offsetScrollChanged( positionOffset );
|
||||
}
|
||||
} );
|
||||
|
||||
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);
|
||||
mCoverUpLayout = findViewById(R.id.module_main_id_cover_up);
|
||||
mCardCoverUpBottomLayout = findViewById(R.id.module_main_id_card_cover_up_bottom);
|
||||
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 );
|
||||
mCoverUpLayout = findViewById( R.id.module_main_id_cover_up );
|
||||
mCardCoverUpBottomLayout = findViewById( R.id.module_main_id_card_cover_up_bottom );
|
||||
|
||||
WindowViewHandler.init(mFloatingLayout);
|
||||
WindowViewHandler.init( mFloatingLayout );
|
||||
}
|
||||
|
||||
// 隐藏布局
|
||||
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);
|
||||
mCardCoverUpBottomLayout.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 );
|
||||
mCardCoverUpBottomLayout.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);
|
||||
mCardCoverUpBottomLayout.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 );
|
||||
mCardCoverUpBottomLayout.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -211,158 +213,157 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
public void loadModules() {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
getWindow().setBackgroundDrawable( null );
|
||||
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
|
||||
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();
|
||||
mMogoMapService = mServiceApis.getMapServiceApi();
|
||||
if ( mMogoMapService != null ) {
|
||||
mMogoMapService.getHostListenerRegister().registerHostMapListener( mMogoModuleHandler );
|
||||
mMogoMapService.getHostListenerRegister().registerHostNaviListener( mMogoModuleHandler );
|
||||
mMogoMapService.getHostListenerRegister().registerHostAimlessModeListener( 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() );
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
loadContainerModules();
|
||||
mMogoModuleHandler.loadModules();
|
||||
mPresenter.delayOperations();
|
||||
|
||||
// 显示左边遮罩
|
||||
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);
|
||||
mMogoCardManager = mServiceApis.getCardManagerApi();
|
||||
|
||||
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 = mServiceApis.getFragmentManagerApi();
|
||||
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();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mMogoIntentManager = (IMogoIntentManager) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_INTENT_MANAGER)
|
||||
.navigation(getContext());
|
||||
mMogoIntentManager = mServiceApis.getIntentManagerApi();
|
||||
registerVoiceCmd();
|
||||
Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
private void registerVoiceCmd() {
|
||||
|
||||
for (String cmd : VoiceConstants.sCmds) {
|
||||
mMogoIntentManager.registerIntentListener(cmd, this);
|
||||
for ( String cmd : VoiceConstants.sCmds ) {
|
||||
mMogoIntentManager.registerIntentListener( cmd, this );
|
||||
}
|
||||
}
|
||||
|
||||
private void startLocation() {
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient(getApplicationContext());
|
||||
mLocationClient.addLocationListener(this);
|
||||
mLocationClient.start(2_000L);
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postPickFirstCardEvent() {
|
||||
if (mOnPageChangeListener != null) {
|
||||
if ( mOnPageChangeListener != null ) {
|
||||
// 默认触发第一个卡片
|
||||
mOnPageChangeListener.onPageSelected(0);
|
||||
mOnPageChangeListener.onPageSelected( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideCoverUpLayout() {
|
||||
mCoverUpLayout.setVisibility(View.GONE);
|
||||
mCoverUpLayout.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCardModules() {
|
||||
|
||||
List<IMogoModuleProvider> providers = mMogoModuleHandler.loadCardsModule();
|
||||
mCardModulesAdapter = new CardModulesAdapter(this, providers);
|
||||
mCardsContainer.setOffscreenPageLimit(providers.size());
|
||||
mCardsContainer.setPageTransformer(true, mTransformer);
|
||||
mCardsContainer.setAdapter(mCardModulesAdapter);
|
||||
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
||||
mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
||||
mCardsContainer.setOffscreenPageLimit( providers.size() );
|
||||
mCardsContainer.setPageTransformer( true, mTransformer );
|
||||
mCardsContainer.setAdapter( mCardModulesAdapter );
|
||||
|
||||
mCardCoverUpBottomLayout.setVisibility(View.VISIBLE);
|
||||
mCardCoverUpBottomLayout.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@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) {
|
||||
switch2Card(marker.getOwner());
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.onMarkerClicked(marker);
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
switch2Card( marker.getOwner() );
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onMarkerClicked( marker );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switch2Card(String cardType) {
|
||||
if (mCardModulesAdapter != null) {
|
||||
public void switch2Card( 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);
|
||||
int position = mCardModulesAdapter.getProviderPosition( cardType );
|
||||
if ( position != -1 ) {
|
||||
int lastFactPosition = mCardModulesAdapter.getFactPosition( mCurrentPosition );
|
||||
mCardsContainer.setCurrentItem( mCurrentPosition + position - lastFactPosition,
|
||||
Math.abs( lastFactPosition - position ) == 1 );
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
@@ -370,12 +371,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;
|
||||
@@ -383,38 +384,39 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
mMogoMapUIController = null;
|
||||
mMogoCardManager = null;
|
||||
mMogoFragmentManager = null;
|
||||
AIAssist.getInstance(this).release();
|
||||
AIAssist.getInstance( this ).release();
|
||||
}
|
||||
|
||||
@Override public void onIntentReceived(String intentStr, Intent intent) {
|
||||
if (TextUtils.isEmpty(intentStr)) {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
if ( TextUtils.isEmpty( intentStr ) ) {
|
||||
return;
|
||||
}
|
||||
int currentItem = mCardsContainer.getCurrentItem();
|
||||
int cardSize = mCardModulesAdapter.getCount();
|
||||
|
||||
switch (intentStr) {
|
||||
switch ( intentStr ) {
|
||||
case VoiceConstants.COMMAND_ZHIDAO_SWITCHCARD:
|
||||
|
||||
String data = intent.getStringExtra("data");
|
||||
String data = intent.getStringExtra( "data" );
|
||||
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(data);
|
||||
JSONObject jsonObject = new JSONObject( data );
|
||||
|
||||
String card = jsonObject.getString("card");
|
||||
String card = jsonObject.getString( "card" );
|
||||
|
||||
if (TextUtils.equals("多媒体",card)) {
|
||||
mCardsContainer.setCurrentItem(1);
|
||||
if ( TextUtils.equals( "多媒体", card ) ) {
|
||||
mCardsContainer.setCurrentItem( 1 );
|
||||
|
||||
}else if (TextUtils.equals("探路",card)){
|
||||
mCardsContainer.setCurrentItem(3);
|
||||
} else if ( TextUtils.equals( "探路", card ) ) {
|
||||
mCardsContainer.setCurrentItem( 3 );
|
||||
|
||||
|
||||
}else if (TextUtils.equals("在线车辆",card)){
|
||||
mCardsContainer.setCurrentItem(5);
|
||||
} else if ( TextUtils.equals( "在线车辆", card ) ) {
|
||||
mCardsContainer.setCurrentItem( 5 );
|
||||
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -422,16 +424,16 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
case VoiceConstants.COMMAND_ZHIDAO_SWITCHCARD_NEXT:
|
||||
currentItem++;
|
||||
mCardsContainer.setCurrentItem(currentItem / cardSize);
|
||||
mCardsContainer.setCurrentItem( currentItem / cardSize );
|
||||
|
||||
break;
|
||||
|
||||
case VoiceConstants.COMMAND_ZHIDAO_SWITCHCARD_PREVIOUS:
|
||||
currentItem--;
|
||||
if (currentItem < 0) {
|
||||
if ( currentItem < 0 ) {
|
||||
currentItem += cardSize;
|
||||
}
|
||||
mCardsContainer.setCurrentItem(currentItem / cardSize);
|
||||
mCardsContainer.setCurrentItem( currentItem / cardSize );
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
@@ -22,7 +23,8 @@ import javax.security.auth.callback.Callback;
|
||||
public interface MogoModulesHandler extends IMogoMapListener,
|
||||
IMogoNaviListener,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener {
|
||||
IMogoMarkerClickListener,
|
||||
IMogoAimlessModeListener {
|
||||
|
||||
/**
|
||||
* 地图加载完成回调
|
||||
|
||||
@@ -16,7 +16,9 @@ import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -530,20 +532,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic( MogoTraffic traffic ) {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onUpdateTraffic( traffic );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.e( TAG, "error. call deprecated method, use onUpdateTraffic2 instead." );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -601,7 +590,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
public void destroy() {
|
||||
if ( mMogoIntentManager != null ) {
|
||||
mMogoIntentManager.unregisterIntentListener( Intent.ACTION_POWER_CONNECTED, this );
|
||||
mMogoIntentManager.unregisterIntentListener( Intent.ACTION_POWER_DISCONNECTED,this );
|
||||
mMogoIntentManager.unregisterIntentListener( Intent.ACTION_POWER_DISCONNECTED, this );
|
||||
mMogoIntentManager.unregisterIntentListener( MogoReceiver.ACTION_NWD_ACC, this );
|
||||
}
|
||||
mActivity = null;
|
||||
@@ -626,6 +615,34 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
Iterator< IMogoAimlessModeListener > iterator = MogoRegisterCenterHandler.getInstance().getAimlessModeListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoAimlessModeListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
listener.onUpdateTraffic2( traffic );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateCongestion( MogoCongestionInfo info ) {
|
||||
Iterator< IMogoAimlessModeListener > iterator = MogoRegisterCenterHandler.getInstance().getAimlessModeListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoAimlessModeListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
listener.onUpdateCongestion( info );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentModuleName() {
|
||||
return mEnableModuleName;
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
@@ -71,7 +72,16 @@ public class MogoRegisterCenter implements IMogoRegisterCenter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
public void registerMogoAimlessModeListener( String tag, IMogoAimlessModeListener listener ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoAimlessModeListener( String tag ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
@@ -22,13 +23,13 @@ import java.util.Map;
|
||||
public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
|
||||
private static volatile MogoRegisterCenterHandler sInstance;
|
||||
private Context mContext;
|
||||
|
||||
private Map< String, IMogoModuleLifecycle > mLifecycle = new HashMap<>();
|
||||
private Map< String, IMogoMapListener > mMap = new HashMap<>();
|
||||
private Map< String, IMogoNaviListener > mNavi = new HashMap<>();
|
||||
private Map< String, IMogoLocationListener > mLocation = new HashMap<>();
|
||||
private Map< String, IMogoMarkerClickListener > mMarker = new HashMap<>();
|
||||
private Map< String, IMogoAimlessModeListener > mAimless = new HashMap<>();
|
||||
|
||||
private MogoRegisterCenterHandler() {
|
||||
}
|
||||
@@ -99,11 +100,18 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
mMarker.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoAimlessModeListener( String tag, IMogoAimlessModeListener listener ) {
|
||||
mAimless.put( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoAimlessModeListener( String tag ) {
|
||||
mAimless.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
if ( mContext == null && context != null ) {
|
||||
mContext = context.getApplicationContext();
|
||||
}
|
||||
}
|
||||
|
||||
public IMogoModuleLifecycle getLifecycleListener( String tag ) {
|
||||
@@ -145,4 +153,8 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
public Iterator< IMogoMarkerClickListener > getMarkerListeners() {
|
||||
return mMarker.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoAimlessModeListener > getAimlessModeListeners() {
|
||||
return mAimless.values().iterator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -60,7 +62,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
IMogoLocationListener,
|
||||
IMogoNaviListener,
|
||||
IMogoStatusChangedListener,
|
||||
IMogoIntentListener {
|
||||
IMogoIntentListener,
|
||||
IMogoAimlessModeListener {
|
||||
|
||||
private MogoServices() {
|
||||
// private constructor
|
||||
@@ -601,8 +604,18 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic( MogoTraffic traffic ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
|
||||
if ( traffic != null ) {
|
||||
|
||||
if ( traffic.getSpeedLimit() <= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.i( TAG, "speed = %d, desc = %s", traffic.getSpeedLimit(), traffic.getDesc() );
|
||||
// 发送当前限速到 adas
|
||||
Intent intent = new Intent( "com.mogo.launcher.adas" );
|
||||
@@ -611,8 +624,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
@Override
|
||||
public void onUpdateCongestion( MogoCongestionInfo info ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.text.TextUtils;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user