opt
This commit is contained in:
@@ -242,12 +242,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
}
|
||||
mAIAssistReceiver = new AIAssistReceiver( context );
|
||||
IntentFilter filter = new IntentFilter();
|
||||
for ( MogoModule module : modules ) {
|
||||
String action = module.getVoiceAction();
|
||||
if ( !TextUtils.isEmpty( action ) ) {
|
||||
filter.addAction( action );
|
||||
}
|
||||
}
|
||||
filter.addAction( AIAssistReceiver.ACTION );
|
||||
try {
|
||||
context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter );
|
||||
Logger.i( TAG, "register voice receiver." );
|
||||
|
||||
@@ -22,6 +22,5 @@ public interface RefreshApiService {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
|
||||
Observable< BaseData > refreshData(
|
||||
@FieldMap Map< String, Object > parameters );
|
||||
Observable< BaseData > refreshData( @FieldMap Map< String, Object > parameters );
|
||||
}
|
||||
|
||||
@@ -56,14 +56,12 @@ public class RefreshModel {
|
||||
public void refreshData( MogoLatLng latLng, int radius, final RefreshCallback callback ) {
|
||||
if ( mRefreshApiService != null ) {
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
|
||||
final Map< String, Object > field = new HashMap<>();
|
||||
field.put( "sn", query.get( "sn" ) );
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.limit = 50;
|
||||
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
|
||||
refreshBody.radius = radius;
|
||||
field.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
|
||||
mRefreshApiService.refreshData( field )
|
||||
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
|
||||
mRefreshApiService.refreshData( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
|
||||
|
||||
@@ -3,7 +3,6 @@ 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;
|
||||
@@ -19,6 +18,9 @@ import com.mogo.utils.logger.Logger;
|
||||
*/
|
||||
public class AIAssistReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String ACTION = "com.zhidao.speech.awake.notify";
|
||||
public static final String PARAM_COMMAND = "command";
|
||||
|
||||
private static final String TAG = "AIAssistReceiver";
|
||||
|
||||
|
||||
@@ -32,6 +34,11 @@ public class AIAssistReceiver extends BroadcastReceiver {
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
Logger.i( TAG, "receive ai assist intent" );
|
||||
final String action = intent.getAction();
|
||||
mMogoVoiceManager.invoke( action, intent );
|
||||
if ( TextUtils.equals( ACTION, action ) ) {
|
||||
String cmd = intent.getStringExtra( PARAM_COMMAND );
|
||||
if ( !TextUtils.isEmpty( cmd ) ) {
|
||||
mMogoVoiceManager.invoke( cmd, intent );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user