Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0

This commit is contained in:
zhangyuanzhen
2020-02-17 20:12:46 +08:00
6 changed files with 69 additions and 46 deletions

2
.idea/misc.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -121,4 +121,12 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
getActivity().onBackPressed();
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
if ( mPresenter != null ) {
mPresenter.onDestroy( getViewLifecycleOwner() );
}
}
}

View File

@@ -1,11 +1,22 @@
package com.mogo.module.apps;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.module.apps.utils.LaunchUtils;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.intent.IMogoIntentManager;
import com.mogo.utils.TipToast;
import org.json.JSONException;
import org.json.JSONObject;
/**
* @author congtaowang
@@ -13,7 +24,9 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
* <p>
* 描述
*/
public class AppNavigatorPresenter extends Presenter< AppNavigatorView > implements IMogoVoiceCmdCallBack {
public class AppNavigatorPresenter extends Presenter< AppNavigatorView > implements IMogoIntentListener {
IMogoIntentManager mIntentManager;
public AppNavigatorPresenter( AppNavigatorView view ) {
super( view );
@@ -22,59 +35,55 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
mIntentManager = ( IMogoIntentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_INTENT_MANAGER ).navigation( getContext() );
}
@Override
public void onResume( @NonNull LifecycleOwner owner ) {
super.onResume( owner );
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( AppsConst.CMD_OPEN_APPS_PANEL, AppsConst.CMD_OPEN_APPS_PANEL_UN_WAKEUP_WORDS, this );
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( AppsConst.CMD_CLOSE_APPS_PANEL, AppsConst.CMD_CLOSE_APPS_PANEL_UN_WAKEUP_WORDS, this );
mIntentManager.registerIntentListener( AppsConst.COMMAND_OPERATION, this );
}
@Override
public void onPause( @NonNull LifecycleOwner owner ) {
super.onPause( owner );
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( AppsConst.CMD_OPEN_APPS_PANEL );
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( AppsConst.CMD_CLOSE_APPS_PANEL );
mIntentManager.unregisterIntentListener( AppsConst.COMMAND_OPERATION );
}
@Override
public void onCmdSelected( String cmd ) {
if ( mView == null ) {
public void onIntentReceived( String intentStr, Intent intent ) {
if ( !AppsConst.COMMAND_OPERATION.equals( intentStr ) ) {
return;
}
switch ( cmd ) {
case AppsConst.CMD_OPEN_APPS_PANEL:
mView.openAppsPanel();
break;
case AppsConst.CMD_CLOSE_APPS_PANEL:
mView.closeAppsPanel();
break;
try {
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
String app = object.optString( "object" );
String operation = object.optString( "operation" );
if ( AppsConst.OBJECT_ALL_APPS.equals( app ) ) {
if ( AppsConst.OPERATION_OPEN.equals( operation ) ) {
mView.openAppsPanel();
} else if ( AppsConst.OPERATION_CLOSE.equals( operation ) ) {
mView.closeAppsPanel();
}
} else if ( AppsConst.OBJECT_FAST_SETTINGS.equals( app ) ) {
if ( AppsConst.OPERATION_OPEN.equals( operation ) ) {
try {
LaunchUtils.launchByPkg( getContext(), AppsConst.APP_PKG_CAR_SETTINGS );
} catch ( Exception e ) {
TipToast.shortTip( R.string.module_apps_str_no_app );
}
}
}
} catch ( JSONException e ) {
e.printStackTrace();
}
}
@Override
public void onCmdAction( String speakText ) {
}
@Override
public void onCmdCancel( String speakText ) {
}
@Override
public void onSpeakEnd( String speakText ) {
}
@Override
public void onSpeakSelectTimeOut( String speakText ) {
}
@Override
public void onDestroy( @NonNull LifecycleOwner owner ) {
if ( mIntentManager != null ) {
mIntentManager.unregisterIntentListener( AppsConst.COMMAND_OPERATION );
}
super.onDestroy( owner );
}
}

View File

@@ -8,17 +8,16 @@ package com.mogo.module.apps;
*/
public class AppsConst {
/**
* 打开/关闭全部应用、打开/关闭车辆设置
*/
public static final String COMMAND_OPERATION = "system.application.operation";
/**
* 每页显示多少个app
*/
public static final int TOTAL_SIZE_EACH_PAGE = 12;
public static final String CMD_OPEN_APPS_PANEL = "CMD_OPEN_APPS_PANEL";
public static final String[] CMD_OPEN_APPS_PANEL_UN_WAKEUP_WORDS = {"打开全部应用"};
public static final String CMD_CLOSE_APPS_PANEL = "CMD_CLOSE_APPS_PANEL";
public static final String[] CMD_CLOSE_APPS_PANEL_UN_WAKEUP_WORDS = {"关闭全部应用"};
/**
* 媒体跳转
*/
@@ -27,4 +26,11 @@ public class AppsConst {
* 车辆设置跳转
*/
public static final String APP_PKG_CAR_SETTINGS = "com.zhidao.settings";
public static final String OBJECT_ALL_APPS = "全部应用";
public static final String OBJECT_FAST_SETTINGS = "快捷设置";
public static final String OPERATION_OPEN = "打开";
public static final String OPERATION_CLOSE = "关闭";
}

View File

@@ -221,7 +221,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessag
if (alpha == 1) {
try {
// 使用TranslateAnimation,填写一个需要移动的目标点
ScaleAnimation animationScale = new ScaleAnimation(0.5f, 1.2f, 0.5f, 1.2f);
ScaleAnimation animationScale = new ScaleAnimation(0.1f, 1.2f, 0.1f, 1.2f);
animationScale.setDuration(500);
animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
@@ -233,10 +233,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessag
} catch (Exception e) {
Logger.e(TAG, e, "error.");
}
}else{
} else {
try {
// 使用TranslateAnimation,填写一个需要移动的目标点
ScaleAnimation animationScale = new ScaleAnimation(1.2f, 1f, 1.2f, 1f);
ScaleAnimation animationScale = new ScaleAnimation(1.2f, 0.9f, 1.2f, 0.9f);
animationScale.setDuration(500);
animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);

View File

@@ -70,8 +70,8 @@
<ProgressBar
android:id="@+id/loading"
android:layout_width="@dimen/tanlu_module_full_loading_width"
android:layout_height="@dimen/tanlu_module_full_loading_height"
android:layout_width="@dimen/tanlu_module_full_start_width"
android:layout_height="@dimen/tanlu_module_full_start_width"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@drawable/loading_bg"