[Change]
完成main转移 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
@@ -9,6 +9,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
|
||||
<application>
|
||||
<!-- <!–保活用–>
|
||||
@@ -57,5 +58,14 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name="com.mogo.eagle.core.function.main.service.MogoMainService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.mogo.launcher.action.MAIN_SERVICE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,516 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import android.location.Location;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
import com.zhidao.adasconfig.listener.IAdasSettingUIListener;
|
||||
import com.zhidao.adasconfig.listener.IAdasSkinStyleListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-24
|
||||
* <p>
|
||||
* 事件回调分发中心
|
||||
*/
|
||||
public class EventDispatchCenter implements
|
||||
IMogoNaviListener,
|
||||
IMogoMarkerClickListener,
|
||||
IMogoCarLocationChangedListener2,
|
||||
IMogoMapListener,
|
||||
IMogoLocationListener,
|
||||
IAdasSettingUIListener,
|
||||
IAdasSkinStyleListener {
|
||||
|
||||
|
||||
private static volatile EventDispatchCenter sInstance;
|
||||
private Runnable mMapLoadedCallback;
|
||||
|
||||
private EventDispatchCenter() {
|
||||
}
|
||||
|
||||
public static EventDispatchCenter getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( EventDispatchCenter.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new EventDispatchCenter();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private static final String TAG = "DispatchCenter";
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() );
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
return listener.onMarkerClicked( marker );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStaticMarkerClicked(IMogoMarker marker) {
|
||||
ArrayList<IMogoMarkerClickListener> list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener( marker.getOwner() );
|
||||
if(list == null){
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
for (IMogoMarkerClickListener listener : list) {
|
||||
return listener.onStaticMarkerClicked( marker );
|
||||
}
|
||||
} catch ( Exception e){
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
|
||||
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
MogoLatLng target = null;
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoCarLocationChangedListener listener = iterator.next();
|
||||
if ( listener instanceof IMogoCarLocationChangedListener2 ) {
|
||||
try {
|
||||
( ( IMogoCarLocationChangedListener2 ) listener ).onCarLocationChanged2( latLng );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图加载完成回调
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
void setMapLoadedCallback( Runnable callback ) {
|
||||
this.mMapLoadedCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
if ( mMapLoadedCallback != null ) {
|
||||
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
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onTouch( motionEvent );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onPOIClick( poi );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMapClick( latLng );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onLockMap( isLock );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMapModeChanged( ui );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMapVisualAngleChanged( visualAngleMode );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onMapChanged( location, zoom, tilt, bearing );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.i( TAG, "onMapChanged event cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onInitNaviFailure();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onInitNaviSuccess();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onNaviInfoUpdate( naviinfo );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onStartNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onStopNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onCalculateSuccess();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onoCalculateFailed();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
|
||||
Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoLocationListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onLocationChanged( location );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void northModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.NorthUP_2D );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void carHeadUp() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.CarUp_2D );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchCarChat( EnumCarChatIncognitoMode enumCarChatIncognitoMode ) {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onCarStatusChanged( enumCarChatIncognitoMode == EnumCarChatIncognitoMode.OPEN );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whiteModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.Type_Light );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blackModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.Type_Night );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.function.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.context.ContextHolderUtil;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.BaseFragment;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.service.MogoMainService;
|
||||
import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper;
|
||||
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.zhidao.adasconfig.api.AdasConfigApiController;
|
||||
import com.zhidao.adasconfig.common.log.LoggerController;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 描述:加载各个模块
|
||||
*/
|
||||
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoStatusChangedListener,
|
||||
IMogoADASControlStatusChangedListener,
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
protected static final String TAG = "MainActivity";
|
||||
private static final int REQUEST_CODE_DIALOG = 100;
|
||||
|
||||
protected IMogoServiceApis mServiceApis;
|
||||
protected IMogoFragmentManager mMogoFragmentManager;
|
||||
protected IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
protected View mEntrance;
|
||||
protected FrameLayout mFloatingLayout;
|
||||
protected View mCoverUpLayout;
|
||||
|
||||
protected ConstraintLayout clSpecialEffect;
|
||||
|
||||
private boolean isFirst = false;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_main_activity_main;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSetContentView(Bundle savedInstanceState) {
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
|
||||
mEntrance = findViewById(R.id.module_main_id_entrance_fragment_container);
|
||||
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
|
||||
mCoverUpLayout = findViewById(R.id.module_main_id_cover_up);
|
||||
|
||||
clSpecialEffect = findViewById(R.id.cl_special_effect);
|
||||
|
||||
FloatingViewHandler.init(mFloatingLayout);
|
||||
|
||||
if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
|
||||
}
|
||||
//申请悬浮窗权限
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// 检查是否有悬浮窗权限
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
return;
|
||||
}
|
||||
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG);
|
||||
}
|
||||
}
|
||||
|
||||
// 隐藏布局
|
||||
protected void hideLayout() {
|
||||
mEntrance.setVisibility(View.GONE);
|
||||
mFloatingLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// 显示布局
|
||||
protected void showLayout() {
|
||||
mEntrance.setVisibility(View.VISIBLE);
|
||||
mFloatingLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
calculateStartTime();
|
||||
ContextHolderUtil.holdContext(this);
|
||||
mPresenter.postLoadModuleMsg();
|
||||
NetworkUtils.listenNetStrength(this);
|
||||
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
|
||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||
|
||||
mPresenter.checkPermission(this);
|
||||
}
|
||||
|
||||
private void calculateStartTime() {
|
||||
long coldStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.COLD_START);
|
||||
// 这里记录的TimeUtils.coldStartTime是指Application启动的时间,最终的冷启动时间等于Application启动时间+热启动时间
|
||||
AppLaunchTimeUtils.sColdStartTime = coldStartTime > 0 ? coldStartTime : 0;
|
||||
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.HOT_START);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
// 统计代码
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
long hotStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.HOT_START);
|
||||
if (AppLaunchTimeUtils.sColdStartTime > 0 && hotStartTime > 0) {
|
||||
// 真正的冷启动时间 = Application启动时间 + 热启动时间
|
||||
long coldStartTime = AppLaunchTimeUtils.sColdStartTime + hotStartTime;
|
||||
// 过滤掉异常启动时间
|
||||
if (coldStartTime < 50000) {
|
||||
// 上传冷启动时间coldStartTime
|
||||
Logger.i(TAG, "coldStartTime:" + coldStartTime);
|
||||
properties.put("app_launch_coldStartTime", coldStartTime);
|
||||
}
|
||||
} else if (hotStartTime > 0) {
|
||||
// 过滤掉异常启动时间
|
||||
if (hotStartTime < 30000) {
|
||||
// 上传热启动时间hotStartTime
|
||||
Logger.i(TAG, "hotStartTime:" + hotStartTime);
|
||||
properties.put("app_launch_hotStartTime", hotStartTime);
|
||||
}
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("app_launch_time", properties);
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (mServiceApis == null) {
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
}
|
||||
mMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
mMogoStatusManager.setMainPageLaunchedStatus(TAG, true);
|
||||
AutopilotServiceManage.getInstance().init(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadModules() {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
MogoModulesManager.getInstance().init(this);
|
||||
|
||||
if (mServiceApis.getMapServiceApi() != null) {
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener(EventDispatchCenter.getInstance());
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
initAdasControlStatusListener();
|
||||
|
||||
if (DebugConfig.isMapBased()) {
|
||||
EventDispatchCenter.getInstance().setMapLoadedCallback(() -> {
|
||||
Logger.d(TAG, "map loaded." + Thread.currentThread().getName());
|
||||
// 延时加载其他模块
|
||||
getWindow().getDecorView().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadOthersModules();
|
||||
loadFunctionFragment();
|
||||
|
||||
// TODO 这里临时兼容进入VR模式
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
|
||||
}
|
||||
}, 3000);
|
||||
Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
});
|
||||
loadFunctionMapView();
|
||||
} else {
|
||||
loadOthersModules();
|
||||
}
|
||||
|
||||
mMogoFragmentManager = mServiceApis.getFragmentManagerApi();
|
||||
if (mMogoFragmentManager != null) {
|
||||
mMogoFragmentManager.init(this, R.id.module_main_id_search_fragment);
|
||||
mMogoFragmentManager.initMessageHistoryContainerId(R.id.module_main_id_message_history_fragment_container);
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransaction(int size) {
|
||||
if (size == 0) {
|
||||
showLayout();
|
||||
} else if (size == 1) {
|
||||
hideLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载其它模块
|
||||
*/
|
||||
protected void loadOthersModules() {
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
loadContainerModules();
|
||||
MogoModulesManager.getInstance().loadModules();
|
||||
MogoModulesManager.getInstance().loadFunctionModules();
|
||||
MogoModulesManager.getInstance().loadFunctionModulesServer();
|
||||
mPresenter.delayOperations();
|
||||
|
||||
// 启动一些基本的服务:定位等
|
||||
startBaseService();
|
||||
}
|
||||
|
||||
private void initAdasControlStatusListener() {
|
||||
mServiceApis.getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this);
|
||||
AdasConfigApiController.getInstance().registerAdasSettingUiListener(EventDispatchCenter.getInstance());
|
||||
AdasConfigApiController.getInstance().registerAdasSettingSkinModelListener(EventDispatchCenter.getInstance());
|
||||
AdasConfigApiController.getInstance().init(getApplicationContext());
|
||||
LoggerController.setPrinterLog(DebugConfig.isDebug());
|
||||
}
|
||||
|
||||
private void startBaseService() {
|
||||
Intent intentMainServicee = new Intent(this, MogoMainService.class);
|
||||
startService(intentMainServicee);
|
||||
|
||||
// USB 摄像头行车记录仪进程
|
||||
// Intent intentCarcorderService = new Intent(this, CarcorderService.class);
|
||||
// startService(intentCarcorderService);
|
||||
}
|
||||
|
||||
protected void loadContainerModules() {
|
||||
//MogoModulesManager.getInstance().loadEventPanelModule(R.id.module_main_id_event_panel_fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideCoverUpLayout() {
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
mCoverUpLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFunctionFragment() {
|
||||
Logger.d(TAG, "loadFunctionFragment……");
|
||||
// 加载 HMI 图层
|
||||
BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation();
|
||||
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment);
|
||||
|
||||
// 加载 小地图 图层
|
||||
BaseFragment fragmentSmpMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP).navigation();
|
||||
addFragment(fragmentSmpMap, fragmentSmpMap.getTagName(), R.id.module_main_id_smp_fragment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载地图视图
|
||||
*/
|
||||
private void loadFunctionMapView() {
|
||||
MvpFragment fragmentHdMap = (MvpFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_MAP).navigation();
|
||||
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_map_fragment_container);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected MainPresenter createPresenter() {
|
||||
return new MainPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
switch (mapUI) {
|
||||
case Type_Night:
|
||||
break;
|
||||
case Type_Light:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mMogoStatusManager.setMainPageResumeStatus(TAG, true);
|
||||
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mMogoStatusManager.setMainPageResumeStatus(TAG, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (mMogoStatusManager != null) {
|
||||
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mMogoFragmentManager == null
|
||||
|| mMogoFragmentManager.getStackSize() <= 0) {
|
||||
if (DebugConfig.isLauncher()) {
|
||||
doWhenBackPressed();
|
||||
return;
|
||||
} else {
|
||||
if (doWhenBackPressed()) {
|
||||
return;
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
} else {
|
||||
mMogoFragmentManager.pop();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean doWhenBackPressed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
mPresenter.handleSchemeIntent(intent, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoServiceApis getApis() {
|
||||
if (mServiceApis == null) {
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
}
|
||||
return mServiceApis;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterMarkerClickListener();
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostMapListener();
|
||||
mServiceApis.getRegisterCenterApi().unregisterADASControlStatusChangedListener(TAG);
|
||||
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
|
||||
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
|
||||
if (mMogoFragmentManager != null) {
|
||||
mMogoFragmentManager.unregisterMainFragmentStackTransactionListener();
|
||||
mMogoFragmentManager.destroy();
|
||||
mMogoFragmentManager = null;
|
||||
}
|
||||
mServiceApis.getMapServiceApi().getMapUIController().destroy();
|
||||
AdasConfigApiController.getInstance().release();
|
||||
mServiceApis.getAdasControllerApi().release();
|
||||
Logger.d(TAG, "destroy.");
|
||||
ContextHolderUtil.releaseContext();
|
||||
MogoModulesManager.getInstance().onDestroy();
|
||||
SchemeIntent.getInstance().clear();
|
||||
FloatingViewHandler.clear();
|
||||
ProcessUtils.killAllBackgroundProcesses();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
FrameLayout.LayoutParams entranceParams = ((FrameLayout.LayoutParams) mEntrance.getLayoutParams());
|
||||
if (isTrue) {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode);
|
||||
} else {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_id_entrance_fragment_container_marginLeft);
|
||||
}
|
||||
mEntrance.setLayoutParams(entranceParams);
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
if (isTrue) {
|
||||
clSpecialEffect.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
clSpecialEffect.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == MOGO_PERMISSION_REQUEST_CODE) {
|
||||
boolean isAllGranted = true;
|
||||
// 判断是否所有的权限都已经授予了
|
||||
for (int grant : grantResults) {
|
||||
if (grant != PackageManager.PERMISSION_GRANTED) {
|
||||
isAllGranted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAllGranted) {
|
||||
isFirst = false;
|
||||
} else {
|
||||
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
|
||||
if (!isFirst) {
|
||||
PermissionsDialogUtils.openAppDetails(this, null, REQUEST_CODE_DIALOG);
|
||||
isFirst = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
Logger.d(TAG, "requestCode: " + requestCode + " resultCode: " + resultCode);
|
||||
if (requestCode == REQUEST_CODE_DIALOG) {
|
||||
//申请悬浮窗权限
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 由于应用是单页面的,所以采用Fragment将各模块的UI进行分割解耦合
|
||||
*
|
||||
* @param newFragment 功能UI
|
||||
* @param tagName UI绑定的Tag
|
||||
* @param containerId 要加入的资源ID
|
||||
*/
|
||||
private void addFragment(Fragment newFragment, String tagName, int containerId) {
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(tagName);
|
||||
if (fragment == null) {
|
||||
fragment = newFragment;
|
||||
}
|
||||
if (fragment == null) {
|
||||
Logger.e(TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
return;
|
||||
}
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(containerId, fragment, tagName)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.main.constants.MainConstants;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MainPresenter extends Presenter< MainView > {
|
||||
|
||||
private Handler mMsgHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
switch ( msg.what ) {
|
||||
case MainConstants.MSG_HIDE_MAP_COVER_FRAME:
|
||||
mView.hideCoverUpLayout();
|
||||
break;
|
||||
case MainConstants.MSG_LOAD_MODULES:
|
||||
mView.loadModules();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static final int MOGO_PERMISSION_REQUEST_CODE = 10000;
|
||||
|
||||
public MainPresenter( MainView view ) {
|
||||
super( view );
|
||||
SchemeIntent.getInstance().init( getContext(), mView.getApis() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
}
|
||||
|
||||
public void checkPermission(Activity activity) {
|
||||
boolean isAllGranted = checkPermissionAllGranted(
|
||||
new String[]{
|
||||
Manifest.permission.RECORD_AUDIO,
|
||||
// Manifest.permission.CAMERA,
|
||||
Manifest.permission.BLUETOOTH,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
}
|
||||
);
|
||||
if (isAllGranted) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求权限
|
||||
*/
|
||||
ActivityCompat.requestPermissions(
|
||||
activity,
|
||||
new String[]{
|
||||
Manifest.permission.RECORD_AUDIO,
|
||||
// Manifest.permission.CAMERA,前行
|
||||
Manifest.permission.BLUETOOTH,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
}, MOGO_PERMISSION_REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否拥有指定的所有权限
|
||||
*/
|
||||
private boolean checkPermissionAllGranted(String[] permissions) {
|
||||
for (String permission : permissions) {
|
||||
if (ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
// 只要有一个权限没有被授予, 则直接返回 false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 延时操作
|
||||
*/
|
||||
public void delayOperations() {
|
||||
mMsgHandler.sendEmptyMessageDelayed( MainConstants.MSG_HIDE_MAP_COVER_FRAME, 150L );
|
||||
}
|
||||
|
||||
public void postLoadModuleMsg() {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MainConstants.MSG_LOAD_MODULES;
|
||||
mMsgHandler.sendMessageDelayed( msg, 500 );
|
||||
}
|
||||
|
||||
public void handleSchemeIntent( Intent intent, boolean isOnNewIntent ) {
|
||||
SchemeIntent.getInstance().handle( intent, isOnNewIntent );
|
||||
}
|
||||
|
||||
public void initADAS(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 主页 view 接口
|
||||
*/
|
||||
public interface MainView extends IView {
|
||||
|
||||
/**
|
||||
* 隐藏背景
|
||||
*/
|
||||
void hideCoverUpLayout();
|
||||
|
||||
/**
|
||||
* 加载各模块中的Fragment
|
||||
*/
|
||||
void loadFunctionFragment();
|
||||
|
||||
/**
|
||||
* 加载模块
|
||||
*/
|
||||
void loadModules();
|
||||
|
||||
/**
|
||||
* 接口水龙头
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoServiceApis getApis();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.CommonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-20
|
||||
* <p>
|
||||
* scheme 意图处理
|
||||
* <p>
|
||||
* 导航:adb shell am start -d "mogo://launcher/main/switch2?type=navi'&'lon=116.327007'&'lat=39.977639"
|
||||
*/
|
||||
public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "SchemeIntent";
|
||||
|
||||
public static final String TYPE_NAVI = "navi";
|
||||
|
||||
public static final String TYPE_SEARCH_ROAD_CONDITION = "search-road-condition";
|
||||
|
||||
public static final String TYPE_LAUNCH = "launch";
|
||||
|
||||
public static final String TYPE_SHOW_ONLINE_CAR_PANEL = "showOnlineCarPanel";
|
||||
|
||||
public static final String TYPE_SHOW_SHARE_PANEL = "showSharePanel";
|
||||
public static final String TYPE_SHOW_HISTORY_PANEL = "showHistoryPanel";
|
||||
public static final String TYPE_SHOW_SURROUNDING_PANEL = "showSurroundingPanel";
|
||||
|
||||
private IMogoServiceApis mApis;
|
||||
private Context mContext;
|
||||
|
||||
private IntentWrapper mNextIntent;
|
||||
|
||||
private static class IntentWrapper {
|
||||
public Intent mIntent;
|
||||
public long mDelay = 0L;
|
||||
|
||||
public IntentWrapper(Intent intent, long delay) {
|
||||
this.mIntent = intent;
|
||||
this.mDelay = delay;
|
||||
}
|
||||
}
|
||||
|
||||
private static volatile SchemeIntent sInstance;
|
||||
|
||||
private SchemeIntent() {
|
||||
}
|
||||
|
||||
public static SchemeIntent getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (SchemeIntent.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SchemeIntent();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void init(Context context, IMogoServiceApis apis) {
|
||||
mContext = context;
|
||||
mApis = apis;
|
||||
mApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mApis.getStatusManagerApi().unregisterStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this);
|
||||
mContext = null;
|
||||
mApis = null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理scheme
|
||||
*
|
||||
* @param intent 跳转的intent
|
||||
* @param isOnNewIntent 根据这个参数判断是从onCreate过来还是从onNewIntent过来,从而可以在{@link #isDelay(Intent, boolean)}里面确定延时逻辑,如果是从onNewIntent过来是不需要延时的
|
||||
*/
|
||||
public void handle(Intent intent, boolean isOnNewIntent) {
|
||||
if (intent == null || intent.getData() == null) {
|
||||
return;
|
||||
}
|
||||
Uri target = intent.getData();
|
||||
String path = target.getPath();
|
||||
if (path == null || path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mApis.getStatusManagerApi().isMainPageOnResume()) {
|
||||
long delay = 0L;
|
||||
if (isDelay(intent, isOnNewIntent)) {
|
||||
delay = 5_000L;
|
||||
}
|
||||
mNextIntent = new IntentWrapper(intent, delay);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (path) {
|
||||
case "/main/switch2":
|
||||
handleSwitch2Action(target);
|
||||
break;
|
||||
case "/main/share":
|
||||
Logger.d(TAG, "收到打开分享框的scheme,准备打开分享框");
|
||||
// Map<String, Object> properties = new HashMap<>();
|
||||
// properties.put("from", "1");
|
||||
// mApis.getAnalyticsApi().track("v2x_share_click", properties);
|
||||
// mApis.getShareManager().showShareDialog();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
mNextIntent = null;
|
||||
}
|
||||
|
||||
private boolean isDelay(Intent intent, boolean isOnNewIntent) {
|
||||
if (isOnNewIntent || intent == null || intent.getData() == null) {
|
||||
return false;
|
||||
}
|
||||
Uri target = intent.getData();
|
||||
String type = target.getQueryParameter("type");
|
||||
return TextUtils.equals(TYPE_NAVI, type) || TextUtils.equals(TYPE_SHOW_SHARE_PANEL, type);
|
||||
}
|
||||
|
||||
private void handleSwitch2Action(Uri target) {
|
||||
String type = target.getQueryParameter("type");
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
return;
|
||||
}
|
||||
Log.d("语音打开事件面板type", type);
|
||||
switch (type) {
|
||||
case TYPE_LAUNCH:
|
||||
handleLaunchIntent(target);
|
||||
break;
|
||||
case TYPE_SHOW_HISTORY_PANEL:
|
||||
handleShowEventPanel(0);
|
||||
break;
|
||||
case TYPE_SHOW_SURROUNDING_PANEL:
|
||||
handleShowEventPanel(1);
|
||||
break;
|
||||
case TYPE_SHOW_SHARE_PANEL:
|
||||
handleShowEventPanel(2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void handleLaunchIntent(Uri uri) {
|
||||
String type = uri.getQueryParameter("channelType");
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("appname", CommonUtils.getAppName(mContext));
|
||||
properties.put("appversion", CommonUtils.getVersionName(mContext));
|
||||
properties.put("from", type);
|
||||
mApis.getAnalyticsApi().track("appenterfront", properties);
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音打开事件面板
|
||||
* */
|
||||
private void handleShowEventPanel(int item) {
|
||||
Logger.d(TAG, "语音打开事件面板" + item);
|
||||
//mApis.getEventPanelManager().showPanelWithSelectedItem(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) {
|
||||
if (mNextIntent == null) {
|
||||
return;
|
||||
}
|
||||
if (isTrue) {
|
||||
// 保证回到桌面后在开始该规划路线。
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
if (mNextIntent == null) {
|
||||
return;
|
||||
}
|
||||
handle(mNextIntent.mIntent, false);
|
||||
}, mNextIntent.mDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.eagle.core.function.main.cards;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 卡片管理
|
||||
*/
|
||||
public interface MogoModulesHandler {
|
||||
|
||||
/**
|
||||
* 加载模块
|
||||
*/
|
||||
void loadModules();
|
||||
|
||||
/**
|
||||
* 架构升级v1.1加载功能模块
|
||||
*/
|
||||
void loadFunctionModules();
|
||||
|
||||
/**
|
||||
* 架构升级v1.1加载功能模块
|
||||
*/
|
||||
void loadFunctionModulesServer();
|
||||
|
||||
/**
|
||||
* 加载基本服务模块,需要不启动页面就能运行
|
||||
* <p>
|
||||
* 1. v2x
|
||||
* 2. mogo-module-service
|
||||
*/
|
||||
void loadBaseModule();
|
||||
|
||||
/**
|
||||
* 释放各个模块资源
|
||||
*/
|
||||
void onDestroy();
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
package com.mogo.eagle.core.function.main.cards;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.eagle.core.function.main.MainActivity;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 卡片加载
|
||||
*/
|
||||
public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
private static final String TAG = "MogoModulesManager";
|
||||
|
||||
private MainActivity mActivity;
|
||||
private Application mApp;
|
||||
|
||||
private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>();
|
||||
// 空间换效率
|
||||
private Map< String, IMogoModuleProvider > mModuleNameProviders = new HashMap<>();
|
||||
|
||||
// 架构升级后的加载功能模块的方式
|
||||
private Map< MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
|
||||
private Map< String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
|
||||
|
||||
// 架构升级后的加载功能模块的方式
|
||||
private Map< MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
|
||||
private Map< String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
|
||||
|
||||
private static volatile MogoModulesManager sInstance;
|
||||
|
||||
private MogoModulesManager() {
|
||||
}
|
||||
|
||||
public static MogoModulesManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoModulesManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoModulesManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void init( MainActivity activity ) {
|
||||
if ( activity == null ) {
|
||||
throw new NullPointerException( "activity can't be null." );
|
||||
}
|
||||
this.mActivity = activity;
|
||||
mApp = mActivity.getApplication();
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return getApplicationContext();
|
||||
}
|
||||
|
||||
private Context getApplicationContext() {
|
||||
return mApp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadModules() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMogoModuleProvider provider = load( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleProviders.put( module, provider );
|
||||
mModuleNameProviders.put( module.getName(), provider );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFunctionModules() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModuleFunctions();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMoGoFunctionProvider provider = loadFunction( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleFunctionProviders.put( module, provider );
|
||||
mModuleNameFunctionProviders.put( module.getName(), provider );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFunctionModulesServer() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModuleFunctionServers();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMoGoFunctionServerProvider provider = loadFunctionServer( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleFunctionServerProviders.put( module, provider );
|
||||
mModuleNameFunctionServerProviders.put( module.getName(), provider );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBaseModule() {
|
||||
List< MogoModule > baseModules = MogoModulePaths.getBaseModules();
|
||||
for ( MogoModule baseModule : baseModules ) {
|
||||
if ( baseModule == null ) {
|
||||
continue;
|
||||
}
|
||||
Logger.d( TAG, "加载基本模块:%s", baseModule.getPath() );
|
||||
loadBaseProvider( baseModule.getPath() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private IProvider loadBaseProvider(String path ) {
|
||||
try {
|
||||
return ( IProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMogoModuleProvider load( String path ) {
|
||||
try {
|
||||
return ( IMogoModuleProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMoGoFunctionProvider loadFunction( String path ) {
|
||||
try {
|
||||
return ( IMoGoFunctionProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMoGoFunctionServerProvider loadFunctionServer(String path ) {
|
||||
try {
|
||||
return ( IMoGoFunctionServerProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addFragment( IMogoModuleProvider provider, int containerId ) {
|
||||
if ( provider == null ) {
|
||||
Logger.e( TAG, "add fragment fail cause provider == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) );
|
||||
return;
|
||||
}
|
||||
Fragment fragment = null;
|
||||
fragment = mActivity.getSupportFragmentManager().findFragmentByTag( provider.getModuleName() );
|
||||
if ( fragment == null ) {
|
||||
fragment = provider.createFragment( getContext(), null );
|
||||
}
|
||||
if ( fragment == null ) {
|
||||
Logger.e( TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) );
|
||||
return;
|
||||
}
|
||||
mActivity.getSupportFragmentManager().beginTransaction()
|
||||
.replace( containerId, fragment, provider.getModuleName() )
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if ( mModuleNameProviders != null ) {
|
||||
Collection< IMogoModuleProvider > modules = mModuleNameProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMogoModuleProvider module : modules ) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getModuleName() );
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameProviders.clear();
|
||||
}
|
||||
if ( mModuleProviders != null ) {
|
||||
mModuleProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionProviders != null ) {
|
||||
Collection< IMoGoFunctionProvider > modules = mModuleFunctionProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMoGoFunctionProvider module : modules ) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getFunctionName() );
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionProviders != null ) {
|
||||
mModuleFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionServerProviders != null ) {
|
||||
Collection< IMoGoFunctionServerProvider > modules = mModuleFunctionServerProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMoGoFunctionServerProvider module : modules ) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getFunctionName() );
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionServerProviders != null ) {
|
||||
mModuleFunctionServerProviders.clear();
|
||||
}
|
||||
mActivity = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.main.constants;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MainConstants {
|
||||
|
||||
/**
|
||||
* 消息:隐藏地图遮罩(避免地图加载白屏)
|
||||
*/
|
||||
public static final int MSG_HIDE_MAP_COVER_FRAME = 5004;
|
||||
|
||||
/**
|
||||
* 加载模块
|
||||
*/
|
||||
public static final int MSG_LOAD_MODULES = 5005;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.eagle.core.function.main.delaycheck;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* 时延验证相关接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface DelayCheckApiServices {
|
||||
|
||||
/**
|
||||
* 空接口
|
||||
* @return 什么都不返回
|
||||
*/
|
||||
@GET("/yycp-test-service/net/delay/heartbeat")
|
||||
Observable<BaseData> emptyInterface();
|
||||
|
||||
/**
|
||||
* 时延上报接口 接口文档如下
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48967034
|
||||
* @param params 相关参数,详见文档
|
||||
* @return 相关返回值,详见文档
|
||||
*/
|
||||
@POST("/yycp-test-service/net/delay/log")
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
Observable<DelayCheckResponse> uploadDelayCheckData(@Body RequestBody params);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.eagle.core.function.main.delaycheck;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
/**
|
||||
* dzt base url
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckHttpConstant {
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com";
|
||||
public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com";
|
||||
|
||||
public static String getBaseUrl(){
|
||||
switch ( DebugConfig.getNetMode() ) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return HOST_DEV;
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return HOST_TEST;
|
||||
case DebugConfig.NET_MODE_DEMO:
|
||||
return HOST_DEMO;
|
||||
default:
|
||||
return HOST_PRODUCT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.eagle.core.function.main.delaycheck;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* 延迟检测response
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckResponse extends BaseData {
|
||||
private DelayCheckResult result;
|
||||
|
||||
public DelayCheckResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(DelayCheckResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DelayCheckResponse{" +
|
||||
"result=" + result +
|
||||
", code=" + code +
|
||||
", msg='" + msg + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.eagle.core.function.main.delaycheck;
|
||||
|
||||
/**
|
||||
* 延迟检查返回结果
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckResult {
|
||||
/**
|
||||
* 是否保持心跳
|
||||
*/
|
||||
private boolean necessary;
|
||||
/**
|
||||
* 心跳间隔,单位 s
|
||||
*/
|
||||
private int beatSeconds;
|
||||
|
||||
public boolean isNecessary() {
|
||||
return necessary;
|
||||
}
|
||||
|
||||
public void setNecessary(boolean necessary) {
|
||||
this.necessary = necessary;
|
||||
}
|
||||
|
||||
public int getBeatSeconds() {
|
||||
return beatSeconds;
|
||||
}
|
||||
|
||||
public void setBeatSeconds(int beatSeconds) {
|
||||
this.beatSeconds = beatSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DelayCheckResult{" +
|
||||
"necessary=" + necessary +
|
||||
", beatSeconds=" + beatSeconds +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.mogo.eagle.core.function.main.delaycheck;
|
||||
|
||||
/**
|
||||
* 时延检测上报请求参数
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckUploadRequest {
|
||||
private String sn;
|
||||
private long startTime;
|
||||
private long endTime;
|
||||
/**
|
||||
* 请求时长
|
||||
*/
|
||||
private long burning;
|
||||
/**
|
||||
* 信号强度
|
||||
*/
|
||||
private int netState;
|
||||
private String place;
|
||||
private String cityCode;
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public long getBurning() {
|
||||
return burning;
|
||||
}
|
||||
|
||||
public void setBurning(long burning) {
|
||||
this.burning = burning;
|
||||
}
|
||||
|
||||
public int getNetState() {
|
||||
return netState;
|
||||
}
|
||||
|
||||
public void setNetState(int netState) {
|
||||
this.netState = netState;
|
||||
}
|
||||
|
||||
public String getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setPlace(String place) {
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DelayCheckUploadRequest{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", startTime=" + startTime +
|
||||
", endTime=" + endTime +
|
||||
", burning=" + burning +
|
||||
", netState=" + netState +
|
||||
", place='" + place + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.mogo.eagle.core.function.main.delaycheck;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* 延时验证工具类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckUtil implements Handler.Callback {
|
||||
private static final String TAG = "DelayCheckUtil";
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001;
|
||||
/**
|
||||
* 首次延时检测时间间隔,暂定10分钟,等待机器稳定后再做打算
|
||||
*/
|
||||
private static final long FIRST_CHECK_NET_CONNECT_STATUS_DELAY = 10 * 60 * 1000;
|
||||
private static final long CHECK_NET_CONNECT_STATUS_DELAY = 5000L;
|
||||
|
||||
private static final int MSG_START_DELAY_CHECK = 1002;
|
||||
/**
|
||||
* 默认检测时间间隔,若服务端正确返回,以服务端返回为主
|
||||
*/
|
||||
private static final long DELAY_CHECK_DELAY = 10 * 60 * 1000;
|
||||
|
||||
private final Context context;
|
||||
|
||||
public DelayCheckUtil(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每5s检查一下网络状态,网络状态为连接状态时,开始空接口请求以及后续的参数上报
|
||||
*/
|
||||
public void waitingForCheck() {
|
||||
Logger.d(TAG, "waitingForCheck===");
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
private long requestTime, netDelay, requestStartSystemTime,requestEndSystem;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_CHECK_NET_CONNECT_STATUS:
|
||||
if (NetworkUtils.isConnected(context)) {
|
||||
handler.sendEmptyMessage(MSG_START_DELAY_CHECK);
|
||||
} else {
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
return true;
|
||||
case MSG_START_DELAY_CHECK:
|
||||
// 请求空接口
|
||||
startEmptyRequest();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void startEmptyRequest() {
|
||||
Logger.d(TAG, "start empty request");
|
||||
requestTime = SystemClock.elapsedRealtime();
|
||||
requestStartSystemTime = System.currentTimeMillis();
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
requestEndSystem = System.currentTimeMillis();
|
||||
netDelay = SystemClock.elapsedRealtime() - requestTime;
|
||||
startUpload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startUpload() {
|
||||
Logger.d(TAG, "start upload");
|
||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if (lastLocation == null) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "lastLocation: " + lastLocation);
|
||||
DelayCheckUploadRequest request = new DelayCheckUploadRequest();
|
||||
request.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
request.setStartTime(requestStartSystemTime);
|
||||
request.setEndTime(requestEndSystem);
|
||||
request.setNetState(NetworkUtils.netStrengthLevel);
|
||||
request.setPlace(lastLocation.getAddress());
|
||||
request.setCityCode(lastLocation.getCityCode());
|
||||
request.setLat(lastLocation.getLatitude());
|
||||
request.setLon(lastLocation.getLongitude());
|
||||
request.setBurning(netDelay);
|
||||
|
||||
RequestBody params = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(request));
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<DelayCheckResponse>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(DelayCheckResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "上报时延成功 " + o);
|
||||
DelayCheckResult result = o.getResult();
|
||||
if(result.isNecessary()) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mogo.eagle.core.function.main.monitoring;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车辆监控
|
||||
* @since: 8/16/21
|
||||
*/
|
||||
public class VehicleMonitoring implements Handler.Callback {
|
||||
|
||||
private static final String TAG = "VehicleMonitoring";
|
||||
private final Context mContext;
|
||||
private final Handler mHandler = new Handler(this);
|
||||
//自动驾驶状态下**分钟间隔弹框提示一次 后期根据需求做修改,暂定30秒自检一次
|
||||
private static final long AUTO_CHECK_STATUS_DELAY = 30 * 1000;
|
||||
//非自动驾驶测试数据 后期根据需求做修改
|
||||
private static final long MANUAL_CHECK_STATUS_DELAY = 30 * 1000;
|
||||
//自动驾驶状态
|
||||
private static int AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
|
||||
|
||||
public VehicleMonitoring(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public void vehicleCheck() {
|
||||
if (AutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
Log.d(TAG, "自动驾驶中...");
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
|
||||
} else {
|
||||
Log.d(TAG, "非自动驾驶状态");
|
||||
//非自动驾驶状态只展示一次
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
|
||||
switch (msg.what) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
|
||||
vehicleMonitor();
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
|
||||
return true;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
vehicleMonitor();
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void vehicleMonitor() {
|
||||
Log.d(TAG, "vehicleMonitor");
|
||||
CallerCheckManager.checkMonitor(mContext);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.mogo.eagle.core.function.main.registercenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_REGISTER_CENTER)
|
||||
public class MogoRegisterCenter implements IMogoRegisterCenter {
|
||||
|
||||
@Override
|
||||
public void registerMogoModuleLifecycle(String moduleName, IMogoModuleLifecycle lifecycle) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoModuleLifecycle(moduleName, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoModuleLifecycle(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoModuleLifecycle(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMapListener(String moduleName, IMogoMapListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMapListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMapListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMapListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoNaviListener(String moduleName, IMogoNaviListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoNaviListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoNaviListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoNaviListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoLocationListener(String moduleName, IMogoLocationListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoLocationListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IMogoLocationListener> getLocationListeners() {
|
||||
return MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoLocationListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoLocationListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMarkerClickListener(String moduleName, IMogoMarkerClickListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMarkerClickListener(moduleName, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMarkerClickListener(String moduleName) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMarkerClickListener(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoStaticMarkerClickListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoStaticMarkerClickListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerCarLocationChangedListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterCarLocationChangedListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerADASControlStatusChangedListener(String tag, IMogoADASControlStatusChangedListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerADASControlStatusChangedListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterADASControlStatusChangedListener(String tag) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterADASControlStatusChangedListener(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IMogoADASControlStatusChangedListener> getAdasControlStatusChangedListeners() {
|
||||
return MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.mogo.eagle.core.function.main.registercenter;
|
||||
|
||||
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.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
|
||||
private static volatile MogoRegisterCenterHandler sInstance;
|
||||
|
||||
private final Map<String, IMogoModuleLifecycle> mLifecycle = new HashMap<>();
|
||||
private final Map<String, IMogoMapListener> mMap = new HashMap<>();
|
||||
private final Map<String, IMogoNaviListener> mNavi = new ConcurrentHashMap<>();
|
||||
private final Map<String, IMogoLocationListener> mLocation = new HashMap<>();
|
||||
private final Map<String, IMogoMarkerClickListener> mMarker = new HashMap<>();
|
||||
private final Map<String, ArrayList<IMogoMarkerClickListener>> mStaticMarker = new HashMap<>();
|
||||
private final Map<String, IMogoCarLocationChangedListener> mCarLocations = new ConcurrentHashMap<>();
|
||||
private final Map<String, IMogoADASControlStatusChangedListener> mADAS = new HashMap<>();
|
||||
|
||||
private MogoRegisterCenterHandler() {
|
||||
}
|
||||
|
||||
public static MogoRegisterCenterHandler getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoRegisterCenterHandler.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoRegisterCenterHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerMogoModuleLifecycle(String tag, IMogoModuleLifecycle lifecycle) {
|
||||
mLifecycle.put(tag, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoModuleLifecycle(String tag) {
|
||||
mLifecycle.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMapListener(String tag, IMogoMapListener listener) {
|
||||
mMap.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMapListener(String tag) {
|
||||
mMap.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoNaviListener(String tag, IMogoNaviListener listener) {
|
||||
mNavi.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoNaviListener(String tag) {
|
||||
mNavi.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoLocationListener(String tag, IMogoLocationListener listener) {
|
||||
mLocation.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoLocationListener(String tag) {
|
||||
mLocation.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
mMarker.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMarkerClickListener(String tag) {
|
||||
mMarker.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
ArrayList<IMogoMarkerClickListener> list = mStaticMarker.get(tag);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
list.add(listener);
|
||||
mStaticMarker.put(tag, list);
|
||||
}
|
||||
list.add(listener);
|
||||
mStaticMarker.put(tag, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
|
||||
ArrayList<IMogoMarkerClickListener> list = mStaticMarker.get(tag);
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
list.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
mCarLocations.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
mCarLocations.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerADASControlStatusChangedListener(String tag, IMogoADASControlStatusChangedListener listener) {
|
||||
mADAS.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterADASControlStatusChangedListener(String tag) {
|
||||
mADAS.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
}
|
||||
|
||||
public IMogoMarkerClickListener getMarkerListener(String tag) {
|
||||
return mMarker.get(tag);
|
||||
}
|
||||
|
||||
public ArrayList<IMogoMarkerClickListener> getStaticMarkerListener(String tag){
|
||||
return mStaticMarker.get(tag);
|
||||
}
|
||||
|
||||
public Iterator<IMogoMapListener> getMapListeners() {
|
||||
return mMap.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator<IMogoNaviListener> getNaviListeners() {
|
||||
return mNavi.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IMogoLocationListener> getLocationListeners() {
|
||||
return mLocation.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator<IMogoCarLocationChangedListener> getCarLocationChangedListener() {
|
||||
return mCarLocations.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IMogoADASControlStatusChangedListener> getAdasControlStatusChangedListeners() {
|
||||
return mADAS.values().iterator();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.mogo.eagle.core.function.main.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.function.main.EventDispatchCenter;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
|
||||
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/10
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = "/service/base/info")
|
||||
class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
private static final String TAG = "MogoMainService";
|
||||
private IMogoServiceApis mServiceApis;
|
||||
|
||||
/**
|
||||
* 主模块管控定位,可以向各个模块发送统一定位信息
|
||||
*/
|
||||
private IMogoLocationClient mLocationClient;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Logger.d(TAG, "基本服务启动");
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
initAndStartLocation();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Logger.d(TAG, "5秒已过,启动基础服务……");
|
||||
loadBaseModules();
|
||||
initADAS();
|
||||
initGpsSimulatorListener();
|
||||
HdMapBuildConfig.isMapLoaded = true;
|
||||
}, 5_000L
|
||||
);
|
||||
// 开启延时检测
|
||||
DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this);
|
||||
delayCheckUtil.waitingForCheck();
|
||||
// 车辆检测
|
||||
VehicleMonitoring monitoring = new VehicleMonitoring(this);
|
||||
monitoring.vehicleCheck();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d(TAG, "开始定位");
|
||||
if (mServiceApis != null) {
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||
mLocationClient.addLocationListener(this);
|
||||
mLocationClient.start(2_000L);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化自车定位监听
|
||||
*/
|
||||
private void initGpsSimulatorListener() {
|
||||
Logger.d(TAG, "注册自车位置监听");
|
||||
MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
private void initADAS() {
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getAdasControllerApi().init(AbsMogoApplication.getApp());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.removeLocationListener(this);
|
||||
mLocationClient.stop();
|
||||
mLocationClient.destroy();
|
||||
mLocationClient = null;
|
||||
}
|
||||
mServiceApis = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.mogo.eagle.core.function.main.utils;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.res.Resources;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.function.main.R;
|
||||
|
||||
/**
|
||||
* created by wujifei on 2021/3/30 14:05
|
||||
* describe:
|
||||
*/
|
||||
public class DisplayEffectsHelper {
|
||||
private volatile static DisplayEffectsHelper instance = null;
|
||||
private AnimatorSet animatorSet;
|
||||
|
||||
public static DisplayEffectsHelper getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (DisplayEffectsHelper.class) {
|
||||
if (instance == null) {
|
||||
instance = new DisplayEffectsHelper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void init(View rootView) {
|
||||
View view1 = rootView.findViewById(R.id.iv_wu1);
|
||||
View view2 = rootView.findViewById(R.id.iv_wu2);
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view1, "alpha", 0f, 1f, 0f);
|
||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view1, "translationX", -500, 100f, 300f);
|
||||
ObjectAnimator animator3 = ObjectAnimator.ofFloat(view1, "scaleX", 1f, 1.5f, 2f);
|
||||
ObjectAnimator animator4 = ObjectAnimator.ofFloat(view1, "scaleY", 1f, 1.5f, 2f);
|
||||
ObjectAnimator animator5 = ObjectAnimator.ofFloat(view2, "alpha", 0f, 1f, 0f);
|
||||
ObjectAnimator animator6 = ObjectAnimator.ofFloat(view2, "translationX", 500, -100f, -300f);
|
||||
ObjectAnimator animator7 = ObjectAnimator.ofFloat(view2, "scaleX", 1f, 1.5f, 2f);
|
||||
ObjectAnimator animator8 = ObjectAnimator.ofFloat(view2, "scaleY", 1f, 1.5f, 2f);
|
||||
animatorSet = new AnimatorSet();
|
||||
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5, animator6, animator7, animator8);
|
||||
animatorSet.setDuration(5000);
|
||||
}
|
||||
|
||||
public void display() {
|
||||
animatorSet.start();
|
||||
}
|
||||
|
||||
private float dp2px(float dp) {
|
||||
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
|
||||
return dp * metrics.density;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.eagle.core.function.main.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.v2x.DisplayEffectsInterface;
|
||||
|
||||
/**
|
||||
* created by wujifei on 2021/3/30 15:45
|
||||
* describe:
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER)
|
||||
public class DisplayEffectsManager implements DisplayEffectsInterface {
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayEffects(String type) {
|
||||
DisplayEffectsHelper.getInstance().display();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.mogo.eagle.core.function.main.windowview;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public class DispatchTouchEventWrapper {
|
||||
|
||||
private IWindowViewHandler mWindowViewHandler;
|
||||
|
||||
int mActionDownX = -1;
|
||||
int mActionDownY = -1;
|
||||
|
||||
/**
|
||||
* Flag whether move after touch down.
|
||||
*/
|
||||
boolean mMoveFlag = false;
|
||||
|
||||
private static volatile DispatchTouchEventWrapper INST;
|
||||
|
||||
private DispatchTouchEventWrapper() {
|
||||
}
|
||||
|
||||
public static DispatchTouchEventWrapper getInstance() {
|
||||
if ( INST == null ) {
|
||||
synchronized ( DispatchTouchEventWrapper.class ) {
|
||||
if ( INST == null ) {
|
||||
INST = new DispatchTouchEventWrapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INST;
|
||||
}
|
||||
|
||||
public DispatchTouchEventWrapper attach( View windowView, WindowManager.LayoutParams params ) {
|
||||
if ( mWindowViewHandler == null || mWindowViewHandler.getWindowView() != windowView ) {
|
||||
mWindowViewHandler = new IWindowViewHandler.DefaultHandler( windowView, params );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean handle( MotionEvent event ) {
|
||||
switch ( event.getAction() & MotionEvent.ACTION_MASK ) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if ( onActionDown( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if ( onActionMove( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if ( onActionUp( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionDown( MotionEvent event ) {
|
||||
mActionDownX = ( ( int ) event.getRawX() );
|
||||
mActionDownY = ( ( int ) event.getRawY() );
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.recordNewPosition();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionMove( MotionEvent event ) {
|
||||
|
||||
if ( Math.abs( event.getRawX() - mActionDownX ) >= 20
|
||||
|| Math.abs( event.getRawY() - mActionDownY ) >= 20 ) {
|
||||
mMoveFlag = false;
|
||||
}
|
||||
|
||||
if ( isLastDownValueLegal() ) {
|
||||
moveWindowView( event );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionUp( MotionEvent event ) {
|
||||
if ( isClickEventLike() ) {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.performClickLike();
|
||||
}
|
||||
} else {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.moveToEdge();
|
||||
mWindowViewHandler.recordNewPosition();
|
||||
}
|
||||
}
|
||||
mMoveFlag = false;
|
||||
clearLastDownAxisValue();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void clearLastDownAxisValue() {
|
||||
mActionDownX = mActionDownY = -1;
|
||||
}
|
||||
|
||||
private boolean isLastDownValueLegal() {
|
||||
return mActionDownX != -1 && mActionDownY != -1;
|
||||
}
|
||||
|
||||
private void moveWindowView( MotionEvent event ) {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.move( event, mActionDownX, mActionDownY );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate click event just like set {@link View.OnClickListener}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isClickEventLike() {
|
||||
System.out.println( mMoveFlag );
|
||||
return isLastDownValueLegal() && !mMoveFlag;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.release();
|
||||
}
|
||||
mWindowViewHandler = null;
|
||||
mActionDownX = -1;
|
||||
mActionDownY = -1;
|
||||
mMoveFlag = false;
|
||||
INST = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package com.mogo.eagle.core.function.main.windowview;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-06
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class FloatingViewHandler {
|
||||
|
||||
private static final String TAG = "WindowViewHandler";
|
||||
|
||||
/**
|
||||
* 上次显示的优先级
|
||||
*/
|
||||
private static int sPriority = Integer.MIN_VALUE;
|
||||
|
||||
/**
|
||||
* 上次添加的view
|
||||
*/
|
||||
private static View sView = null;
|
||||
|
||||
private static int sX, sY;
|
||||
private static FrameLayout.LayoutParams sParams;
|
||||
|
||||
/**
|
||||
* 是否可手指拖动
|
||||
*/
|
||||
private static boolean sMovable = false;
|
||||
|
||||
private static FrameLayout sFloatingLayout = null;
|
||||
|
||||
public static void init( FrameLayout frameLayout ) {
|
||||
sFloatingLayout = frameLayout;
|
||||
}
|
||||
|
||||
public static void clear(){
|
||||
sFloatingLayout = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加任意view到布局,不考虑优先级
|
||||
*
|
||||
* @param view
|
||||
* @param x
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
params.leftMargin = x;
|
||||
params.topMargin = y;
|
||||
sFloatingLayout.addView( view, params );
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加view到布局,优先级大的展示
|
||||
*
|
||||
* @param view
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.addView( view, params );
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加view到布局,优先级大的展示
|
||||
*
|
||||
* @param view
|
||||
* @param priority
|
||||
* @param x
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int priority, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
sPriority = priority;
|
||||
sX = x;
|
||||
sY = y;
|
||||
addView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加view到布局,优先级大的展示
|
||||
*
|
||||
* @param view
|
||||
* @param priority
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int priority, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
sPriority = priority;
|
||||
sParams = params;
|
||||
addView();
|
||||
}
|
||||
|
||||
public static void removeView( View view ) {
|
||||
if ( sFloatingLayout == null ) {
|
||||
return;
|
||||
}
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( view );
|
||||
if ( sView == view ) {
|
||||
sView = null;
|
||||
sPriority = Integer.MIN_VALUE;
|
||||
sMovable = false;
|
||||
sParams = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void addView() {
|
||||
if ( sView == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = sParams;
|
||||
if ( params == null ) {
|
||||
params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
params.leftMargin = sX;
|
||||
params.topMargin = sY;
|
||||
}
|
||||
sFloatingLayout.addView( sView, params );
|
||||
}
|
||||
|
||||
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
view.setOnTouchListener( ( v, event ) -> {
|
||||
DispatchTouchEventWrapper.getInstance()
|
||||
.attach( view, params )
|
||||
.handle( event );
|
||||
return false;
|
||||
} );
|
||||
}
|
||||
|
||||
public static void setVisible( boolean visible ) {
|
||||
if ( sFloatingLayout != null ) {
|
||||
sFloatingLayout.setVisibility( visible ? View.VISIBLE : View.INVISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.mogo.eagle.core.function.main.windowview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.util.WindowUtils;
|
||||
|
||||
/**
|
||||
* Created by congtaowang on 2017/6/20.
|
||||
*/
|
||||
|
||||
public interface IWindowViewHandler {
|
||||
|
||||
View getWindowView();
|
||||
|
||||
void recordNewPosition();
|
||||
|
||||
void move( MotionEvent event, int downX, int downY );
|
||||
|
||||
void release();
|
||||
|
||||
void moveToEdge();
|
||||
|
||||
void performClickLike();
|
||||
|
||||
class DefaultHandler implements IWindowViewHandler {
|
||||
|
||||
protected View mWindowView;
|
||||
|
||||
protected int mWindowViewLeft = -1;
|
||||
protected int mWindowViewTop = -1;
|
||||
|
||||
private WindowManager.LayoutParams mParams;
|
||||
|
||||
public DefaultHandler( View windowView, WindowManager.LayoutParams params ) {
|
||||
this.mWindowView = windowView;
|
||||
mParams = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getWindowView() {
|
||||
return mWindowView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordNewPosition() {
|
||||
mWindowViewLeft = mParams.x;
|
||||
mWindowViewTop = mParams.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move( MotionEvent event, int downX, int downY ) {
|
||||
move( ( ( int ) ( event.getRawX() - downX ) ),
|
||||
( ( int ) ( event.getRawY() - downY ) ) );
|
||||
}
|
||||
|
||||
private void move( int distanceX, int distanceY ) {
|
||||
if ( mWindowView == null ) {
|
||||
return;
|
||||
}
|
||||
mParams.x = mWindowViewLeft + distanceX;
|
||||
mParams.y = mWindowViewTop + distanceY;
|
||||
WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
|
||||
|
||||
if ( wm == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToEdge() {
|
||||
if ( mWindowView == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
|
||||
|
||||
if ( mParams.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) / 2 ) {
|
||||
mParams.x = WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) - mWindowView.getMeasuredWidth();
|
||||
} else {
|
||||
mParams.x = 0;
|
||||
}
|
||||
|
||||
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );
|
||||
}
|
||||
|
||||
protected WindowManager.LayoutParams alignLayoutParamsBoundary( WindowManager.LayoutParams params ) {
|
||||
return params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performClickLike() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mWindowView = null;
|
||||
mWindowViewLeft = -1;
|
||||
mWindowViewTop = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.eagle.core.function.main.windowview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.windowview.IMogoWindowManager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-06
|
||||
* <p>
|
||||
* 根据优先级控制显示 window view.
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_WINDOW_MANAGER )
|
||||
public class MogoWindowManager implements IMogoWindowManager {
|
||||
|
||||
@Override
|
||||
public void addView( View view, int x, int y, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, x, y, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView( View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, params, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView( int priority, View view, int x, int y, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, priority, x, y, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView( int priority, View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
FloatingViewHandler.addView( view, priority, params, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeView( View view ) {
|
||||
FloatingViewHandler.removeView( view );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideAll() {
|
||||
FloatingViewHandler.setVisible( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAll() {
|
||||
FloatingViewHandler.setVisible( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTopView(View view) {
|
||||
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 784 KiB |
|
After Width: | Height: | Size: 55 KiB |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#66FF0808"
|
||||
android:type="linear"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#66FF0808"
|
||||
android:type="linear"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#66FF0808"
|
||||
android:type="linear"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00FF0606"
|
||||
android:startColor="#66FF0808"
|
||||
android:type="linear"/>
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 729 KiB |
|
After Width: | Height: | Size: 518 KiB |
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--黑色矩形 作为背景色-->
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:centerX="0.6"
|
||||
android:endColor="#0B0F17"
|
||||
android:startColor="#171D2B"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
</item>
|
||||
<!--单独的slogan图片 并且设置下间距-->
|
||||
<!--如果使用svg可以直接 drawable-->
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/mogo_slogan"
|
||||
android:tileMode="disabled" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--单独的slogan图片 并且设置下间距-->
|
||||
<!--如果使用svg可以直接 drawable-->
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/mogo_slogan"
|
||||
android:tileMode="disabled" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:centerX="0.6"
|
||||
android:endColor="#0B0F17"
|
||||
android:startColor="#171D2B"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient android:angle="0" android:centerX="0.6" android:centerColor="#7f000000" android:endColor="#00000000" android:startColor="#000000" android:type="linear" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient android:angle="270" android:endColor="#00222222" android:startColor="#000000" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/module_main_window_background_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 地图 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_special_effect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wu1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0"
|
||||
android:src="@drawable/wu1"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wu2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0"
|
||||
android:src="@drawable/wu2"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!--预警视图 OBU、云端下发、自车感知、自车策略-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_waring_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- 快捷操作浮层 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_entrance_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"
|
||||
android:paddingLeft="@dimen/module_main_apps_fragment_container_padding"
|
||||
android:paddingTop="@dimen/module_main_apps_fragment_container_paddingTop"
|
||||
android:paddingRight="@dimen/module_main_apps_fragment_container_padding"
|
||||
android:paddingBottom="@dimen/module_main_apps_fragment_container_paddingTop" />
|
||||
|
||||
<!-- 浮层-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_floating_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- 右边事件面板 -->
|
||||
<!-- <FrameLayout-->
|
||||
<!-- android:id="@+id/module_main_id_event_panel_fragment_container"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"-->
|
||||
<!-- android:paddingLeft="@dimen/module_main_event_panel_fragment_paddingLeft"-->
|
||||
<!-- android:paddingTop="@dimen/module_main_event_panel_fragment_paddingTop"-->
|
||||
<!-- android:paddingRight="@dimen/module_main_event_panel_fragment_paddingRight"-->
|
||||
<!-- android:paddingBottom="@dimen/module_main_event_panel_fragment_paddingBottom" />-->
|
||||
|
||||
<!-- 目的地车友 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_message_history_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft" />
|
||||
|
||||
<!--搜索视图-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_search_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
<!--网约车视图-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_och_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!--小地图视图-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_smp_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!--冷启动过渡Logo-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/module_main_id_cover_up"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/main_splash_bg">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/main_bitmap_splash_icon"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.47" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >444px</dimen>
|
||||
</resources>
|
||||
@@ -1,5 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >444px</dimen>
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<dimen name="module_main_map_left_shadow_frame_width">350px</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>
|
||||
<dimen name="module_main_card_cover_up_margin">352px</dimen>
|
||||
|
||||
<dimen name="cards_container_dp_600">320px</dimen>
|
||||
<dimen name="cards_container_shadow_dp_margin_top">319px</dimen>
|
||||
|
||||
<dimen name="module_main_apps_fragment_container_width">110px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_padding">6px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginTop">15px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">460px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">444px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">350px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">10px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">8px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingTop">2px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingBottom">2px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
|
||||
<dimen name="module_main_panel_margin_right">0px</dimen>
|
||||
<!--事件面板-->
|
||||
<dimen name="module_main_event_panel_fragment_paddingTop">0px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingBottom">0px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingLeft">6px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingRight">6px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
|
||||
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<dimen name="module_main_map_left_shadow_frame_width">350px</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>
|
||||
<dimen name="module_main_card_cover_up_margin">660px</dimen>
|
||||
<dimen name="cards_container_dp_600">600px</dimen>
|
||||
<dimen name="cards_container_shadow_dp_margin_top">599px</dimen>
|
||||
|
||||
<dimen name="module_main_apps_fragment_container_width">200px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_padding">20px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginTop">30px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">830px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">590px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">30px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">70px</dimen>
|
||||
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">635px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_width">1263px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">20px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingTop">20px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingBottom">20px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
|
||||
<dimen name="module_main_panel_margin_right">0px</dimen>
|
||||
</resources>
|
||||
@@ -1,5 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<dimen name="module_main_map_left_shadow_frame_width">350px</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>
|
||||
<dimen name="module_main_card_cover_up_margin">660px</dimen>
|
||||
<dimen name="cards_container_dp_600">600px</dimen>
|
||||
<dimen name="cards_container_shadow_dp_margin_top">599px</dimen>
|
||||
|
||||
<dimen name="module_main_apps_fragment_container_width">200px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_padding">20px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginTop">30px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">830px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">800px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">20px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">30px</dimen>
|
||||
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">340px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_width">1313px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">20px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingTop">20px</dimen>
|
||||
|
||||
<dimen name="module_main_event_panel_fragment_paddingTop">20px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingBottom">18px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingLeft">18px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingRight">18px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_main_window_background_color">#212831</color>
|
||||
</resources>
|
||||
@@ -2,4 +2,40 @@
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<dimen name="module_main_map_left_shadow_frame_width">350px</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>
|
||||
<dimen name="module_main_card_cover_up_margin">352px</dimen>
|
||||
|
||||
<dimen name="cards_container_dp_600">320px</dimen>
|
||||
<dimen name="cards_container_shadow_dp_margin_top">319px</dimen>
|
||||
|
||||
<dimen name="module_main_apps_fragment_container_width">110px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_padding">6px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginTop">15px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">460px</dimen>
|
||||
<dimen name="module_main_id_entrance_fragment_container_marginLeft">444px</dimen>
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">350px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding">10px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">8px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingBottom">2px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
<dimen name="module_main_panel_margin_right">0px</dimen>
|
||||
<!--事件面板-->
|
||||
<dimen name="module_main_event_panel_fragment_paddingTop">2px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingBottom">2px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingLeft">2px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingRight">4px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingTop">8px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-main</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Main" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:windowTranslucentStatus">false</item>
|
||||
<item name="android:statusBarColor" tools:ignore="NewApi">@null</item>
|
||||
<item name="android:windowEnterAnimation">@null</item>
|
||||
<item name="android:windowExitAnimation">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowBackground">@drawable/main_bitmap_splash_bg</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:windowAnimationStyle">@style/MainAnimation</item>
|
||||
<item name="checkboxStyle">@style/noCheckboxStyle</item>
|
||||
<item name="android:windowFullscreen">false</item>
|
||||
<item name="radioButtonStyle">@style/noCheckboxStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="MainAnimation">
|
||||
<item name="android:activityOpenEnterAnimation">@null</item>
|
||||
<item name="android:activityOpenExitAnimation">@null</item>
|
||||
<item name="android:activityCloseEnterAnimation">@null</item>
|
||||
<item name="android:activityCloseExitAnimation">@null</item>
|
||||
<item name="android:taskOpenEnterAnimation">@null</item>
|
||||
<item name="android:taskOpenExitAnimation">@null</item>
|
||||
<item name="android:taskCloseEnterAnimation">@null</item>
|
||||
<item name="android:taskCloseExitAnimation">@null</item>
|
||||
<item name="android:taskToFrontEnterAnimation">@null</item>
|
||||
<item name="android:taskToFrontExitAnimation">@null</item>
|
||||
<item name="android:taskToBackEnterAnimation">@null</item>
|
||||
<item name="android:taskToBackExitAnimation">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="noCheckboxStyle" parent="Widget.AppCompat.CompoundButton.CheckBox">
|
||||
<item name="buttonCompat">@null</item>
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="noRadioButtonStyle" parent="Widget.AppCompat.CompoundButton.RadioButton">
|
||||
<item name="buttonCompat">@null</item>
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||