merge
This commit is contained in:
@@ -141,7 +141,7 @@ ext {
|
||||
|
||||
// gps 模拟
|
||||
gpssimulator : "com.mogo.module:module-gps-simulator:${MOGO_MODULE_GPS_SIMULATOR_VERSION}",
|
||||
gpssimulatordebug : "com.mogo.module:mogo-module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:mogo-module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
]
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import com.mogo.map.impl.amap.AMapWrapper;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageManager;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
@@ -61,7 +62,7 @@ public class NaviClient implements IMogoNavi {
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation;
|
||||
private IMogoCarLocationChangedListener mCarLocationChangedListener;
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener;
|
||||
private LocationSource.OnLocationChangedListener mOnLocationChangedListener;
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
@@ -260,7 +261,12 @@ public class NaviClient implements IMogoNavi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener listener ) {
|
||||
public Location getCarLocation2() {
|
||||
return mCarLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
mCarLocationChangedListener = listener;
|
||||
}
|
||||
|
||||
@@ -269,7 +275,7 @@ public class NaviClient implements IMogoNavi {
|
||||
public void syncCarLocation( Location location ) {
|
||||
mCarLocation = location;
|
||||
if ( mCarLocationChangedListener != null ) {
|
||||
mCarLocationChangedListener.onCarLocationChanged( getCarLocation() );
|
||||
mCarLocationChangedListener.onCarLocationChanged2( mCarLocation );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-14
|
||||
* <p>
|
||||
* 车辆位置变化
|
||||
*/
|
||||
public interface IMogoCarLocationChangedListener2 extends IMogoCarLocationChangedListener {
|
||||
|
||||
void onCarLocationChanged2( Location latLng );
|
||||
}
|
||||
@@ -144,12 +144,19 @@ public interface IMogoNavi {
|
||||
*/
|
||||
MogoLatLng getCarLocation();
|
||||
|
||||
/**
|
||||
* 获取车标经纬度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Location getCarLocation2();
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener listener );
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener );
|
||||
|
||||
/**
|
||||
* 打开巡航模式
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.location.Location;
|
||||
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
@@ -176,7 +177,15 @@ public class MogoNavi implements IMogoNavi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener listener ) {
|
||||
public Location getCarLocation2() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getCarLocation2();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.registerCarLocationChangedListener( listener );
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
./gradlew :libraries:mogo-map-api:clean :libraries:mogo-map-api:uploadArchives
|
||||
./gradlew :libraries:map-amap:clean :libraries:map-amap:uploadArchives
|
||||
./gradlew :libraries:mogo-map:clean :libraries:mogo-map:uploadArchives
|
||||
./gradlew :services:mogo-service-api:clean :services:mogo-service-api:uploadArchives
|
||||
./gradlew :services:mogo-service:clean :services:mogo-service:uploadArchives
|
||||
./gradlew :modules:mogo-module-extensions:clean :modules:mogo-module-extensions:uploadArchives
|
||||
@@ -39,6 +39,7 @@ import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
@@ -221,6 +222,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
}
|
||||
} );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON1, findViewById( R.id.module_entrance_id_button1 ) );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON2, findViewById( R.id.module_entrance_id_button2 ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_ENTRANCE_BUTTON_API )
|
||||
public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonController {
|
||||
|
||||
@Override
|
||||
public TextView getButton( ButtonIndex index ) {
|
||||
return MogoEntranceButtons.getButton( index );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoEntranceButtons {
|
||||
|
||||
private static Map< ButtonIndex, TextView > sButtons = new HashMap<>();
|
||||
|
||||
public static void save( ButtonIndex index, TextView btn ) {
|
||||
sButtons.put( index, btn );
|
||||
}
|
||||
|
||||
public static TextView getButton( ButtonIndex index ) {
|
||||
return sButtons.get( index );
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
sButtons.clear();
|
||||
}
|
||||
}
|
||||
@@ -80,8 +80,8 @@
|
||||
android:layout_marginRight="@dimen/module_ext_speed_limit_marginRight"
|
||||
android:background="@drawable/module_ext_dw_speed_limit_bkg"
|
||||
android:gravity="center"
|
||||
android:visibility="invisible"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
@@ -116,18 +116,18 @@
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_north"
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:text="@string/mode_north_up"
|
||||
android:paddingTop="@dimen/dp_14"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_marginTop="@dimen/dp_33"
|
||||
android:background="@drawable/shape_react_gray_round"
|
||||
android:drawableTop="@drawable/selector_icon_north_up"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_entrance_id_navi_info_panel"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingTop="@dimen/dp_14"
|
||||
android:text="@string/mode_north_up"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_entrance_id_navi_info_panel"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_entrance_id_navi_info_panel" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_entrance_id_operation_panel"
|
||||
@@ -194,18 +194,52 @@
|
||||
app:layout_goneMarginBottom="@dimen/module_ext_operation_panel_share_goneMarginBottom"
|
||||
app:layout_goneMarginRight="@dimen/module_ext_operation_panel_share_goneMarginRight" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_exit_navi"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:layout_marginLeft="@dimen/module_ext_navi_exit_marginLeft"
|
||||
android:layout_marginBottom="@dimen/module_ext_navi_exit_marginBottom"
|
||||
android:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
android:gravity="center"
|
||||
android:text="退出导航"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
<LinearLayout
|
||||
android:id="@+id/module_entrance_id_buttons_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_ext_button_container_marginLeft"
|
||||
android:layout_marginBottom="@dimen/module_ext_button_container_marginBottom"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_button1"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
tools:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
tools:text="前方\n实况"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_button2"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:layout_marginTop="@dimen/module_entrance_id_button_marginTop"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
tools:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
tools:text="取消\n求助"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_exit_navi"
|
||||
android:layout_width="@dimen/module_ext_navi_exit_width"
|
||||
android:layout_height="@dimen/module_ext_navi_exit_height"
|
||||
android:layout_marginTop="@dimen/module_entrance_id_button_marginTop"
|
||||
android:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
android:gravity="center"
|
||||
android:text="退出\n导航"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_navi_exit_textSize"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -46,11 +46,14 @@
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">20px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_ext_navi_exit_width">130px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">58px</dimen>
|
||||
<dimen name="module_ext_navi_exit_width">64px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">64px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginLeft">20px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginBottom">32px</dimen>
|
||||
<dimen name="module_ext_button_container_marginLeft">20px</dimen>
|
||||
<dimen name="module_ext_button_container_marginBottom">30px</dimen>
|
||||
<dimen name="module_ext_navi_exit_textSize">22px</dimen>
|
||||
<dimen name="module_entrance_id_button_marginTop">8px</dimen>
|
||||
|
||||
<!-- module_ext_layout_extensions.xml-->
|
||||
<dimen name="module_ext_height">64px</dimen>
|
||||
|
||||
@@ -44,11 +44,14 @@
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">32px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">32px</dimen>
|
||||
|
||||
<dimen name="module_ext_navi_exit_width">200px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">90px</dimen>
|
||||
<dimen name="module_ext_navi_exit_width">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_button_container_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_button_container_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_navi_exit_textSize">32px</dimen>
|
||||
<dimen name="module_entrance_id_button_marginTop">20px</dimen>
|
||||
|
||||
<!-- module_ext_layout_extensions.xml-->
|
||||
<dimen name="module_ext_height">120px</dimen>
|
||||
|
||||
@@ -44,11 +44,14 @@
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">32px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">32px</dimen>
|
||||
|
||||
<dimen name="module_ext_navi_exit_width">200px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">90px</dimen>
|
||||
<dimen name="module_ext_navi_exit_width">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_height">120px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_navi_exit_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_button_container_marginLeft">32px</dimen>
|
||||
<dimen name="module_ext_button_container_marginBottom">60px</dimen>
|
||||
<dimen name="module_ext_navi_exit_textSize">32px</dimen>
|
||||
<dimen name="module_entrance_id_button_marginTop">20px</dimen>
|
||||
|
||||
<!-- module_ext_layout_extensions.xml-->
|
||||
<dimen name="module_ext_height">120px</dimen>
|
||||
|
||||
@@ -51,3 +51,5 @@ dependencies {
|
||||
implementation project(':services:mogo-service-api')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -46,3 +46,5 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-gps-simulator')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -37,3 +37,5 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-authorize')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
@@ -26,7 +27,7 @@ public interface MogoModulesHandler extends IMogoMapListener,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoCarLocationChangedListener {
|
||||
IMogoCarLocationChangedListener2 {
|
||||
|
||||
/**
|
||||
* 地图加载完成回调
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.main.cards;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@@ -17,6 +18,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
@@ -109,7 +111,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
final List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d(TAG,"module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMogoModuleProvider provider = load( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleProviders.put( module, provider );
|
||||
@@ -655,15 +657,30 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
MogoLatLng target = null;
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoCarLocationChangedListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if ( listener instanceof IMogoCarLocationChangedListener2 ) {
|
||||
try {
|
||||
listener.onCarLocationChanged( latLng );
|
||||
( ( IMogoCarLocationChangedListener2 ) listener ).onCarLocationChanged2( latLng );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if ( target == null ) {
|
||||
target = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
|
||||
}
|
||||
listener.onCarLocationChanged( target );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -40,255 +40,225 @@ import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi
|
||||
* @author zyz
|
||||
* 2020-01-09.
|
||||
*/
|
||||
class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBack {
|
||||
class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBack, IMogoMarkerClickListener {
|
||||
// override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
|
||||
//
|
||||
// return true
|
||||
// }
|
||||
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
if (cmd?.startsWith("position") == true) {
|
||||
var index = cmd.substring(8)
|
||||
mAdapter.setCurrent(index.toInt())
|
||||
updateMarker()
|
||||
goPath()
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
if (cmd?.startsWith("position") == true) {
|
||||
var index = cmd.substring(8)
|
||||
mAdapter.current = index.toInt()
|
||||
updateMarker(false)
|
||||
goPath()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
}
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
}
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
}
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
}
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
}
|
||||
|
||||
private val TAG: String = "CategorySearchFragment"
|
||||
private var addMarkers: ArrayList<IMogoMarker> = ArrayList()
|
||||
var arrayList = ArrayList<MogoMarkerOptions>()
|
||||
var locationList = ArrayList<MogoLatLng>()
|
||||
private val TAG: String = "CategorySearchFragment"
|
||||
private var addMarkers: ArrayList<IMogoMarker> = ArrayList()
|
||||
var arrayList = ArrayList<MogoMarkerOptions>()
|
||||
var locationList = ArrayList<MogoLatLng>()
|
||||
|
||||
private lateinit var cmds: ArrayList<String>
|
||||
override fun renderSearchPoiResult(datums: List<MogoPoiItem>?) {
|
||||
mAdapter.setDatas(datums)
|
||||
cv_search_result.visibility = View.VISIBLE
|
||||
pb_path.visibility = View.GONE
|
||||
AIAssist.getInstance(context)
|
||||
.speakTTSVoice(String.format("搜索到%d个位置,请选择", datums?.size))
|
||||
private lateinit var cmds: ArrayList<String>
|
||||
override fun renderSearchPoiResult(datums: List<MogoPoiItem>?) {
|
||||
mAdapter.setDatas(datums)
|
||||
cv_search_result.visibility = View.VISIBLE
|
||||
pb_path.visibility = View.GONE
|
||||
AIAssist.getInstance(context).speakTTSVoice(String.format("搜索到%d个位置,请选择", datums?.size))
|
||||
|
||||
arrayList.clear()
|
||||
locationList.clear()
|
||||
arrayList.clear()
|
||||
locationList.clear()
|
||||
|
||||
for (index in 0 until datums!!.size) {
|
||||
var decodeResource =
|
||||
BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
for (index in 0 until datums!!.size) {
|
||||
var decodeResource = BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
|
||||
var createWaterMask =
|
||||
BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
val options = MogoMarkerOptions()
|
||||
.icon(createWaterMask)
|
||||
.latitude(datums[index].point?.lat ?: 0.0)
|
||||
.owner("CategorySearchFragment")
|
||||
.`object`(index)
|
||||
var createWaterMask = BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
val options = MogoMarkerOptions()
|
||||
.icon(createWaterMask)
|
||||
.latitude(datums[index].point?.lat ?: 0.0)
|
||||
.owner("CategorySearchFragment")
|
||||
.`object`(index)
|
||||
// .anchor(0.5f, 1f)
|
||||
.longitude(datums[index].point?.lng ?: 0.0)
|
||||
arrayList.add(options)
|
||||
locationList.add(datums[index].point)
|
||||
.longitude(datums[index].point?.lng ?: 0.0)
|
||||
arrayList.add(options)
|
||||
locationList.add(datums[index].point)
|
||||
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
"position" + index, arrayOf("第" + int2String + "个", "第" + int2String + "条"), this
|
||||
)
|
||||
cmds.add("position" + index)
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("position${index}", arrayOf("第${int2String}个", "第${int2String}条"), this)
|
||||
cmds.add("position" + index)
|
||||
|
||||
}
|
||||
addMarkers()
|
||||
}
|
||||
addMarkers()
|
||||
}
|
||||
|
||||
private fun addMarkers() {
|
||||
addMarkers.clear()
|
||||
var marginBounder = resources.getDimensionPixelSize(R.dimen.dp_60) * 2
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.showBounds(
|
||||
TAG, null, locationList, Rect(
|
||||
cv_search_result.width + marginBounder, marginBounder, marginBounder, marginBounder
|
||||
), false
|
||||
private fun addMarkers() {
|
||||
addMarkers.clear()
|
||||
var marginBounder = resources.getDimensionPixelSize(R.dimen.dp_60) * 2
|
||||
SearchServiceHolder.getMapUIController().showBounds(TAG,
|
||||
null,
|
||||
locationList,
|
||||
Rect(cv_search_result.width + marginBounder, marginBounder, marginBounder, marginBounder),
|
||||
false
|
||||
)
|
||||
|
||||
for (options in arrayList) {
|
||||
var addMarker = SearchServiceHolder.getMarkerManger()
|
||||
.addMarker(TAG, options)
|
||||
addMarkers.add(addMarker)
|
||||
}
|
||||
addClick()
|
||||
}
|
||||
|
||||
private fun registerVoice() {
|
||||
|
||||
for (index in 0 until cmds.size) {
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
"position" + index, arrayOf("第" + int2String + "个", "第" + int2String + "条"), this
|
||||
)
|
||||
for (options in arrayList) {
|
||||
var addMarker = SearchServiceHolder.getMarkerManger().addMarker(TAG, options)
|
||||
addMarker.onMarkerClickListener = this
|
||||
addMarkers.add(addMarker)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
registerVoice()
|
||||
addMarkers()
|
||||
} else {
|
||||
unRegisterVoice()
|
||||
private fun registerVoice() {
|
||||
for (index in 0 until cmds.size) {
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("position${index}", arrayOf("第${int2String}个", "第${int2String}条"), this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun addClick() {
|
||||
if (addMarkers != null) {
|
||||
for (item in addMarkers!!) {
|
||||
item.setOnMarkerClickListener {
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
registerVoice()
|
||||
addMarkers()
|
||||
} else {
|
||||
unRegisterVoice()
|
||||
}
|
||||
}
|
||||
|
||||
var index = it.mogoMarkerOptions.`object` as Int
|
||||
mAdapter.current = index
|
||||
rv_search_result.smoothScrollToPosition(index)
|
||||
updateMarker()
|
||||
true
|
||||
override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
|
||||
var index = marker?.mogoMarkerOptions?.`object` as Int
|
||||
mAdapter.current = index
|
||||
rv_search_result.smoothScrollToPosition(index)
|
||||
updateMarker()
|
||||
return true
|
||||
}
|
||||
|
||||
private lateinit var mAdapter: SearchCategoryAdapter
|
||||
|
||||
private lateinit var mSearchPresenter: CategoryPresenter
|
||||
private var category: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
category = arguments?.getString("category")
|
||||
mSearchPresenter = CategoryPresenter(this)
|
||||
lifecycle.addObserver(mSearchPresenter)
|
||||
cmds = ArrayList<String>()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mAdapter = SearchCategoryAdapter(activity, ArrayList())
|
||||
|
||||
rv_search_result.layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
rv_search_result.adapter = mAdapter
|
||||
et_navi_search.setText(category)
|
||||
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
|
||||
}
|
||||
tv_navi_navi.setOnClickListener {
|
||||
goPath()
|
||||
}
|
||||
mAdapter.setOnClickListener {
|
||||
var position = it.getTag(R.id.tag_position) as Int
|
||||
mAdapter.current = position
|
||||
updateMarker()
|
||||
}
|
||||
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("back", arrayOf("关闭", "返回"), this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private lateinit var mAdapter: SearchCategoryAdapter
|
||||
|
||||
private lateinit var mSearchPresenter: CategoryPresenter
|
||||
private var category: String? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
category = arguments?.getString("category")
|
||||
mSearchPresenter = CategoryPresenter(this)
|
||||
lifecycle.addObserver(mSearchPresenter)
|
||||
cmds = ArrayList<String>()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mAdapter = SearchCategoryAdapter(activity, ArrayList())
|
||||
|
||||
rv_search_result.layoutManager =
|
||||
LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
rv_search_result.adapter = mAdapter
|
||||
|
||||
et_navi_search.setText(category)
|
||||
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
private fun goPath() {
|
||||
mAdapter.currentItem?.let {
|
||||
AddressManager.calculatePath(mAdapter.currentItem.point)
|
||||
}
|
||||
}
|
||||
|
||||
tv_navi_navi.setOnClickListener {
|
||||
private fun updateMarker(moveToCenter:Boolean = true) {
|
||||
|
||||
goPath()
|
||||
}
|
||||
mAdapter.setOnClickListener {
|
||||
var position = it.getTag(R.id.tag_position) as Int
|
||||
mAdapter.setCurrent(position)
|
||||
updateMarker()
|
||||
addMarkers?.get(mAdapter.lastPosition)?.setIcon(getMarkerIcon(mAdapter.lastPosition))
|
||||
var current = addMarkers?.get(mAdapter.current)
|
||||
current?.setIcon(getMarkerIcon(mAdapter.current))
|
||||
current?.setToTop()
|
||||
arrayList.get(mAdapter.lastPosition).icon(getMarkerIcon(mAdapter.lastPosition))
|
||||
arrayList.get(mAdapter.current).icon(getMarkerIcon(mAdapter.current))
|
||||
if (moveToCenter) {
|
||||
SearchServiceHolder.statusManager.setUserInteractionStatus(TAG, true, false)
|
||||
SearchServiceHolder.getMapUIController().moveToCenter(current.position)
|
||||
}
|
||||
}
|
||||
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("back", arrayOf("关闭", "返回"), this)
|
||||
private fun getMarkerIcon(index: Int): Bitmap {
|
||||
var decodeResource = BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
private fun goPath() {
|
||||
mAdapter.currentItem?.let {
|
||||
AddressManager.calculatePath(mAdapter.currentItem.point)
|
||||
var createWaterMask = BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
return createWaterMask
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateMarker() {
|
||||
|
||||
addMarkers?.get(mAdapter.lastPosition)
|
||||
?.setIcon(getMarkerIcon(mAdapter.lastPosition))
|
||||
var current = addMarkers?.get(mAdapter.current)
|
||||
current?.setIcon(getMarkerIcon(mAdapter.current))
|
||||
current?.setToTop()
|
||||
arrayList.get(mAdapter.lastPosition)
|
||||
.icon(getMarkerIcon(mAdapter.lastPosition))
|
||||
arrayList.get(mAdapter.current)
|
||||
.icon(getMarkerIcon(mAdapter.current))
|
||||
}
|
||||
|
||||
private fun getMarkerIcon(index: Int): Bitmap {
|
||||
var decodeResource =
|
||||
BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
|
||||
var createWaterMask =
|
||||
BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
return createWaterMask
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
mSearchPresenter.startSearchLocalPoiByInput(category)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
mSearchPresenter.onDestroy(viewLifecycleOwner)
|
||||
lifecycle.removeObserver(mSearchPresenter)
|
||||
SearchServiceHolder.getMarkerManger()
|
||||
.removeMarkers(TAG)
|
||||
|
||||
unRegisterVoice()
|
||||
}
|
||||
|
||||
private fun unRegisterVoice() {
|
||||
cmds.forEach {
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand(it)
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
mSearchPresenter.startSearchLocalPoiByInput(category)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
mSearchPresenter.onDestroy(viewLifecycleOwner)
|
||||
lifecycle.removeObserver(mSearchPresenter)
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers(TAG)
|
||||
|
||||
companion object {
|
||||
fun newInstance(category: String): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CATEGORY_SEARCH)
|
||||
var bundle = Bundle()
|
||||
bundle.putString("category", category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
categorySerachFragment.arguments = bundle
|
||||
return categorySerachFragment
|
||||
unRegisterVoice()
|
||||
}
|
||||
|
||||
private fun unRegisterVoice() {
|
||||
cmds.forEach {
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(category: String): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CATEGORY_SEARCH)
|
||||
var bundle = Bundle()
|
||||
bundle.putString("category", category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
categorySerachFragment.arguments = bundle
|
||||
return categorySerachFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,10 @@ public class MarkerServiceHandler {
|
||||
mMapMarkerManager.init( context );
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis(){
|
||||
return mApis;
|
||||
}
|
||||
|
||||
public static IMogoMapService getMapService() {
|
||||
return mMapService;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.location.LocationManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Trace;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
@@ -30,7 +29,6 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
@@ -38,6 +36,7 @@ import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
@@ -60,14 +59,11 @@ import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
@@ -796,24 +792,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_SWITCH_CARD.equals( command ) ) {
|
||||
String data = intent.getStringExtra( "data" );
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject( data );
|
||||
String card = jsonObject.getString( "card" );
|
||||
if ( TextUtils.equals( "多媒体卡片", card )
|
||||
|| TextUtils.equals( "媒体中心卡片", card )
|
||||
|| TextUtils.equals( "音乐卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_SHARE_MUSIC );
|
||||
} else if ( TextUtils.equals( "探路卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
} else if ( TextUtils.equals( "在线车辆卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
} else if ( TextUtils.equals( "新鲜事卡片", card ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_NOVELTY );
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
} else if ( MogoReceiver.ACTION_ADAS_STATUS.equals( command ) ) {
|
||||
String msg = intent.getStringExtra( "adasMsg" );
|
||||
if ( TextUtils.isEmpty( msg ) ) {
|
||||
@@ -825,82 +804,14 @@ public class MogoServices implements IMogoMapListener,
|
||||
// changeMyLocation( stateInfo.getValues() );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_OPERATION.equals( command ) ) {
|
||||
try {
|
||||
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
|
||||
String app = object.optString( "object" );
|
||||
String operation = object.optString( "operation" );
|
||||
if ( TextUtils.equals( app, "车聊聊" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_CARS_CHATTING );
|
||||
}
|
||||
} else {
|
||||
if ( TextUtils.equals( app, "探路" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
switchCard2( ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
} else if ( MogoReceiver.ACTION_VOICE_READY.equals( command ) ) {
|
||||
AIAssist.getInstance( mContext ).flush();
|
||||
mStatusManager.setAIAssistReady( TAG, true );
|
||||
} else if ( ServiceConst.COMMAND_MY_LOCATION.equals( command ) ) {
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mUiController.recoverLockMode();
|
||||
} else {
|
||||
mLauncher.backToLauncher( mContext );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
mUiController.recoverLockMode();
|
||||
}, 2_000L );
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
} else if ( MogoReceiver.ACTION_MOCK.equals( command ) ) {
|
||||
|
||||
if ( !DebugConfig.isDebug() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int oper = intent.getIntExtra( "oper", -1 );
|
||||
switch ( oper ) {
|
||||
case 1:
|
||||
mUiController.showMyLocation( true );
|
||||
break;
|
||||
case 2:
|
||||
boolean status = intent.getBooleanExtra( "status", false );
|
||||
mStatusManager.setSeekHelping( TAG, status );
|
||||
break;
|
||||
case 3:
|
||||
String msg = intent.getStringExtra( "msg" );
|
||||
if ( !TextUtils.isEmpty( msg ) ) {
|
||||
TipToast.shortTip( msg );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换卡片
|
||||
*/
|
||||
private void switchCard2( String card ) {
|
||||
if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) {
|
||||
mLauncher.backToLauncher( mContext );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
mADASController.closeADAS();
|
||||
}
|
||||
mCardManager.switch2( card, true );
|
||||
}, 2000L );
|
||||
} else {
|
||||
mFragmentManager.clearAll();
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
mADASController.closeADAS();
|
||||
}
|
||||
mCardManager.switch2( card, true );
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppOperationIntentHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
try {
|
||||
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
|
||||
String app = object.optString( "object" );
|
||||
String operation = object.optString( "operation" );
|
||||
if ( TextUtils.equals( app, "车聊聊" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
SwitchCardIntentHandler.switchCard2( context, ServiceConst.CARD_TYPE_CARS_CHATTING );
|
||||
}
|
||||
} else {
|
||||
if ( TextUtils.equals( app, "探路" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
SwitchCardIntentHandler.switchCard2( context, ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class EmptyIntentHandler implements IntentHandler {
|
||||
|
||||
private static final String TAG = "EmptyIntentHandler";
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
Logger.w( TAG, "空实现." );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface IntentHandler {
|
||||
|
||||
void handle( Context context, Intent intent );
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class IntentHandlerFactory {
|
||||
|
||||
private IntentHandlerFactory() {
|
||||
// private constructor
|
||||
mHandlers.put( MogoReceiver.ACTION_MOCK, new MockIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_SWITCH_CARD, new SwitchCardIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_OPERATION, new AppOperationIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_MY_LOCATION, new MyLocationHandler() );
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final IntentHandlerFactory INSTANCE = new IntentHandlerFactory();
|
||||
}
|
||||
|
||||
public static IntentHandlerFactory getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Map< String, IntentHandler > mHandlers = new HashMap<>();
|
||||
|
||||
private IntentHandler DEFAULT = new EmptyIntentHandler();
|
||||
|
||||
private IntentHandler getIntentHandler( String intent ) {
|
||||
if ( mHandlers.containsKey( intent ) && mHandlers.get( intent ) != null ) {
|
||||
return mHandlers.get( intent );
|
||||
}
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
public void handle( Context context, String intent, Intent obj ) {
|
||||
IntentHandler handler = getIntentHandler( intent );
|
||||
if ( handler != null ) {
|
||||
handler.handle( context, obj );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MockIntentHandler implements IntentHandler {
|
||||
|
||||
private static final String TAG = "MockIntentHandler";
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
if ( !DebugConfig.isDebug() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int oper = intent.getIntExtra( "oper", -1 );
|
||||
switch ( oper ) {
|
||||
case 1:
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation( true );
|
||||
break;
|
||||
case 2:
|
||||
boolean status = intent.getBooleanExtra( "status", false );
|
||||
MarkerServiceHandler.getMogoStatusManager().setSeekHelping( TAG, status );
|
||||
break;
|
||||
case 3:
|
||||
String msg = intent.getStringExtra( "msg" );
|
||||
if ( !TextUtils.isEmpty( msg ) ) {
|
||||
TipToast.shortTip( msg );
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
TextView button1 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 );
|
||||
if ( button1 != null ) {
|
||||
button1.setVisibility( View.VISIBLE );
|
||||
button1.setBackgroundColor( Color.RED );
|
||||
button1.setOnClickListener( view -> {
|
||||
TipToast.shortTip( "测试" );
|
||||
} );
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
TextView button2 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 );
|
||||
if ( button2 != null ) {
|
||||
button2.setOnClickListener( null );
|
||||
button2.setVisibility( View.GONE );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 语音指令:定位我的位置等处理
|
||||
*/
|
||||
public class MyLocationHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
MarkerServiceHandler.getMapUIController().recoverLockMode();
|
||||
} else {
|
||||
MarkerServiceHandler.getLauncher().backToLauncher( context );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
MarkerServiceHandler.getMapUIController().recoverLockMode();
|
||||
}, 2_000L );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class SwitchCardIntentHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
String data = intent.getStringExtra( "data" );
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject( data );
|
||||
String card = jsonObject.getString( "card" );
|
||||
if ( TextUtils.equals( "多媒体卡片", card )
|
||||
|| TextUtils.equals( "媒体中心卡片", card )
|
||||
|| TextUtils.equals( "音乐卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_SHARE_MUSIC );
|
||||
} else if ( TextUtils.equals( "探路卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
} else if ( TextUtils.equals( "在线车辆卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_USER_DATA );
|
||||
} else if ( TextUtils.equals( "新鲜事卡片", card ) ) {
|
||||
switchCard2( context, ServiceConst.CARD_TYPE_NOVELTY );
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换卡片
|
||||
*/
|
||||
public static void switchCard2( Context context, String card ) {
|
||||
if ( AppUtils.isApplicationBroughtToBackground( context ) ) {
|
||||
MarkerServiceHandler.getLauncher().backToLauncher( context );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
MarkerServiceHandler.getADASController().closeADAS();
|
||||
}
|
||||
MarkerServiceHandler.getMogoCardManager().switch2( card, true );
|
||||
}, 2000L );
|
||||
} else {
|
||||
MarkerServiceHandler.getFragmentManager().clearAll();
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
MarkerServiceHandler.getADASController().closeADAS();
|
||||
}
|
||||
MarkerServiceHandler.getMogoCardManager().switch2( card, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.module.share.constant.ShareConstants
|
||||
import com.mogo.module.share.constant.ShareConstants.VOICE_CMD_PUB_TROUBLE_HELP
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
/**
|
||||
@@ -11,11 +12,11 @@ import com.mogo.utils.logger.Logger
|
||||
*/
|
||||
class ShareVoiceCmdReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
// todo 接收唤醒词指令
|
||||
// 接收唤醒词指令
|
||||
val command = intent.getStringExtra("command")
|
||||
Logger.d("ShareCmdReceiver", "收到唤醒词指令: $command")
|
||||
if (command == "zhunbeishangbao") {
|
||||
//todo 开启服务,准备上报求助
|
||||
if (command == VOICE_CMD_PUB_TROUBLE_HELP) {
|
||||
// 开启服务,准备上报求助
|
||||
val seekHelp = Intent(context, VoiceCmdService::class.java)
|
||||
seekHelp.putExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP)
|
||||
context.startService(seekHelp)
|
||||
|
||||
@@ -42,7 +42,7 @@ class VoiceCmdService:Service() {
|
||||
if (intent.getIntExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY,0) == ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP) {
|
||||
// 收到语音指令,准备上报求助
|
||||
Logger.i(TAG, "收到语音指令,准备上报求助")
|
||||
SeekHelpManager.seekHelp(this,seekListener,false)
|
||||
SeekHelpManager.seekHelp(this,seekListener)
|
||||
}
|
||||
}
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
|
||||
@@ -18,4 +18,6 @@ public class ShareConstants {
|
||||
|
||||
public static final String VOICE_CMD_SERVICE_EVENT_KEY = "type";
|
||||
public static final int VOICE_CMD_SERVICE_SEEK_HELP = 1;
|
||||
|
||||
public static final String VOICE_CMD_PUB_TROUBLE_HELP = "com.zhidao.auxiliaryDriving.pubTroubleHelp";
|
||||
}
|
||||
|
||||
@@ -37,12 +37,13 @@ object SeekHelpManager {
|
||||
private const val SEEK_RECORD_LIMIT_AMOUNT = 2
|
||||
const val VOICE_WILL_SEEK_HELP = "将发布故障求助"
|
||||
|
||||
private var context:Context? = null
|
||||
private var aiAssist:AIAssist? = null
|
||||
private var context: Context? = null
|
||||
private var aiAssist: AIAssist? = null
|
||||
|
||||
private val seekRecordList = mutableListOf<SeekRecord>()
|
||||
private val seekListenerList = mutableListOf<ISeekHelpListener>()
|
||||
private var isSeekHelp = false
|
||||
private var isSeeking = false
|
||||
|
||||
private val voiceCallback = object : IMogoVoiceCmdCallBack {
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
@@ -77,34 +78,36 @@ object SeekHelpManager {
|
||||
*
|
||||
* @param useLocalVoiceNotice 使用自己的语音播报,如果是从语音助手过来的请求,语音助手可能会走自己的播报,默认是使用自己的播报
|
||||
*/
|
||||
fun seekHelp(context: Context, seekHelpListener: ISeekHelpListener,useLocalVoiceNotice:Boolean = true) {
|
||||
// context初始化
|
||||
if (this.context == null) {
|
||||
this.context = context
|
||||
aiAssist = AIAssist.getInstance(context)
|
||||
}
|
||||
isSeekHelp = ShareControl.getInstance(SeekHelpManager.context).mogoServiceApis.statusManagerApi.isSeekHelping
|
||||
Logger.d(TAG, "开始故障求助上报---${isSeekHelp}")
|
||||
seekListenerList.add(seekHelpListener)
|
||||
when {
|
||||
isSeekHelp -> {
|
||||
// 正在求助中,进行异常提示
|
||||
toast("已发布故障求助,请耐心等待")
|
||||
aiAssist?.speakTTSVoice("已发布故障求助,请耐心等待")
|
||||
fun seekHelp(context: Context, seekHelpListener: ISeekHelpListener, useLocalVoiceNotice: Boolean = true) {
|
||||
if(!isSeeking) {
|
||||
isSeeking = true
|
||||
if (this.context == null) {
|
||||
this.context = context
|
||||
aiAssist = AIAssist.getInstance(context)
|
||||
}
|
||||
getSeekAmountByLimitTime() >= SEEK_RECORD_LIMIT_AMOUNT -> {
|
||||
// 超过限制时间内的限制次数,进行异常提示
|
||||
toast("已在求助状态,请勿连续发布哦")
|
||||
aiAssist?.speakTTSVoice("已在求助状态,请勿连续发布哦")
|
||||
}
|
||||
else -> {
|
||||
// 没有异常情况,开始故障求助
|
||||
if(useLocalVoiceNotice) {
|
||||
// 语音说完再请求,要不然可能请求的太快
|
||||
aiAssist?.speakTTSVoice(VOICE_WILL_SEEK_HELP, voiceCallback)
|
||||
}else{
|
||||
Logger.d(TAG,"不使用本地语音播报,直接开始发起求助")
|
||||
realSeekHelp()
|
||||
isSeekHelp = ShareControl.getInstance(SeekHelpManager.context).mogoServiceApis.statusManagerApi.isSeekHelping
|
||||
Logger.d(TAG, "开始故障求助上报---${isSeekHelp}")
|
||||
seekListenerList.add(seekHelpListener)
|
||||
when {
|
||||
isSeekHelp -> {
|
||||
// 正在求助中,进行异常提示
|
||||
toast("已发布故障求助,请耐心等待")
|
||||
aiAssist?.speakTTSVoice("已发布故障求助,请耐心等待")
|
||||
}
|
||||
getSeekAmountByLimitTime() >= SEEK_RECORD_LIMIT_AMOUNT -> {
|
||||
// 超过限制时间内的限制次数,进行异常提示
|
||||
toast("已在求助状态,请勿连续发布哦")
|
||||
aiAssist?.speakTTSVoice("已在求助状态,请勿连续发布哦")
|
||||
}
|
||||
else -> {
|
||||
// 没有异常情况,开始故障求助
|
||||
if (useLocalVoiceNotice) {
|
||||
// 语音说完再请求,要不然可能请求的太快
|
||||
aiAssist?.speakTTSVoice(VOICE_WILL_SEEK_HELP, voiceCallback)
|
||||
} else {
|
||||
Logger.d(TAG, "不使用本地语音播报,直接开始发起求助")
|
||||
realSeekHelp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,12 +147,12 @@ object SeekHelpManager {
|
||||
// 请求故障求助接口
|
||||
val seekRequest = SeekRequest(DeviceUtil.getSn())
|
||||
val param = mutableMapOf("data" to seekRequest.getJson())
|
||||
|
||||
|
||||
ShareControl.getInstance(context).mogoServiceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: BaseData?) {
|
||||
super.onSuccess(o)
|
||||
// 接口请求成功,内部同步v2x状态,通知adas,改变自车图标
|
||||
ShareControl.getInstance(context).mogoServiceApis.statusManagerApi.setSeekHelping("ShareDialog",true)
|
||||
ShareControl.getInstance(context).mogoServiceApis.statusManagerApi.setSeekHelping("ShareDialog", true)
|
||||
isSeekHelp = true
|
||||
aiAssist?.speakTTSVoice("已发布求助信息,将为你通知其他车主")
|
||||
toast("已发布求助信息,将为你通知其他车主")
|
||||
@@ -157,6 +160,7 @@ object SeekHelpManager {
|
||||
seekListenerList.forEach {
|
||||
it.onSeekHelpSuccess()
|
||||
}
|
||||
isSeeking = false
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
@@ -165,6 +169,7 @@ object SeekHelpManager {
|
||||
Logger.e(TAG, "上报求助失败,网络异常")
|
||||
e.printStackTrace()
|
||||
seekHelpFail()
|
||||
isSeeking = false
|
||||
}
|
||||
|
||||
override fun onError(message: String?, code: Int) {
|
||||
@@ -172,6 +177,7 @@ object SeekHelpManager {
|
||||
// 接口请求失败
|
||||
Logger.e(TAG, "上报求助失败")
|
||||
seekHelpFail()
|
||||
isSeeking = false
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -185,4 +191,30 @@ object SeekHelpManager {
|
||||
aiAssist?.speakTTSVoice("求助上报失败,请稍后重试")
|
||||
}
|
||||
|
||||
fun debugCancelSeek() {
|
||||
val seekRequest = SeekRequest(DeviceUtil.getSn(), 0)
|
||||
val param = mutableMapOf("data" to seekRequest.getJson())
|
||||
ShareControl.getInstance(context).mogoServiceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: BaseData?) {
|
||||
super.onSuccess(o)
|
||||
// 接口请求成功,内部同步v2x状态,通知adas,改变自车图标
|
||||
ShareControl.getInstance(context).mogoServiceApis.statusManagerApi.setSeekHelping("ShareDialog", false)
|
||||
isSeekHelp = false
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
super.onError(e)
|
||||
// 接口请求失败
|
||||
Logger.e(TAG, "上报求助失败,网络异常")
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
override fun onError(message: String?, code: Int) {
|
||||
super.onError(message, code)
|
||||
// 接口请求失败
|
||||
Logger.e(TAG, "上报求助失败")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.datamanager.IMogoDataManager;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
@@ -170,4 +171,11 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoLauncher getLauncherApi();
|
||||
|
||||
/**
|
||||
* 获取入口按钮控制器
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoEntranceButtonController getEntranceButtonController();
|
||||
}
|
||||
|
||||
@@ -160,4 +160,10 @@ public class MogoServicePaths {
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_LAUNCHER_API = "/launcher/api";
|
||||
|
||||
/**
|
||||
* 入口按钮
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_ENTRANCE_BUTTON_API = "/entrancebutton/api";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.service.entrance;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 入口按钮顺序:从上到下
|
||||
*/
|
||||
public enum ButtonIndex {
|
||||
|
||||
/**
|
||||
* 第一个
|
||||
*/
|
||||
BUTTON1,
|
||||
|
||||
/**
|
||||
* 第二个
|
||||
*/
|
||||
BUTTON2;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.service.entrance;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 入口按钮
|
||||
*/
|
||||
public interface IMogoEntranceButtonController extends IProvider {
|
||||
|
||||
/**
|
||||
* 获取入口按钮实例
|
||||
*
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
TextView getButton( ButtonIndex index );
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.datamanager.IMogoDataManager;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.impl.analytics.impl.MogoAnalyticsImpl;
|
||||
@@ -153,6 +154,11 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance( IMogoLauncher.class, MogoServicePaths.PATH_LAUNCHER_API );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoEntranceButtonController getEntranceButtonController() {
|
||||
return getApiInstance( IMogoEntranceButtonController.class, MogoServicePaths.PATH_ENTRANCE_BUTTON_API );
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
|
||||
T inst = SingletonsHolder.get( clazz );
|
||||
if ( inst == null ) {
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
./gradlew :modules:mogo-module-share:clean :modules:mogo-module-share:uploadArchives
|
||||
./gradlew :modules:mogo-module-authorize:clean :modules:mogo-module-authorize:uploadArchives
|
||||
./gradlew :modules:mogo-module-extensions:clean :modules:mogo-module-extensions:uploadArchives
|
||||
./gradlew :modules:mogo-module-gps-simulator:clean :modules:mogo-module-gps-simulator:uploadArchives
|
||||
./gradlew :modules:mogo-module-search:clean :modules:mogo-module-search:uploadArchives
|
||||
./gradlew :modules:mogo-module-main:clean :modules:mogo-module-main:uploadArchives
|
||||
./gradlew :modules:mogo-module-back:clean :modules:mogo-module-back:uploadArchives
|
||||
./gradlew :modules:mogo-module-guide:clean :modules:mogo-module-guide:uploadArchives
|
||||
./gradlew :modules:mogo-module-gps-simulator:clean :modules:mogo-module-gps-simulator:uploadArchives
|
||||
./gradlew :modules:mogo-module-gps-simulator-debug:clean :modules:mogo-module-gps-simulator-debug:uploadArchives
|
||||
./gradlew :modules:mogo-module-gps-simulator-noop:clean :modules:mogo-module-gps-simulator-noop:uploadArchives
|
||||
|
||||
|
||||
Reference in New Issue
Block a user