This commit is contained in:
unknown
2020-09-25 18:07:09 +08:00
32 changed files with 348 additions and 561 deletions

View File

@@ -195,7 +195,7 @@ android {
// 是否使用高德sdk自定义导航
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
// 是否支持查询导航目的地车友
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
// 是否支持桌面卡片刷新
@@ -215,7 +215,7 @@ android {
// 是否使用高德sdk自定义导航
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
// 是否支持查询导航目的地车友
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
// 是否支持桌面卡片刷新
@@ -273,7 +273,7 @@ android {
// 是否使用高德sdk自定义导航
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
// 是否支持查询导航目的地车友
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
// 是否支持桌面卡片刷新

View File

@@ -1,10 +1,10 @@
project.dependencies {
if (Boolean.valueOf(RELEASE)) {
bydautoImplementation rootProject.ext.dependencies.skinsupportnoop
d82xImplementation rootProject.ext.dependencies.skinsupportnoop
em1Implementation rootProject.ext.dependencies.skinsupportnoop
em3Implementation rootProject.ext.dependencies.skinsupportnoop
d82xImplementation rootProject.ext.dependencies.skinsupportimpl
em1Implementation rootProject.ext.dependencies.skinsupportimpl
em3Implementation rootProject.ext.dependencies.skinsupportimpl
d8xxImplementation rootProject.ext.dependencies.skinsupportimpl
d80xImplementation rootProject.ext.dependencies.skinsupportimpl
f8xxImplementation rootProject.ext.dependencies.skinsupportimpl
@@ -18,17 +18,17 @@ project.dependencies {
e8xxImplementation rootProject.ext.dependencies.skinsupportlight
d8xxImplementation rootProject.ext.dependencies.skinsupportlight
d80xImplementation rootProject.ext.dependencies.skinsupportlight
// d82xImplementation rootProject.ext.dependencies.skinsupportlight
// em1Implementation rootProject.ext.dependencies.skinsupportlight
// em3Implementation rootProject.ext.dependencies.skinsupportlight
em3Implementation rootProject.ext.dependencies.skinsupportlight
d82xImplementation rootProject.ext.dependencies.skinsupportlight
em1Implementation rootProject.ext.dependencies.skinsupportlight
} else {
bydautoImplementation project(':skin:mogo-skin-support-noop')
d82xImplementation project(':skin:mogo-skin-support-noop')
em1Implementation project(':skin:mogo-skin-support-noop')
em3Implementation project(':skin:mogo-skin-support-noop')
d82xImplementation project(':skin:mogo-skin-support-impl')
em1Implementation project(':skin:mogo-skin-support-impl')
em3Implementation project(':skin:mogo-skin-support-impl')
d8xxImplementation project(':skin:mogo-skin-support-impl')
d80xImplementation project(':skin:mogo-skin-support-impl')
f8xxImplementation project(':skin:mogo-skin-support-impl')
@@ -42,8 +42,8 @@ project.dependencies {
e8xxImplementation project(':skin:mogo-skin-light')
d8xxImplementation project(':skin:mogo-skin-light')
d80xImplementation project(':skin:mogo-skin-light')
// d82xImplementation project(':skin:mogo-skin-light')
// em1Implementation project(':skin:mogo-skin-light')
// em3Implementation project(':skin:mogo-skin-light')
d82xImplementation project(':skin:mogo-skin-light')
em1Implementation project(':skin:mogo-skin-light')
em3Implementation project(':skin:mogo-skin-light')
}
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:sharedUserId="android.uid.system"
package="com.mogo.launcher">
package="com.mogo.launcher">
<!-- android:sharedUserId="android.uid.system"-->
</manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,39 @@
package com.mogo.module.common.view;
import android.view.View;
public
/**
* @author congtaowang
* @since 2020/9/25
*
* 防止短时间内多次点击
*/
abstract class OnPreventFastClickListener implements View.OnClickListener {
public static final long INTERVAL = 1_000L;
private long mInterval;
private long mLastClickTime = 0L;
public OnPreventFastClickListener() {
this( INTERVAL );
}
public OnPreventFastClickListener( long interval ) {
if ( interval < 0L ) {
interval = INTERVAL;
}
this.mInterval = interval;
}
@Override
public final void onClick( View v ) {
if ( System.currentTimeMillis() - mLastClickTime > mInterval ) {
onClickImpl( v );
mLastClickTime = System.currentTimeMillis();
}
}
public abstract void onClickImpl( View v );
}

View File

@@ -1,132 +0,0 @@
package com.mogo.module.extensions;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.utils.LaunchUtils;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
import java.util.HashMap;
import java.util.Map;
/**
* 天气,消息,个人头像
*
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsPresenter > implements ExtensionsView {
private static final String TAG = "ExtensionsFragment";
public static final int MAX_DISPLAY_MSG_AMOUNT = 99;
private View mWeatherContainer;
private ImageView mWeatherIcon;
private TextView mWeatherTemp;
private View mMsgContainer;
private TextView mMsgCounter;
private ImageView mUserHeadImg;
@Override
protected int getLayoutId() {
return R.layout.module_ext_layout_extensions;
}
@Override
protected void initViews() {
mWeatherContainer = findViewById( R.id.module_ext_id_weather_container );
mWeatherIcon = findViewById( R.id.module_ext_id_weather_icon );
mWeatherTemp = findViewById( R.id.module_ext_id_weather_temp );
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
mMsgContainer = findViewById( R.id.module_ext_id_msg );
mMsgContainer.setOnClickListener( view -> {
ARouter.getInstance().build( "/push/ui/message" ).navigation( getContext() );
} );
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
mUserHeadImg.setOnClickListener(view ->{
try {
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track( "Launcher_APP_Icon", properties );
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
}
});
mUserHeadImg.setVisibility(DebugConfig.isLauncher()?View.VISIBLE:View.GONE);
}
@NonNull
@Override
protected ExtensionsPresenter createPresenter() {
return new ExtensionsPresenter( this );
}
@Override
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
super.onActivityCreated( savedInstanceState );
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void renderWeatherInfo( String temp, String desc, int iconId ) {
boolean hidden = false;
if ( iconId != 0 ) {
mWeatherIcon.setImageResource( iconId );
mWeatherIcon.setVisibility( View.VISIBLE );
} else {
mWeatherIcon.setVisibility( View.GONE );
hidden |= true;
}
hidden |= TextUtils.isEmpty( temp );
hidden |= TextUtils.isEmpty( desc );
mWeatherTemp.setText( temp );
mWeatherContainer.setVisibility( hidden ? View.GONE : View.VISIBLE );
}
@Override
public void renderMsgInfo( boolean hasMsg, int amount ) {
mMsgContainer.setVisibility( hasMsg ? View.VISIBLE : View.GONE );
mMsgCounter.setText( amount > MAX_DISPLAY_MSG_AMOUNT ? getString( R.string.module_ext_str_dots ) : String.valueOf( amount ) );
}
@Override
public void renderUserInfo(UserInfo userInfo) {
if(userInfo != null){
Logger.d(TAG, "renderUserInfo: " + userInfo);
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).placeholder(R.drawable.model_ext_default_user_head).circleCrop().into(mUserHeadImg);
}
}
}

View File

@@ -8,11 +8,6 @@ package com.mogo.module.extensions;
*/
public class ExtensionsModuleConst {
/**
* 顶部UI
*/
public static final String PATH_EXTENSION = "/extension/ui";
/**
* 快捷操作入口:定位、
*/

View File

@@ -1,90 +0,0 @@
package com.mogo.module.extensions;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.ModuleType;
/**
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
@Route( path = ExtensionsModuleConst.PATH_EXTENSION )
public class ExtensionsModuleProvider implements IMogoModuleProvider {
@Override
public Fragment createFragment( Context context, Bundle data ) {
ExtensionsFragment fragment = new ExtensionsFragment();
fragment.setArguments( data );
return fragment;
}
@Override
public View createView( Context context ) {
return null;
}
@NonNull
@Override
public String getModuleName() {
return ExtensionsModuleConst.TYPE;
}
@Override
public IMogoModuleLifecycle getCardLifecycle() {
return null;
}
@Override
public IMogoMapListener getMapListener() {
return null;
}
@Override
public int getType() {
return ModuleType.TYPE_EXTENSION;
}
@Override
public IMogoNaviListener getNaviListener() {
return null;
}
@Override
public IMogoLocationListener getLocationListener() {
return null;
}
@Override
public void init( Context context ) {
}
@Override
public IMogoMarkerClickListener getMarkerClickListener() {
return null;
}
@Override
public String getAppPackage() {
return null;
}
@Override
public String getAppName() {
return null;
}
}

View File

@@ -1,161 +0,0 @@
package com.mogo.module.extensions;
import android.util.ArrayMap;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.network.Utils;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.extensions.net.UserInfoNetApiServices;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.userinfo.UserInfoConstant;
import com.mogo.module.extensions.userinfo.UserInfoResponse;
import com.mogo.module.extensions.utils.ExtensionsConfig;
import com.mogo.module.extensions.weather.Phenomena;
import com.mogo.module.extensions.weather.WeatherCallback;
import com.mogo.module.extensions.weather.WeatherInfo;
import com.mogo.module.extensions.weather.WeatherModel;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.network.IMogoNetwork;
import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import com.mogo.utils.digest.DigestUtils;
import com.mogo.utils.logger.Logger;
import java.util.Map;
import io.reactivex.SingleObserver;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
public class ExtensionsPresenter extends Presenter< ExtensionsView > implements WeatherCallback,
IMogoMsgCenterListener {
private static final String TAG = "ExtensionsPresenter";
private WeatherModel mWeatherModel;
private IMogoMsgCenter mMsgCenter;
private IMogoNetwork mNetWork;
public ExtensionsPresenter( ExtensionsView view ) {
super( view );
mWeatherModel = new WeatherModel( getContext() );
mNetWork = MogoApisHandler.getInstance().getApis().getNetworkApi();
}
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
mWeatherModel.init( this );
mWeatherModel.queryWeatherInformation();
mMsgCenter = ( IMogoMsgCenter ) ARouter.getInstance().build( MogoServicePaths.PATH_MSG_CENTER ).navigation();
mMsgCenter.registerMsgCenterListener( this );
}
@Override
public void onWeatherLoaded( WeatherInfo weatherInfo ) {
if ( weatherInfo == null ) {
return;
}
String temp = getContext().getResources().getString( R.string.module_ext_str_weather_temp_format, weatherInfo.getTemperature() );
Phenomena phenomena = Phenomena.getById( weatherInfo.getPhenomena() );
String desc = phenomena == null ? "" : phenomena.nameCn;
int resId = phenomena.resId;
mView.renderWeatherInfo( temp, desc, resId );
}
@Override
public void onMsgChanged( boolean hasMsg, int amount ) {
if ( mView != null ) {
mView.renderMsgInfo( hasMsg, amount );
}
}
@Override
public void onResume( @NonNull LifecycleOwner owner ) {
super.onResume( owner );
if(ExtensionsConfig.needRequestUserInfo()){
// 相当于每次onResume都会请求一下个人信息目的是能够相对及时的同步手机端的个人信息修改
requestUserInfo();
}
}
@Override
public void onPause( @NonNull LifecycleOwner owner ) {
super.onPause( owner );
}
@Override
public void onDestroy( @NonNull LifecycleOwner owner ) {
super.onDestroy( owner );
if ( mWeatherModel != null ) {
mWeatherModel.destroy();
}
if ( mMsgCenter != null ) {
mMsgCenter.unregisterMsgCenterListener( this );
}
}
private UserInfo userInfo;
public void requestUserInfo() {
Map<String, String> params = new ArrayMap<>();
params.put("sn", Utils.getSn());
params.put("source", "2");
String sign = createSign(params, "JGqZw9");
params.put("sig", sign);
mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(UserInfoResponse userInfoBaseResponse) {
userInfo = userInfoBaseResponse.getResult();
if(userInfo!=null) {
Logger.d(TAG, "获取个人信息成功: " + userInfo);
mView.renderUserInfo(userInfo);
}else{
Logger.e(TAG,"获取个人信息失败");
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
Logger.e(TAG, e, "获取个人信息失败==");
}
});
}
private String createSign(Map<String, String> map, String salt) {
try {
StringBuilder queryString = new StringBuilder();
for (Map.Entry<String, String> entry : map.entrySet()) {
queryString.append(entry.getKey())
.append("=")
.append(entry.getValue())
.append("&");
}
queryString.append("key=").append(DigestUtils.shaHex(salt));
return DigestUtils.shaHex(queryString.toString()).toUpperCase();
} catch (Exception e) {
e.printStackTrace();
Logger.e(TAG, e, "createSign()");
return "";
}
}
}

View File

@@ -41,6 +41,7 @@ import com.mogo.module.common.glide.SkinAbleBitmapTarget;
import com.mogo.module.common.map.CustomNaviInterrupter;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.navi.NaviInfoView;
@@ -73,6 +74,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
@@ -192,41 +194,50 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
mUpload = findViewById(R.id.module_entrance_id_upload);
mUploading = findViewById(R.id.module_entrance_id_uploading);
mUploadRoadCondition.setOnClickListener(view -> {
showShareDialog();
playShareGuideVoice();
});
mUploadRoadCondition.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
showShareDialog();
playShareGuideVoice();
}
} );
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
mDisplayOverviewText = findViewById(R.id.module_ext_id_display_overview_text);
mDisplayOverviewIcon = findViewById(R.id.module_ext_id_display_overview_icon);
mDisplayOverview.setOnClickListener(view -> {
if (getContext() != null) {
// 加此判断是解决下面setDisplayOverview后本Fragment回调中出现not attached to a context问题
if (!mStatusManager.isDisplayOverview()) {
mMApUIController.displayOverview(mDisplayOverviewBounds);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
} else {
mMApUIController.recoverLockMode();
UiThreadHandler.removeCallbacks(mLockCarRunnable);
mDisplayOverview.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
if (getContext() != null) {
// 加此判断是解决下面setDisplayOverview后本Fragment回调中出现not attached to a context问题
if (!mStatusManager.isDisplayOverview()) {
mMApUIController.displayOverview(mDisplayOverviewBounds);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
} else {
mMApUIController.recoverLockMode();
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
}
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
}
});
} );
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
mMove2CurrentLocation.setOnClickListener(view -> {
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
if (location != null) {
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
mMove2CurrentLocation.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
if (location != null) {
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
mStatusManager.setUserInteractionStatus(TAG, true, false);
mMApUIController.recoverLockMode();
}
mStatusManager.setUserInteractionStatus(TAG, true, false);
mMApUIController.recoverLockMode();
}
});
} );
if (DebugConfig.isDebug()) {
mMove2CurrentLocation.setOnLongClickListener(view -> {
@@ -246,46 +257,47 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
mExitNavi.setOnClickListener(view -> {
if (mMogoNavi != null) {
if (mIsLock) {
new WMDialog.Builder(getContext())
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
dlg.dismiss();
mMogoNavi.stopNavi();
})
.setCancelButton(R.string.module_commons_button_cancel,
(dlg, which) -> {
dlg.dismiss();
})
.setContent(R.string.module_commons_exit_navi_content)
.build()
.show();
} else {
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
mMApUIController.recoverLockMode();
mExitNavi.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
if (mMogoNavi != null) {
if (mIsLock) {
new WMDialog.Builder(getContext())
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
dlg.dismiss();
mMogoNavi.stopNavi();
})
.setCancelButton(R.string.module_commons_button_cancel,
(dlg, which) -> {
dlg.dismiss();
})
.setContent(R.string.module_commons_exit_navi_content)
.build()
.show();
} else {
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
mMApUIController.recoverLockMode();
}
}
}
});
} );
mCameraMode = findViewById(R.id.module_ext_id_north);
mCameraMode.setOnClickListener(view -> {
if (mCameraMode.isSelected()) {
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else {
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
mCameraMode.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
if (mCameraMode.isSelected()) {
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else {
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
}
}
// mCameraMode.setSelected(!mCameraMode.isSelected());
// mCameraMode.setText(getString(mCameraMode.isSelected() ? R.string.mode_car_up :
// R.string.mode_north_up));
});
} );
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
MogoEntranceButtons.save(ButtonIndex.BUTTON1,
findViewById(R.id.module_entrance_id_button1));
MogoEntranceButtons.save(ButtonIndex.BUTTON2,
findViewById(R.id.module_entrance_id_button2));
MogoEntranceButtons.save(ButtonIndex.BUTTON1, findViewById(R.id.module_entrance_id_button1));
MogoEntranceButtons.save(ButtonIndex.BUTTON2, findViewById(R.id.module_entrance_id_button2));
mDisplayOverviewBounds = new Rect(
ResourcesHelper.getDimensionPixelSize(getContext(),
@@ -301,13 +313,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mNaviInfo = new NaviInfoView();
mNaviInfo.inflate(rootView);
findViewById(R.id.module_map_id_navi_bg).setOnClickListener(view -> {
try {
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
} catch (Exception e) {
e.printStackTrace();
findViewById(R.id.module_map_id_navi_bg).setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
try {
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
} catch (Exception e) {
e.printStackTrace();
}
}
});
} );
mWeatherContainer = findViewById(R.id.module_ext_id_weather_container);
mWeatherIcon = findViewById(R.id.module_ext_id_weather_icon);
@@ -317,29 +332,35 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMsgContainer = findViewById(R.id.module_ext_id_msg);
mMsgContainer.setOnClickListener(view -> {
try {
if ( mMessageHistoryPanelProvider == null ) {
mMessageHistoryPanelProvider = (IFragmentProvider)ARouter.getInstance().build("/push/ui/message").navigation(getContext());
}
mMessageHistoryPanelProvider.createFragment( getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null );
} catch( Exception e ){
mMsgContainer.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
try {
if ( mMessageHistoryPanelProvider == null ) {
mMessageHistoryPanelProvider = (IFragmentProvider)ARouter.getInstance().build("/push/ui/message").navigation(getContext());
}
mMessageHistoryPanelProvider.createFragment( getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null );
} catch( Exception e ){
}
}
});
} );
mMsgCounter = findViewById(R.id.module_ext_id_msg_counter);
mUserHeadImg.setOnClickListener(view -> {
try {
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
properties);
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
mUserHeadImg.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
try {
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
properties);
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
}
}
});
} );
mUserHeadImg.setVisibility(DebugConfig.isLauncher() ? View.VISIBLE : View.GONE);
@@ -347,11 +368,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mStatusManager);
mOnlineCarEntrance = findViewById( R.id.module_ext_id_destination_online_car );
mOnlineCarEntrance.setOnClickListener( view -> {
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
Map<String, Object> properties = new HashMap<>();
properties.put( "type", 1 );
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "APP_Find_Mogoer", properties );
mOnlineCarEntrance.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
Map<String, Object> properties = new HashMap<>();
properties.put( "type", 1 );
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "APP_Find_Mogoer", properties );
}
} );
dealWeatherContainer();
@@ -359,8 +383,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
debugTopView();
boolean isShowGuide = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false);
Logger.d(TAG, " isShowGuide = " + isShowGuide);
if (isShowGuide) {
Logger.d(TAG, " isShowGuide = " + isShowGuide + " --isGreaterThanOneDay = " + isGreaterThanOneDay());
if (isShowGuide && isGreaterThanOneDay()) {
UiThreadHandler.postDelayed(() -> {
playShareOuterGuideVoice();
}, 5_000L
@@ -368,6 +392,20 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
}
private boolean isGreaterThanOneDay() {
boolean isGreaterThanOneDay;
long guideRecordTime = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getLong(getSPGuideRecord(), 0);
Logger.d(TAG, " isGreaterThanOneDay interval = " + (System.currentTimeMillis() - guideRecordTime));
if ((System.currentTimeMillis() - guideRecordTime) > ONE_DAY_TIME) {
isGreaterThanOneDay = true;
} else {
isGreaterThanOneDay = false;
}
return isGreaterThanOneDay;
}
Random random = new Random();
/**

View File

@@ -152,7 +152,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
public void loadModules() {
final long start = System.currentTimeMillis();
MogoModulesManager.getInstance().init( this, getApis() );
MogoModulesManager.getInstance().init( this );
loadSplash();
mMogoMapService = mServiceApis.getMapServiceApi();
if ( mMogoMapService != null ) {

View File

@@ -38,13 +38,6 @@ public interface MogoModulesHandler {
*/
void loadAppsListModule( int containerId );
/**
* 加载头部信息
*
* @param containerId
*/
void loadExtensionsModule( int containerId );
/**
* 加载快捷操作
*

View File

@@ -1,5 +1,6 @@
package com.mogo.module.main.cards;
import android.app.Application;
import android.content.Context;
import androidx.fragment.app.Fragment;
@@ -33,6 +34,7 @@ public class MogoModulesManager implements MogoModulesHandler {
private static final String TAG = "MogoModulesManager";
private MainActivity mActivity;
private Application mApp;
private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>();
// 空间换效率
@@ -58,19 +60,20 @@ public class MogoModulesManager implements MogoModulesHandler {
sInstance = null;
}
public void init( MainActivity activity, IMogoServiceApis apis ) {
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 mActivity;
return getApplicationContext();
}
private Context getApplicationContext() {
return mActivity.getApplicationContext();
return mApp;
}
@Override
@@ -117,14 +120,6 @@ public class MogoModulesManager implements MogoModulesHandler {
addFragment( provider, containerId );
}
@Override
public void loadExtensionsModule( int containerId ) {
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
.build( ExtensionsModuleConst.PATH_EXTENSION )
.navigation( getContext() );
addFragment( provider, containerId );
}
@Override
public void loadEntrancesModule( int containerId ) {
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
@@ -215,5 +210,6 @@ public class MogoModulesManager implements MogoModulesHandler {
if ( mModuleProviders != null ) {
mModuleProviders.clear();
}
mActivity = null;
}
}

View File

@@ -30,8 +30,7 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener {
private MapBroadCastHelper( Context context ) {
this.mContext = context;
IMogoServiceApis api = MogoApisHandler.getInstance().getApis();
api.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.AI_ASSIST_READY, this );
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.AI_ASSIST_READY, this );
}
public static MapBroadCastHelper getInstance( Context context ) {
@@ -100,4 +99,10 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener {
}
}
}
public void release(){
MogoApisHandler.getInstance().getApis().getStatusManagerApi().unregisterStatusChangedListener( TAG, StatusDescriptor.AI_ASSIST_READY, this );
mContext = null;
sInstance = null;
}
}

View File

@@ -145,5 +145,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
if ( mMogoMapView != null ) {
mMogoMapView.onDestroy();
}
MapBroadCastHelper.getInstance( getContext() ).release();
}
}

View File

@@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.module.push.Config;
import com.mogo.module.push.R;
import com.mogo.module.push.adapter.PushMessageAdapter;
@@ -64,20 +65,26 @@ class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHis
mClose = findViewById( R.id.module_push_id_close );
AnalyticsUtils.track( Config.NEWS_HISTORY_OPEN, null );
mClose.setOnClickListener( view -> {
exitSelf();
mClose.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
exitSelf();
}
} );
mClear.setOnClickListener( view -> {
AnalyticsUtils.track( Config.NEWS_HISTORY_ALL_CLEAR, null );
if ( !mClearing ) {
mClearing = true;
AnimatorUtilsKt.startClearAnimator(
mHistoryList,
() -> {
mViewModel.deleteAll();
mClearing = false;
}
);
mClear.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
AnalyticsUtils.track( Config.NEWS_HISTORY_ALL_CLEAR, null );
if ( !mClearing ) {
mClearing = true;
AnimatorUtilsKt.startClearAnimator(
mHistoryList,
() -> {
mViewModel.deleteAll();
mClearing = false;
}
);
}
}
} );
mAdapter.deletePushBean = new PushMessageAdapter.PushAdapterListener() {

View File

@@ -111,18 +111,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
mContext = context.getApplicationContext();
mRefreshModel = new RefreshModel( mContext );
// 长连接 - 长链变短链
// MarkerServiceHandler.getMogoSocketManager().registerOnMessageListener( 401001, this );
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this );
}
// ACC ON 的时候重置为trueACC OFF 设置为 false
// 保留 - 外部模块调用
public void setCheckOn( boolean checkOnLineData ) {
Logger.e( TAG, "do not invoke anymore." );
}
/**
* 地图上的Marker点击回调
*/
@@ -132,6 +124,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
try {
boolean result = switchMarkerOpenStatus( marker );
if ( !result ) {
updateCarUserInfoWindow( marker );
return false;
}
@@ -188,14 +181,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
mLastCheckMarker = mogoMarker;
// 在线车辆点击使用infoWindow
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
if ( !mogoMarker.isDestroyed() ) {
try {
MarkerOnlineCar onlineCar = ( MarkerOnlineCar ) ( ( MarkerShowEntity ) mogoMarker.getObject() ).getBindObj();
CallChatApi.getInstance().showUserWindow( mContext, onlineCar );
} catch ( Exception e ) {
Logger.e( TAG, e, "openMarker" );
}
}
updateCarUserInfoWindow( mogoMarker );
} else {
Object object = mogoMarker.getObject();
if ( object != null ) {
@@ -218,6 +204,17 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
MarkerServiceHandler.getMapUIController().moveToCenter( mogoMarker.getPosition(), CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X );
}
private void updateCarUserInfoWindow( IMogoMarker marker ) {
if ( !marker.isDestroyed() ) {
try {
MarkerOnlineCar onlineCar = ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
CallChatApi.getInstance().showUserWindow( mContext, onlineCar );
} catch ( Exception e ) {
Logger.e( TAG, e, "openMarker" );
}
}
}
// 折叠气泡
private void closeMarker( IMogoMarker mogoMarker ) {
if ( mogoMarker == null ) {

View File

@@ -12,6 +12,7 @@ import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
@@ -46,8 +47,11 @@ public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, On
@Override
protected void initViews() {
findViewById( R.id.module_services_id_close ).setOnClickListener( view -> {
removeSelf();
findViewById( R.id.module_services_id_close ).setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
removeSelf();
}
} );
mList = findViewById( R.id.module_services_id_recycler_view );
mRefreshPanel = findViewById( R.id.module_services_id_load_strategy_container );
@@ -59,18 +63,30 @@ public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, On
mList.setLayoutManager( new LinearLayoutManager( getContext(), LinearLayoutManager.VERTICAL, false ) );
m20KMStrategy.setOnClickListener( view -> {
mPresenter.nextStrategy();
m20KMStrategy.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
mPresenter.next20KMStrategy();
}
} );
m40KMStrategy.setOnClickListener( view -> {
mPresenter.nextStrategy();
m40KMStrategy.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
mPresenter.next40KMStrategy();
}
} );
mErrorPanel.setOnClickListener( view -> {
mPresenter.loadOnlineCar();
mErrorPanel.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
mPresenter.loadOnlineCar();
}
} );
mRootView.setOnClickListener( view -> {
} );
}
public void refreshPanel(){
public void refreshPanel() {
mPresenter.refreshPanel();
}

View File

@@ -54,13 +54,14 @@ class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implement
refreshPanel();
}
public void nextStrategy() {
if ( mStrategy != null ) {
mStrategy = mStrategy.getNext();
}
if ( mStrategy != null ) {
loadOnlineCar();
}
public void next20KMStrategy() {
mStrategy = OnlineCarStrategy.Strategy2;
loadOnlineCar();
}
public void next40KMStrategy() {
mStrategy = OnlineCarStrategy.Strategy3;
loadOnlineCar();
}
public void refreshPanel() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<dimen name="module_main_v2x_animation_width">445px</dimen>
<dimen name="module_v2x_search_marginLeft">18px</dimen>
<dimen name="module_v2x_operation_panel_share_goneMarginRight">20px</dimen>
<dimen name="module_v2x_event_window_height">190px</dimen>
<dimen name="module_v2x_event_window_height_ground">250px</dimen>
<dimen name="module_v2x_push_img_height">190px</dimen>
<dimen name="module_v2x_push_img_container_height">210px</dimen>
<dimen name="module_v2x_fatigue_driving_window_height_ground">136px</dimen>
<dimen name="module_v2x_event_icon_size">82px</dimen>
<dimen name="module_v2x_event_button_size">54px</dimen>
<dimen name="module_v2x_event_button_size_detail">64px</dimen>
<dimen name="module_v2x_event_image_height">156px</dimen>
<dimen name="module_v2x_event_image_width">234px</dimen>
<dimen name="module_v2x_event_distance_text">34px</dimen>
<dimen name="module_v2x_event_distance_title">22px</dimen>
<dimen name="module_v2x_history_event_icon_size">40px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_size">6px</dimen>
<dimen name="module_v2x_live_window_height">150px</dimen>
<dimen name="module_v2x_map_left">550px</dimen>
<dimen name="module_v2x_map_top">200px</dimen>
<dimen name="module_v2x_map_right">200px</dimen>
<dimen name="module_v2x_map_bottom">100px</dimen>
<dimen name="module_v2x_surrounding_top_height">50px</dimen>
<dimen name="module_v2x_surrounding_top_bt_width">90px</dimen>
<dimen name="module_v2x_surrounding_top_bt_height">36px</dimen>
<dimen name="module_v2x_surrounding_empty_iv_margin_top">40px</dimen>
<dimen name="module_v2x_surrounding_empty_tv_margin_top">15px</dimen>
<dimen name="module_v2x_surrounding_empty_bt_width">150px</dimen>
<dimen name="module_v2x_surrounding_empty_bt_height">48px</dimen>
<dimen name="module_v2x_surrounding_empty_bt_margin_top">32px</dimen>
<dimen name="module_v2x_surrounding_root_margin_left">28px</dimen>
<dimen name="module_v2x_surrounding_margin_left">28px</dimen>
<dimen name="module_v2x_surrounding_empty_image_height">190px</dimen>
<dimen name="module_v2x_surrounding_item_width">238px</dimen>
<dimen name="module_v2x_surrounding_item_height">170px</dimen>
<dimen name="module_v2x_surrounding_item_bottom">43px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_image_height">26px</dimen>
<dimen name="module_v2x_surrounding_item_marigin_left">12px</dimen>
<dimen name="module_v2x_surrounding_item_marigin_bottom_left">8px</dimen>
<dimen name="module_v2x_panel_surrounding_marginbottom">2px</dimen>
<dimen name="module_v2x_panel_surrounding_stance">30px</dimen>
<dimen name="module_v2x_surrounding_top">34px</dimen>
<dimen name="module_v2x_surrounding_list_margin_left">12px</dimen>
<dimen name="module_v2x_surrounding_item_margin_left">16px</dimen>
<dimen name="module_v2x_surrounding_refresh_bt_radius">24px</dimen>
<dimen name="module_v2x_surrounding_top_textsize">18px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_left_textsize">20px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_right_textsize">16px</dimen>
<dimen name="module_v2x_panel_width">82px</dimen>
<dimen name="module_v2x_panel_icon_cor">16px</dimen>
<dimen name="share_empty_icon_width">117px</dimen>
<dimen name="v2x_loading_ani_width">50px</dimen>
<dimen name="v2x_index_rating_top">17px</dimen>
<dimen name="share_top_text_size">16px</dimen>
<dimen name="share_des_num_size">36px</dimen>
<dimen name="share_index_des_size">16px</dimen>
<dimen name="share_empty_btn_padding">20px</dimen>
<dimen name="shaer_refresh_padding">34px</dimen>
<dimen name="share_index_bottom_padding">15px</dimen>
<dimen name="share_btn_middle_padding">29px</dimen>
<dimen name="v2x_panel_btn_translationY">-8px</dimen>
<dimen name="module_v2x_panel_tab_height">84px</dimen>
<dimen name="share_item_text_size">16px</dimen>
<dimen name="share_item_padding">20px</dimen>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:bottomLeftRadius="0px" android:bottomRightRadius="0px" android:topLeftRadius="@dimen/module_widgets_app_bkg_corner" android:topRightRadius="0px" />
<corners android:bottomLeftRadius="@dimen/module_widgets_app_bkg_corner" android:bottomRightRadius="0px" android:topLeftRadius="@dimen/module_widgets_app_bkg_corner" android:topRightRadius="0px" />
<solid android:color="#E6F5F5F5" />
</shape>
</item>