From a13f194849ebe3d827a1ce93ed326079fe00bdf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 15 Jun 2020 18:01:06 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=B9=E5=8A=9B?= =?UTF-8?q?=E6=83=85=E6=8A=A5=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 2 +- .../module/common/entity/MarkerExploreWayItem.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 2dc54c489f..707ee6e613 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java index efc6a88649..f8ab53ca9d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java @@ -6,11 +6,15 @@ import android.text.TextUtils; import java.io.Serializable; +/** + * 道路情报,V2X预警,地图道路事件POI,违章停车POI等 + */ @SuppressWarnings("unused") public class MarkerExploreWayItem implements Serializable { private String thumbnail; private String url; + private String content; public String getThumbnail() { if (TextUtils.isEmpty(thumbnail)) { @@ -34,11 +38,20 @@ public class MarkerExploreWayItem implements Serializable { this.url = url; } + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + @Override public String toString() { return "MarkerExploreWayItem{" + "thumbnail='" + thumbnail + '\'' + ", url='" + url + '\'' + + ", content='" + content + '\'' + '}'; } } From ab07340efc7863852b6adca22c73f7175ce1155f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 15 Jun 2020 18:25:41 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AD=97=E6=AE=B5=E7=9A=84=E7=BB=A7=E6=89=BF=E5=85=B3?= =?UTF-8?q?=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mogo/module/common/entity/MarkerCardResult.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java index be7c7bbe23..3896ae58c4 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java @@ -1,11 +1,13 @@ package com.mogo.module.common.entity; +import com.mogo.commons.data.BaseData; + import java.io.Serializable; import java.util.List; @SuppressWarnings("unused") -public class MarkerCardResult implements Serializable { +public class MarkerCardResult extends BaseData { private List dataType; // 要查询的类型 private List carChat; From 34335e8f919f9928b5944702816e3e60cc88a838 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 16 Jun 2020 13:46:23 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=B7=E6=88=91?= =?UTF-8?q?=E9=9F=B3=E4=B9=90sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/mogo-module-media/build.gradle | 1 + .../com/mogo/module/media/MediaWindow2.java | 8 +- .../module/media/presenter/KwPresenter.java | 162 ++++++++++++++++++ 3 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java diff --git a/modules/mogo-module-media/build.gradle b/modules/mogo-module-media/build.gradle index fb9eab7108..d734d287e0 100644 --- a/modules/mogo-module-media/build.gradle +++ b/modules/mogo-module-media/build.gradle @@ -46,6 +46,7 @@ dependencies { // 爱趣听sdk上传到了公司的maven,用来规避RELEASE时ClassDefNotFound异常,后续若爱趣听有新的sdk也需要上传maven implementation "com.mogo.tencent.wecarflow:mogo-wecarflow:+@aar" + implementation "com.mogo.kwmusic:mogo-kwmusic:+" if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.mogomap diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java index 21898f15df..1ba6514075 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java @@ -14,6 +14,8 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack; import com.mogo.module.media.constants.MusicConstant; import com.mogo.module.media.listener.NoDoubleClickListener; import com.mogo.module.media.model.MediaInfoData; +import com.mogo.module.media.presenter.BaseMediaPresenter; +import com.mogo.module.media.presenter.KwPresenter; import com.mogo.module.media.presenter.WeCarFlowPresenter; import com.mogo.module.media.utils.Utils; import com.mogo.module.media.view.IMusicView; @@ -35,7 +37,7 @@ public class MediaWindow2 implements IMusicView { public static final String TAG = MediaWindow2.class.getName(); private Context mContext; - private WeCarFlowPresenter mPresenter; + private KwPresenter mPresenter; private MediaInfoData mMediaInfoData = new MediaInfoData(); @@ -54,7 +56,7 @@ public class MediaWindow2 implements IMusicView { public void initMedia(Context context) { mContext = context; - mPresenter = new WeCarFlowPresenter(this); + mPresenter = new KwPresenter(this); mPresenter.init(context); if(DebugConfig.isLauncher()) { @@ -221,6 +223,8 @@ public class MediaWindow2 implements IMusicView { if (mCircleImg != null) { mCircleImg.stopAnim(); } + + } @Override diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java new file mode 100644 index 0000000000..8faf72a28a --- /dev/null +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java @@ -0,0 +1,162 @@ +package com.mogo.module.media.presenter; + +import android.content.Context; +import android.os.Handler; +import android.os.Message; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.module.media.MediaConstants; +import com.mogo.module.media.model.MediaInfoData; +import com.mogo.module.media.view.IMusicView; +import com.mogo.service.IMogoServiceApis; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.statusmanager.IMogoStatusChangedListener; +import com.mogo.service.statusmanager.StatusDescriptor; +import com.mogo.utils.logger.Logger; + +import java.security.PrivilegedAction; + +import cn.kuwo.autosdk.api.KWAPI; +import cn.kuwo.autosdk.api.PlayState; +import cn.kuwo.base.bean.Music; + +/** + * 适配酷我的presenter + * + * @author tongchenfei + */ +public class KwPresenter extends BaseMediaPresenter { + private static final String TAG = "KwPresenter"; + private KWAPI kwapi; + private boolean isBind = false; + + private Music currentMusic; + + public KwPresenter(IMusicView view) { + super(view); + } + + @Override + public void init(Context context) { + kwapi = KWAPI.createKWAPI(context, "auto"); + + kwapi.registerConnectedListener(b -> { + Logger.d(TAG, "onConnected: " + b); + isBind = b; + if (!isBind) { + mView.onMusicStopped(); + } + }); + + kwapi.registerExitListener(() -> { + Logger.d(TAG, "onExit==="); + mView.onMusicStopped(); + }); + + kwapi.registerPlayerStatusListener((playerStatus, music) -> { + currentMusic = music; + MediaInfoData mediaInfoData = new MediaInfoData(); + mediaInfoData.setMediaName(music.name); + mediaInfoData.setMediaImg(music.imageURL); + Logger.d(TAG, + "onPlayerStatusChange: " + mediaInfoData + " playStatus: " + playerStatus); + mView.onMediaInfoChanged(mediaInfoData); + switch (playerStatus) { + case PLAYING: + case BUFFERING: + startTrackTrackProgress(); + mView.onMusicPlaying(); + break; + case PAUSE: + stopTrackTrackProgress(); + mView.onMusicPause(); + break; + case STOP: + stopTrackTrackProgress(); + break; + default: + break; + } + }); + + IMogoServiceApis serviceApis = + (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context); + + serviceApis.getStatusManagerApi().registerStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() { + @Override + public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { + if (isTrue) { + Logger.d(TAG, "onResume, isBind: " + isBind); + // 需要在resume时候判断绑定关系是否正常 + if (!isBind) { + // 未绑定,需要重新绑定,同时第一次绑定初始化也是在此处 + kwapi.bindAutoSdkService(); + } + } + } + }); + + kwapi.bindAutoSdkService(); + } + + @Override + public void play(MediaInfoData mediaInfoData) { + if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_PLAY); + } else { + kwapi.randomPlayMusic(); + } + } + + @Override + public void pause(MediaInfoData mediaInfoData) { + if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_PAUSE); + } + } + + @Override + public void stop(MediaInfoData mediaInfoData) { + + } + + @Override + public void pre() { + if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_PRE); + } + } + + @Override + public void next() { + if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_NEXT); + } + } + + private Handler.Callback callback = new Handler.Callback() { + @Override + public boolean handleMessage(Message msg) { + if (isTrackingProgress) { + mView.onMusicProgress(kwapi.getCurrentMusicDuration(), currentMusic.duration); + msg.getTarget().sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, MSG_TRACK_PROGRESS_DELAY); + } + return false; + } + }; + private Handler handler = new Handler(callback); + private static final int MSG_TRACK_PROGRESS = 1001; + private static final long MSG_TRACK_PROGRESS_DELAY = 1000; + + private boolean isTrackingProgress = false; + + private void startTrackTrackProgress() { + isTrackingProgress = true; + handler.sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, MSG_TRACK_PROGRESS_DELAY); + } + + private void stopTrackTrackProgress() { + isTrackingProgress = false; + handler.removeMessages(MSG_TRACK_PROGRESS); + } +} From 7f9bc2e5928f38e38466d23bd12e81507264ba1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Tue, 16 Jun 2020 14:30:49 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=BF=9D?= =?UTF-8?q?=E7=AB=A0=E5=81=9C=E8=BD=A6=E7=9A=84POI=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java index e57e3270fe..c3bb85d757 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java @@ -38,4 +38,6 @@ public interface MarkerPoiTypeEnum { public String FOURS_NEALY = "10014"; //实时路况 public String FOURS_LIVING = "10015"; + //违章停车 + public String ILLEGAL_PARK_LIVING = "10016"; } \ No newline at end of file From bfb31d0e0a22f0bebac46396b13783894aba678e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Tue, 16 Jun 2020 15:09:27 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=BF=9D?= =?UTF-8?q?=E7=AB=A0=E5=81=9C=E8=BD=A6=E7=9A=84Marker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/entity/MarkerPoiTypeEnum.java | 32 +++++++++--------- .../service/marker/MapMarkerInfoView.java | 3 ++ .../module/service/marker/MapMarkerView.java | 3 ++ .../module_service_ic_rc_illegal_park.png | Bin 0 -> 1592 bytes ...odule_service_ic_rc_illegal_park_light.png | Bin 0 -> 1110 bytes 5 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park.png create mode 100644 modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park_light.png diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java index c3bb85d757..a0afae8e89 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java @@ -9,35 +9,35 @@ package com.mogo.module.common.entity; */ public interface MarkerPoiTypeEnum { //加油站 - public String GAS_STATION = "10001"; + String GAS_STATION = "10001"; //交通检查 - public String TRAFFIC_CHECK = "10002"; + String TRAFFIC_CHECK = "10002"; //封路 - public String ROAD_CLOSED = "10003"; + String ROAD_CLOSED = "10003"; //商场打折 - public String SHOP_DISCOUNT = "10004"; + String SHOP_DISCOUNT = "10004"; //4S店 - public String FOURS_4S = "10005"; + String FOURS_4S = "10005"; //施工 - public String FOURS_ROAD_WORK = "10006"; + String FOURS_ROAD_WORK = "10006"; //拥堵 - public String FOURS_BLOCK_UP = "10007"; + String FOURS_BLOCK_UP = "10007"; //积水 - public String FOURS_PONDING = "10008"; + String FOURS_PONDING = "10008"; //超市打折 - public String FOURS_SHOP_FREE = "10009"; + String FOURS_SHOP_FREE = "10009"; //浓雾 - public String FOURS_FOG = "10010"; + String FOURS_FOG = "10010"; //结冰 - public String FOURS_ICE = "10011"; + String FOURS_ICE = "10011"; //停车场 - public String FOURS_PARKING = "10012"; + String FOURS_PARKING = "10012"; //事故 - public String FOURS_ACCIDENT = "10013"; + String FOURS_ACCIDENT = "10013"; //身边 - public String FOURS_NEALY = "10014"; + String FOURS_NEALY = "10014"; //实时路况 - public String FOURS_LIVING = "10015"; + String FOURS_LIVING = "10015"; //违章停车 - public String ILLEGAL_PARK_LIVING = "10016"; + String ILLEGAL_PARK_LIVING = "10016"; } \ No newline at end of file diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java index d564a1757d..d5195bf069 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java @@ -135,6 +135,9 @@ public class MapMarkerInfoView extends MapMarkerBaseView { case MarkerPoiTypeEnum.FOURS_LIVING: ivIcon.setImageResource( R.drawable.icon_map_marker_living_light ); break; + case MarkerPoiTypeEnum.ILLEGAL_PARK_LIVING: + ivIcon.setImageResource( R.drawable.module_service_ic_rc_illegal_park_light ); + break; default: ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2_light ); break; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java index 1c83655149..9b7153b574 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java @@ -101,6 +101,9 @@ public class MapMarkerView extends MapMarkerBaseView { case MarkerPoiTypeEnum.FOURS_LIVING: ivIcon.setImageResource( R.drawable.icon_map_marker_living ); break; + case MarkerPoiTypeEnum.ILLEGAL_PARK_LIVING: + ivIcon.setImageResource( R.drawable.module_service_ic_rc_illegal_park ); + break; case MarkerPoiTypeEnum.FOURS_PARKING: default: ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2 ); diff --git a/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park.png b/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park.png new file mode 100644 index 0000000000000000000000000000000000000000..6e1443d3b42bdd894a8b7a4b0f6f7b21e4bc1f4b GIT binary patch literal 1592 zcmYjQ2~bm46pf}75om1{ah$d?c7kXrMNIPZ_n%E%D2;*@6)+aWrKL(m0|E|ijA&6? zQK~2vXY2q9C<;#9ST%zzAtGRcAd7}TLUzIufxd((!qO-|LLOOK=-+e z=hA32_qA&T8^L?2{h33zdoJ4yG}`PMQBbH5Y$yL`{i;=ylap#cKlN%qU^GKeCj|BL zAqyV@TYx$yvlC^$=b|Pqcgiz!ZA4hDfCOuRN0@npO|O@6m}UX>28H@abULzu9ngcr zBZ3(f%w}-fj6g;qsleF%Tx>eH5n?vN%ytY?bFm=-G3}pefLmHIb}Powa&avmw+PAU z)A7;KX}cMPUZGGM2FOuhoHqoggMizCBp{VIr;m$)#v2hfC_cz1fOB$e48%0R%m$eChJe8>Dhkzx zhgpRb@DGT?ff5k;3bE_a@(Eze5LO3{yrWPfpEU7FM>-1>S5tUDg;^YlKwC2kXwTL0 z2@q)%kS!>r;Ss9+KTm%60J0`*Hn8@^{aObz>tI$Vf%KB7Rban&>Zo55Z#XQGBdnJw zpuM0r@sOTR7zAWJhuK9S=H$d7A!$rX&?hI#V3r(VgNY6Ba4-|lT0P9HhgqO6&@#|0 zL)c9S8^pW>bX1!fGEmj(nDc9#qrf>z9B#*9$0!gW=`EmRyxk)1x+w7?T7{41NB_jZE9s*}0l$ZN_;0a3 zK5YC@+Z*_)zT;7QY~_i3UY=>F&Qm4{Du}&WHmx;(R8=;ZdpKU zi;8}Fr8I}!e0u-A_nNHOl|L*Ym3Ipv&&zIZzTFjuuuDt*yjOJVdY8K`kRb;*&Ml}Je0Ctk>)GcY zyPey6K07f5D^1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fRL21)ZWo17_^6+5n#aUB_i zi3nd`*d=|-g0@N0^*uoB5reqsxnZh`-b29bqG56wci|d&01}OMC{aZ+cf&n^%)ZN{|A^rF>?wOm3#!mz>yX)5}1v z4P_hfCU9FJ?=X)vET5I}rsi5y?`ylY0SQxYjJ#jmE$KkEkEi7XuE5?To6^)Ui?Zvl zvZ;GxR7GrP6}?k>PdSuU@y@KG208Rrv4Cl6o(-}Vcu&%gr4$h{F%@v{a&F-fcW$fy zRr6fH^!uFnq3GQFNip)D69tS7d^2$S|Mr1ZlfLbf)4T7E|MZiyDJw?$T;EU5k)E(u cyio)44+VrOL7?Q8x&QzG07*qoM6N<$g3EafT>t<8 literal 0 HcmV?d00001 From 627e5dec677f1f29796fb90ade1adc96d752d4ee Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 16 Jun 2020 16:28:59 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E9=80=82=E9=85=8D=E9=85=B7=E6=88=91?= =?UTF-8?q?=E9=9F=B3=E4=B9=90=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/module/apps/model/AppEnum.java | 2 + .../mogo/module/apps/model/NavigatorApps.java | 3 +- .../src/main/res/drawable/ic_kuwo.webp | Bin 0 -> 3266 bytes .../res/layout/module_main_activity_main.xml | 13 +-- .../module/media/MediaCardViewProvider.java | 1 + .../media/presenter/BaseMediaPresenter.java | 5 ++ .../module/media/presenter/KwPresenter.java | 84 ++++++++++++------ .../media/presenter/WeCarFlowPresenter.java | 5 ++ .../mogo/module/media/view/IMusicView.java | 2 + .../media/widget/AnimCircleImageView.java | 4 +- .../media/{ => window}/MediaWindow.java | 15 ++-- .../media/{ => window}/MediaWindow2.java | 31 ++++--- 12 files changed, 109 insertions(+), 56 deletions(-) create mode 100644 modules/mogo-module-apps/src/main/res/drawable/ic_kuwo.webp rename modules/mogo-module-media/src/main/java/com/mogo/module/media/{ => window}/MediaWindow.java (98%) rename modules/mogo-module-media/src/main/java/com/mogo/module/media/{ => window}/MediaWindow2.java (93%) diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java index 7eadd38ab6..df83f351c0 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java @@ -14,6 +14,8 @@ import com.mogo.module.apps.R; * 基础类:均衡器、方控学习、蓝牙、FM、车载设置、AUX */ public enum AppEnum { + // 酷我音乐 + KwMusic("酷我音乐", "cn.kuwo.kwmusiccar", R.drawable.ic_kuwo), // 爱趣听 WeCarFlow("爱趣听","com.tencent.wecarflow", R.drawable.module_apps_ic_we_car_flow ), //"QQ音乐", diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java index 700564dce6..f1e00886b6 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java @@ -15,7 +15,8 @@ public class NavigatorApps { private static AppInfo app = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi, 1 ); private static AppInfo app_ = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable, 1 ); - private static AppInfo app2 = new AppInfo( "音乐", "com.tencent.wecarflow", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 ); +// private static AppInfo app2 = new AppInfo( "音乐", "com.tencent.wecarflow", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 ); + private static AppInfo app2 = new AppInfo( "音乐", "cn.kuwo.kwmusiccar", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 ); private static AppInfo app3 = new AppInfo( "车聊聊", "com.zhidao.imdemo", "", 0, null, R.drawable.module_apps_ic_navigator_im, 6 ); private static AppInfo app4 = new AppInfo( "全部应用", "com.mogo.launcher.applist", "", 0, null, R.drawable.module_apps_ic_navigator_applist, 4 ); diff --git a/modules/mogo-module-apps/src/main/res/drawable/ic_kuwo.webp b/modules/mogo-module-apps/src/main/res/drawable/ic_kuwo.webp new file mode 100644 index 0000000000000000000000000000000000000000..82330db5faf09fc7fceda04d164cf133d4254818 GIT binary patch literal 3266 zcmV;z3_bHwNk&Gx3;+OEMM6+kP&il$0000G0001A003VA06|PpNFV|L00Cd)Ad)0S zx*RyZ=l3sm<2*z}PCJpR14$U+j3~AR%D>ho+~2aH1trRuV}>w7A%k)=$d)AAw5@q; z+qS)J+dlT0|NjkRthM?+aqNixPk{Q}v2$#3YxnZb=?%qG*=qCov;8d9Y$_h|I`1xb zw-(1bEz`Gpa2w1#X%k8&czdwgXR`kNf;PSE_nT+j^`$K-?s0Q;9KLJI%29_2Ml#yc z*%8C$@3qD6#h`^ZZFyNRWaL2ud>ApHGpiwHyZBBt$Wyk-4-_9$TpkV6%QXCr<7b%X zKm$GGsUfMc3}~o>9BWwCInJ=0bJ(#sI3if093?Dej#n(g(9;InOPfM7OBD*-OJZ#M(Q2}!jGic3t2n8Q@4o)Bj$C&u zQ_co{tRaCpW!jPBhWX@VRGE8t^U@isyqQ5NG3UkRu(E3J^vcfOjm_;3C)4>_>*cfk z(yB>18TPwvH+wrPGrj6}M^;ccAan`<0MI!AodGIf0AK(<8483!p#>hBMFaq0EX{Ig z2l8BWe~JDl_>+7C`sd@9^b7zmfIo?T7-N9^75u}r2lj4JU+8~>+VDS|`Pct<{dfC! zrT@!+u6hFgFZ`GJU)TSOm!N;}36Ka7AB4Z48h{^wAF8_re}EfcABwxBe};QNzra6- z{uloM;sEo!^P?TnzYITYf5&{7)8Cf;zx}xWx5J`T`mp@h=12JM&>xk5z!<(!TL1h1?S2V=WqGJ<@+;KN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00001 diff --git a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml index 02d9555475..96f61eca7b 100644 --- a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml +++ b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml @@ -9,7 +9,13 @@ + android:layout_height="match_parent" > + + + - - extends Presenter { * 下一首 */ public abstract void next(); + + /** + * 打开对应的应用 + */ + public abstract void openApp(); } diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java index 8faf72a28a..75e49e751a 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java @@ -6,6 +6,7 @@ import android.os.Message; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.module.media.MediaConstants; +import com.mogo.module.media.constants.MusicConstant; import com.mogo.module.media.model.MediaInfoData; import com.mogo.module.media.view.IMusicView; import com.mogo.service.IMogoServiceApis; @@ -14,10 +15,10 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.logger.Logger; -import java.security.PrivilegedAction; - import cn.kuwo.autosdk.api.KWAPI; +import cn.kuwo.autosdk.api.OnGetSongImgUrlListener; import cn.kuwo.autosdk.api.PlayState; +import cn.kuwo.autosdk.api.PlayerStatus; import cn.kuwo.base.bean.Music; /** @@ -30,7 +31,7 @@ public class KwPresenter extends BaseMediaPresenter { private KWAPI kwapi; private boolean isBind = false; - private Music currentMusic; + private MediaInfoData currentMedia = new MediaInfoData(); public KwPresenter(IMusicView view) { super(view); @@ -45,35 +46,42 @@ public class KwPresenter extends BaseMediaPresenter { isBind = b; if (!isBind) { mView.onMusicStopped(); + }else{ + PlayerStatus currentState = kwapi.getPlayerStatus(); + Logger.d(TAG, "check current status: " + currentState); + if(currentState == PlayerStatus.BUFFERING||currentState == PlayerStatus.PLAYING){ + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + kwapi.getSongPicUrl(kwapi.getNowPlayingMusic(), onGetSongImgUrlListener); + startTrackTrackProgress(); + mView.onMusicPlaying(); + } } }); kwapi.registerExitListener(() -> { Logger.d(TAG, "onExit==="); - mView.onMusicStopped(); + mView.onAppExit(); }); kwapi.registerPlayerStatusListener((playerStatus, music) -> { - currentMusic = music; - MediaInfoData mediaInfoData = new MediaInfoData(); - mediaInfoData.setMediaName(music.name); - mediaInfoData.setMediaImg(music.imageURL); - Logger.d(TAG, - "onPlayerStatusChange: " + mediaInfoData + " playStatus: " + playerStatus); - mView.onMediaInfoChanged(mediaInfoData); + Logger.d(TAG, "onPlayerStatusListener: " + playerStatus); switch (playerStatus) { - case PLAYING: case BUFFERING: + kwapi.getSongPicUrl(music, onGetSongImgUrlListener); + break; + case PLAYING: + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + kwapi.getSongPicUrl(music, onGetSongImgUrlListener); startTrackTrackProgress(); mView.onMusicPlaying(); break; + case INIT: case PAUSE: + case STOP: + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP); stopTrackTrackProgress(); mView.onMusicPause(); break; - case STOP: - stopTrackTrackProgress(); - break; default: break; } @@ -101,11 +109,11 @@ public class KwPresenter extends BaseMediaPresenter { @Override public void play(MediaInfoData mediaInfoData) { - if (kwapi.isKuwoRunning()) { +// if (kwapi.isKuwoRunning()) { kwapi.setPlayState(PlayState.STATE_PLAY); - } else { - kwapi.randomPlayMusic(); - } +// } else { +// kwapi.randomPlayMusic(); +// } } @Override @@ -138,8 +146,9 @@ public class KwPresenter extends BaseMediaPresenter { @Override public boolean handleMessage(Message msg) { if (isTrackingProgress) { - mView.onMusicProgress(kwapi.getCurrentMusicDuration(), currentMusic.duration); - msg.getTarget().sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, MSG_TRACK_PROGRESS_DELAY); + mView.onMusicProgress(kwapi.getCurrentPos(), kwapi.getCurrentMusicDuration()); + msg.getTarget().sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, + MSG_TRACK_PROGRESS_DELAY); } return false; } @@ -151,12 +160,37 @@ public class KwPresenter extends BaseMediaPresenter { private boolean isTrackingProgress = false; private void startTrackTrackProgress() { - isTrackingProgress = true; - handler.sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, MSG_TRACK_PROGRESS_DELAY); + if(!isTrackingProgress) { + isTrackingProgress = true; + handler.sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, MSG_TRACK_PROGRESS_DELAY); + } } private void stopTrackTrackProgress() { - isTrackingProgress = false; - handler.removeMessages(MSG_TRACK_PROGRESS); + if(isTrackingProgress) { + isTrackingProgress = false; + handler.removeMessages(MSG_TRACK_PROGRESS); + } + } + + private OnGetSongImgUrlListener onGetSongImgUrlListener = new OnGetSongImgUrlListener() { + @Override + public void onGetSongImgUrlSucessed(Music music, String s) { + currentMedia.setMediaName(music.name); + currentMedia.setMediaImg(s); + Logger.d(TAG, + "onGetSongImgUrlSucessed: " + currentMedia); + handler.post(() -> mView.onMediaInfoChanged(currentMedia)); + } + + @Override + public void onGetSongImgUrlFailed(Music music, int i) { + Logger.e(TAG, "onGetSongImgUrlFailed: " + i); + } + }; + + @Override + public void openApp(){ + kwapi.startAPP(true); } } diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java index 66ab3efecc..4aa6dd259c 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java @@ -195,4 +195,9 @@ public class WeCarFlowPresenter extends BaseMediaPresenter { public void next() { FlowPlayControl.getInstance().doNext(); } + + @Override + public void openApp() { + FlowPlayControl.getInstance().startPlayActivity(context); + } } diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java index d0379ff238..bf6eee1611 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java @@ -18,4 +18,6 @@ public interface IMusicView extends IView { void onMusicStopped(); void onMusicProgress(long current,long total); + + void onAppExit(); } diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/AnimCircleImageView.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/AnimCircleImageView.java index 280aee83e1..77cee5ce4e 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/AnimCircleImageView.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/AnimCircleImageView.java @@ -79,7 +79,9 @@ public class AnimCircleImageView extends ImageView { } public void startAnim() { - if (isRotating == true) return; + if (isRotating){ + return; + } isRotateEnable = true; isRotating = true; currentDegree = savedDegree; diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java similarity index 98% rename from modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow.java rename to modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java index dfa6be7426..45ea10d832 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java @@ -1,4 +1,4 @@ -package com.mogo.module.media; +package com.mogo.module.media.window; import android.content.BroadcastReceiver; import android.content.Context; @@ -8,12 +8,14 @@ import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.TextView; import com.mogo.map.marker.IMogoMarker; import com.mogo.module.common.entity.MarkerShareMusic; import com.mogo.module.common.entity.MarkerShowEntity; +import com.mogo.module.media.MediaConstants; +import com.mogo.module.media.R; +import com.mogo.module.media.ServiceMediaHandler; import com.mogo.module.media.constants.LeTingFieldConstants; import com.mogo.module.media.constants.QQMusicFieldConstants; import com.mogo.module.media.listener.NoDoubleClickListener; @@ -30,7 +32,6 @@ import com.mogo.module.media.view.MediaView; import com.mogo.module.media.widget.AnimCircleImageView; import com.mogo.module.media.widget.NoScrollSeekBar; import com.mogo.module.media.widget.ScrollingTextView; -import com.mogo.module.service.marker.MapMarkerManager; import com.mogo.utils.ActivityLifecycleManager; import com.mogo.utils.ThreadPoolService; import com.mogo.utils.UiThreadHandler; @@ -65,15 +66,9 @@ public class MediaWindow implements MediaView{ private boolean mTwoChange = false; private boolean isFirstPlay = false; - private Runnable mRunnable = new Runnable() { - @Override - public void run() { - MusicControlBroadCast.sendGetMusicPlayStateBroadcast(); - } - }; + private Runnable mRunnable = MusicControlBroadCast::sendGetMusicPlayStateBroadcast; public void initMedia(Context context){ - mContext = context; mPresenter = new MediaPresenter(this); registerMediaReceiver(); diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java similarity index 93% rename from modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java rename to modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java index 1ba6514075..818bf5e792 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java @@ -1,7 +1,6 @@ -package com.mogo.module.media; +package com.mogo.module.media.window; import android.content.Context; -import android.content.res.Resources; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; @@ -11,18 +10,17 @@ import android.widget.TextView; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.voice.AIAssist; import com.mogo.commons.voice.IMogoVoiceCmdCallBack; +import com.mogo.module.media.R; +import com.mogo.module.media.ServiceMediaHandler; import com.mogo.module.media.constants.MusicConstant; import com.mogo.module.media.listener.NoDoubleClickListener; import com.mogo.module.media.model.MediaInfoData; -import com.mogo.module.media.presenter.BaseMediaPresenter; import com.mogo.module.media.presenter.KwPresenter; -import com.mogo.module.media.presenter.WeCarFlowPresenter; import com.mogo.module.media.utils.Utils; import com.mogo.module.media.view.IMusicView; import com.mogo.module.media.widget.AnimCircleImageView; import com.mogo.module.media.widget.NoScrollSeekBar; import com.mogo.module.media.widget.ScrollingTextView; -import com.mogo.utils.LaunchUtils; import com.mogo.utils.WindowUtils; import com.mogo.utils.glide.GlideApp; import com.mogo.utils.logger.Logger; @@ -110,7 +108,7 @@ public class MediaWindow2 implements IMusicView { mWindowView.setOnClickListener(new NoDoubleClickListener() { @Override public void onClicks(View view) { - openAqtApp(); + mPresenter.openApp(); } }); @@ -125,7 +123,7 @@ public class MediaWindow2 implements IMusicView { mPresenter.pause(mMediaInfoData); } } else { - openAqtApp(); + mPresenter.openApp(); } } }); @@ -171,6 +169,16 @@ public class MediaWindow2 implements IMusicView { if (mWindowCurrTime != null) { mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime())); } + + if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) { + // kw音乐做的容错 + if (mWindowPlayPause != null) { + mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play); + } + if (mCircleImg != null) { + mCircleImg.startAnim(); + } + } } if (mCircleImg != null) { @@ -257,11 +265,8 @@ public class MediaWindow2 implements IMusicView { } } - private void openAqtApp() { - try { - LaunchUtils.launchByPkg(mContext, "com.tencent.wecarflow"); - } catch (Exception e) { - e.printStackTrace(); - } + @Override + public void onAppExit() { + mWindowView.setVisibility(View.GONE); } }