add apis
This commit is contained in:
@@ -68,7 +68,7 @@ MOGO_MODULE_ONLINECAR_VERSION=1.0.3.1
|
||||
# v2x
|
||||
MOGO_MODULE_V2X_VERSION=1.0.3.3-SNAPSHOT
|
||||
# 媒体卡片
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.4.2
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.4.3
|
||||
# 推送
|
||||
MOGO_MODULE_PUSH_VERSION=1.0.1
|
||||
# 广告资源位
|
||||
|
||||
@@ -2,11 +2,15 @@ package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -45,7 +49,10 @@ import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -64,7 +71,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
IMogoNaviListener,
|
||||
IMogoMapListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoAcquireAuthorizeListener {
|
||||
IMogoAcquireAuthorizeListener,
|
||||
IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
@@ -74,7 +82,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
private View mHome;
|
||||
private View mCompany;
|
||||
|
||||
private View mUploadRoadCondition;
|
||||
private TextView mUploadRoadCondition;
|
||||
|
||||
private View mVRMode;
|
||||
private View mMove2CurrentLocation;
|
||||
@@ -109,6 +117,24 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
public static boolean isClickShare;
|
||||
|
||||
@DrawableRes
|
||||
private int[] mUploadingFrameRes = {
|
||||
R.drawable.amap_route_color_texture_0_arrow,
|
||||
R.drawable.amap_route_color_texture_1_arrow,
|
||||
R.drawable.amap_route_color_texture_2_arrow,
|
||||
R.drawable.amap_route_color_texture_3_arrow,
|
||||
R.drawable.amap_route_color_texture_4_arrow,
|
||||
R.drawable.amap_route_color_texture_5_arrow,
|
||||
R.drawable.amap_route_color_texture_6_arrow,
|
||||
R.drawable.amap_route_color_texture_7_arrow,
|
||||
R.drawable.amap_route_color_texture_8_arrow,
|
||||
R.drawable.amap_route_color_texture_9_arrow,
|
||||
};
|
||||
private int mCurrentUploadFrame = 0;
|
||||
private Handler mUploadFrameAnimHandler;
|
||||
public static final int MSG_FRAME_ANIM = 307;
|
||||
public static final long TIME_FRAME_INTERVAL_TIME = 200;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
@@ -251,6 +277,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener( TAG, this );
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager( getContext() );
|
||||
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.UPLOADING, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -436,4 +464,47 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( mUploadRoadCondition == null ) {
|
||||
return;
|
||||
}
|
||||
if ( descriptor == StatusDescriptor.UPLOADING ) {
|
||||
if ( isTrue ) {
|
||||
doFrameAnimOnUploadButton();
|
||||
} else {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
mUploadRoadCondition.setText( R.string.module_map_str_upload_road_condition );
|
||||
mUploadRoadCondition.setBackgroundResource( R.drawable.module_ext_dw_upload_road_condition_bkg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doFrameAnimOnUploadButton() {
|
||||
if ( mUploadFrameAnimHandler == null ) {
|
||||
mUploadFrameAnimHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == MSG_FRAME_ANIM ) {
|
||||
if ( mUploadingFrameRes == null || mUploadingFrameRes.length == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( !mMogoStatusManager.isUploading() ) {
|
||||
mCurrentUploadFrame = 0;
|
||||
if ( mUploadRoadCondition != null ) {
|
||||
mUploadRoadCondition.setText( R.string.module_map_str_upload_road_condition );
|
||||
mUploadRoadCondition.setBackgroundResource( R.drawable.module_ext_dw_upload_road_condition_bkg );
|
||||
}
|
||||
return;
|
||||
}
|
||||
mUploadRoadCondition.setBackgroundResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM, TIME_FRAME_INTERVAL_TIME );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
button2.setVisibility( View.GONE );
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
boolean status1 = intent.getBooleanExtra( "status", false );
|
||||
MarkerServiceHandler.getMogoStatusManager().setUploadingStatus( TAG, status1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,13 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isDisplayOverview();
|
||||
|
||||
/**
|
||||
* 是否在查看全程状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isUploading();
|
||||
|
||||
/**
|
||||
* 设置小智语音UI状态
|
||||
*
|
||||
@@ -196,6 +203,14 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setDisplayOverview( String tag, boolean display );
|
||||
|
||||
/**
|
||||
* 设置展示全程状态
|
||||
*
|
||||
* @param tag
|
||||
* @param uploading
|
||||
*/
|
||||
void setUploadingStatus( String tag, boolean uploading );
|
||||
|
||||
/**
|
||||
* 注册监听
|
||||
*
|
||||
|
||||
@@ -69,5 +69,10 @@ public enum StatusDescriptor {
|
||||
/**
|
||||
* 展示全程
|
||||
*/
|
||||
DISPLAY_OVERVIEW;
|
||||
DISPLAY_OVERVIEW,
|
||||
|
||||
/**
|
||||
* 上报状态
|
||||
*/
|
||||
UPLOADING;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,11 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val( StatusDescriptor.DISPLAY_OVERVIEW );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUploading() {
|
||||
return get_bool_val( StatusDescriptor.UPLOADING );
|
||||
}
|
||||
|
||||
private boolean get_bool_val( StatusDescriptor descriptor ) {
|
||||
Boolean val = mStatus.get( descriptor );
|
||||
return val == null ? false : val;
|
||||
@@ -117,37 +122,27 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
|
||||
@Override
|
||||
public void setVoiceUIShow( String tag, boolean show ) {
|
||||
mStatus.put( StatusDescriptor.VOICE_UI, show );
|
||||
invokeStatusChangedListener( StatusDescriptor.VOICE_UI, show );
|
||||
recordStatusModifier( tag, StatusDescriptor.VOICE_UI );
|
||||
doSetStatus( tag, StatusDescriptor.VOICE_UI, show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setADASUIShow( String tag, boolean show ) {
|
||||
mStatus.put( StatusDescriptor.ADAS_UI, show );
|
||||
invokeStatusChangedListener( StatusDescriptor.ADAS_UI, show );
|
||||
recordStatusModifier( tag, StatusDescriptor.ADAS_UI );
|
||||
doSetStatus( tag, StatusDescriptor.ADAS_UI, show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setV2XUIShow( String tag, boolean show ) {
|
||||
mStatus.put( StatusDescriptor.V2X_UI, show );
|
||||
invokeStatusChangedListener( StatusDescriptor.V2X_UI, show );
|
||||
recordStatusModifier( tag, StatusDescriptor.V2X_UI );
|
||||
Logger.e( TAG, "do not implement" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPushUIShow( String tag, boolean show ) {
|
||||
mStatus.put( StatusDescriptor.PUSH_UI, show );
|
||||
invokeStatusChangedListener( StatusDescriptor.PUSH_UI, show );
|
||||
recordStatusModifier( tag, StatusDescriptor.PUSH_UI );
|
||||
doSetStatus( tag, StatusDescriptor.PUSH_UI, show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccStatus( String tag, boolean isOn ) {
|
||||
mStatus.put( StatusDescriptor.ACC_STATUS, isOn );
|
||||
invokeStatusChangedListener( StatusDescriptor.ACC_STATUS, isOn );
|
||||
recordStatusModifier( tag, StatusDescriptor.ACC_STATUS );
|
||||
doSetStatus( tag, StatusDescriptor.ACC_STATUS, isOn );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,44 +157,43 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
|
||||
@Override
|
||||
public void setSearchUIShow( String tag, boolean isShow ) {
|
||||
mStatus.put( StatusDescriptor.SEARCH_UI, isShow );
|
||||
invokeStatusChangedListener( StatusDescriptor.SEARCH_UI, isShow );
|
||||
recordStatusModifier( tag, StatusDescriptor.SEARCH_UI );
|
||||
doSetStatus( tag, StatusDescriptor.SEARCH_UI, isShow );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppListUIShow( String tag, boolean isShow ) {
|
||||
mStatus.put( StatusDescriptor.APP_LIST_UI, isShow );
|
||||
invokeStatusChangedListener( StatusDescriptor.APP_LIST_UI, isShow );
|
||||
recordStatusModifier( tag, StatusDescriptor.APP_LIST_UI );
|
||||
doSetStatus( tag, StatusDescriptor.APP_LIST_UI, isShow );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainPageResumeStatus( String tag, boolean resume ) {
|
||||
mStatus.put( StatusDescriptor.MAIN_PAGE_RESUME, resume );
|
||||
invokeStatusChangedListener( StatusDescriptor.MAIN_PAGE_RESUME, resume );
|
||||
recordStatusModifier( tag, StatusDescriptor.MAIN_PAGE_RESUME );
|
||||
doSetStatus( tag, StatusDescriptor.MAIN_PAGE_RESUME, resume );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAIAssistReady( String tag, boolean ready ) {
|
||||
mStatus.put( StatusDescriptor.AI_ASSIST_READY, ready );
|
||||
invokeStatusChangedListener( StatusDescriptor.AI_ASSIST_READY, ready );
|
||||
recordStatusModifier( tag, StatusDescriptor.AI_ASSIST_READY );
|
||||
doSetStatus( tag, StatusDescriptor.AI_ASSIST_READY, ready );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeekHelping( String tag, boolean seekHelping ) {
|
||||
mStatus.put( StatusDescriptor.SEEK_HELPING, seekHelping );
|
||||
invokeStatusChangedListener( StatusDescriptor.SEEK_HELPING, seekHelping );
|
||||
recordStatusModifier( tag, StatusDescriptor.SEEK_HELPING );
|
||||
doSetStatus( tag, StatusDescriptor.SEEK_HELPING, seekHelping );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayOverview( String tag, boolean display ) {
|
||||
mStatus.put( StatusDescriptor.DISPLAY_OVERVIEW, display );
|
||||
invokeStatusChangedListener( StatusDescriptor.DISPLAY_OVERVIEW, display );
|
||||
recordStatusModifier( tag, StatusDescriptor.DISPLAY_OVERVIEW );
|
||||
doSetStatus( tag, StatusDescriptor.DISPLAY_OVERVIEW, display );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUploadingStatus( String tag, boolean uploading ) {
|
||||
doSetStatus( tag, StatusDescriptor.UPLOADING, uploading );
|
||||
}
|
||||
|
||||
private void doSetStatus(String tag, StatusDescriptor target, boolean value){
|
||||
mStatus.put( target, value );
|
||||
invokeStatusChangedListener( target, value );
|
||||
recordStatusModifier( tag, target );
|
||||
}
|
||||
|
||||
private void invokeStatusChangedListener( StatusDescriptor descriptor, boolean status ) {
|
||||
|
||||
Reference in New Issue
Block a user