opt
This commit is contained in:
@@ -3,4 +3,7 @@
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
|
||||
|
||||
<color name="app_window_background">#1C1C1C</color>
|
||||
</resources>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<item name="android:windowEnterAnimation">@null</item>
|
||||
<item name="android:windowExitAnimation">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowBackground">@color/app_window_background</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:windowAnimationStyle">@style/Animation</item>
|
||||
</style>
|
||||
|
||||
@@ -20,13 +20,17 @@ import com.zhidao.account.sdk.AccountClientManager;
|
||||
import com.zhidao.account.sdk.callback.TicketInfoCallback;
|
||||
import com.zhidao.account.sdk.network.NetEnvironManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -86,6 +90,17 @@ public class AbsMogoApplication extends Application {
|
||||
NetConfig.instance().setSignaturePrefix( Constants.SIGN_PREFIX )
|
||||
.setPublicParams( ParamsUtil.getStaticParams() )
|
||||
.setHostnameVerifier( new AllAllowedHostnameVerifier() )
|
||||
.addNetworkInterceptor( new Interceptor() {
|
||||
@Override
|
||||
public Response intercept( Chain chain ) throws IOException {
|
||||
Request original = chain.request();
|
||||
Request request = original.newBuilder()
|
||||
.header( "token", SpStorage.getTicket() )
|
||||
.method( original.method(), original.body() )
|
||||
.build();
|
||||
return chain.proceed( request );
|
||||
}
|
||||
} )
|
||||
.setLoggable( DebugConfig.isDebug() );
|
||||
}
|
||||
|
||||
@@ -103,11 +118,12 @@ public class AbsMogoApplication extends Application {
|
||||
}
|
||||
|
||||
private static void initAccountSdk() {
|
||||
AccountClientManager.init( sApp, NetEnvironManager.QA, NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
AccountClientManager.init( sApp, DebugConfig.getNetMode(), NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
AccountClientManager.getTicket( new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
SpStorage.setTicket( ticket );
|
||||
Logger.w( TAG, "request ticket success" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,6 +33,13 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
|
||||
for ( String cmd : mCmdMap.keySet() ) {
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
}
|
||||
}
|
||||
mVoiceMap.clear();
|
||||
mVoiceClient.release();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@@ -204,7 +211,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
callBacks.remove( callBack );
|
||||
}
|
||||
|
||||
public static void startAssistant(Context context) {
|
||||
public static void startAssistant( Context context ) {
|
||||
final Intent intent = new Intent();
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
android:layout_marginBottom="@dimen/module_apps_indicator_marginBottom"
|
||||
app:lineWidth="@dimen/module_apps_indicator_width"
|
||||
app:selectedColor="#ffffffff"
|
||||
app:strokeWidth="@dimen/module_apps_indicator_heigt"
|
||||
app:strokeWidth="@dimen/module_apps_indicator_height"
|
||||
app:unselectedColor="#33ffffff" />
|
||||
|
||||
<ProgressBar
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_apps_pager_marginTop">117px</dimen>
|
||||
<dimen name="module_apps_indicator_heigt">2.7px</dimen>
|
||||
<dimen name="module_apps_indicator_height">2.7px</dimen>
|
||||
<dimen name="module_apps_indicator_width">16px</dimen>
|
||||
<dimen name="module_apps_indicator_marginBottom">54.9px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_width">64px</dimen>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_apps_pager_marginTop">260px</dimen>
|
||||
<dimen name="module_apps_indicator_heigt">5px</dimen>
|
||||
<dimen name="module_apps_indicator_height">5px</dimen>
|
||||
<dimen name="module_apps_indicator_width">30px</dimen>
|
||||
<dimen name="module_apps_indicator_marginBottom">103px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_width">120px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_height">120px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_marginLeft">61px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_marginLeft">60px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_paddingBottom">60px</dimen>
|
||||
<dimen name="module_apps_app_name_marginTop">32px</dimen>
|
||||
<dimen name="module_apps_app_name_textSize">32px</dimen>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_apps_pager_marginTop">260px</dimen>
|
||||
<dimen name="module_apps_indicator_heigt">5px</dimen>
|
||||
<dimen name="module_apps_indicator_height">5px</dimen>
|
||||
<dimen name="module_apps_indicator_width">30px</dimen>
|
||||
<dimen name="module_apps_indicator_marginBottom">103px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_width">120px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_height">120px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_marginLeft">61px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_marginLeft">60px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_paddingBottom">60px</dimen>
|
||||
<dimen name="module_apps_app_name_marginTop">32px</dimen>
|
||||
<dimen name="module_apps_app_name_textSize">32px</dimen>
|
||||
|
||||
@@ -27,30 +27,36 @@ public interface ModuleType {
|
||||
/**
|
||||
* APP 列表模块
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_APP_LIST = 4;
|
||||
|
||||
/**
|
||||
* 小智语音形象
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_VOICE = 5;
|
||||
|
||||
/**
|
||||
* 地图模块
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_MAP = 6;
|
||||
|
||||
/**
|
||||
* 导航模块
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_NAVI = 7;
|
||||
|
||||
/**
|
||||
* 小智、天气、时间等
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_EXTENSION = 8;
|
||||
|
||||
/**
|
||||
* 操作快捷入口
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_ENTRANCE = 9;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.fragment.app.Fragment;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
@@ -53,6 +54,8 @@ import java.util.HashMap;
|
||||
*/
|
||||
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter > implements EntranceView,
|
||||
IMogoNaviListener, IMogoMapListener {
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
|
||||
private View mSearch;
|
||||
|
||||
BIN
modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_ic_message.png
Normal file → Executable file
BIN
modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_ic_message.png
Normal file → Executable file
Binary file not shown.
|
Before Width: | Height: | Size: 834 B After Width: | Height: | Size: 467 B |
@@ -4,7 +4,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_ext_height"
|
||||
android:background="@drawable/module_ext_dw_shadow_frame_bkg"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/module_ext_paddingLeft"
|
||||
android:paddingRight="@dimen/module_ext_paddingRight">
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<dimen name="module_ext_operation_panel_share_width">58px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_height">58px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_marginBottom">21px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_textSize">14px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_textSize">20px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">34.5px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">20px</dimen>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -18,7 +19,6 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.main.cards.CardModulesAdapter;
|
||||
import com.mogo.module.main.cards.MogoModulesHandler;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
@@ -31,7 +31,6 @@ import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.impl.fragmentmanager.FragmentStack;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -66,7 +65,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
private View mApps;
|
||||
private View mEntrance;
|
||||
private FrameLayout mFloatingLayout;
|
||||
private View mShadowFrame;
|
||||
private View mLeftShadowFrame;
|
||||
private View mTopShadowFrame;
|
||||
|
||||
/**
|
||||
* 主模块管控定位,可以向各个模块发送统一定位信息
|
||||
@@ -104,7 +104,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
mCurrentPosition = position;
|
||||
provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
mMogoModuleHandler.setEnable( provider.getModuleName() );
|
||||
mMogoModuleHandler.setModuleEnable( provider.getModuleName() );
|
||||
if ( !isClickMarker ) {
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
}
|
||||
@@ -163,9 +163,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> {
|
||||
if ( size == 0 ) {
|
||||
show();
|
||||
showLayout();
|
||||
} else if ( size == 1 ) {
|
||||
hide();
|
||||
hideLayout();
|
||||
}
|
||||
} );
|
||||
mHeader = findViewById( R.id.module_main_id_header_fragment_container );
|
||||
@@ -173,38 +173,37 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
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 );
|
||||
mShadowFrame = findViewById( R.id.module_main_id_map_shadow_frame );
|
||||
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 );
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
// 隐藏布局
|
||||
private void hideLayout() {
|
||||
mHeader.setVisibility( View.GONE );
|
||||
mCards.setVisibility( View.GONE );
|
||||
mApps.setVisibility( View.GONE );
|
||||
mEntrance.setVisibility( View.GONE );
|
||||
mFloatingLayout.setVisibility( View.GONE );
|
||||
mShadowFrame.setVisibility( View.GONE );
|
||||
mLeftShadowFrame.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
private void show() {
|
||||
// 显示布局
|
||||
private void showLayout() {
|
||||
mHeader.setVisibility( View.VISIBLE );
|
||||
mCards.setVisibility( View.VISIBLE );
|
||||
mApps.setVisibility( View.VISIBLE );
|
||||
mEntrance.setVisibility( View.VISIBLE );
|
||||
mFloatingLayout.setVisibility( View.VISIBLE );
|
||||
mShadowFrame.setVisibility( View.VISIBLE );
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_APPS, MogoModulePaths.PATH_MODULE_APPS ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_MAP, MogoModulePaths.PATH_MODULE_MAP ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_EXTENSION, ExtensionsModuleConst.TYPE ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_ENTRANCE, ExtensionsModuleConst.TYPE_ENTRANCE ) );
|
||||
|
||||
mMogoModuleHandler = new MogoModulesManager( this );
|
||||
mMogoMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation();
|
||||
@@ -214,30 +213,43 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
|
||||
}
|
||||
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
|
||||
mMogoModuleHandler.loadModules();
|
||||
mMogoModuleHandler.onMapLoadedCallback( () -> {
|
||||
mMogoModuleHandler.setMapLoadedCallback( () -> {
|
||||
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
|
||||
loadModules();
|
||||
mShadowFrame.setVisibility( View.VISIBLE );
|
||||
mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
} );
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
mMogoModuleHandler.loadMap( R.id.module_main_id_map_fragment_container );
|
||||
mMogoModuleHandler.loadAppsList( R.id.module_main_id_apps_fragment_container );
|
||||
mMogoModuleHandler.loadExtensions( R.id.module_main_id_header_fragment_container );
|
||||
mMogoModuleHandler.loadEntrances( R.id.module_main_id_entrance_fragment_container );
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
mMogoModuleHandler.loadModules();
|
||||
loadContainerModules();
|
||||
loadCardModules();
|
||||
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start();
|
||||
// 显示左边遮罩
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mTopShadowFrame.setVisibility( View.VISIBLE );
|
||||
|
||||
// 右移地图中心点
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
|
||||
// 开启定位
|
||||
startLocation();
|
||||
} );
|
||||
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 );
|
||||
}
|
||||
|
||||
private void loadModules() {
|
||||
private void startLocation() {
|
||||
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 );
|
||||
}
|
||||
|
||||
private void loadCardModules() {
|
||||
|
||||
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
||||
mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
||||
@@ -268,7 +280,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
isClickMarker = true;
|
||||
switch2( marker.getOwner() );
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onMarkerReceive( marker );
|
||||
mMogoModuleHandler.onMarkerClicked( marker );
|
||||
}
|
||||
isClickMarker = false;
|
||||
return false;
|
||||
@@ -291,10 +303,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( FragmentStack.getInstance().isEmpty() ) {
|
||||
if ( mMogoFragmentManager.getStackSize() == 0 ) {
|
||||
return;
|
||||
}
|
||||
FragmentStack.getInstance().pop();
|
||||
if ( mMogoFragmentManager != null ) {
|
||||
mMogoFragmentManager.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,10 +319,15 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mLocationClient.destroy();
|
||||
}
|
||||
mLocationClient = null;
|
||||
mMogoMapService = null;
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.destroy();
|
||||
mMogoModuleHandler = null;
|
||||
}
|
||||
mMogoModuleHandler = null;
|
||||
mMogoMapService = null;
|
||||
mMogoMapUIController = null;
|
||||
mMogoCardManager = null;
|
||||
mMogoFragmentManager = null;
|
||||
|
||||
AIAssist.getInstance( this ).release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,19 @@ import javax.security.auth.callback.Callback;
|
||||
*/
|
||||
public interface MogoModulesHandler extends IMogoMapListener,
|
||||
IMogoNaviListener,
|
||||
IMogoLocationListener {
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener {
|
||||
|
||||
void onMapLoadedCallback( Runnable callback );
|
||||
/**
|
||||
* 地图加载完成回调
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
void setMapLoadedCallback( Runnable callback );
|
||||
|
||||
/**
|
||||
* 加载模块
|
||||
*/
|
||||
void loadModules();
|
||||
|
||||
/**
|
||||
@@ -39,49 +48,41 @@ public interface MogoModulesHandler extends IMogoMapListener,
|
||||
*
|
||||
* @param containerId 容器id
|
||||
*/
|
||||
void loadMap( int containerId );
|
||||
void loadMapModule( int containerId );
|
||||
|
||||
/**
|
||||
* 加载所有应用
|
||||
*
|
||||
* @param containerId 容器id
|
||||
*/
|
||||
void loadAppsList( int containerId );
|
||||
void loadAppsListModule( int containerId );
|
||||
|
||||
/**
|
||||
* 加载头部信息
|
||||
*
|
||||
* @param containerId
|
||||
*/
|
||||
void loadExtensions( int containerId );
|
||||
void loadExtensionsModule( int containerId );
|
||||
|
||||
/**
|
||||
* 加载快捷操作
|
||||
*
|
||||
* @param containerId
|
||||
*/
|
||||
void loadEntrances( int containerId );
|
||||
void loadEntrancesModule( int containerId );
|
||||
|
||||
/**
|
||||
* 设置某一个module可用
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
void setEnable( String module );
|
||||
void setModuleEnable( String module );
|
||||
|
||||
/**
|
||||
* 销毁
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
|
||||
/**
|
||||
* 卡片接收到Marker传入数据
|
||||
*
|
||||
* @param marker marker
|
||||
*/
|
||||
void onMarkerReceive( IMogoMarker marker );
|
||||
|
||||
/**
|
||||
* 当前卡片名称
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -23,6 +24,7 @@ import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
@@ -36,7 +38,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -90,7 +91,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapLoadedCallback( Runnable callback ) {
|
||||
public void setMapLoadedCallback( Runnable callback ) {
|
||||
mMapLoadedCallback = callback;
|
||||
}
|
||||
|
||||
@@ -111,35 +112,27 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadMap( int containerId ) {
|
||||
loadModuleByType( ModuleType.TYPE_MAP, containerId );
|
||||
public void loadMapModule( int containerId ) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance().build( MogoModulePaths.PATH_MODULE_MAP ).navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAppsList( int containerId ) {
|
||||
loadModuleByType( ModuleType.TYPE_APP_LIST, containerId );
|
||||
public void loadAppsListModule( int containerId ) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance().build( MogoModulePaths.PATH_MODULE_APPS ).navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadExtensions( int containerId ) {
|
||||
loadModuleByType( ModuleType.TYPE_EXTENSION, containerId );
|
||||
public void loadExtensionsModule( int containerId ) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance().build( ExtensionsModuleConst.PATH_EXTENSION ).navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadEntrances( int containerId ) {
|
||||
loadModuleByType( ModuleType.TYPE_ENTRANCE, containerId );
|
||||
}
|
||||
|
||||
private void loadModuleByType( int type, int containerId ) {
|
||||
if ( mModuleProviders.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == type ) {
|
||||
addFragment( value, containerId );
|
||||
return;
|
||||
}
|
||||
}
|
||||
public void loadEntrancesModule( int containerId ) {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance().build( ExtensionsModuleConst.PATH_ENTRANCE ).navigation( getContext() );
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
private IMogoModuleProvider load( String path ) {
|
||||
@@ -162,8 +155,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnable( String module ) {
|
||||
public void setModuleEnable( String module ) {
|
||||
|
||||
// 仅操作上一个模块和当前模块
|
||||
Iterator< IMogoModuleProvider > iterator = mModuleProviders.values().iterator();
|
||||
int counter = 0;
|
||||
while ( iterator.hasNext() ) {
|
||||
@@ -178,7 +172,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
final IMogoModuleLifecycle lifecycle = MogoRegisterCenterHandler.getInstance().getLifecycleListener( mEnableModuleName );
|
||||
if ( lifecycle != null ) {
|
||||
try {
|
||||
final long start = System.currentTimeMillis();
|
||||
lifecycle.onDisable();
|
||||
Logger.i(TAG, "set %s module disable event cost " + (System.currentTimeMillis() - start) + "ms", mEnableModuleName);
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
@@ -190,7 +186,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
final IMogoModuleLifecycle lifecycle = MogoRegisterCenterHandler.getInstance().getLifecycleListener( module );
|
||||
if ( lifecycle != null ) {
|
||||
try {
|
||||
final long start = System.currentTimeMillis();
|
||||
lifecycle.onPerform();
|
||||
Logger.i(TAG, "set %s module perform event cost " + (System.currentTimeMillis() - start) + "ms", module);
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
@@ -212,20 +210,6 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
mMapLoadedCallback.run();
|
||||
mMapLoadedCallback = null;
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMapLoaded();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,7 +410,6 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
@@ -473,7 +456,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onUpdateTraffic(traffic);
|
||||
listener.onUpdateTraffic( traffic );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
@@ -541,15 +524,16 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMarkerReceive( IMogoMarker marker ) {
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() );
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMarkerClicked( marker );
|
||||
return listener.onMarkerClicked( marker );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,8 +10,8 @@ import com.mogo.utils.WindowUtils;
|
||||
public class VerticalStackTransformer extends VerticalBaseTransformer {
|
||||
|
||||
private Context context;
|
||||
private int spaceBetweenFirAndSecWith = 5 * 2;//第一张卡片和第二张卡片宽度差 dp单位
|
||||
private int spaceBetweenFirAndSecHeight = 5;//第一张卡片和第二张卡片高度差 dp单位
|
||||
private int spaceBetweenFirAndSecWith;//第一张卡片和第二张卡片宽度差
|
||||
private int spaceBetweenFirAndSecHeight;//第一张卡片和第二张卡片高度差
|
||||
|
||||
public VerticalStackTransformer( Context context ) {
|
||||
this.context = context;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient android:angle="180" android:endColor="#232536" android:startColor="#001D1D1D" />
|
||||
<gradient android:angle="180" android:endColor="#232536" android:centerColor="#aa1D1D1D" android:startColor="#001D1D1D" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -2,7 +2,7 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient android:angle="270" android:centerColor="#7f000000" android:endColor="#1F000000" android:startColor="#CC000000" />
|
||||
<gradient android:angle="270" android:endColor="#00222222" android:startColor="#99000000" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -14,7 +14,14 @@
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_map_shadow_frame"
|
||||
android:id="@+id/module_main_id_map_top_shadow_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_main_top_shadow_height"
|
||||
android:background="@drawable/module_main_dw_top_frame_bkg"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_map_left_shadow_frame"
|
||||
android:layout_width="@dimen/module_main_map_shadow_frame_width"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/module_main_dw_left_frame_bkg"
|
||||
@@ -46,7 +53,7 @@
|
||||
<com.mogo.module.main.cards.OrientedViewPager
|
||||
android:id="@+id/module_main_id_cards_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="@dimen/module_main_card_container_height"
|
||||
android:layout_marginBottom="@dimen/module_main_card_container_marginBottom"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
<dimen name="module_main_map_shadow_frame_width">384px</dimen>
|
||||
<dimen name="module_main_card_container_marginTop">8px</dimen>
|
||||
<dimen name="module_main_card_container_width">352px</dimen>
|
||||
<dimen name="module_main_card_container_height">370px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">32px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">140.5px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">18px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_width_div">20px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_height_div">10px</dimen>
|
||||
<dimen name="module_main_top_shadow_height">144px</dimen>
|
||||
</resources>
|
||||
@@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<dimen name="module_main_map_shadow_frame_width">720px</dimen>
|
||||
<dimen name="module_main_card_container_marginTop">10px</dimen>
|
||||
<dimen name="module_main_card_container_width">660px</dimen>
|
||||
<dimen name="module_main_card_container_height">690px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">60px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">211px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_width_div">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_height_div">15px</dimen>
|
||||
<dimen name="module_main_top_shadow_height">270px</dimen>
|
||||
</resources>
|
||||
4
modules/mogo-module-main/src/main/res/values/colors.xml
Normal file
4
modules/mogo-module-main/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_main_window_background_color">#1D1D1D</color>
|
||||
</resources>
|
||||
@@ -4,9 +4,11 @@
|
||||
<dimen name="module_main_map_shadow_frame_width">720px</dimen>
|
||||
<dimen name="module_main_card_container_marginTop">10px</dimen>
|
||||
<dimen name="module_main_card_container_width">660px</dimen>
|
||||
<dimen name="module_main_card_container_height">690px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">60px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">211px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_width_div">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_height_div">15px</dimen>
|
||||
<dimen name="module_main_top_shadow_height">270px</dimen>
|
||||
</resources>
|
||||
@@ -7,7 +7,7 @@
|
||||
<item name="android:windowEnterAnimation">@null</item>
|
||||
<item name="android:windowExitAnimation">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowBackground">@color/module_main_window_background_color</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:windowAnimationStyle">@style/MainAnimation</item>
|
||||
</style>
|
||||
|
||||
@@ -27,30 +27,36 @@ public interface ModuleType {
|
||||
/**
|
||||
* APP 列表模块
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_APP_LIST = 4;
|
||||
|
||||
/**
|
||||
* 小智语音形象
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_VOICE = 5;
|
||||
|
||||
/**
|
||||
* 地图模块
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_MAP = 6;
|
||||
|
||||
/**
|
||||
* 导航模块
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_NAVI = 7;
|
||||
|
||||
/**
|
||||
* 小智、天气、时间等
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_EXTENSION = 8;
|
||||
|
||||
/**
|
||||
* 操作快捷入口
|
||||
*/
|
||||
@Deprecated
|
||||
int TYPE_ENTRANCE = 9;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user