From 6376663e69928fcb58e311eef0fe5b2193facff4 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 27 Feb 2020 15:46:33 +0800 Subject: [PATCH 1/3] opt share ui --- .../src/main/res/layout/launcher_dialog_share.xml | 15 ++++++++------- .../src/main/res/values-ldpi/dimens.xml | 1 + .../src/main/res/values-xhdpi/dimens.xml | 1 + .../src/main/res/values/dimens.xml | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml b/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml index edae501d58..25151ea2a7 100644 --- a/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml +++ b/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml @@ -44,7 +44,7 @@ android:layout_below="@+id/block_up_iv" android:layout_marginTop="@dimen/share_module_tv_margin_top" android:gravity="center" - android:text="拥堵" + android:text="上报拥堵" android:textColor="@color/white" android:textSize="@dimen/share_module_item" android:textStyle="bold" /> @@ -70,7 +70,7 @@ android:layout_below="@+id/oil_price_iv" android:layout_marginTop="@dimen/share_module_tv_margin_top" android:gravity="center" - android:text="油价" + android:text="分享油价" android:textColor="@color/white" android:textSize="@dimen/share_module_item" android:textStyle="bold" /> @@ -78,7 +78,7 @@ @@ -87,16 +87,17 @@ android:id="@+id/traffic_check_iv" android:layout_width="@dimen/share_module_image_width" android:layout_height="@dimen/share_module_image_width" + android:layout_centerHorizontal="true" android:src="@drawable/share_traffic_check" /> @@ -122,7 +123,7 @@ android:layout_below="@+id/road_closure_iv" android:layout_marginTop="@dimen/share_module_tv_margin_top" android:gravity="center" - android:text="封路" + android:text="上报封路" android:textColor="@color/white" android:textSize="@dimen/share_module_item" android:textStyle="bold" /> @@ -135,7 +136,7 @@ android:layout_below="@+id/btn_block_layout" android:layout_marginTop="@dimen/share_module_bottom_margin_top" android:gravity="center" - android:text="可以对小智说:上报路况、分享油价、交通检查、交通管制" + android:text="可以对小智说:上报拥堵、分享油价、上报交通检查、上报封路" android:textColor="@color/white_40" android:textSize="@dimen/share_module_bottom_size" android:textStyle="bold" /> diff --git a/modules/mogo-module-share/src/main/res/values-ldpi/dimens.xml b/modules/mogo-module-share/src/main/res/values-ldpi/dimens.xml index da65c676db..dda7550e62 100644 --- a/modules/mogo-module-share/src/main/res/values-ldpi/dimens.xml +++ b/modules/mogo-module-share/src/main/res/values-ldpi/dimens.xml @@ -9,6 +9,7 @@ 64px 15px 85px + 110px 28px diff --git a/modules/mogo-module-share/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-share/src/main/res/values-xhdpi/dimens.xml index 8e1edc4724..1e9163fec3 100644 --- a/modules/mogo-module-share/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-share/src/main/res/values-xhdpi/dimens.xml @@ -8,6 +8,7 @@ 120px 30px 160px + 198px 55px diff --git a/modules/mogo-module-share/src/main/res/values/dimens.xml b/modules/mogo-module-share/src/main/res/values/dimens.xml index 8e1edc4724..1e9163fec3 100644 --- a/modules/mogo-module-share/src/main/res/values/dimens.xml +++ b/modules/mogo-module-share/src/main/res/values/dimens.xml @@ -8,6 +8,7 @@ 120px 30px 160px + 198px 55px From 983031cae9079be38a80e7cf0b9ae197492e5200 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Thu, 27 Feb 2020 15:55:58 +0800 Subject: [PATCH 2/3] opt --- .idea/misc.xml | 2 +- foudations/mogo-commons/build.gradle | 5 +++++ .../com/mogo/commons/AbsMogoApplication.java | 16 +++++++++++++--- .../java/com/mogo/module/main/MainActivity.java | 6 ++++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 707ee6e613..2dc54c489f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/foudations/mogo-commons/build.gradle b/foudations/mogo-commons/build.gradle index 41630f2f28..1591dbe34d 100644 --- a/foudations/mogo-commons/build.gradle +++ b/foudations/mogo-commons/build.gradle @@ -27,6 +27,11 @@ android { } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + } dependencies { diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java index d88b077caf..1db758b56f 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java @@ -13,6 +13,7 @@ import com.mogo.commons.network.Constants; import com.mogo.commons.network.ParamsUtil; import com.mogo.commons.network.X509TrustManagerImpl; import com.mogo.commons.storage.SpStorage; +import com.mogo.utils.ThreadPoolService; import com.mogo.utils.TipToast; import com.mogo.utils.logger.Logger; import com.mogo.utils.network.NetConfig; @@ -56,7 +57,11 @@ public class AbsMogoApplication extends Application { } protected void init() { + syncInit(); + asyncInit(); + } + private void syncInit(){ // 初始化埋点 Analytics.getInstance().start( sApp ); Analytics.getInstance().setAppKey( "6bbe7e0e1ecd8e2f8dc336e1678a2791" ); @@ -72,9 +77,6 @@ public class AbsMogoApplication extends Application { } ARouter.init( sApp ); - // 初始化toast - TipToast.init( sApp, null ); - initNetConfig(); initAccountSdk(); } @@ -117,6 +119,14 @@ public class AbsMogoApplication extends Application { return sc; } + private void asyncInit(){ + ThreadPoolService.execute( ()->{ + initAccountSdk(); + // 初始化toast + TipToast.init( sApp, null ); + } ); + } + private static void initAccountSdk() { AccountClientManager.init( sApp, DebugConfig.getNetMode(), NetEnvironManager.OS_2C, "os2.0-launcher" ); AccountClientManager.getTicket( new TicketInfoCallback() { diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java index 36bf0f03b4..57a898b4aa 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java @@ -21,6 +21,8 @@ import com.mogo.map.location.MogoLocation; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.uicontroller.IMogoMapUIController; +import com.mogo.module.common.MogoModule; +import com.mogo.module.common.MogoModulePaths; import com.mogo.module.main.assist.MapBroadCastHelper; import com.mogo.module.main.cards.CardModulesAdapter; import com.mogo.module.main.cards.MogoModulesHandler; @@ -30,6 +32,7 @@ import com.mogo.module.main.cards.OrientedViewPager; import com.mogo.module.main.cards.VerticalStackTransformer; import com.mogo.module.main.constants.MainConstants; import com.mogo.module.main.windowview.WindowViewHandler; +import com.mogo.module.service.ServiceConst; import com.mogo.service.MogoServicePaths; import com.mogo.service.analytics.IMogoAnalytics; import com.mogo.service.cardmanager.IMogoCardManager; @@ -214,7 +217,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme WindowViewHandler.init( mFloatingLayout ); } - /** * 卡片展示时长埋点 * @@ -273,7 +275,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme protected void onCreate( @Nullable Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); -// MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) ); + MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) ); mMogoModuleHandler = new MogoModulesManager( this ); mMogoMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation(); From bb61cd1076a17f1198208aaeb4836408b76c9354 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 27 Feb 2020 16:09:24 +0800 Subject: [PATCH 3/3] add voice next and previous --- .../module/tanlu/constant/TanluConstants.java | 7 ++ .../tanlu/fragment/TanluCardViewFragment.java | 67 +++++++++++++------ 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java index 2506814f49..612164ab58 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java @@ -13,6 +13,8 @@ public class TanluConstants { public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION"; public static final String[] CMD_PLAY_ROAD_CONDITION = {"播放路况"}; + public static final String[] CMD_THE_PREVIOUS = {"上一条"}; + public static final String[] CMD_THE_NEXT = {"下一条"}; //上报路况 public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition"; @@ -21,6 +23,11 @@ public class TanluConstants { //播放 public static final String PLAY_VIDEO = "com.zhidao.tanlu.play"; + //上一条 + public static final String THE_PREVIOUS = "com.zhidao.tanlu.previous"; + //下一条 + public static final String THE_NEXT = "com.zhidao.tanlu.next"; + //分享封路 public static final String SHARE_ROAD_CLOSURE = "com.zhidao.share.road.closure"; //分享交通检查 diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java index 32bb168011..b7c9f9d97c 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java @@ -495,6 +495,10 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo; .build(simpleCoverVideoPlayer); simpleCoverVideoPlayer.getStartButton().performClick(); traceVideoPlayStatusData(); + } else if (cmd.equals(TanluConstants.THE_PREVIOUS)) { //上一条 + handlePrevious(); + } else if (cmd.equals(TanluConstants.THE_NEXT)) { //下一条 + handleNext(); } } @@ -584,35 +588,48 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo; public void onClick(View view) { int id = view.getId(); if (id == R.id.tv_previous_res) { //上一个 - //判断是图片还是视频,第一个时,上一个不可点击 - Log.e(TAG, " tv_previous_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); - if (currentPosition < 0) { - currentPosition = markerExploreWayList.size(); - } - currentPosition--; - Log.d(TAG, " tv_previous_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); - if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) { - handleMarkerExploreWay(markerExploreWayList.get(currentPosition)); - moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon()); - } + handlePrevious(); } else if (id == R.id.tv_next_res) { //下一个 - //判断是图片还是视频,最后一个时,下一个不可点击 - Log.e(TAG, " tv_next_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); - if (currentPosition >= markerExploreWayList.size()) { - currentPosition = 0; - } - currentPosition++; - Log.d(TAG, " tv_next_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); - if (markerExploreWayList.size() > currentPosition) { - handleMarkerExploreWay(markerExploreWayList.get(currentPosition)); - moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon()); - } + handleNext(); } else if (id == R.id.tv_main_empty) { //上报路况 sendShareReceiver("1"); } } + /** + * 上一条逻辑 + */ + private void handlePrevious() { + //判断是图片还是视频,第一个时,上一个不可点击 + Log.e(TAG, " tv_previous_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); + if (currentPosition < 0) { + currentPosition = markerExploreWayList.size(); + } + currentPosition--; + Log.d(TAG, " tv_previous_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); + if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) { + handleMarkerExploreWay(markerExploreWayList.get(currentPosition)); + moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon()); + } + } + + /** + * 下一条逻辑 + */ + private void handleNext() { + //判断是图片还是视频,最后一个时,下一个不可点击 + Log.d(TAG, " tv_next_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); + if (currentPosition >= markerExploreWayList.size()) { + currentPosition = 0; + } + currentPosition++; + Log.d(TAG, " tv_next_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); + if (markerExploreWayList.size() > currentPosition) { + handleMarkerExploreWay(markerExploreWayList.get(currentPosition)); + moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon()); + } + } private void moveToMarcker(double lat, double lon) { MogoLatLng latLng = new MogoLatLng(lat, lon); @@ -763,6 +780,10 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo; //免唤醒 AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.PLAY_VIDEO, TanluConstants.CMD_PLAY_ROAD_CONDITION, mogoVoiceListener); + AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.THE_PREVIOUS, + TanluConstants.CMD_THE_PREVIOUS, mogoVoiceListener); + AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.THE_NEXT, + TanluConstants.CMD_THE_NEXT, mogoVoiceListener); isCurrentPage = true; Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->"); @@ -873,6 +894,8 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo; } AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.PLAY_VIDEO); + AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.THE_PREVIOUS); + AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.THE_NEXT); } @Override