Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
This commit is contained in:
@@ -61,8 +61,8 @@ dependencies {
|
||||
|
||||
// implementation rootProject.ext.dependencies.moduledemo
|
||||
// implementation rootProject.ext.dependencies.moduledemo2
|
||||
// implementation rootProject.ext.dependencies.modulechattingprovider
|
||||
// implementation rootProject.ext.dependencies.modulechatting
|
||||
implementation rootProject.ext.dependencies.modulechattingprovider
|
||||
implementation rootProject.ext.dependencies.modulechatting
|
||||
|
||||
|
||||
implementation rootProject.ext.dependencies.moduleonlinecar
|
||||
|
||||
@@ -6,10 +6,11 @@ import androidx.multidex.MultiDex;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.carchatting.CallChatConstant;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.onlinecar.OnLineCarConstants;
|
||||
import com.mogo.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -27,8 +28,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setNetMode( DebugConfig.NET_MODE_QA );
|
||||
MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, "CARD_TYPE_ROAD_ONLINECAR"));
|
||||
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, "CARD_TYPE_ROAD_CODITION" ) );
|
||||
MogoModulePaths.addModule(new MogoModule( OnLineCarConstants.TAG, "CARD_TYPE_ROAD_ONLINECAR"));
|
||||
// MogoModulePaths.addModule(new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac
|
||||
listener.onMsgReceived( GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() ) );
|
||||
}
|
||||
} catch ( InvalidProtocolBufferException e ) {
|
||||
Logger.e( TAG, "parse msg error.", e );
|
||||
Logger.e( TAG, e, "parse msg error." );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
private View mExit;
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
|
||||
private View mLoadingView;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_apps_fragment_apps;
|
||||
@@ -62,6 +64,8 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
// }
|
||||
// } );
|
||||
// mBottomSheetBehavior.setState( BottomSheetBehavior.STATE_COLLAPSED );
|
||||
mLoadingView = findViewById( R.id.module_apps_id_loading );
|
||||
mLoadingView.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -78,6 +82,7 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
|
||||
@Override
|
||||
public void renderApps( Map< Integer, List< AppInfo > > appInfos ) {
|
||||
mLoadingView.setVisibility( View.GONE );
|
||||
if ( mAppsPagerAdapter == null ) {
|
||||
mAppsPagerAdapter = new AppsPagerAdapter( appInfos );
|
||||
mAppsPager.setAdapter( mAppsPagerAdapter );
|
||||
@@ -88,5 +93,6 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
} else {
|
||||
mAppsPagerAdapter.setPagedApps( appInfos );
|
||||
}
|
||||
mLoadingView.setVisibility( View.GONE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
package com.mogo.module.apps;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -32,13 +22,8 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
|
||||
private static final String TAG = "AppsPresenter";
|
||||
|
||||
private AppFilter mAppFilter;
|
||||
|
||||
public AppsPresenter( AppsView view ) {
|
||||
super( view );
|
||||
RefreshAppsListLiveData.getInstance().observeForever( s -> {
|
||||
renderAppsList();
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,45 +34,17 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
|
||||
private void renderAppsList() {
|
||||
ThreadPoolService.execute( () -> {
|
||||
final Map< Integer, List< AppInfo > > appInfoList = loadAppsList();
|
||||
UiThreadHandler.post( () -> {
|
||||
if ( mView != null ) {
|
||||
mView.renderApps( appInfoList );
|
||||
}
|
||||
AppsModel.getInstance( getContext() ).load( appInfoList -> {
|
||||
UiThreadHandler.post( () -> {
|
||||
if ( mView != null ) {
|
||||
mView.renderApps( appInfoList );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
private Map< Integer, List< AppInfo > > loadAppsList() {
|
||||
Logger.i( TAG, "load apps list." );
|
||||
if ( mAppFilter == null ) {
|
||||
mAppFilter = new AppFilterImpl( getContext() );
|
||||
}
|
||||
|
||||
final Map< Integer, List< AppInfo > > pagedApps = new HashMap<>();
|
||||
final PackageManager packageManager = getContext().getPackageManager();
|
||||
List< PackageInfo > packages = packageManager.getInstalledPackages( 0 );
|
||||
int counter = 0;
|
||||
for ( int i = 0; i < packages.size(); ++i ) {
|
||||
PackageInfo packageInfo = packages.get( i );
|
||||
if ( mAppFilter.filter( packageInfo ) ) {
|
||||
continue;
|
||||
}
|
||||
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
|
||||
if ( !pagedApps.containsKey( page ) ) {
|
||||
pagedApps.put( page, new ArrayList<>() );
|
||||
}
|
||||
String appName = packageInfo.applicationInfo.loadLabel( packageManager ).toString();
|
||||
String packageName = packageInfo.packageName;
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon );
|
||||
pagedApps.get( page ).add( appInfo );
|
||||
}
|
||||
return pagedApps;
|
||||
}
|
||||
|
||||
public void launch( AppInfo appInfo ) {
|
||||
if ( appInfo == null ) {
|
||||
return;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mogo.module.apps;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-30
|
||||
* <p>
|
||||
* 刷新app列表
|
||||
*/
|
||||
public class RefreshAppsListLiveData extends MutableLiveData< String > {
|
||||
|
||||
private static volatile RefreshAppsListLiveData sInstance;
|
||||
|
||||
private RefreshAppsListLiveData() {
|
||||
}
|
||||
|
||||
public static RefreshAppsListLiveData getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( RefreshAppsListLiveData.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new RefreshAppsListLiveData();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface AppLoadCallback {
|
||||
|
||||
void onLoaded( Map< Integer, List< AppInfo > > appInfos );
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.apps.AppFilter;
|
||||
import com.mogo.module.apps.AppFilterImpl;
|
||||
import com.mogo.module.apps.AppsConst;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 加载并保存 app 列表
|
||||
*/
|
||||
public class AppsModel {
|
||||
|
||||
private static volatile AppsModel sInstance;
|
||||
private final Context mContext;
|
||||
|
||||
private AppFilter mAppFilter;
|
||||
|
||||
private Map< Integer, List< AppInfo > > mPagedApps = new HashMap<>();
|
||||
|
||||
private AppsModel( Context context ) {
|
||||
mContext = context;
|
||||
mAppFilter = new AppFilterImpl( context );
|
||||
}
|
||||
|
||||
public static AppsModel getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AppsModel.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new AppsModel( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
private AtomicBoolean mIsLoaded = new AtomicBoolean( false );
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void load( AppLoadCallback callback ) {
|
||||
if ( !mPagedApps.isEmpty() ) {
|
||||
if ( callback != null ) {
|
||||
callback.onLoaded( mPagedApps );
|
||||
}
|
||||
return;
|
||||
}
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
List< PackageInfo > packages = packageManager.getInstalledPackages( 0 );
|
||||
int counter = 0;
|
||||
for ( int i = 0; i < packages.size(); ++i ) {
|
||||
PackageInfo packageInfo = packages.get( i );
|
||||
if ( mAppFilter.filter( packageInfo ) ) {
|
||||
continue;
|
||||
}
|
||||
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
|
||||
if ( !mPagedApps.containsKey( page ) ) {
|
||||
mPagedApps.put( page, new ArrayList<>() );
|
||||
}
|
||||
String appName = packageInfo.applicationInfo.loadLabel( packageManager ).toString();
|
||||
String packageName = packageInfo.packageName;
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon );
|
||||
mPagedApps.get( page ).add( appInfo );
|
||||
}
|
||||
if ( callback != null ) {
|
||||
callback.onLoaded( mPagedApps );
|
||||
}
|
||||
mIsLoaded.set( true );
|
||||
}
|
||||
|
||||
public void appAdded( String packageName ) {
|
||||
if ( !mIsLoaded.get() ) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.isEmpty( packageName ) ) {
|
||||
return;
|
||||
}
|
||||
if ( mPagedApps.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo( packageName, 0 );
|
||||
if ( !mAppFilter.filter( packageInfo ) ) {
|
||||
String appName = packageInfo.applicationInfo.loadLabel( packageManager ).toString();
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon );
|
||||
int pageIndex = getPageIndex( packageName, true );
|
||||
if ( !mPagedApps.containsKey( pageIndex ) ) {
|
||||
mPagedApps.put( pageIndex, new ArrayList<>() );
|
||||
}
|
||||
mPagedApps.get( pageIndex ).add( appInfo );
|
||||
}
|
||||
} catch ( PackageManager.NameNotFoundException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int getPageIndex( String packageName, boolean add ) {
|
||||
int totalPages = mPagedApps.size();
|
||||
if ( add ) {
|
||||
if ( totalPages == 0 ) {
|
||||
return 0;
|
||||
} else {
|
||||
if ( mPagedApps.get( totalPages - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
|
||||
return totalPages + 1;
|
||||
} else {
|
||||
return totalPages;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( totalPages == 0 ) {
|
||||
return -1;
|
||||
}
|
||||
int pageIndex = -1;
|
||||
for ( int i = 0; i < totalPages; i++ ) {
|
||||
for ( AppInfo appInfo : mPagedApps.get( i ) ) {
|
||||
if ( TextUtils.equals( appInfo.getPackageName(), packageName ) ) {
|
||||
pageIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pageIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public void appRemoved( String packageName ) {
|
||||
if ( !mIsLoaded.get() ) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.isEmpty( packageName ) ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo( packageName, 0 );
|
||||
if ( !mAppFilter.filter( packageInfo ) ) {
|
||||
int pageIndex = getPageIndex( packageName, false );
|
||||
if ( pageIndex == -1 ) {
|
||||
return;
|
||||
}
|
||||
int totalPages = mPagedApps.size();
|
||||
List< AppInfo > dynamicAppsList = new ArrayList<>();
|
||||
for ( int i = pageIndex; i < totalPages; i++ ) {
|
||||
dynamicAppsList.addAll( mPagedApps.remove( i ) );
|
||||
}
|
||||
int counter = 0;
|
||||
for ( int i = 0; i < dynamicAppsList.size(); i++ ) {
|
||||
AppInfo appInfo = dynamicAppsList.get( i );
|
||||
if ( TextUtils.equals( appInfo.getPackageName(), packageName ) ) {
|
||||
continue;
|
||||
}
|
||||
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE + pageIndex;
|
||||
if ( !mPagedApps.containsKey( page ) ) {
|
||||
mPagedApps.put( page, new ArrayList<>() );
|
||||
}
|
||||
mPagedApps.get( page ).add( appInfo );
|
||||
}
|
||||
}
|
||||
} catch ( PackageManager.NameNotFoundException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,8 @@ package com.mogo.module.apps.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import com.mogo.module.apps.RefreshAppsListLiveData;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
|
||||
public class AppInstallReceiver extends BroadcastReceiver {
|
||||
|
||||
@@ -14,31 +13,23 @@ public class AppInstallReceiver extends BroadcastReceiver {
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_ADDED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
notifyRefreshAppsList( packageName );
|
||||
AppsModel.getInstance( context ).appAdded( packageName );
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_REMOVED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
notifyRefreshAppsList( packageName );
|
||||
AppsModel.getInstance( context ).appRemoved( packageName );
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_REPLACED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
notifyRefreshAppsList( packageName );
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_CHANGED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
notifyRefreshAppsList( packageName );
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_RESTARTED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
notifyRefreshAppsList( packageName );
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_DATA_CLEARED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
notifyRefreshAppsList( packageName );
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyRefreshAppsList( String packageName ) {
|
||||
RefreshAppsListLiveData.getInstance().postValue( packageName );
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_210" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/module_apps_id_loading"
|
||||
android:layout_width="@dimen/dp_75"
|
||||
android:layout_height="@dimen/dp_75"
|
||||
android:layout_gravity="center" />
|
||||
</FrameLayout>
|
||||
@@ -18,6 +18,11 @@ public class MogoModule {
|
||||
*/
|
||||
private String mName;
|
||||
|
||||
/**
|
||||
* 语音指令通过广播传递数据 action.
|
||||
*/
|
||||
private String mVoiceAction;
|
||||
|
||||
/**
|
||||
* @param path 模块加载路径
|
||||
* @param name 模块名称
|
||||
@@ -32,15 +37,26 @@ public class MogoModule {
|
||||
return mPath;
|
||||
}
|
||||
|
||||
public void setPath( String path ) {
|
||||
public MogoModule setPath( String path ) {
|
||||
this.mPath = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName( String name ) {
|
||||
public MogoModule setName( String name ) {
|
||||
this.mName = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getVoiceAction() {
|
||||
return mVoiceAction;
|
||||
}
|
||||
|
||||
public MogoModule setVoiceAction( String voiceAction ) {
|
||||
this.mVoiceAction = voiceAction;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
try {
|
||||
refreshTimeAndDate();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, "error. ", e );
|
||||
Logger.e( TAG, e, "error. " );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -57,14 +57,14 @@ public class WeatherModel {
|
||||
try {
|
||||
queryWeatherInformation();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, "error. ", e );
|
||||
Logger.e( TAG, e, "error. " );
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
mContentResolver.registerContentObserver( mWeatherUri, false, mContentObserver );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, "error when query weather info.", e );
|
||||
Logger.e( TAG, e, "error when query weather info." );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_92"
|
||||
android:background="@drawable/module_map_dw_top_corner_bkg"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -31,6 +31,7 @@ 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.map.VoiceConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
@@ -132,7 +133,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_APPS, MogoModulePaths.PATH_MODULE_APPS ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_MAP, MogoModulePaths.PATH_MODULE_MAP ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_MAP, MogoModulePaths.PATH_MODULE_MAP ).setVoiceAction( VoiceConstants.ACTION_GAODE_SDK_NAVI_RECV ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_EXTENSION, ExtensionsModuleConst.TYPE ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_ENTRANCE, ExtensionsModuleConst.TYPE_ENTRANCE ) );
|
||||
|
||||
@@ -5,10 +5,14 @@ import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.MogoMapView;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -23,6 +27,8 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
private MogoMapView mMogoMapView;
|
||||
private IMogoMap mMogoMap;
|
||||
|
||||
private IMogoVoiceManager mMogoVoiceManager;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_map_fragment_map;
|
||||
@@ -48,6 +54,8 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
mMogoMapView.onCreate( savedInstanceState );
|
||||
}
|
||||
initMapView();
|
||||
mMogoVoiceManager = ( IMogoVoiceManager ) ARouter.getInstance().build( MogoServicePaths.PATH_VOICE_MANAGER ).navigation( getContext() );
|
||||
mMogoVoiceManager.registerIntentListener( VoiceConstants.ACTION_GAODE_SDK_NAVI_RECV, mPresenter );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,14 +74,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
@@ -109,4 +109,20 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getUIController() {
|
||||
return mMogoMap.getUIController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onDestroy();
|
||||
}
|
||||
if ( mMogoVoiceManager != null ) {
|
||||
mMogoVoiceManager.unregisterIntentListener( VoiceConstants.ACTION_GAODE_SDK_NAVI_RECV );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.service.voice.IMogoVoiceListener;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -8,11 +19,185 @@ import com.mogo.commons.mvp.Presenter;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MapPresenter extends Presenter< MapView > {
|
||||
public class MapPresenter extends Presenter< MapView > implements IMogoVoiceListener, IMogoVoiceCmdCallBack {
|
||||
|
||||
|
||||
public MapPresenter( MapView view ) {
|
||||
super( view );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
registerUnWakeupCmd();
|
||||
}
|
||||
|
||||
private void registerUnWakeupCmd() {
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_ZOOM_IN, VoiceConstants.CMD_MAP_ZOOM_IN_WAKE_UP_WORDS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_ZOOM_OUT, VoiceConstants.CMD_MAP_ZOOM_OUT_WAKE_UP_WORDS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_2D, VoiceConstants.CMD_MAP_2D_WAKE_UP_WORDS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_3D, VoiceConstants.CMD_MAP_3D_WAKE_UP_WORDS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_LIGHT_MODE, VoiceConstants.CMD_MAP_LIGHT_MODE_WAKE_UP_WORDS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_NIGHT_MODE, VoiceConstants.CMD_MAP_NIGHT_MODE_WAKE_UP_WORDS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_TRAFFIC_MODE, VoiceConstants.CMD_MAP_TRAFFIC_MODE_WAKE_UP_WORDS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE, VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_WAKE_UP_WORDS, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String action, Intent intent ) {
|
||||
if ( !TextUtils.equals( action, VoiceConstants.ACTION_GAODE_SDK_NAVI_RECV ) ) {
|
||||
return;
|
||||
}
|
||||
int type = intent.getExtras().getInt( VoiceConstants.EXTRA_KEY_TYPE );
|
||||
Bundle data = intent.getExtras();
|
||||
switch ( type ) {
|
||||
case VoiceConstants.TYPE_START_NAVI:
|
||||
// actions.onStartNavi();
|
||||
break;
|
||||
case VoiceConstants.TYPE_STOP_NAVI:
|
||||
// actions.onStopNavi();
|
||||
break;
|
||||
case VoiceConstants.TYPE_NAVI_GUIDE_INFO:
|
||||
// actions.onSpeakNaviGuideInfo();
|
||||
break;
|
||||
case VoiceConstants.TYPE_MAP_UI_SETTING:
|
||||
final int actionType = data.getInt( VoiceConstants.EXTRA_TYPE, 0 );
|
||||
final int operateAction = data.getInt( VoiceConstants.EXTRA_OPERA, 0 );
|
||||
onMapUISetting( actionType, operateAction );
|
||||
break;
|
||||
case VoiceConstants.TYPE_NAVI_STRATEGY:
|
||||
// actions.onNaviStrategySetting( data.getInt( VoiceConstants.EXTRA_M, 1 ) );
|
||||
break;
|
||||
case VoiceConstants.TYPE_NAVI_OVERVIEW:
|
||||
final int overview = data.getInt( VoiceConstants.EXTRA_IS_SHOW, -1 );
|
||||
// if ( overview == 0 ) {
|
||||
// actions.onNaviOverview();
|
||||
// } else {
|
||||
// actions.onNaviContinue();
|
||||
// }
|
||||
break;
|
||||
case VoiceConstants.TYPE_NAVI_SPEAK:
|
||||
// actions.onNaviSpeak( data.getInt( VoiceConstants.EXTRA_MUTE, 0 ) );
|
||||
break;
|
||||
case VoiceConstants.TYPE_COMMON_ADDRESS_SETTING:
|
||||
// actions.onAddressSetting();
|
||||
break;
|
||||
case VoiceConstants.TYPE_COMMON_ADDRESS_CHANGED:
|
||||
// actions.onAddressUpdate();
|
||||
break;
|
||||
case VoiceConstants.TYPE_NAVI_ADD_POINT:
|
||||
// final int updateType = intent.getIntExtra( "TYPE", -1 );
|
||||
// final String name = intent.getStringExtra( "POINAME" );
|
||||
// final String address = intent.getStringExtra( "ADDRESS" );
|
||||
// final double lat = intent.getDoubleExtra( "LAT", 0.0 );
|
||||
// final double lng = intent.getDoubleExtra( "LON", 0.0 );
|
||||
// actions.onUpdateNaviPoint( updateType, name, address, lat, lng );
|
||||
break;
|
||||
case VoiceConstants.TYPE_SPEAK_NAVI_INFO:
|
||||
// actions.onSpeakPathRetainDistanceInfo();
|
||||
break;
|
||||
case VoiceConstants.TYPE_SPEAK_SPEED_LIMIT_INFO:
|
||||
// actions.onSpeakSpeedLimitInfo();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actionType 0 - 实时路况
|
||||
* 1 - 地图缩放
|
||||
* 2 - 视图模式
|
||||
* 3 - 夜间模式
|
||||
* @param action actionType = 0 -> 0 - 开、1 - 关
|
||||
* actionType = 1 -> 0 - 放大地图、1 - 缩小地图
|
||||
* actionType = 2 -> 0 - 切换到2D车头朝上、1 - 切换2D正北模式、2 - 切换3D车头朝上
|
||||
* actionType = 3 -> 0 - 黑夜、1 - 正常
|
||||
*/
|
||||
public void onMapUISetting( int actionType, int action ) {
|
||||
switch ( actionType ) {
|
||||
case 0:
|
||||
if ( action == 0 ) {
|
||||
mView.getUIController().setTrafficEnabled( true );
|
||||
} else if ( action == 1 ) {
|
||||
mView.getUIController().setTrafficEnabled( false );
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ( action == 0 ) {
|
||||
mView.getUIController().changeZoom( true );
|
||||
} else if ( action == 1 ) {
|
||||
mView.getUIController().changeZoom( false );
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ( action == 0 ) {
|
||||
// 车头朝上,2D
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else if ( action == 1 ) {
|
||||
// 北朝上,2D
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
} else if ( action == 2 ) {
|
||||
// 车头朝上,3D
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ( action == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
} else if ( action == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
switch ( cmd ) {
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
|
||||
onMapUISetting( 0, 0 );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
|
||||
onMapUISetting( 0, 1 );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN:
|
||||
onMapUISetting( 1, 0 );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT:
|
||||
onMapUISetting( 1, 1 );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_2D:
|
||||
onMapUISetting( 2, 1 );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
onMapUISetting( 2, 2 );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_LIGHT_MODE:
|
||||
onMapUISetting( 3, 1 );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
onMapUISetting( 3, 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -9,4 +10,11 @@ import com.mogo.commons.mvp.IView;
|
||||
* 地图view
|
||||
*/
|
||||
public interface MapView extends IView {
|
||||
|
||||
/**
|
||||
* 地图控制接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMapUIController getUIController();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class VoiceConstants {
|
||||
|
||||
// 同行者Adapter接受action
|
||||
public static final String ACTION_GAODE_SDK_NAVI_RECV = "ACTION_GAODE_SDK_NAVI_RECV";
|
||||
// 同行者Adapter发送action
|
||||
public static final String ACTION_GAODE_SDK_NAVI_SEND = "ACTION_GAODE_SDK_NAVI_SEND";
|
||||
|
||||
public static final String EXTRA_KEY_TYPE = "KEY_TYPE";
|
||||
public static final String EXTRA_TYPE = "EXTRA_TYPE";//操作地图
|
||||
public static final String EXTRA_OPERA = "EXTRA_OPERA";//操作地图
|
||||
public static final String EXTRA_MUTE = "EXTRA_MUTE";
|
||||
public static final String EXTRA_IS_SHOW = "EXTRA_IS_SHOW";//预览全路径还是继续导航
|
||||
public static final String EXTRA_M = "EXTRA_M";// 导航策略:1(避免收费) 3(不走高速) 4(躲避拥堵) 20 (高速优先)
|
||||
|
||||
/**
|
||||
* 直接导航
|
||||
*/
|
||||
public static final int TYPE_START_NAVI = 110009;
|
||||
|
||||
/**
|
||||
* 导航预览or继续导航
|
||||
*/
|
||||
public static final int TYPE_NAVI_OVERVIEW = 110006;
|
||||
|
||||
/**
|
||||
* 地图控制:缩放、路况、车头、2/3D
|
||||
*/
|
||||
public static final int TYPE_MAP_UI_SETTING = 110027;
|
||||
|
||||
/**
|
||||
* 重新计算导航策略
|
||||
*/
|
||||
public static final int TYPE_NAVI_STRATEGY = 110032;
|
||||
|
||||
/**
|
||||
* 提箱前方路线方案
|
||||
* <p>
|
||||
* 未实现
|
||||
*/
|
||||
public static final int TYPE_NAVI_GUIDE_INFO = 120004;
|
||||
|
||||
/**
|
||||
* 播放当前剩余里程和时间
|
||||
* <p>
|
||||
* 未实现
|
||||
*/
|
||||
public static final int TYPE_SPEAK_NAVI_INFO = 120001;
|
||||
|
||||
/**
|
||||
* 播放当前限速信息
|
||||
* <p>
|
||||
* 未实现
|
||||
*/
|
||||
public static final int TYPE_SPEAK_SPEED_LIMIT_INFO = 120002;
|
||||
|
||||
/**
|
||||
* 停止导航,但是不退出地图
|
||||
*/
|
||||
public static final int TYPE_STOP_NAVI = 110010;
|
||||
|
||||
/**
|
||||
* 退出地图应用
|
||||
*/
|
||||
@Deprecated
|
||||
public static final int TYPE_EXIT_NAVI = 120003;
|
||||
|
||||
/**
|
||||
* 插入途经点
|
||||
*/
|
||||
public static final int TYPE_NAVI_ADD_POINT = 210009;
|
||||
|
||||
public static final int TYPE_NAVI_SPEAK = 10011;
|
||||
public static final int TYPE_COMMON_ADDRESS_SETTING = 10007;
|
||||
public static final int TYPE_COMMON_ADDRESS_CHANGED = 10008;
|
||||
public static final int TYPE_NAVI_TO = 110027;
|
||||
|
||||
// 地图免唤醒语音注册
|
||||
/**
|
||||
* 放大地图
|
||||
*/
|
||||
public static final String CMD_MAP_ZOOM_IN = "CMD_MAP_ZOOM_IN";
|
||||
public static final String[] CMD_MAP_ZOOM_IN_WAKE_UP_WORDS = {"放大地图"};
|
||||
|
||||
/**
|
||||
* 缩小地图
|
||||
*/
|
||||
public static final String CMD_MAP_ZOOM_OUT = "CMD_MAP_ZOOM_OUT";
|
||||
public static final String[] CMD_MAP_ZOOM_OUT_WAKE_UP_WORDS = {"缩小地图"};
|
||||
|
||||
/**
|
||||
* 2D模式
|
||||
*/
|
||||
public static final String CMD_MAP_2D = "CMD_MAP_2D";
|
||||
public static final String[] CMD_MAP_2D_WAKE_UP_WORDS = {"2D模式"};
|
||||
/**
|
||||
* 3D模式
|
||||
*/
|
||||
public static final String CMD_MAP_3D = "CMD_MAP_3D";
|
||||
public static final String[] CMD_MAP_3D_WAKE_UP_WORDS = {"3D模式"};
|
||||
|
||||
/**
|
||||
* 白天模式
|
||||
*/
|
||||
public static final String CMD_MAP_LIGHT_MODE = "CMD_MAP_LIGHT_MODE";
|
||||
public static final String[] CMD_MAP_LIGHT_MODE_WAKE_UP_WORDS = {"白天模式"};
|
||||
|
||||
/**
|
||||
* 黑夜模式
|
||||
*/
|
||||
public static final String CMD_MAP_NIGHT_MODE = "CMD_MAP_NIGHT_MODE";
|
||||
public static final String[] CMD_MAP_NIGHT_MODE_WAKE_UP_WORDS = {"黑夜模式"};
|
||||
|
||||
/**
|
||||
* 查看路况
|
||||
*/
|
||||
public static final String CMD_MAP_TRAFFIC_MODE = "CMD_MAP_TRAFFIC_MODE";
|
||||
public static final String[] CMD_MAP_TRAFFIC_MODE_WAKE_UP_WORDS = {"查看路况"};
|
||||
/**
|
||||
* 关闭路况
|
||||
*/
|
||||
public static final String CMD_MAP_UN_TRAFFIC_MODE = "CMD_MAP_UN_TRAFFIC_MODE";
|
||||
public static final String[] CMD_MAP_UN_TRAFFIC_MODE_WAKE_UP_WORDS = {"关闭路况"};
|
||||
|
||||
|
||||
}
|
||||
@@ -2,10 +2,12 @@ package com.mogo.module.service;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
@@ -25,8 +27,13 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.receiver.AIAssistReceiver;
|
||||
import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
@@ -37,6 +44,8 @@ import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
@@ -71,6 +80,8 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
*/
|
||||
boolean mIsVertical = false;
|
||||
|
||||
private AIAssistReceiver mAIAssistReceiver;
|
||||
|
||||
/**
|
||||
* 手动刷新策略
|
||||
*/
|
||||
@@ -208,6 +219,31 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
|
||||
//TODO 初始化地图地图绘制大而全的Marker
|
||||
MarkerServiceHandler.init( mContext );
|
||||
registerAIReceiver( context );
|
||||
}
|
||||
|
||||
private void registerAIReceiver( Context context ) {
|
||||
if ( context == null ) {
|
||||
return;
|
||||
}
|
||||
List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
if ( modules.isEmpty() || modules == null ) {
|
||||
return;
|
||||
}
|
||||
mAIAssistReceiver = new AIAssistReceiver( context );
|
||||
IntentFilter filter = new IntentFilter();
|
||||
for ( MogoModule module : modules ) {
|
||||
String action = module.getVoiceAction();
|
||||
if ( !TextUtils.isEmpty( action ) ) {
|
||||
filter.addAction( action );
|
||||
}
|
||||
}
|
||||
try {
|
||||
context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter );
|
||||
Logger.i( TAG, "register voice receiver." );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error. " );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,7 +367,6 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
}
|
||||
}
|
||||
Logger.d( TAG, "current map status: %s, zoom = %f, tilt = %f, bearing = %f", latLng, zoom, tilt, bearing );
|
||||
}
|
||||
|
||||
private int getQueryRadius() {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.module.service.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-10-03
|
||||
* <p>
|
||||
* 语音助手广播接收者
|
||||
*/
|
||||
public class AIAssistReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "AIAssistReceiver";
|
||||
|
||||
|
||||
private IMogoVoiceManager mMogoVoiceManager;
|
||||
|
||||
public AIAssistReceiver( Context context ) {
|
||||
mMogoVoiceManager = ( IMogoVoiceManager ) ARouter.getInstance().build( MogoServicePaths.PATH_VOICE_MANAGER ).navigation( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
Logger.i( TAG, "receive ai assist intent" );
|
||||
final String action = intent.getAction();
|
||||
mMogoVoiceManager.invoke( action, intent );
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service;
|
||||
package com.mogo.module.service.refresh;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service;
|
||||
package com.mogo.module.service.refresh;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.tanlu">
|
||||
package="com.mogo.module.tanlu">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.constant
|
||||
package com.mogo.module.tanlu.constant
|
||||
|
||||
const val REQUESTCODE_MAINACTIVITY = 0
|
||||
const val REQUESTCODE_MEDIAACTIVITY = 1
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.constant;
|
||||
package com.mogo.module.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.fragment;
|
||||
package com.mogo.module.tanlu.fragment;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
@@ -35,12 +35,12 @@ import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.tanlu.R;
|
||||
import com.mogo.tanlu.model.event.MarkerInfo;
|
||||
import com.mogo.tanlu.util.Utils;
|
||||
import com.mogo.tanlu.video.FullMediaActivity;
|
||||
import com.mogo.tanlu.video.SimpleCoverVideoPlayer;
|
||||
import com.mogo.tanlu.view.AutoZoomInImageView;
|
||||
import com.mogo.module.tanlu.R;
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo;
|
||||
import com.mogo.module.tanlu.util.Utils;
|
||||
import com.mogo.module.tanlu.video.FullMediaActivity;
|
||||
import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
|
||||
import com.mogo.module.tanlu.view.AutoZoomInImageView;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
||||
@@ -52,9 +52,9 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.tanlu.util.StringUitlKt.formatDate;
|
||||
import static com.mogo.tanlu.util.Utils.handleDistance;
|
||||
import static com.mogo.tanlu.video.VideoInitKt.initVideo;
|
||||
import static com.mogo.module.tanlu.util.StringUitlKt.formatDate;
|
||||
import static com.mogo.module.tanlu.util.Utils.handleDistance;
|
||||
import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -157,23 +157,23 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
int id = view.getId();
|
||||
if (id == R.id.tv_previous_res) { //上一个
|
||||
//判断是图片还是视频,第一个时,上一个不可点击
|
||||
Logger.d(TAG, " tv_previous_res --1-> currentPosition =" + currentPosition);
|
||||
Logger.d(TAG, " tv_previous_res --1-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
if (currentPosition < 0) {
|
||||
return;
|
||||
}
|
||||
currentPosition--;
|
||||
Logger.d(TAG, " tv_previous_res --2-> currentPosition =" + currentPosition);
|
||||
if (markerExploreWayList.size() > currentPosition) {
|
||||
Logger.d(TAG, " tv_previous_res --2-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) {
|
||||
handleData(markerExploreWayList.get(currentPosition));
|
||||
}
|
||||
} else if (id == R.id.tv_next_res) { //下一个
|
||||
//判断是图片还是视频,最后一个时,下一个不可点击
|
||||
Logger.d(TAG, " tv_next_res --1-> currentPosition =" + currentPosition);
|
||||
if (currentPosition > markerExploreWayList.size()) { //TODO >=
|
||||
Logger.d(TAG, " tv_next_res --1-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
if (currentPosition > markerExploreWayList.size()) {
|
||||
return;
|
||||
}
|
||||
currentPosition++;
|
||||
Logger.d(TAG, " tv_next_res --2-> currentPosition =" + currentPosition);
|
||||
Logger.d(TAG, " tv_next_res --2-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition) {
|
||||
handleData(markerExploreWayList.get(currentPosition));
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.fragment;
|
||||
package com.mogo.module.tanlu.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@@ -14,7 +14,7 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.fragment;
|
||||
package com.mogo.module.tanlu.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.map;
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
@@ -10,7 +10,7 @@ import com.amap.api.services.route.BusPath;
|
||||
import com.amap.api.services.route.BusStep;
|
||||
import com.amap.api.services.route.RouteBusLineItem;
|
||||
import com.amap.api.services.route.RouteRailwayItem;
|
||||
import com.mogo.tanlu.R;
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.map;
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
public class ChString {
|
||||
public static final String Kilometer = "\u516c\u91cc";// "公里";
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.map;
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
@@ -15,7 +15,7 @@ import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.route.DrivePath;
|
||||
import com.amap.api.services.route.DriveStep;
|
||||
import com.amap.api.services.route.TMC;
|
||||
import com.mogo.tanlu.R;
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.map;
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -14,7 +14,7 @@ import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.tanlu.R;
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
class CarsLive {
|
||||
var sn: String
|
||||
var lat: Double
|
||||
var lon: Double
|
||||
var direction: Int
|
||||
var canLive: Int
|
||||
|
||||
constructor(sn: String, lat: Double, lon: Double, direction: Int, canLive: Int) {
|
||||
this.sn = sn
|
||||
this.lat = lat
|
||||
this.lon = lon
|
||||
this.direction = direction
|
||||
this.canLive = canLive
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
/**
|
||||
* @description
|
||||
*
|
||||
* @author lixiaopeng
|
||||
* @since 2019-10-24
|
||||
*/
|
||||
data class Center (
|
||||
val lat: Double,//weidu
|
||||
val lon: Double
|
||||
)
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.mogo.tanlu.model;
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -10,7 +12,7 @@ import java.util.ArrayList;
|
||||
* @description 列表数据
|
||||
* @since 2020-01-05
|
||||
*/
|
||||
public class Information implements Parcelable {
|
||||
public class Information extends BaseData implements Parcelable {
|
||||
private int type;
|
||||
private Double lon;
|
||||
private Double lat;
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-11-20
|
||||
*
|
||||
* 根据范围请求情报+在线车机结果
|
||||
*/
|
||||
data class InformationAndLiveCarResult(
|
||||
var onTheWayData: Result,
|
||||
var infoMationResult: Result,
|
||||
var snResult: Sns
|
||||
) {
|
||||
fun getInformation(): Result = if (onTheWayData == null
|
||||
|| onTheWayData.informations == null
|
||||
|| onTheWayData.informations.isEmpty()
|
||||
) infoMationResult else onTheWayData
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.model
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 通勤族划线
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class PathLineResult extends BaseData {
|
||||
private List<Information> informations;
|
||||
private List<Center> pointList;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
|
||||
public List<Center> getPointList() {
|
||||
return pointList;
|
||||
}
|
||||
|
||||
public void setPointList(List<Center> pointList) {
|
||||
this.pointList = pointList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class Result extends BaseData {
|
||||
public List<Information> informations;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
|
||||
class Sns {
|
||||
|
||||
var sns: List<CarsLive>
|
||||
var localUserId: String
|
||||
|
||||
constructor(sns: List<CarsLive>, localUserId: String) {
|
||||
this.sns = sns
|
||||
this.localUserId = localUserId
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 声音控制接口
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class VoiceSearchResult extends BaseData {
|
||||
private List<Information> informations;
|
||||
private String description;
|
||||
private Sns snResult;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Sns getSnResult() {
|
||||
return snResult;
|
||||
}
|
||||
|
||||
public void setSnResult(Sns snResult) {
|
||||
this.snResult = snResult;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.model.event;
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.model.event;
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.tanlu.model.global
|
||||
package com.mogo.module.tanlu.model.global
|
||||
|
||||
import com.mogo.tanlu.model.Information
|
||||
import com.mogo.module.tanlu.model.Information
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.module.tanlu.net;
|
||||
|
||||
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
|
||||
import com.mogo.module.tanlu.model.PathLineResult;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 探路相关接口定义
|
||||
* @since 2020-01-07
|
||||
*/
|
||||
public interface TanluApiService {
|
||||
|
||||
/**
|
||||
* 探路沿途数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/path/no/getOnTheWayDataAndSn/v1")
|
||||
Observable<InformationAndLiveCarResult> requestInformationAlongTheWay(@Query("sn") String sn, @FieldMap Map<String, String> parameters);
|
||||
|
||||
/**
|
||||
* 获取上班族路线的坐标集
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-travel-condition/travelDetail/info/no/commuter/v1")
|
||||
Observable<PathLineResult> getRoadLineInfo(@FieldMap Map<String, String> infoBody);
|
||||
|
||||
|
||||
/**
|
||||
* 基于地理信息词缀的空间情报检索
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/search/no/searchInforationByAddress/v1")
|
||||
Observable<VoiceSearchResult> searchOnLineInformation(@FieldMap Map<String, String> infoBody);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mogo.tanlu.receiver
|
||||
package com.mogo.module.tanlu.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.mogo.tanlu.model.event.MarkerInfo
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.mogo.tanlu.receiver
|
||||
package com.mogo.module.tanlu.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.mogo.tanlu.model.event.VoiceRoadInfo
|
||||
import com.mogo.module.tanlu.model.event.VoiceRoadInfo
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* xx堵不堵,接收关键字
|
||||
* xx堵不堵,接收关键字,应该在哪里接收关键字请求接口?
|
||||
*/
|
||||
class RoadInfoReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
@@ -1,5 +1,4 @@
|
||||
package com.mogo.tanlu.util
|
||||
|
||||
package com.mogo.module.tanlu.util
|
||||
|
||||
|
||||
const val SPACE_TIME = 1000
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.util
|
||||
package com.mogo.module.tanlu.util
|
||||
|
||||
import android.os.Message
|
||||
import android.view.View
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.util
|
||||
package com.mogo.module.tanlu.util
|
||||
|
||||
import android.text.format.DateFormat
|
||||
import java.text.DecimalFormat
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.util;
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.mogo.tanlu.video
|
||||
package com.mogo.module.tanlu.video
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.mogo.tanlu.R
|
||||
import com.mogo.tanlu.model.Informations
|
||||
import com.mogo.tanlu.util.HideControl
|
||||
import com.mogo.tanlu.util.formatDate
|
||||
import com.mogo.module.tanlu.R
|
||||
import com.mogo.module.tanlu.util.HideControl
|
||||
import com.mogo.module.tanlu.util.formatDate
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.video
|
||||
package com.mogo.module.tanlu.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -6,7 +6,7 @@ import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.mogo.tanlu.R
|
||||
import com.mogo.module.tanlu.R
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.video
|
||||
package com.mogo.module.tanlu.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -6,7 +6,7 @@ import android.view.Surface
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.mogo.tanlu.R
|
||||
import com.mogo.module.tanlu.R
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.video
|
||||
package com.mogo.module.tanlu.video
|
||||
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.tanlu.view;
|
||||
package com.mogo.module.tanlu.view;
|
||||
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.mogo.tanlu.model
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import com.amap.api.maps.model.LatLng
|
||||
|
||||
fun Informations.toLatLng(): LatLng {
|
||||
return LatLng(lat, lon)
|
||||
}
|
||||
|
||||
class Informations(
|
||||
var type: Int,
|
||||
var lon: Double,
|
||||
var lat: Double,
|
||||
var addr: String?,
|
||||
var generateTime: Long,
|
||||
var cityName: String?,
|
||||
// var items: ArrayList<Items>,
|
||||
var distance: Int,
|
||||
var nickName: String?,
|
||||
var headImgUrl: String?
|
||||
) :
|
||||
Parcelable {
|
||||
|
||||
var position = 0
|
||||
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readInt(),
|
||||
parcel.readDouble(),
|
||||
parcel.readDouble(),
|
||||
parcel.readString(),
|
||||
parcel.readLong(),
|
||||
parcel.readString(),
|
||||
// parcel.readArrayList(Items::class.java.classLoader) as ArrayList<Items>,
|
||||
parcel.readInt(),
|
||||
parcel.readString(),
|
||||
parcel.readString()
|
||||
)
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(type)
|
||||
parcel.writeDouble(lon)
|
||||
parcel.writeDouble(lat)
|
||||
parcel.writeString(addr)
|
||||
parcel.writeLong(generateTime)
|
||||
parcel.writeString(cityName)
|
||||
// parcel.writeList(items)
|
||||
parcel.writeInt(distance)
|
||||
parcel.writeString(nickName)
|
||||
parcel.writeString(headImgUrl)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<Informations> {
|
||||
override fun createFromParcel(parcel: Parcel): Informations {
|
||||
return Informations(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Informations?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.mogo.tanlu.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 探路相关接口定义
|
||||
* @since 2020-01-07
|
||||
*/
|
||||
public interface TanluApiService {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "" )
|
||||
Observable<BaseData> refreshData(@QueryMap Map< String, Object > params,
|
||||
@FieldMap Map< String, Object > parameters );
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
tools:context=".video.FullMediaActivity">
|
||||
|
||||
<!--全屏播放器-->
|
||||
<com.mogo.tanlu.video.MediaCoverVideoPlayer
|
||||
<com.mogo.module.tanlu.video.MediaCoverVideoPlayer
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<com.zhidao.roadcondition.video.MediaCoverVideoPlayer
|
||||
<com.mogo.module.tanlu.video.MediaCoverVideoPlayer
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:longClickable="true" />
|
||||
|
||||
<com.zhidao.roadcondition.view.AutoZoomInImageView
|
||||
<com.mogo.module.tanlu.view.AutoZoomInImageView
|
||||
android:id="@+id/iv_pager_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -68,13 +68,13 @@
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/shape_bg_222533_9px">
|
||||
|
||||
<com.mogo.tanlu.video.SimpleCoverVideoPlayer
|
||||
<com.mogo.module.tanlu.video.SimpleCoverVideoPlayer
|
||||
android:id="@+id/video_player_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.mogo.tanlu.view.AutoZoomInImageView
|
||||
<com.mogo.module.tanlu.view.AutoZoomInImageView
|
||||
android:id="@+id/tanlu_photo_imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
android:layout_marginBottom="14dp"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<com.zhidao.roadcondition.view.AutoZoomInImageView
|
||||
<com.mogo.module.tanlu.view.AutoZoomInImageView
|
||||
android:id="@+id/recycle_photo_imageView"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="225dp"
|
||||
|
||||
@@ -71,7 +71,10 @@ public class MogoServicePaths {
|
||||
*/
|
||||
public static final String PATH_FRAGMENT_MANAGER = "/fragmentmanager/api";
|
||||
|
||||
|
||||
/**
|
||||
* 免唤醒语音控制
|
||||
*/
|
||||
public static final String PATH_VOICE_MANAGER = "/voicemanager/api";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.service.voice;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 免唤醒语音监听
|
||||
*/
|
||||
public interface IMogoVoiceListener {
|
||||
|
||||
/**
|
||||
* 回调语音意图
|
||||
*
|
||||
* @param action 广播 action
|
||||
* @param intent 意图
|
||||
*/
|
||||
void onIntentReceived( String action, Intent intent );
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.service.voice;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 免唤醒语音控制
|
||||
*/
|
||||
public interface IMogoVoiceManager extends IProvider {
|
||||
|
||||
/**
|
||||
* 注册意图接收者
|
||||
*
|
||||
* @param action
|
||||
*/
|
||||
void registerIntentListener( String action, IMogoVoiceListener listener );
|
||||
|
||||
/**
|
||||
* 注册意图接收者
|
||||
*
|
||||
* @param action
|
||||
*/
|
||||
void unregisterIntentListener( String action );
|
||||
|
||||
/**
|
||||
* 触发意图回调,各业务不用关心
|
||||
*
|
||||
* @param action
|
||||
* @param intent
|
||||
*/
|
||||
void invoke( String action, Intent intent );
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mogo.service.impl.voice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.voice.IMogoVoiceListener;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_VOICE_MANAGER )
|
||||
public class MogoVoiceManager implements IMogoVoiceManager {
|
||||
|
||||
@Override
|
||||
public void registerIntentListener( String action, IMogoVoiceListener listener ) {
|
||||
VoiceManager.getInstance().registerIntentListener( action, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterIntentListener( String action ) {
|
||||
VoiceManager.getInstance().unregisterIntentListener( action );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke( String action, Intent intent ) {
|
||||
VoiceManager.getInstance().invoke( action, intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
VoiceManager.getInstance().init( context );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.service.impl.voice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.service.voice.IMogoVoiceListener;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class VoiceManager implements IMogoVoiceManager {
|
||||
|
||||
private static volatile VoiceManager sInstance;
|
||||
|
||||
private VoiceManager() {
|
||||
}
|
||||
|
||||
public static VoiceManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( VoiceManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new VoiceManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
private Map< String, List< IMogoVoiceListener > > mListeners = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void registerIntentListener( String action, IMogoVoiceListener listener ) {
|
||||
if ( listener == null || action == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !mListeners.containsKey( action ) ) {
|
||||
mListeners.put( action, new ArrayList<>() );
|
||||
}
|
||||
mListeners.get( action ).add( listener );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterIntentListener( String action ) {
|
||||
mListeners.remove( action );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke( String action, Intent intent ) {
|
||||
List< IMogoVoiceListener > listeners = mListeners.get( action );
|
||||
if ( listeners != null && !listeners.isEmpty() ) {
|
||||
for ( IMogoVoiceListener listener : listeners ) {
|
||||
listener.onIntentReceived( action, intent );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class WindowViewHandler {
|
||||
try {
|
||||
sWindowManager = ( WindowManager ) view.getContext().getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, "error. ", e );
|
||||
Logger.e( TAG, e, "error. " );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user