diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java index f3f83666ce..72d382f0c8 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java @@ -78,6 +78,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack { mHasFlush = isVoiceServiceReady( context ); } + @VoiceTrack @Override public void onCmdSelected( String cmd ) { if ( !mCmdMap.containsKey( cmd ) ) { @@ -94,6 +95,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack { } } + @VoiceTrack @Override public void onCmdAction( String speakText ) { if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) { @@ -104,6 +106,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack { } } + @VoiceTrack @Override public void onCmdCancel( String speakText ) { if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) { @@ -114,6 +117,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack { } } + @VoiceTrack @Override public void onSpeakEnd( String speakText ) { if ( mQAndAMap.containsKey( speakText ) ) { @@ -130,6 +134,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack { } } + @VoiceTrack @Override public void onSpeakSelectTimeOut( String speakText ) { if ( mQAndAMap.containsKey( speakText ) ) { diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceIntentTrack.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceIntentTrack.java new file mode 100644 index 0000000000..8c1a6c9b75 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceIntentTrack.java @@ -0,0 +1,16 @@ +package com.mogo.commons.voice; + + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.CONSTRUCTOR; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Target({TYPE, METHOD, CONSTRUCTOR}) +@Retention(RUNTIME) +public @interface VoiceIntentTrack { + +} \ No newline at end of file diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceTrack.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceTrack.java new file mode 100644 index 0000000000..d1ef2c606f --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceTrack.java @@ -0,0 +1,16 @@ +package com.mogo.commons.voice; + + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.CONSTRUCTOR; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Target({TYPE, METHOD, CONSTRUCTOR}) +@Retention(RUNTIME) +public @interface VoiceTrack { + +} \ No newline at end of file diff --git a/modules/mogo-module-apps/build.gradle b/modules/mogo-module-apps/build.gradle index 312c819552..e9dc018ba2 100644 --- a/modules/mogo-module-apps/build.gradle +++ b/modules/mogo-module-apps/build.gradle @@ -1,5 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'com.alibaba.arouter' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' android { compileSdkVersion rootProject.ext.android.compileSdkVersion @@ -43,6 +45,8 @@ dependencies { implementation rootProject.ext.dependencies.material annotationProcessor rootProject.ext.dependencies.aroutercompiler implementation rootProject.ext.dependencies.androidxrecyclerview + implementation rootProject.ext.dependencies.guideshowprovider + if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.mogomap implementation rootProject.ext.dependencies.mogomapapi diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java index ef4e5ad8e0..7dc4ce40d3 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java @@ -8,6 +8,8 @@ import com.mogo.map.navi.IMogoNavi; import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.module.common.entity.MarkerResponse; import com.mogo.module.common.entity.MarkerShowEntity; +import com.mogo.module.guideshow.provider.GuideShowProviderConstant; +import com.mogo.module.guideshow.provider.IGuideShowProvider; import com.mogo.service.IMogoServiceApis; import com.mogo.service.MogoServicePaths; import com.mogo.service.analytics.IMogoAnalytics; @@ -30,12 +32,14 @@ public class AppServiceHandler { private static IMogoServiceApis mApis; private static IMogoCardManager mMogoCardManager; private static IMogoAnalytics mMogoAnalytics; + private static IGuideShowProvider mMogoGuideShow; public static void init( final Context context ) { mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context ); mMogoCardManager = mApis.getCardManagerApi(); mMogoAnalytics = mApis.getAnalyticsApi(); + mMogoGuideShow = (IGuideShowProvider) ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation(context); } public static IMogoCardManager getMogoCardManager() { @@ -44,4 +48,8 @@ public class AppServiceHandler { public static IMogoAnalytics getMogoAnalytics() { return mMogoAnalytics; } + + public static IGuideShowProvider getMogoGuideShow() { + return mMogoGuideShow; + } } diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java index 9a5c6116f7..53e4c9d5ce 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java @@ -8,6 +8,7 @@ import com.mogo.commons.mvp.Presenter; import com.mogo.module.apps.applaunch.AppLaunchFilter; import com.mogo.module.apps.applaunch.AppLauncher; import com.mogo.module.apps.applaunch.CardAppLauncher; +import com.mogo.module.apps.applaunch.GuideShowLauncher; import com.mogo.module.apps.model.AppInfo; import com.mogo.module.apps.model.AppsModel; import com.mogo.service.MogoServicePaths; @@ -18,16 +19,19 @@ import com.mogo.utils.ThreadPoolService; 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 * @since 2019-12-30 *

* 描述 */ -public class AppsPresenter extends Presenter< AppsView > { +public class AppsPresenter extends Presenter { private static final String TAG = "AppsPresenter"; @@ -37,81 +41,102 @@ public class AppsPresenter extends Presenter< AppsView > { private IMogoCardManager mCardManager; private IMogoStatusManager mMogoStatusManager; - public AppsPresenter( AppsView view ) { - super( view ); - mCardManager = ( IMogoCardManager ) ARouter.getInstance().build( MogoServicePaths.PATH_CARD_MANAGER ).navigation( getContext() ); - CardAppLauncher cardAppLauncher = new CardAppLauncher( this, mCardManager ); - cardAppLauncher.setNext( new AppLauncher() ); + public AppsPresenter(AppsView view) { + super(view); + mCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(getContext()); + CardAppLauncher cardAppLauncher = new CardAppLauncher(this, mCardManager); + cardAppLauncher.setNext(new GuideShowLauncher()); + cardAppLauncher.setNext(new AppLauncher()); mLauncher = cardAppLauncher; } @Override - public void onCreate( @NonNull LifecycleOwner owner ) { - super.onCreate( owner ); + public void onCreate(@NonNull LifecycleOwner owner) { + super.onCreate(owner); renderAppsList(); - AppsListChangedLiveData.getInstance().observeForever( bool -> { - if ( mView != null ) { + AppsListChangedLiveData.getInstance().observeForever(bool -> { + if (mView != null) { renderAppsList(); } - } ); + }); - mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() ); - mMogoStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation(); - mMogoStatusManager.setAppListUIShow( TAG, true ); + mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(getContext()); + mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(); + mMogoStatusManager.setAppListUIShow(TAG, true); } private void renderAppsList() { - ThreadPoolService.execute( () -> { - AppsModel.getInstance( getContext() ).load( appInfoList -> { + ThreadPoolService.execute(() -> { + AppsModel.getInstance(getContext()).load(appInfoList -> { - Logger.d( TAG, "apps: %s", appInfoList ); - UiThreadHandler.post( () -> { - if ( mView != null ) { - mView.renderApps( appInfoList ); + Logger.d(TAG, "apps: %s", appInfoList); + UiThreadHandler.post(() -> { + if (mView != null) { + mView.renderApps(addGuideAppEntrance(appInfoList)); } - } ); - } ); + }); + }); - } ); + }); } - public void launch( AppInfo appInfo ) { - if ( appInfo == null ) { + private Map> addGuideAppEntrance(Map> appInfoMap) { + Map> result; + if (appInfoMap == null) { + result = new HashMap<>(); + } else { + result = new HashMap<>(); + result.putAll(appInfoMap); + } + if (result.isEmpty()) { + result.put(0, new ArrayList<>()); + } else if (result.get(result.size() - 1) == null) { + result.put(result.size() - 1, new ArrayList<>()); + } else if (result.get(result.size() - 1).size() == AppsConst.TOTAL_SIZE_EACH_PAGE) { + result.put(result.size(), new ArrayList<>()); + } + // 添加逻辑 + result.get(result.size() - 1).add(new AppInfo(GuideShowLauncher.APP_INFO_NAME_GUIDE_SHOW, getContext().getPackageName(), null, 0, null, R.drawable.module_apps_ic_guide_show)); + return result; + } + + public void launch(AppInfo appInfo) { + if (appInfo == null) { return; } - trackAppClicked( appInfo ); + trackAppClicked(appInfo); try { - mLauncher.launch( getContext(), appInfo ); - } catch ( Exception e ) { + mLauncher.launch(getContext(), appInfo); + } catch (Exception e) { } } - private void trackAppClicked( AppInfo appInfo ) { - if ( appInfo == null ) { + private void trackAppClicked(AppInfo appInfo) { + if (appInfo == null) { return; } - Map< String, Object > properties = new HashMap<>(); - properties.put( "appname", appInfo.getName() ); - properties.put( "packagename", appInfo.getPackageName() ); - properties.put( "appversion", appInfo.getVersionName() ); - properties.put( "from", 1 ); - mAnalytics.track( "appenterfront", properties ); + Map properties = new HashMap<>(); + properties.put("appname", appInfo.getName()); + properties.put("packagename", appInfo.getPackageName()); + properties.put("appversion", appInfo.getVersionName()); + properties.put("from", 1); + mAnalytics.track("appenterfront", properties); } @Override - public void onDestroy( @NonNull LifecycleOwner owner ) { - super.onDestroy( owner ); - mMogoStatusManager.setAppListUIShow( TAG, false ); + public void onDestroy(@NonNull LifecycleOwner owner) { + super.onDestroy(owner); + mMogoStatusManager.setAppListUIShow(TAG, false); AppsListChangedLiveData.getInstance().release(); mView = null; mLauncher.destroy(); } public void exit() { - if ( mView != null ) { + if (mView != null) { mView.exit(); } } diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher.java new file mode 100644 index 0000000000..57b57acfd4 --- /dev/null +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher.java @@ -0,0 +1,33 @@ +package com.mogo.module.apps.applaunch; + +import android.content.Context; + +import com.mogo.module.apps.AppServiceHandler; +import com.mogo.module.apps.model.AppInfo; +import com.mogo.utils.logger.Logger; + +import kotlin.Unit; + +public class GuideShowLauncher extends BaseAppLauncher { + + public static final String TAG = "GuideShowLauncher"; + public static final String APP_INFO_NAME_GUIDE_SHOW = "新手引导"; + + @Override + public void launch(Context context, AppInfo appInfo) { + if (appInfo != null && APP_INFO_NAME_GUIDE_SHOW.equals(appInfo.getName())) { + AppServiceHandler.getMogoGuideShow().playGuideVideo((s) -> { + Logger.d(TAG, s); + return Unit.INSTANCE; + }); + } + } + + @Override + public void destroy() { + if (getNext() != null) { + getNext().destroy(); + setNext(null); + } + } +} diff --git a/modules/mogo-module-apps/src/main/res/drawable-ldpi/module_apps_ic_guide_show.png b/modules/mogo-module-apps/src/main/res/drawable-ldpi/module_apps_ic_guide_show.png new file mode 100644 index 0000000000..a919bbfb36 Binary files /dev/null and b/modules/mogo-module-apps/src/main/res/drawable-ldpi/module_apps_ic_guide_show.png differ diff --git a/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_guide_show.png b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_guide_show.png new file mode 100644 index 0000000000..c216b6ef9f Binary files /dev/null and b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_guide_show.png differ diff --git a/modules/mogo-module-apps/src/main/res/values/strings.xml b/modules/mogo-module-apps/src/main/res/values/strings.xml index 905586c2af..da20e97ccb 100644 --- a/modules/mogo-module-apps/src/main/res/values/strings.xml +++ b/modules/mogo-module-apps/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ mogo-module-apps APP 未安装 + 新手引导服务未加载 com.mogo.launcher diff --git a/modules/mogo-module-authorize/build.gradle b/modules/mogo-module-authorize/build.gradle index c36164fa39..07b85f6d3b 100644 --- a/modules/mogo-module-authorize/build.gradle +++ b/modules/mogo-module-authorize/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'com.alibaba.arouter' apply plugin: 'kotlin-kapt' +apply plugin: 'android-aspectjx' android { compileSdkVersion rootProject.ext.android.compileSdkVersion @@ -50,6 +51,7 @@ dependencies { implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.arouter kapt rootProject.ext.dependencies.aroutercompiler + implementation rootProject.ext.dependencies.aspectj if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.mogoutils diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenTrackPoint.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenTrackPoint.kt deleted file mode 100644 index 4517f18e9c..0000000000 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenTrackPoint.kt +++ /dev/null @@ -1,4 +0,0 @@ -package com.mogo.module.authorize.aspectj - -class VoiceForbiddenTrackPoint { -} \ No newline at end of file diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenWhenAuthorize.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenWhenAuthorize.kt new file mode 100644 index 0000000000..c64cf27a3d --- /dev/null +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenWhenAuthorize.kt @@ -0,0 +1,17 @@ +package com.mogo.module.authorize.aspectj + +import org.aspectj.lang.annotation.Aspect +import org.aspectj.lang.annotation.Pointcut + +@Aspect +class VoiceForbiddenWhenAuthorize { + + companion object{ + const val TAG = "VoiceForbiddenWhenAuthorize" + } + + @Pointcut() + fun authorizeTrackPoint(){ + + } +} \ No newline at end of file diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/launcher/MogoMainAuthorize.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/launcher/MogoMainAuthorize.kt index 7d8ab11136..7ef48e00df 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/launcher/MogoMainAuthorize.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/launcher/MogoMainAuthorize.kt @@ -83,6 +83,10 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog } } + fun resetShowStatus(){ + showAuthorizeView = false + } + private inline fun pushFragmentToMainView(tag: String, push: (() -> Unit)) { val builderWrapper = FragmentDescriptor.Builder().fragment(AuthorizeFragment(tag)).build() Logger.d(TAG, "pushFragmentToMainView") diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizePresenter.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizePresenter.kt index f767588254..dccfd29d9c 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizePresenter.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizePresenter.kt @@ -86,8 +86,9 @@ class AuthorizePresenter : Presenter, AuthorizeContract. override fun onDestroy(owner: LifecycleOwner) { super.onDestroy(owner) Logger.d(TAG, "onDestroy invokeTag : $invokeTag") + mogoAuthShow.resetShowStatus() invokeTag?.let { - MogoAuthorizeRegisterHandler.getAuthorizeContentListener(it)?.requestContentFailed("user exit authorize by back press") + MogoAuthorizeRegisterHandler.getAuthorizeContentListener(it)?.requestContentFailed("user exit authorize --- onDestroy") MogoAuthorizeRegisterHandler.getAuthorizeListener(it)?.authorizeFailed("user exit authorize by back press") } } diff --git a/modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml b/modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml index 68244747c6..14a5bb005d 100644 --- a/modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml +++ b/modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml @@ -18,27 +18,36 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - - - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + + + + + (), GuideC private fun invokeAuthorize() { GuideBizManager.invokeAuthorize() } + + override fun onDestroy() { + super.onDestroy() + invokeAuthorize() + } } \ No newline at end of file diff --git a/modules/mogo-module-guide/src/main/res/mipmap-ldpi/module_guide_item_entry_main.png b/modules/mogo-module-guide/src/main/res/mipmap-ldpi/module_guide_item_entry_main.png index 7b8468eb3d..ee612b77e0 100644 Binary files a/modules/mogo-module-guide/src/main/res/mipmap-ldpi/module_guide_item_entry_main.png and b/modules/mogo-module-guide/src/main/res/mipmap-ldpi/module_guide_item_entry_main.png differ diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java index 1faa275105..50160dc874 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.text.TextUtils; import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.commons.voice.VoiceIntentTrack; import com.mogo.service.MogoServicePaths; import com.mogo.service.intent.IMogoIntentManager; import com.mogo.utils.logger.Logger; @@ -59,21 +60,22 @@ public class MogoReceiver extends BroadcastReceiver { private IMogoIntentManager mMogoIntentManager; - public MogoReceiver( Context context ) { - mMogoIntentManager = ( IMogoIntentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_INTENT_MANAGER ).navigation( context ); + public MogoReceiver(Context context) { + mMogoIntentManager = (IMogoIntentManager) ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation(context); } + @VoiceIntentTrack @Override - public void onReceive( Context context, Intent intent ) { + public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); - Logger.i( TAG, "receive intent action: %s", action ); - if ( TextUtils.equals( VOICE_ACTION, action ) ) { - String cmd = intent.getStringExtra( PARAM_COMMAND ); - if ( !TextUtils.isEmpty( cmd ) ) { - mMogoIntentManager.invoke( cmd, intent ); + Logger.i(TAG, "receive intent action: %s", action); + if (TextUtils.equals(VOICE_ACTION, action)) { + String cmd = intent.getStringExtra(PARAM_COMMAND); + if (!TextUtils.isEmpty(cmd)) { + mMogoIntentManager.invoke(cmd, intent); } } else { - mMogoIntentManager.invoke( action, intent ); + mMogoIntentManager.invoke(action, intent); } } }