Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
# Conflicts: # modules/mogo-module-map/src/main/java/com/mogo/module/map/VoiceConstants.java
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
|
||||
@@ -202,4 +203,13 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
List< IMogoVoiceCmdCallBack > callBacks = mCmdMap.get( cmd );
|
||||
callBacks.remove( callBack );
|
||||
}
|
||||
|
||||
public static void startAssistant(Context context) {
|
||||
final Intent intent = new Intent();
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||
intent.putExtra( "window_start_cancel", 1 );
|
||||
intent.putExtra( "extra_switch_type", "window_start_cancel" );
|
||||
context.sendBroadcast( intent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoOnMessageListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
Logger.d(TAG, "received msg ==" + payload.getPayload().toStringUtf8());
|
||||
listener.onMsgReceived( GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,15 @@ package com.mogo.utils.network;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okio.Buffer;
|
||||
|
||||
|
||||
final class RequestLogInterceptor implements Interceptor {
|
||||
@@ -33,9 +36,26 @@ final class RequestLogInterceptor implements Interceptor {
|
||||
logMsg.append(request.url()).append("\r\n");
|
||||
if(hasRequestBody){
|
||||
logMsg.append("Content-Type: ").append(requestBody.contentType()).append(", ");
|
||||
logMsg.append("Content-Length: ").append(requestBody.contentLength());
|
||||
logMsg.append("\r\nContent-Length: ").append(requestBody.contentLength());
|
||||
try {
|
||||
String body = null;
|
||||
Charset UTF8 = Charset.forName("UTF-8");
|
||||
Buffer buffer = new Buffer();
|
||||
requestBody.writeTo(buffer);
|
||||
Charset charset = UTF8;
|
||||
MediaType contentType = requestBody.contentType();
|
||||
if (contentType != null) {
|
||||
charset = contentType.charset(UTF8);
|
||||
}
|
||||
if (charset != null) {
|
||||
body = buffer.readString(charset);
|
||||
}
|
||||
logMsg.append("\r\nContent-body: ").append(body);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
logMsg.append(" <-- end http request");
|
||||
logMsg.append("\r\n<-- end http request");
|
||||
|
||||
if(NetConfig.instance().isLoggable()){
|
||||
Logger.d(TAG, logMsg.toString());
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -52,6 +53,12 @@ public interface IMogoMarkerManager {
|
||||
* @return
|
||||
*/
|
||||
List< IMogoMarker > getMarkers( String tag );
|
||||
/**
|
||||
* 获取所有类型的marker。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map< String, List< IMogoMarker > > getAllMarkers( );
|
||||
|
||||
/**
|
||||
* 仅保留指定类型的tag
|
||||
|
||||
@@ -77,6 +77,11 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
|
||||
}
|
||||
|
||||
|
||||
public synchronized Map< String, List< IMogoMarker > > getAllMarkers() {
|
||||
return mServicesMarkers;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void add( String tag, IMogoMarker marker ) {
|
||||
if ( marker == null ) {
|
||||
return;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.marker.MogoMarkersHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -78,6 +79,11 @@ public class MogoMarkerManager implements IMogoMarkerManager {
|
||||
return MogoMarkersHandler.getInstance().getMarkers( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map< String, List< IMogoMarker > > getAllMarkers() {
|
||||
return MogoMarkersHandler.getInstance().getAllMarkers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMarkersExcept( String tag ) {
|
||||
MogoMarkersHandler.getInstance().deleteAllExcept( tag );
|
||||
|
||||
@@ -13,10 +13,14 @@ import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-06
|
||||
@@ -38,6 +42,8 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
*/
|
||||
private IMogoModuleProvider mSearchProvider;
|
||||
|
||||
private IMogoAnalytics mMogoAnalytics;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_apps_fragment_apps_navigator;
|
||||
@@ -53,16 +59,18 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
mCarSettings = findViewById( R.id.module_apps_ic_car_settings );
|
||||
mApps = findViewById( R.id.module_apps_id_apps );
|
||||
mNavigation.setOnClickListener( view -> {
|
||||
mSearchProvider = ( IMogoModuleProvider ) ARouter.getInstance().build( MogoModulePaths.PATH_MODULE_SEARCH ).navigation();
|
||||
final Fragment fragment = mSearchProvider.createFragment( getContext(), null );
|
||||
mMogoFragmentManager.push( new FragmentDescriptor.Builder().fragment( fragment ).tag( MogoModulePaths.PATH_FRAGMENT_SEARCH ).notifyMainModule( true ).build() );
|
||||
openSearchPanel();
|
||||
trackNavigatorClickEvent( 1 );
|
||||
} );
|
||||
mMediaCenter.setOnClickListener( view -> {
|
||||
trackNavigatorClickEvent( 2 );
|
||||
} );
|
||||
mCarSettings.setOnClickListener( view -> {
|
||||
trackNavigatorClickEvent( 3 );
|
||||
} );
|
||||
mApps.setOnClickListener( view -> {
|
||||
openAppsPanel();
|
||||
trackNavigatorClickEvent( 4 );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -72,10 +80,17 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
return new AppNavigatorPresenter( this );
|
||||
}
|
||||
|
||||
private void openSearchPanel() {
|
||||
mSearchProvider = ( IMogoModuleProvider ) ARouter.getInstance().build( MogoModulePaths.PATH_MODULE_SEARCH ).navigation();
|
||||
final Fragment fragment = mSearchProvider.createFragment( getContext(), null );
|
||||
mMogoFragmentManager.push( new FragmentDescriptor.Builder().fragment( fragment ).tag( MogoModulePaths.PATH_FRAGMENT_SEARCH ).notifyMainModule( true ).build() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( getContext() );
|
||||
mMogoAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,6 +99,12 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
mMogoFragmentManager.push( new FragmentDescriptor.Builder().hasTransition( true ).fragment( mAppsFragment ).tag( "apps" ).notifyMainModule( false ).build() );
|
||||
}
|
||||
|
||||
private void trackNavigatorClickEvent( int type ) {
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", type );
|
||||
mMogoAnalytics.track( "Launcher_APP_Icon", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAppsPanel() {
|
||||
if ( getActivity() != null ) {
|
||||
|
||||
@@ -81,4 +81,14 @@ public class AppsFragmentProvider implements IMogoModuleProvider {
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,19 @@ import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-30
|
||||
@@ -22,6 +28,8 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
|
||||
private static final String TAG = "AppsPresenter";
|
||||
|
||||
private IMogoAnalytics mAnalytics;
|
||||
|
||||
public AppsPresenter( AppsView view ) {
|
||||
super( view );
|
||||
}
|
||||
@@ -35,6 +43,8 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
renderAppsList();
|
||||
}
|
||||
} );
|
||||
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() );
|
||||
}
|
||||
|
||||
private void renderAppsList() {
|
||||
@@ -55,6 +65,8 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
return;
|
||||
}
|
||||
|
||||
trackAppClicked( appInfo );
|
||||
|
||||
try {
|
||||
Intent intent = getContext().getPackageManager().getLaunchIntentForPackage( appInfo.getPackageName() );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
@@ -64,6 +76,19 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void trackAppClicked( AppInfo appInfo ) {
|
||||
if ( appInfo == null ) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", appInfo.getName() );
|
||||
properties.put( "packagename", appInfo.getPackageName() );
|
||||
properties.put( "appversion", appInfo.getVersionName() );
|
||||
properties.put( "from", 1 );
|
||||
mAnalytics.track( "appenterfront", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -11,6 +13,9 @@ public class MarkerCarInfo implements Serializable {
|
||||
private String carTypeName;
|
||||
|
||||
public String getCarBrandLogoUrl() {
|
||||
if (TextUtils.isEmpty(carBrandLogoUrl)) {
|
||||
return "";
|
||||
}
|
||||
return carBrandLogoUrl;
|
||||
}
|
||||
|
||||
@@ -19,6 +24,9 @@ public class MarkerCarInfo implements Serializable {
|
||||
}
|
||||
|
||||
public String getCarTypeName() {
|
||||
if (TextUtils.isEmpty(carTypeName)) {
|
||||
return "未知";
|
||||
}
|
||||
return carTypeName;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ public class MarkerCardResult implements Serializable {
|
||||
private List<MarkerExploreWay> exploreWay;
|
||||
private List<MarkerOnlineCar> onlineCar;
|
||||
private List<MarkerShareMusic> shareMusic;
|
||||
private List<MarkerNoveltyInfo> noveltyInfo;
|
||||
|
||||
public List<MarkerCarChat> getCarChat() {
|
||||
return carChat;
|
||||
@@ -44,6 +45,14 @@ public class MarkerCardResult implements Serializable {
|
||||
this.shareMusic = shareMusic;
|
||||
}
|
||||
|
||||
public List<MarkerNoveltyInfo> getNoveltyInfo() {
|
||||
return noveltyInfo;
|
||||
}
|
||||
|
||||
public void setNoveltyInfo(List<MarkerNoveltyInfo> noveltyInfo) {
|
||||
this.noveltyInfo = noveltyInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerCardResult{" +
|
||||
@@ -51,6 +60,7 @@ public class MarkerCardResult implements Serializable {
|
||||
", exploreWay=" + exploreWay +
|
||||
", onlineCar=" + onlineCar +
|
||||
", shareMusic=" + shareMusic +
|
||||
", noveltyInfo=" + noveltyInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -20,6 +22,9 @@ public class MarkerDynamicData implements Serializable {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
return "未知";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,6 +23,9 @@ public class MarkerExploreWay implements Serializable {
|
||||
private List<MarkerExploreWayItem> items;//视频地址和图片地址
|
||||
|
||||
public String getAddr() {
|
||||
if (TextUtils.isEmpty(addr)) {
|
||||
return "未知";
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -11,6 +13,9 @@ public class MarkerExploreWayItem implements Serializable {
|
||||
private String url;
|
||||
|
||||
public String getThumbnail() {
|
||||
if (TextUtils.isEmpty(thumbnail)) {
|
||||
return "";
|
||||
}
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
@@ -19,6 +24,9 @@ public class MarkerExploreWayItem implements Serializable {
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return "";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -12,6 +14,9 @@ public class MarkerHobbyDatum implements Serializable {
|
||||
private int isCheck;
|
||||
|
||||
public String getContent() {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
return "未知";
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -37,6 +39,9 @@ public class MarkerLocation implements Serializable {
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
if (TextUtils.isEmpty(address)) {
|
||||
return "未知";
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
/**
|
||||
* 新鲜事儿Marker数据
|
||||
*/
|
||||
public class MarkerNoveltyInfo {
|
||||
private String type;
|
||||
private MarkerLocation location;
|
||||
private MarkerUserInfo userInfo;
|
||||
/**
|
||||
* @see MarkerPoiTypeEnum
|
||||
*/
|
||||
private String poiType;
|
||||
private ContentData contentData;
|
||||
|
||||
|
||||
public ContentData getContentData() {
|
||||
return contentData;
|
||||
}
|
||||
|
||||
public void setContentData(ContentData contentData) {
|
||||
this.contentData = contentData;
|
||||
}
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MarkerUserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(MarkerUserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public class ContentData {
|
||||
private String content;
|
||||
private String iconUrl;
|
||||
private String imgUrl;
|
||||
private String infoId;
|
||||
private Long likeNum;
|
||||
private String title;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public void setIconUrl(String iconUrl) {
|
||||
this.iconUrl = iconUrl;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public String getInfoId() {
|
||||
return infoId;
|
||||
}
|
||||
|
||||
public void setInfoId(String infoId) {
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
||||
public Long getLikeNum() {
|
||||
return likeNum;
|
||||
}
|
||||
|
||||
public void setLikeNum(Long likeNum) {
|
||||
this.likeNum = likeNum;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1514:47
|
||||
* desc : 车机启动状态
|
||||
* version: 1.0
|
||||
*/
|
||||
public interface MarkerPoiTypeEnum {
|
||||
//加油站
|
||||
public String GAS_STATION = "10001";
|
||||
//交通检查
|
||||
public String TRAFFIC_CHECK = "10002";
|
||||
//封路
|
||||
public String ROAD_CLOSED = "10003";
|
||||
//商场打折
|
||||
public String SHOP_DISCOUNT = "10004";
|
||||
//4S店
|
||||
public String FOURS_SHOP = "10005";
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -54,6 +56,9 @@ public class MarkerShareMusic implements Serializable {
|
||||
}
|
||||
|
||||
public String getMediaImg() {
|
||||
if (TextUtils.isEmpty(mediaImg)) {
|
||||
return "";
|
||||
}
|
||||
return mediaImg;
|
||||
}
|
||||
|
||||
@@ -62,6 +67,9 @@ public class MarkerShareMusic implements Serializable {
|
||||
}
|
||||
|
||||
public String getMediaName() {
|
||||
if (TextUtils.isEmpty(mediaName)) {
|
||||
return "未知";
|
||||
}
|
||||
return mediaName;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -13,6 +15,8 @@ public class MarkerShowEntity {
|
||||
|
||||
// false - 没选中,true - 选中
|
||||
private boolean isChecked;
|
||||
// false - 非高亮,true - 高亮
|
||||
private boolean isHighlighted;
|
||||
// icon 地址,例如:头像,唱片图片,探路缩略,可能为空展示默认图
|
||||
private String iconUrl;
|
||||
// 要展示的文本
|
||||
@@ -32,6 +36,14 @@ public class MarkerShowEntity {
|
||||
isChecked = checked;
|
||||
}
|
||||
|
||||
public boolean isHighlighted() {
|
||||
return isHighlighted;
|
||||
}
|
||||
|
||||
public void setHighlighted(boolean highlighted) {
|
||||
isHighlighted = highlighted;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
@@ -41,6 +53,9 @@ public class MarkerShowEntity {
|
||||
}
|
||||
|
||||
public String getTextContent() {
|
||||
if (TextUtils.isEmpty(textContent)) {
|
||||
return "未知";
|
||||
}
|
||||
return textContent;
|
||||
}
|
||||
|
||||
@@ -77,8 +92,7 @@ public class MarkerShowEntity {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MarkerShowEntity that = (MarkerShowEntity) o;
|
||||
return isChecked == that.isChecked &&
|
||||
Objects.equals(iconUrl, that.iconUrl) &&
|
||||
return Objects.equals(iconUrl, that.iconUrl) &&
|
||||
Objects.equals(textContent, that.textContent) &&
|
||||
Objects.equals(markerType, that.markerType) &&
|
||||
Objects.equals(bindObj, that.bindObj) &&
|
||||
@@ -87,13 +101,14 @@ public class MarkerShowEntity {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(isChecked, iconUrl, textContent, markerType, bindObj, markerLocation);
|
||||
return Objects.hash(iconUrl, textContent, markerType, bindObj, markerLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerShowEntity{" +
|
||||
"isChecked=" + isChecked +
|
||||
", isHighlighted=" + isHighlighted +
|
||||
", iconUrl='" + iconUrl + '\'' +
|
||||
", textContent='" + textContent + '\'' +
|
||||
", markerType='" + markerType + '\'' +
|
||||
|
||||
@@ -90,6 +90,9 @@ public class MarkerUserInfo implements Serializable {
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
if (TextUtils.isEmpty(sn)) {
|
||||
return "";
|
||||
}
|
||||
return sn;
|
||||
}
|
||||
|
||||
@@ -98,6 +101,9 @@ public class MarkerUserInfo implements Serializable {
|
||||
}
|
||||
|
||||
public String getUserHead() {
|
||||
if (TextUtils.isEmpty(userHead)) {
|
||||
return "";
|
||||
}
|
||||
return userHead;
|
||||
}
|
||||
|
||||
@@ -114,6 +120,9 @@ public class MarkerUserInfo implements Serializable {
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
if (TextUtils.isEmpty(userName)) {
|
||||
return "";
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 8.4 KiB |
@@ -11,8 +11,13 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.extensions.anim.AnimRes;
|
||||
import com.mogo.module.extensions.anim.JSurfaceView;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -36,6 +41,9 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
private View mMsgContainer;
|
||||
private TextView mMsgCounter;
|
||||
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
private IMogoAnalytics mAnalytics;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_extensions;
|
||||
@@ -47,8 +55,12 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
mVoiceMsg = findViewById( R.id.module_ext_id_voice_msg );
|
||||
|
||||
mVoiceIcon.setOnClickListener( view -> {
|
||||
mVoiceMsg.performClick();
|
||||
} );
|
||||
mVoiceMsg.setOnClickListener( view -> {
|
||||
AIAssist.startAssistant( getContext() );
|
||||
mAnalytics.track( "Launcher_xiaozhi_Click", null );
|
||||
} );
|
||||
mVoiceMsg.setOnClickListener( view -> {} );
|
||||
|
||||
mTime = findViewById( R.id.module_ext_id_time );
|
||||
mDate = findViewById( R.id.module_ext_id_date );
|
||||
@@ -65,6 +77,15 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
|
||||
|
||||
mVoiceIcon.setFrames( AnimRes.sRes );
|
||||
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( getContext() );
|
||||
mMogoFragmentManager.addMainFragmentStackTransactionListener( size -> {
|
||||
if ( size == 0 ) {
|
||||
mVoiceIcon.setVisibility( View.VISIBLE );
|
||||
} else {
|
||||
mVoiceIcon.setVisibility( View.INVISIBLE );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -76,6 +97,7 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() );
|
||||
mVoiceIcon.startAnim();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,4 +77,14 @@ public class ExtensionsModuleProvider implements IMogoModuleProvider {
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class JSurfaceView extends SurfaceView implements Runnable, SurfaceHolder
|
||||
private void init() {
|
||||
mHolder = getHolder();
|
||||
mHolder.addCallback( this );
|
||||
setZOrderOnTop( false );
|
||||
setZOrderOnTop( true );
|
||||
mHolder.setFormat( PixelFormat.TRANSLUCENT );
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class JSurfaceView extends SurfaceView implements Runnable, SurfaceHolder
|
||||
return;
|
||||
}
|
||||
//绘制透明色
|
||||
mCanvas.drawColor( Color.parseColor( "#1F000000" ) );
|
||||
mCanvas.drawColor( Color.TRANSPARENT, PorterDuff.Mode.CLEAR );
|
||||
Bitmap mBitmap = BitmapFactory.decodeResource( getResources(), mFrames[mCurrentPos % mFrames.length] );
|
||||
|
||||
Paint paint = new Paint();
|
||||
|
||||
@@ -80,4 +80,14 @@ public class EntranceProvider implements IMogoModuleProvider {
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
@@ -24,18 +26,20 @@ import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.cards.OnPageChangeListenerAdapter;
|
||||
import com.mogo.module.main.cards.OrientedViewPager;
|
||||
import com.mogo.module.main.cards.VerticalStackTransformer;
|
||||
import com.mogo.module.main.fragmentmanager.FragmentStack;
|
||||
import com.mogo.module.main.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.module.main.windowview.WindowViewHandler;
|
||||
import com.mogo.module.map.VoiceConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.impl.fragmentmanager.FragmentStack;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -52,6 +56,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoMapUIController mMogoMapUIController;
|
||||
private MogoModulesHandler mMogoModuleHandler;
|
||||
private IMogoCardManager mMogoCardManager;
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
|
||||
private OrientedViewPager mCardsContainer;
|
||||
private CardModulesAdapter mCardModulesAdapter;
|
||||
@@ -70,6 +76,13 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
private int mCurrentPosition = 0;
|
||||
|
||||
// 是否是点击Marker进行的页面切换,false-不是,true-是
|
||||
private boolean isClickMarker;
|
||||
|
||||
private long mCardStartShowTime = 0;
|
||||
|
||||
private IMogoAnalytics mAnalytics;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_main_activity_main;
|
||||
@@ -81,27 +94,80 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mCardsContainer.setOrientation( OrientedViewPager.Orientation.VERTICAL );
|
||||
|
||||
mCardsContainer.setOnPageChangeListener( new OnPageChangeListenerAdapter() {
|
||||
|
||||
private boolean mCardFlipStatus = false;
|
||||
|
||||
@Override
|
||||
public void onPageSelected( int position ) {
|
||||
try {
|
||||
mCurrentPosition = position;
|
||||
mMogoModuleHandler.setEnable( mCardModulesAdapter.getProvider( position ).getModuleName() );
|
||||
mShadowFrame.setVisibility( View.VISIBLE );
|
||||
final IMogoModuleProvider provider = mCardModulesAdapter.getProvider( position );
|
||||
mMogoModuleHandler.setEnable( provider.getModuleName() );
|
||||
if ( !isClickMarker ) {
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
}
|
||||
trackCardSelectedEvent( provider );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels ) {
|
||||
super.onPageScrolled( position, positionOffset, positionOffsetPixels );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged( int state ) {
|
||||
super.onPageScrollStateChanged( state );
|
||||
if ( state == ViewPager.SCROLL_STATE_DRAGGING ) {
|
||||
if ( !mCardFlipStatus ) {
|
||||
mCardFlipStatus = true;
|
||||
final IMogoModuleProvider provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
trackCardFlipEvent( provider );
|
||||
}
|
||||
} else if ( state == ViewPager.SCROLL_STATE_IDLE ) {
|
||||
mCardFlipStatus = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片展示时长埋点
|
||||
* @param provider
|
||||
*/
|
||||
private void trackCardSelectedEvent( IMogoModuleProvider provider ) {
|
||||
if ( provider == null ) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", provider.getAppName() );
|
||||
properties.put( "packagename", provider.getAppPackage() );
|
||||
properties.put( "activeTime", System.currentTimeMillis() - mCardStartShowTime );
|
||||
mAnalytics.track( "Launcher_Card_Show", properties );
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片滑动埋点,WTF
|
||||
*/
|
||||
private void trackCardFlipEvent( IMogoModuleProvider provider ) {
|
||||
if ( provider == null ) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", provider.getAppName() );
|
||||
properties.put( "packagename", provider.getAppPackage() );
|
||||
mAnalytics.track( "Launcher_Card_Slide", properties );
|
||||
}
|
||||
} );
|
||||
|
||||
FragmentStack.getInstance().init( this, R.id.module_main_id_search_fragment );
|
||||
FragmentStack.getInstance().setFragmentStackTransactionListener( new FragmentStackTransactionListener() {
|
||||
@Override
|
||||
public void onTransaction() {
|
||||
if ( FragmentStack.getInstance().isEmpty() ) {
|
||||
show();
|
||||
} else if ( FragmentStack.getInstance().getStackSize() == 1 ) {
|
||||
hide();
|
||||
}
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( this );
|
||||
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> {
|
||||
if ( size == 0 ) {
|
||||
show();
|
||||
} else if ( size == 1 ) {
|
||||
hide();
|
||||
}
|
||||
} );
|
||||
mHeader = findViewById( R.id.module_main_id_header_fragment_container );
|
||||
@@ -153,14 +219,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
|
||||
mMogoModuleHandler.loadModules();
|
||||
mMogoModuleHandler.onMapLoadedCallback( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
|
||||
loadModules();
|
||||
mShadowFrame.setVisibility( View.VISIBLE );
|
||||
mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
}
|
||||
mMogoModuleHandler.onMapLoadedCallback( () -> {
|
||||
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
|
||||
loadModules();
|
||||
mShadowFrame.setVisibility( View.VISIBLE );
|
||||
mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
} );
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
mMogoModuleHandler.loadMap( R.id.module_main_id_map_fragment_container );
|
||||
@@ -171,6 +234,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start();
|
||||
|
||||
mMogoCardManager = ( IMogoCardManager ) ARouter.getInstance().build( MogoServicePaths.PATH_CARD_MANAGER ).navigation( this );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( this );
|
||||
}
|
||||
|
||||
private void loadModules() {
|
||||
@@ -181,6 +247,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mCardsContainer.setPageTransformer( true, new VerticalStackTransformer( this ) );
|
||||
mCardsContainer.setAdapter( mCardModulesAdapter );
|
||||
mCardsContainer.setCurrentItem( mCurrentPosition );
|
||||
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
@@ -199,10 +267,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
isClickMarker = true;
|
||||
switch2( marker.getOwner() );
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onMarkerReceive( marker );
|
||||
}
|
||||
isClickMarker = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,6 +282,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
int position = mCardModulesAdapter.getProviderPosition( cardType );
|
||||
if ( position != -1 ) {
|
||||
mCardsContainer.setCurrentItem( position, Math.abs( mCurrentPosition - position ) == 1 );
|
||||
if ( !isClickMarker ) {
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
}
|
||||
} else {
|
||||
Logger.e( TAG, "Can't find type of %s's position", cardType );
|
||||
}
|
||||
@@ -221,7 +294,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( FragmentStack.getInstance().isEmpty() ) {
|
||||
super.onBackPressed();
|
||||
return;
|
||||
}
|
||||
FragmentStack.getInstance().pop();
|
||||
|
||||
@@ -24,14 +24,13 @@ public class MainPresenter extends Presenter< MainView > {
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CardSwitchLiveData.getInstance().observeForever( new Observer< String >() {
|
||||
@Override
|
||||
public void onChanged( String s ) {
|
||||
if ( TextUtils.isEmpty( s ) ) {
|
||||
return;
|
||||
}
|
||||
mView.switch2( s );
|
||||
CardSwitchLiveData.getInstance().observeForever( to -> {
|
||||
if ( TextUtils.isEmpty( to ) ) {
|
||||
return;
|
||||
}
|
||||
mView.switch2( to );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,13 @@ import android.content.Context;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.module.main.livedata.CardSwitchLiveData;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-06
|
||||
@@ -16,11 +21,36 @@ import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
@Route( path = MogoServicePaths.PATH_CARD_MANAGER )
|
||||
public class MogoCardManager implements IMogoCardManager {
|
||||
|
||||
private static final Map< String, IMogoCardChangedListener > sListeners = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void switch2( String cardType ) {
|
||||
CardSwitchLiveData.getInstance().postValue( cardType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCardChangedListener( String tag, IMogoCardChangedListener listener ) {
|
||||
sListeners.put( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterCardChangedListener( String tag ) {
|
||||
sListeners.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke( int position, String moduleName ) {
|
||||
if ( sListeners != null && !sListeners.isEmpty() ) {
|
||||
Iterator< IMogoCardChangedListener > iterator = sListeners.values().iterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoCardChangedListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
listener.onSwitched( position, moduleName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -77,7 +77,15 @@ public interface MogoModulesHandler extends IMogoMapListener,
|
||||
|
||||
/**
|
||||
* 卡片接收到Marker传入数据
|
||||
*
|
||||
* @param marker marker
|
||||
*/
|
||||
void onMarkerReceive(IMogoMarker marker);
|
||||
void onMarkerReceive( IMogoMarker marker );
|
||||
|
||||
/**
|
||||
* 当前卡片名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getCurrentModuleName();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
for ( MogoModule module : modules ) {
|
||||
IMogoModuleProvider provider = mModuleProviders.get( module );
|
||||
if ( provider.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName == null ) {
|
||||
mEnableModuleName = provider.getModuleName();
|
||||
}
|
||||
providers.add( provider );
|
||||
}
|
||||
}
|
||||
@@ -355,6 +358,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
try {
|
||||
getApplicationContext().unregisterReceiver( mReceiver );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
mReceiver = null;
|
||||
@@ -374,4 +378,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
listener.onMarkerClicked( marker );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentModuleName() {
|
||||
return mEnableModuleName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,4 +81,14 @@ public class MapFragmentProvider implements IMogoModuleProvider {
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,9 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MapPresenter extends Presenter< MapView >
|
||||
implements IMogoIntentListener, IMogoVoiceCmdCallBack {
|
||||
public class MapPresenter extends Presenter< MapView > implements
|
||||
IMogoIntentListener,
|
||||
IMogoVoiceCmdCallBack {
|
||||
|
||||
private static final String TAG = "MapPresenter";
|
||||
|
||||
@@ -58,8 +59,6 @@ public class MapPresenter extends Presenter< MapView >
|
||||
.build( MogoServicePaths.PATH_SEARCH_MANAGER )
|
||||
.navigation( getContext() );
|
||||
|
||||
registerVoiceCmd();
|
||||
|
||||
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
|
||||
mogoNavi.setCalculatePathDisplayBounds( new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.dp_730 )
|
||||
@@ -84,26 +83,24 @@ public class MapPresenter extends Presenter< MapView >
|
||||
}
|
||||
|
||||
private void registerVoiceCmd() {
|
||||
if ( VoiceConstants.sVoiceCmds.isEmpty() ) {
|
||||
Logger.w( TAG, "no unwakeup words" );
|
||||
return;
|
||||
}
|
||||
|
||||
for ( Map.Entry< String, String[] > entry : VoiceConstants.sVoiceCmds.entrySet() ) {
|
||||
mMogoIntentManager.registerIntentListener( entry.getKey(), this );
|
||||
// AIAssist.getInstance( getContext() ).registerUnWakeupCommand( entry.getKey(), entry.getValue(), this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( entry.getKey(), entry.getValue(), this );
|
||||
}
|
||||
|
||||
for ( String cmd : VoiceConstants.sCmds ) {
|
||||
mMogoIntentManager.registerIntentListener( cmd, this );
|
||||
}
|
||||
}
|
||||
|
||||
private void unregisterVoiceCmd() {
|
||||
if ( VoiceConstants.sVoiceCmds.isEmpty() ) {
|
||||
Logger.w( TAG, "no unwakeup words" );
|
||||
return;
|
||||
}
|
||||
|
||||
for ( Map.Entry< String, String[] > entry : VoiceConstants.sVoiceCmds.entrySet() ) {
|
||||
mMogoIntentManager.unregisterIntentListener( entry.getKey() );
|
||||
// AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( entry.getKey(), this );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( entry.getKey(), this );
|
||||
}
|
||||
|
||||
for ( String cmd : VoiceConstants.sCmds ) {
|
||||
mMogoIntentManager.unregisterIntentListener( cmd );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,92 +115,90 @@ public class MapPresenter extends Presenter< MapView >
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
switch ( cmd ) {
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开", null );
|
||||
mView.getUIController().setTrafficEnabled( true );
|
||||
mSearchManager.showSearch();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已关闭", null );
|
||||
mView.getUIController().setTrafficEnabled( false );
|
||||
mSearchManager.showMain();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已关闭", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP:
|
||||
mView.getUIController().changeZoom( true );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已放大", null );
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN:
|
||||
mView.getUIController().changeZoom( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已缩小", null );
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT:
|
||||
mView.getUIController().changeZoom( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_2D:
|
||||
case VoiceConstants.CMD_MAP_2D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE:
|
||||
case VoiceConstants.CMD_MAP_2D:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_GO_COMPANY:
|
||||
case VoiceConstants.CMD_MAP_GO_COMPANY_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_GO_COMPANY:
|
||||
mSearchManager.goCompany();
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_GO_HOME:
|
||||
case VoiceConstants.CMD_MAP_GO_HOME_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_GO_HOME:
|
||||
mSearchManager.goHome();
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_HISTORY:
|
||||
case VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_HISTORY:
|
||||
mSearchManager.showSearch();
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE:
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE:
|
||||
mSearchManager.showMain();
|
||||
break;
|
||||
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE:
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_UN_WAKEUP:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
|
||||
mView.getUIController().displayOverview();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_UN_WAKEUP:
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
|
||||
mView.getUIController().recoverLockMode();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
default:
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -24,14 +26,14 @@ public class VoiceConstants {
|
||||
*/
|
||||
public static final String CMD_MAP_GO_HOME = "com.ileja.navi.map.go.home";
|
||||
public static final String CMD_MAP_GO_HOME_UN_WAKEUP = "CMD_MAP_GO_HOME_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_ZOOM_IN_GO_HOME = {"我要回家","导航回家","带我回家"};
|
||||
public static final String[] CMD_MAP_ZOOM_IN_GO_HOME = {"我要回家", "导航回家", "带我回家"};
|
||||
|
||||
/**
|
||||
* 去公司
|
||||
*/
|
||||
public static final String CMD_MAP_GO_COMPANY = "com.ileja.navi.map.go.company";
|
||||
public static final String CMD_MAP_GO_COMPANY_UN_WAKEUP = "CMD_MAP_GO_COMPANY_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_ZOOM_IN_GO_COMPANY = {"我要去公司","导航去公司","带我去公司"};
|
||||
public static final String[] CMD_MAP_ZOOM_IN_GO_COMPANY = {"我要去公司", "导航去公司", "带我去公司"};
|
||||
|
||||
/**
|
||||
* 导航历史记录
|
||||
@@ -41,7 +43,6 @@ public class VoiceConstants {
|
||||
public static final String[] CMD_MAP_HISTORY_TRIGGER_WORDS = {"查询导航历史记录"};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 缩小地图
|
||||
*/
|
||||
@@ -129,20 +130,22 @@ public class VoiceConstants {
|
||||
/**
|
||||
* 车头朝上
|
||||
*/
|
||||
public static final String CMD_MAP_CAR_UP_MODE = "com.ileja.navi.mode.car_up";
|
||||
public static final String CMD_MAP_CAR_UP_MODE = "com.ileja.traffic.head.up";
|
||||
public static final String CMD_MAP_CAR_UP_MODE_UN_WAKEUP = "CMD_MAP_CAR_UP_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_CAR_UP_MODE_TRIGGER_WORDS = {"车头朝上"};
|
||||
|
||||
/**
|
||||
* 北朝上
|
||||
*/
|
||||
public static final String CMD_MAP_NORTH_UP_MODE = "com.ileja.navi.mode.north_up";
|
||||
public static final String CMD_MAP_NORTH_UP_MODE = "com.ileja.traffic.north.up";
|
||||
public static final String CMD_MAP_NORTH_UP_MODE_UN_WAKEUP = "CMD_MAP_NORTH_UP_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS = {"北朝上"};
|
||||
|
||||
public static final Map< String, String[] > sVoiceCmds = new HashMap<>();
|
||||
public static final List< String > sCmds = new ArrayList<>();
|
||||
|
||||
static {
|
||||
// 免唤醒
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_2D_UN_WAKEUP, VoiceConstants.CMD_MAP_2D_TRIGGER_WORDS );
|
||||
@@ -161,5 +164,23 @@ public class VoiceConstants {
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP, VoiceConstants.CMD_MAP_HISTORY_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_STOP_NAVI_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_GEO_NEARBY_WAKEUP, VoiceConstants.CMD_MAP_GEO_NEARBY_TRIGGER_WORDS );
|
||||
// 唤醒
|
||||
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_IN );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_OUT );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_2D );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_3D );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_DAY_TIME_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_NIGHT_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_TRAFFIC_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_CAR_UP_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_NORTH_UP_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_GO_HOME );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_GO_COMPANY );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_HISTORY );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_STOP_NAVI_MODE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,9 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener {
|
||||
)
|
||||
}
|
||||
|
||||
// 是否开启导航
|
||||
var isStartedNavi = false
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
@@ -96,6 +99,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener {
|
||||
tv_navi_navi.setOnClickListener {
|
||||
SearchServiceHolder.getNavi()
|
||||
.startNavi(false)
|
||||
isStartedNavi = true
|
||||
SearchServiceHolder.fragmentManager.clearAll()
|
||||
}
|
||||
|
||||
@@ -122,10 +126,12 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener {
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT, false
|
||||
)
|
||||
SearchServiceHolder.getNavi()
|
||||
.clearCalculatePaths()
|
||||
if (!isStartedNavi) {
|
||||
SearchServiceHolder.getNavi().clearCalculatePaths()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(searchPoi: MogoLatLng): Fragment {
|
||||
var bundle = Bundle()
|
||||
|
||||
@@ -79,4 +79,14 @@ public class SearchFragmentProvider implements IMogoModuleProvider {
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,17 @@ import com.mogo.module.common.entity.MarkerCarChat;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.marker.MapMarkerAdapter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
@@ -27,7 +32,9 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -49,6 +56,8 @@ public class MarkerServiceHandler {
|
||||
private static IMogoStatusManager mMogoStatusManager;
|
||||
private static IMogoImageloader mImageloader;
|
||||
private static IMogoSocketManager mMogoSocketManager;
|
||||
private static IMogoCardManager mMogoCardManager;
|
||||
private static IMogoAnalytics mMogoAnalytics;
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
@@ -57,14 +66,17 @@ public class MarkerServiceHandler {
|
||||
mMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(context);
|
||||
mImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation(context);
|
||||
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(context);
|
||||
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(context);
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
mMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation();
|
||||
mMogoAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation();
|
||||
|
||||
mMarkerManager = mMapService.getMarkerManager(context);
|
||||
mNavi = mMapService.getNavi(context);
|
||||
mMapUIController = mMapService.getMapUIController();
|
||||
|
||||
mogoMarkerClickListener = new MoGoMarkerClickListener();
|
||||
|
||||
// 长连接
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
mMogoSocketManager.registerOnMessageListener(401001, new IMogoOnMessageListener<MarkerResponse>() {
|
||||
|
||||
@Override
|
||||
@@ -80,6 +92,15 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
getMogoCardManager().registerCardChangedListener("LAUNCHER_MARKER_MODULE", new IMogoCardChangedListener() {
|
||||
|
||||
@Override
|
||||
public void onSwitched(int position, String moduleName) {
|
||||
Logger.e(TAG, "======moduleName:" + moduleName);
|
||||
highlightedMarker(moduleName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static IMogoMapService getMapService() {
|
||||
@@ -110,6 +131,13 @@ public class MarkerServiceHandler {
|
||||
return mMogoStatusManager;
|
||||
}
|
||||
|
||||
public static IMogoCardManager getMogoCardManager() {
|
||||
return mMogoCardManager;
|
||||
}
|
||||
|
||||
public static IMogoAnalytics getMogoAnalytics() {
|
||||
return mMogoAnalytics;
|
||||
}
|
||||
|
||||
private static IMogoMarker lastMarker;
|
||||
|
||||
@@ -121,37 +149,112 @@ public class MarkerServiceHandler {
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker:" + marker);
|
||||
if (lastMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if (marker.equals(lastMarker)) {
|
||||
Logger.w(TAG, "onMarkerClicked 与上一次点击的Marker一样,不做处理:" + marker);
|
||||
return false;
|
||||
try {
|
||||
if (lastMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if (marker.equals(lastMarker)) {
|
||||
Logger.w(TAG, "onMarkerClicked 与上一次点击的Marker一样,不做处理:" + marker);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 将上次选中 Marker 设置为未选中状态
|
||||
MarkerShowEntity lastMarkerShowEntity = (MarkerShowEntity) lastMarker.getObject();
|
||||
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker lastMarkerShowEntity:" + lastMarkerShowEntity);
|
||||
|
||||
lastMarkerShowEntity.setChecked(false);
|
||||
lastMarkerShowEntity.setHighlighted(false);
|
||||
|
||||
drawMapMarker(lastMarkerShowEntity);
|
||||
|
||||
lastMarker.remove();
|
||||
}
|
||||
|
||||
// 将上次选中 Marker 设置为未选中状态
|
||||
MarkerShowEntity lastMarkerShowEntity = (MarkerShowEntity) lastMarker.getObject();
|
||||
// 将当前的Marker设置为选中
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) marker.getObject();
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker markerShowEntity:" + markerShowEntity);
|
||||
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker lastMarkerShowEntity:" + lastMarkerShowEntity);
|
||||
markerShowEntity.setChecked(true);
|
||||
markerShowEntity.setHighlighted(true);
|
||||
|
||||
lastMarkerShowEntity.setChecked(false);
|
||||
drawMapMarker(lastMarkerShowEntity);
|
||||
lastMarker = drawMapMarker(markerShowEntity);
|
||||
if (lastMarker != null) {
|
||||
lastMarker.setAlpha(1f);
|
||||
}
|
||||
|
||||
lastMarker.remove();
|
||||
marker.remove();
|
||||
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
switch (lastMarker.getOwner()) {
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
properties.put("type", 3);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
properties.put("type", 5);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
properties.put("type", 2);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
MarkerShowEntity showEntity = (MarkerShowEntity) lastMarker.getObject();
|
||||
Object bindObj = showEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerNoveltyInfo) {
|
||||
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
properties.put("type", 4);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
properties.put("type", 8);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
properties.put("type", 7);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
properties.put("type", 9);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP:
|
||||
properties.put("type", 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
properties.put("type", 6);
|
||||
break;
|
||||
}
|
||||
|
||||
getMogoAnalytics().track("Launcher_Icon_Click", properties);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 将当前的Marker设置为选中
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) marker.getObject();
|
||||
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker markerShowEntity:" + markerShowEntity);
|
||||
|
||||
markerShowEntity.setChecked(true);
|
||||
|
||||
lastMarker = drawMapMarker(markerShowEntity);
|
||||
|
||||
marker.remove();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 对指定类型高亮处理
|
||||
public static void highlightedMarker(String typeTag) {
|
||||
try {
|
||||
Map<String, List<IMogoMarker>> allMarker = getMarkerManager().getAllMarkers();
|
||||
for (Map.Entry<String, List<IMogoMarker>> entry : allMarker.entrySet()) {
|
||||
String keyStr = entry.getKey();
|
||||
List<IMogoMarker> markerList = entry.getValue();
|
||||
|
||||
if (keyStr.equals(typeTag)) {
|
||||
for (IMogoMarker marker : markerList) {
|
||||
marker.setAlpha(1f);
|
||||
}
|
||||
} else {
|
||||
for (IMogoMarker marker : markerList) {
|
||||
marker.setAlpha(0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制Marker
|
||||
@@ -164,13 +267,14 @@ public class MarkerServiceHandler {
|
||||
if (response != null && response.getResult() != null) {
|
||||
MarkerCardResult markerCardResult = response.getResult();
|
||||
|
||||
List<MarkerCarChat> carChat = markerCardResult.getCarChat();
|
||||
List<MarkerOnlineCar> onlineCar = markerCardResult.getOnlineCar();
|
||||
List<MarkerExploreWay> exploreWay = markerCardResult.getExploreWay();
|
||||
List<MarkerShareMusic> shareMusic = markerCardResult.getShareMusic();
|
||||
List<MarkerCarChat> carChatList = markerCardResult.getCarChat();
|
||||
List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
List<MarkerShareMusic> shareMusicList = markerCardResult.getShareMusic();
|
||||
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
|
||||
|
||||
if (carChat != null) {
|
||||
for (MarkerCarChat markerCarChat : carChat) {
|
||||
if (carChatList != null) {
|
||||
for (MarkerCarChat markerCarChat : carChatList) {
|
||||
MarkerLocation markerLocation = markerCarChat.getLocation();
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
@@ -184,8 +288,8 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineCar != null) {
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
|
||||
if (onlineCarList != null) {
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCarList) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
@@ -197,10 +301,11 @@ public class MarkerServiceHandler {
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
analyticData(3, onlineCarList.size());
|
||||
}
|
||||
|
||||
if (exploreWay != null) {
|
||||
for (MarkerExploreWay markerExploreWay : exploreWay) {
|
||||
if (exploreWayList != null) {
|
||||
for (MarkerExploreWay markerExploreWay : exploreWayList) {
|
||||
if (!markerExploreWay.getCanLive()) {
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
|
||||
@@ -213,10 +318,11 @@ public class MarkerServiceHandler {
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
}
|
||||
analyticData(1, exploreWayList.size());
|
||||
}
|
||||
|
||||
if (shareMusic != null) {
|
||||
for (MarkerShareMusic markerShareMusic : shareMusic) {
|
||||
if (shareMusicList != null) {
|
||||
for (MarkerShareMusic markerShareMusic : shareMusicList) {
|
||||
MarkerLocation markerLocation = markerShareMusic.getLocation();
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
@@ -228,53 +334,99 @@ public class MarkerServiceHandler {
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
analyticData(4, shareMusicList.size());
|
||||
}
|
||||
|
||||
if (noveltyInfoList != null) {
|
||||
int num_gas_station = 0;
|
||||
int num_traffic_check = 0;
|
||||
int num_road_closed = 0;
|
||||
int num_shop_discount = 0;
|
||||
int num_fours_shop = 0;
|
||||
|
||||
for (MarkerNoveltyInfo noveltyInfo : noveltyInfoList) {
|
||||
MarkerLocation markerLocation = noveltyInfo.getLocation();
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(noveltyInfo);
|
||||
markerShowEntity.setMarkerLocation(markerLocation);
|
||||
markerShowEntity.setMarkerType(noveltyInfo.getType());
|
||||
markerShowEntity.setTextContent(noveltyInfo.getLocation().getAddress());
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
|
||||
switch (noveltyInfo.getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
num_gas_station++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
num_traffic_check++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
num_road_closed++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
num_shop_discount++;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP:
|
||||
num_fours_shop++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
analyticData(2, num_gas_station);
|
||||
analyticData(6, num_road_closed);
|
||||
analyticData(5, num_traffic_check);
|
||||
analyticData(7, num_shop_discount);
|
||||
analyticData(8, num_fours_shop);
|
||||
}
|
||||
}
|
||||
getMapUIController().changeZoom(10);
|
||||
getMapUIController().changeZoom(12);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制Marker
|
||||
* 统计地图内数据获取
|
||||
*
|
||||
* @param type 类型
|
||||
* @param num marker数量
|
||||
*/
|
||||
private static void analyticData(int type, int num) {
|
||||
try {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
properties.put("num", num);
|
||||
getMogoAnalytics().track("Launcher_Data_Get", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制Marker,这里绘制的会使用markerShowEntities队列进行维护
|
||||
*/
|
||||
public static IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity) {
|
||||
Logger.e(TAG, "绘制Marker====markerTag:" + markerShowEntity);
|
||||
Logger.e(TAG, "绘制Marker====drawMapMarker:" + markerShowEntity);
|
||||
try {
|
||||
if (markerShowEntity.getMarkerLocation() != null) {
|
||||
View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity);
|
||||
|
||||
if (markerShowEntity.getMarkerLocation() != null) {
|
||||
View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity);
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(markerShowEntity.getMarkerType())
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
options.icon(markerView);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(markerShowEntity.getMarkerType())
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
options.icon(markerView);
|
||||
|
||||
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
marker.setObject(markerShowEntity);
|
||||
return marker;
|
||||
} else {
|
||||
Logger.e(TAG, "Location 必须进行初始化!!!!!");
|
||||
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
marker.setObject(markerShowEntity);
|
||||
marker.setAlpha(0.7f);
|
||||
return marker;
|
||||
} else {
|
||||
Logger.e(TAG, "Location 必须进行初始化!!!!!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//TODO 这里是用来测试的
|
||||
public static void drawMapMarker() {
|
||||
// Logger.e(TAG, "=====绘制Marker====");
|
||||
//
|
||||
// MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
//
|
||||
// MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
// .icon(mapMarkerView)
|
||||
// .owner("CARD_TYPE_USER_DATA")
|
||||
// .latitude(39.574525d + new Random().nextDouble())
|
||||
// .longitude(116.21733d + new Random().nextDouble());
|
||||
// IMogoMarker marker = getMarkerManager().addMarker("CARD_TYPE_USER_DATA", options);
|
||||
// marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
// marker.setObject("我是Marker上面绑定的数据");
|
||||
//
|
||||
// getMapUIController().changeZoom(8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,12 +472,10 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -527,4 +525,14 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mStatusManager.setADASUIShow( getModuleName(), status == 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,9 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final String CARD_TYPE_USER_DATA = "CARD_TYPE_USER_DATA";
|
||||
|
||||
/**
|
||||
* 卡片 新鲜事
|
||||
*/
|
||||
public static final String CARD_TYPE_NOVELTY = "CARD_TYPE_NOVELTY";
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
@@ -29,7 +30,7 @@ public abstract class MapMarkerBaseView extends ConstraintLayout {
|
||||
protected Context mContext;
|
||||
|
||||
protected MogoImageView ivUserHead;
|
||||
protected ImageView ivIconForeground;
|
||||
protected ImageView ivIcon;
|
||||
protected ImageView ivCar;
|
||||
|
||||
public MapMarkerBaseView(Context context) {
|
||||
@@ -55,6 +56,7 @@ public abstract class MapMarkerBaseView extends ConstraintLayout {
|
||||
public abstract void updateView(MarkerShowEntity markerShowEntity);
|
||||
|
||||
protected void loadImageWithMarker(MarkerShowEntity markerShowEntity) {
|
||||
|
||||
if (!TextUtils.isEmpty(markerShowEntity.getIconUrl())) {
|
||||
MarkerServiceHandler
|
||||
.getImageloader()
|
||||
@@ -69,15 +71,17 @@ public abstract class MapMarkerBaseView extends ConstraintLayout {
|
||||
|
||||
@Override
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 刷新图标
|
||||
Logger.d(TAG, "loaded.");
|
||||
Logger.d(TAG, "loadImageWithMarker loaded.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
|
||||
Logger.e(TAG, "loadImageWithMarker onFailure.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ivUserHead.setBackgroundResource(R.drawable.icon_default_user_head);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.R;
|
||||
@@ -28,7 +30,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
private String TAG = "MapMarkerInfoView";
|
||||
|
||||
private TextView tvMarkerContent;
|
||||
private ConstraintLayout llMarkerContent;
|
||||
private ConstraintLayout clMarkerContent;
|
||||
private ImageView ivReverseTriangle;
|
||||
|
||||
public MapMarkerInfoView(Context context) {
|
||||
@@ -51,8 +53,8 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
protected void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_map_marker_info, this);
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
ivIconForeground = findViewById(R.id.ivIconForeground);
|
||||
llMarkerContent = findViewById(R.id.llMarkerContent);
|
||||
ivIcon = findViewById(R.id.ivIcon);
|
||||
clMarkerContent = findViewById(R.id.clMarkerContent);
|
||||
ivReverseTriangle = findViewById(R.id.ivReverseTriangle);
|
||||
ivCar = findViewById(R.id.ivCar);
|
||||
tvMarkerContent = findViewById(R.id.tvMarkerContent);
|
||||
@@ -64,53 +66,103 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
case ServiceConst
|
||||
.CARD_TYPE_CARS_CHATTING:
|
||||
ivIconForeground.setVisibility(View.GONE);
|
||||
case ServiceConst
|
||||
.CARD_TYPE_USER_DATA:
|
||||
ivIconForeground.setVisibility(View.GONE);
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
ivUserHead.setVisibility(View.VISIBLE);
|
||||
ivIcon.setVisibility(View.INVISIBLE);
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_car_blue);
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
|
||||
if (bindObj instanceof MarkerOnlineCar) {
|
||||
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
|
||||
llMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
} else {
|
||||
llMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple);
|
||||
}
|
||||
}
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
|
||||
break;
|
||||
case ServiceConst
|
||||
.CARD_TYPE_ROAD_CONDITION:
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
break;
|
||||
case ServiceConst
|
||||
.CARD_TYPE_SHARE_MUSIC:
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
|
||||
if (bindObj instanceof MarkerNoveltyInfo) {
|
||||
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_refuel);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_orange_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_orange);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_green_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_green);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_off);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP:
|
||||
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_green_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_green);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
|
||||
if (bindObj instanceof MarkerShareMusic) {
|
||||
// 2 为书籍听书,3 为新闻,1 为qq音乐,int
|
||||
switch (((MarkerShareMusic) bindObj).getShareType()) {
|
||||
case 1:
|
||||
ivUserHead.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
break;
|
||||
case 2:
|
||||
ivUserHead.setImageResource(R.drawable.icon_map_marker_book);
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_book);
|
||||
break;
|
||||
case 3:
|
||||
ivUserHead.setImageResource(R.drawable.icon_map_marker_news);
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_news);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ivIconForeground.setVisibility(View.VISIBLE);
|
||||
llMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple);
|
||||
break;
|
||||
}
|
||||
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) {
|
||||
tvMarkerContent.setText(markerShowEntity.getTextContent());
|
||||
String content;
|
||||
if (markerShowEntity.getTextContent().length() > 8) {
|
||||
content = markerShowEntity.getTextContent().substring(0, 7) + "...";
|
||||
} else {
|
||||
content = markerShowEntity.getTextContent();
|
||||
}
|
||||
tvMarkerContent.setText(content);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -8,7 +8,9 @@ import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.R;
|
||||
@@ -44,11 +46,9 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
}
|
||||
|
||||
protected void initView(Context context) {
|
||||
setBackground(null);
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.view_map_marker, this);
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
ivIconForeground = findViewById(R.id.ivIconForeground);
|
||||
ivIcon = findViewById(R.id.ivIcon);
|
||||
ivCar = findViewById(R.id.ivCar);
|
||||
ivBg = findViewById(R.id.ivBg);
|
||||
}
|
||||
@@ -56,14 +56,14 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
public void updateView(MarkerShowEntity markerShowEntity) {
|
||||
try {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
case ServiceConst
|
||||
.CARD_TYPE_CARS_CHATTING:
|
||||
ivIconForeground.setVisibility(View.GONE);
|
||||
case ServiceConst
|
||||
.CARD_TYPE_USER_DATA:
|
||||
ivIconForeground.setVisibility(View.GONE);
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
ivUserHead.setVisibility(View.VISIBLE);
|
||||
ivIcon.setVisibility(View.INVISIBLE);
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_car_blue);
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
|
||||
if (bindObj instanceof MarkerOnlineCar) {
|
||||
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
|
||||
@@ -72,33 +72,71 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_purple);
|
||||
}
|
||||
}
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
break;
|
||||
case ServiceConst
|
||||
.CARD_TYPE_ROAD_CONDITION:
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
break;
|
||||
case ServiceConst
|
||||
.CARD_TYPE_SHARE_MUSIC:
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_green);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
|
||||
if (bindObj instanceof MarkerNoveltyInfo) {
|
||||
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
|
||||
case MarkerPoiTypeEnum.GAS_STATION:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_refuel);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_oragne);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_green);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_off);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_dark_blue);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
|
||||
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_SHOP:
|
||||
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_green);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_purple);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
|
||||
|
||||
if (bindObj instanceof MarkerShareMusic) {
|
||||
// 2 为书籍听书,3 为新闻,1 为qq音乐,int
|
||||
switch (((MarkerShareMusic) bindObj).getShareType()) {
|
||||
case 1:
|
||||
ivUserHead.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
break;
|
||||
case 2:
|
||||
ivUserHead.setImageResource(R.drawable.icon_map_marker_book);
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_book);
|
||||
break;
|
||||
case 3:
|
||||
ivUserHead.setImageResource(R.drawable.icon_map_marker_news);
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_news);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ivIconForeground.setVisibility(View.VISIBLE);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_purple);
|
||||
break;
|
||||
}
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -57,7 +57,7 @@ public class RefreshModel {
|
||||
if ( mRefreshApiService != null ) {
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.limit = 20;
|
||||
refreshBody.limit = 5;
|
||||
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
|
||||
refreshBody.radius = radius;
|
||||
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 905 B |
@@ -12,7 +12,7 @@
|
||||
android:layout_width="@dimen/dp_34"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:src="@drawable/icon_map_marker_car_gray"
|
||||
android:translationY="-5dp"
|
||||
android:translationY="-10dp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/ivBg"
|
||||
app:layout_constraintStart_toStartOf="@+id/ivBg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivBg" />
|
||||
@@ -22,7 +22,7 @@
|
||||
android:layout_width="@dimen/dp_68"
|
||||
android:layout_height="@dimen/dp_85"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/bg_map_marker_green"
|
||||
android:src="@drawable/bg_map_marker_blue"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -36,22 +36,22 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:miv_failureHolder="@drawable/icon_default"
|
||||
app:miv_overlayImageId="@drawable/icon_default"
|
||||
app:miv_placeHolder="@drawable/icon_default"
|
||||
app:miv_failureHolder="@drawable/icon_default_user_head"
|
||||
app:miv_overlayImageId="@drawable/icon_default_user_head"
|
||||
app:miv_placeHolder="@drawable/icon_default_user_head"
|
||||
app:miv_shape="circle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivIconForeground"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:id="@+id/ivIcon"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:src="@drawable/icon_map_marker_music_play"
|
||||
android:layout_marginTop="@dimen/dp_14"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/icon_map_marker_road_block_up"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</merge >
|
||||
@@ -13,16 +13,16 @@
|
||||
android:layout_width="@dimen/dp_34"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:src="@drawable/icon_map_marker_car_gray"
|
||||
android:translationY="-5dp"
|
||||
android:translationY="-10dp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/ivReverseTriangle"
|
||||
app:layout_constraintStart_toStartOf="@+id/ivReverseTriangle"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivReverseTriangle" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/llMarkerContent"
|
||||
android:id="@+id/clMarkerContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_74"
|
||||
android:background="@drawable/bg_map_marker_green_info"
|
||||
android:background="@drawable/bg_map_marker_blue_info"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" >
|
||||
@@ -33,29 +33,32 @@
|
||||
android:layout_height="@dimen/dp_60"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:miv_failureHolder="@drawable/icon_default"
|
||||
app:miv_overlayImageId="@drawable/icon_default"
|
||||
app:miv_placeHolder="@drawable/icon_default"
|
||||
app:miv_failureHolder="@drawable/icon_default_user_head"
|
||||
app:miv_overlayImageId="@drawable/icon_default_user_head"
|
||||
app:miv_placeHolder="@drawable/icon_default_user_head"
|
||||
app:miv_shape="circle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivIconForeground"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:id="@+id/ivIcon"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:src="@drawable/icon_map_marker_music_play"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="@+id/ivUserHead"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivUserHead"
|
||||
android:layout_marginLeft="@dimen/dp_14"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/icon_map_marker_road_block_up"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMarkerContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="@dimen/sp_32"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivUserHead"
|
||||
@@ -65,14 +68,14 @@
|
||||
tools:text="诗一样的女子" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout >
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivReverseTriangle"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:src="@drawable/bg_shape_reverse_triangle_green"
|
||||
app:layout_constraintEnd_toEndOf="@+id/llMarkerContent"
|
||||
app:layout_constraintStart_toStartOf="@+id/llMarkerContent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/llMarkerContent" />
|
||||
android:src="@drawable/bg_shape_reverse_triangle_blue"
|
||||
app:layout_constraintEnd_toEndOf="@+id/clMarkerContent"
|
||||
app:layout_constraintStart_toStartOf="@+id/clMarkerContent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clMarkerContent" />
|
||||
|
||||
|
||||
</merge >
|
||||
@@ -66,15 +66,14 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btn_block_layout) {
|
||||
if (id == R.id.btn_block_layout) { //拥堵
|
||||
sendShareReceiver("1");
|
||||
} else if (id == R.id.oil_price_layout) {
|
||||
//TODO
|
||||
|
||||
} else if (id == R.id.traffic_check_layout) {
|
||||
sendShareReceiver("2");
|
||||
} else if (id == R.id.road_closure_layout) {
|
||||
} else if (id == R.id.traffic_check_layout) { //交通检查
|
||||
sendShareReceiver("2");
|
||||
} else if (id == R.id.road_closure_layout) { //封路
|
||||
sendShareReceiver("3");
|
||||
}
|
||||
|
||||
dismiss();
|
||||
|
||||
@@ -11,4 +11,8 @@ public class TanluConstants {
|
||||
public static final String TAG = "/tanlu/ui";
|
||||
public static final String NAVI_INFO = "navi_info";
|
||||
public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
|
||||
public static final String UPLOAD_ROAD_CONDITION = "upload_road_condition";
|
||||
|
||||
}
|
||||
|
||||
@@ -83,4 +83,14 @@ public class TanluCardViewProvider implements IMogoModuleProvider {
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return "探路";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ import java.util.ArrayList;
|
||||
* @since 2020-01-05
|
||||
*/
|
||||
public class Information extends BaseData implements Parcelable {
|
||||
private int type;
|
||||
private Double lon;
|
||||
private Double lat;
|
||||
private String addr;
|
||||
private Long generateTime;
|
||||
private String cityName;
|
||||
private ArrayList<Items> items;
|
||||
private int distance;
|
||||
private String nickName;
|
||||
private String headImgUrl;
|
||||
public int type;
|
||||
public Double lon;
|
||||
public Double lat;
|
||||
public String addr;
|
||||
public Long generateTime;
|
||||
public String cityName;
|
||||
public ArrayList<Items> items;
|
||||
public int distance;
|
||||
public String nickName;
|
||||
public String headImgUrl;
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,12 +8,12 @@ import java.io.Serializable;
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class MarkerInfo implements Serializable {
|
||||
public int type; //封路,还是上报
|
||||
public String type; //封路,还是上报
|
||||
public String imageUrl;
|
||||
public Long lon; //经度
|
||||
public Long lat; //纬度
|
||||
|
||||
public MarkerInfo(int type, String imageUrl, Long lon, Long lat) {
|
||||
public MarkerInfo(String type, /*String imageUrl,*/ Long lon, Long lat) {
|
||||
this.type = type;
|
||||
this.imageUrl = imageUrl;
|
||||
this.lon = lon;
|
||||
|
||||
@@ -13,11 +13,11 @@ import org.greenrobot.eventbus.EventBus
|
||||
class MarkerInfoReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action == "com.zhidao.roadcondition.marker.info"){
|
||||
var imageUrl = intent.getStringExtra("imageUrl")
|
||||
var type = intent.getStringExtra("type")
|
||||
var lat = intent.getLongExtra("lat",0)
|
||||
var lon = intent.getLongExtra("lon",0) //经度
|
||||
Log.d("MarkerInfoReceiver", "imageUrl = $imageUrl ---->lat = $lat ---->lon = $lon")
|
||||
EventBus.getDefault().post(MarkerInfo(1, imageUrl, lon, lat))
|
||||
Log.d("MarkerInfoReceiver", "type = $type ---->lat = $lat ---->lon = $lon")
|
||||
EventBus.getDefault().post(MarkerInfo(type, lon, lat))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 17 KiB |
@@ -15,7 +15,6 @@ import java.util.Map;
|
||||
@Keep
|
||||
public interface IMogoAnalytics extends IProvider {
|
||||
|
||||
|
||||
/**
|
||||
* 埋点
|
||||
*
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.service.cardmanager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-14
|
||||
* <p>
|
||||
* 卡片切换监听
|
||||
*/
|
||||
public interface IMogoCardChangedListener {
|
||||
|
||||
void onSwitched( int position, String moduleName );
|
||||
}
|
||||
@@ -16,4 +16,22 @@ public interface IMogoCardManager extends IProvider {
|
||||
* @param cardType
|
||||
*/
|
||||
void switch2( String cardType );
|
||||
|
||||
/**
|
||||
* 注册卡片切换监听
|
||||
*/
|
||||
void registerCardChangedListener( String tag, IMogoCardChangedListener listener );
|
||||
|
||||
/**
|
||||
* 注销卡片监听
|
||||
*/
|
||||
void unregisterCardChangedListener( String tag );
|
||||
|
||||
/**
|
||||
* 回调
|
||||
*
|
||||
* @param position 卡片位置
|
||||
* @param moduleName 卡片名称
|
||||
*/
|
||||
void invoke( int position, String moduleName );
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.main.fragmentmanager;
|
||||
package com.mogo.service.fragmentmanager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -8,5 +8,8 @@ package com.mogo.module.main.fragmentmanager;
|
||||
*/
|
||||
public interface FragmentStackTransactionListener {
|
||||
|
||||
void onTransaction();
|
||||
/**
|
||||
* @param size 栈内的fragment数量
|
||||
*/
|
||||
void onTransaction( int size );
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.service.fragmentmanager;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
@@ -33,4 +35,26 @@ public interface IMogoFragmentManager extends IProvider {
|
||||
* 退出栈中所有fragment
|
||||
*/
|
||||
void clearAll();
|
||||
|
||||
/**
|
||||
* 主页注册栈变化监听
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerMainFragmentStackTransactionListener( FragmentStackTransactionListener listener );
|
||||
|
||||
/**
|
||||
* 其他注册栈变化监听
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void addMainFragmentStackTransactionListener( FragmentStackTransactionListener listener );
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param activity
|
||||
* @param containerId
|
||||
*/
|
||||
void init( AppCompatActivity activity, int containerId );
|
||||
}
|
||||
|
||||
@@ -96,4 +96,18 @@ public interface IMogoModuleProvider extends IProvider {
|
||||
*/
|
||||
@Deprecated
|
||||
IMogoMarkerClickListener getMarkerClickListener();
|
||||
|
||||
/**
|
||||
* 获取模块对应 app 的包名
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getAppPackage();
|
||||
|
||||
/**
|
||||
* 获取对应模块 app 名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getAppName();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.service.voice;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.mogo.service.voice;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.main.fragmentmanager;
|
||||
package com.mogo.service.impl.fragmentmanager;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
@@ -7,8 +7,11 @@ import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
@@ -31,6 +34,7 @@ public class FragmentStack {
|
||||
private FragmentDescriptor mCurrentFragment;
|
||||
|
||||
private FragmentStackTransactionListener mFragmentStackTransactionListener;
|
||||
private List< FragmentStackTransactionListener > mFragmentStackTransactionListeners = new ArrayList<>();
|
||||
|
||||
private FragmentStack() {
|
||||
}
|
||||
@@ -82,9 +86,12 @@ public class FragmentStack {
|
||||
mFragmentStack.push( descriptor );
|
||||
mCurrentFragment = descriptor;
|
||||
|
||||
if ( descriptor.isNotifyMainModule() && getFragmentStackTransactionListener() != null ) {
|
||||
getFragmentStackTransactionListener().onTransaction();
|
||||
if ( descriptor.isNotifyMainModule() ) {
|
||||
if ( mFragmentStackTransactionListener != null ) {
|
||||
mFragmentStackTransactionListener.onTransaction(getStackSize());
|
||||
}
|
||||
}
|
||||
invokeCallback();
|
||||
}
|
||||
|
||||
public void pop() {
|
||||
@@ -100,9 +107,12 @@ public class FragmentStack {
|
||||
}
|
||||
if ( mFragmentStack.isEmpty() ) {
|
||||
mFragmentTransaction.commitAllowingStateLoss();
|
||||
if ( mCurrentFragment.isNotifyMainModule() && getFragmentStackTransactionListener() != null ) {
|
||||
getFragmentStackTransactionListener().onTransaction();
|
||||
if ( mCurrentFragment.isNotifyMainModule() ) {
|
||||
if ( mFragmentStackTransactionListener != null ) {
|
||||
mFragmentStackTransactionListener.onTransaction(getStackSize());
|
||||
}
|
||||
}
|
||||
invokeCallback();
|
||||
mCurrentFragment = null;
|
||||
return;
|
||||
}
|
||||
@@ -112,12 +122,23 @@ public class FragmentStack {
|
||||
mFragmentTransaction.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
if ( mCurrentFragment.isNotifyMainModule() && getFragmentStackTransactionListener() != null ) {
|
||||
getFragmentStackTransactionListener().onTransaction();
|
||||
if ( mCurrentFragment.isNotifyMainModule() ) {
|
||||
if ( mFragmentStackTransactionListener != null ) {
|
||||
mFragmentStackTransactionListener.onTransaction(getStackSize());
|
||||
}
|
||||
}
|
||||
invokeCallback();
|
||||
mCurrentFragment = fragment;
|
||||
}
|
||||
|
||||
private void invokeCallback() {
|
||||
if ( mFragmentStackTransactionListeners != null ) {
|
||||
for ( FragmentStackTransactionListener fragmentStackTransactionListener : mFragmentStackTransactionListeners ) {
|
||||
fragmentStackTransactionListener.onTransaction(getStackSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return mFragmentStack.isEmpty();
|
||||
}
|
||||
@@ -126,8 +147,8 @@ public class FragmentStack {
|
||||
return mFragmentStack.size();
|
||||
}
|
||||
|
||||
public FragmentStackTransactionListener getFragmentStackTransactionListener() {
|
||||
return mFragmentStackTransactionListener;
|
||||
public void addFragmentStackTransactionListener( FragmentStackTransactionListener fragmentStackTransactionListener ) {
|
||||
this.mFragmentStackTransactionListeners.add( fragmentStackTransactionListener );
|
||||
}
|
||||
|
||||
public void setFragmentStackTransactionListener( FragmentStackTransactionListener fragmentStackTransactionListener ) {
|
||||
@@ -145,8 +166,9 @@ public class FragmentStack {
|
||||
mFragmentTransaction.commitAllowingStateLoss();
|
||||
mFragmentStack.clear();
|
||||
mCurrentFragment = null;
|
||||
if ( getFragmentStackTransactionListener() != null ) {
|
||||
getFragmentStackTransactionListener().onTransaction();
|
||||
if ( mFragmentStackTransactionListener != null ) {
|
||||
mFragmentStackTransactionListener.onTransaction(getStackSize());
|
||||
}
|
||||
invokeCallback();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mogo.module.main.fragmentmanager;
|
||||
package com.mogo.service.impl.fragmentmanager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
|
||||
/**
|
||||
@@ -36,6 +39,21 @@ public class MogoFragmentManager implements IMogoFragmentManager {
|
||||
FragmentStack.getInstance().clearAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ) {
|
||||
FragmentStack.getInstance().setFragmentStackTransactionListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ) {
|
||||
FragmentStack.getInstance().addFragmentStackTransactionListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( AppCompatActivity activity, int containerId ) {
|
||||
FragmentStack.getInstance().init( activity, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
@@ -20,21 +20,17 @@ public class MogoVoiceManager implements IMogoVoiceManager {
|
||||
|
||||
@Override
|
||||
public void unregisterIntentListener( String command ) {
|
||||
IntentManager.getInstance().unregisterIntentListener( command );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke( String command, Intent intent ) {
|
||||
IntentManager.getInstance().invoke( command, intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIntentListener( String intent, IMogoIntentListener listener ) {
|
||||
IntentManager.getInstance().registerIntentListener( intent, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
IntentManager.getInstance().init( context );
|
||||
}
|
||||
}
|
||||
|
||||