diff --git a/.idea/misc.xml b/.idea/misc.xml index 489c377bc5..21e99e2dc0 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 5384551e83..7e8007defa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,7 +25,7 @@ android { externalNativeBuild { ndk { // 设置支持的SO库架构 - abiFilters 'armeabi-v7a','x86' + abiFilters 'armeabi-v7a' } } } @@ -192,9 +192,6 @@ dependencies { implementation rootProject.ext.dependencies.guideshowprovider implementation rootProject.ext.dependencies.guideshow - implementation rootProject.ext.dependencies.modulepush, { - exclude group: 'com.mogo.module', module: 'module-common' - } implementation rootProject.ext.dependencies.moduleadcard implementation rootProject.ext.dependencies.moduleV2x @@ -202,6 +199,10 @@ dependencies { exclude group: 'com.mogo.module', module: 'module-share' } + implementation rootProject.ext.dependencies.modulepushbase + launcherImplementation rootProject.ext.dependencies.modulepush + independentImplementation rootProject.ext.dependencies.modulepushnoop + if (Boolean.valueOf(RELEASE)) { launcherImplementation rootProject.ext.dependencies.modulemainlauncher independentImplementation rootProject.ext.dependencies.modulemainindependent diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index ca92b2cb80..bdb64675f9 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -16,6 +16,7 @@ import com.mogo.module.common.MogoModule; import com.mogo.module.common.MogoModulePaths; import com.mogo.module.main.service.MogoMainService; import com.mogo.module.media.MediaConstants; +import com.mogo.module.push.base.PushUIConstants; import com.mogo.module.service.ServiceConst; import com.mogo.module.tanlu.constant.TanluConstants; import com.mogo.module.v2x.V2XConst; @@ -51,7 +52,7 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addModule(new MogoModule(AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME)); //运营位卡片,需要默认显示,放在第一个加载 - MogoModulePaths.addModule(new MogoModule(AdCardConstants.TAG, AdCardConstants.MODULE_NAME)); +// MogoModulePaths.addModule(new MogoModule(AdCardConstants.TAG, AdCardConstants.MODULE_NAME)); if (DebugConfig.isLauncher()) { MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE)); } @@ -63,7 +64,7 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY)); MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI)); // 暂时去掉推送 -// MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG)); + MogoModulePaths.addModule(new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME)); if (!DebugConfig.isLauncher()) { PersistentManager.getInstance().initManager(this); diff --git a/config.gradle b/config.gradle index ea2f5501c3..2b5b3af387 100644 --- a/config.gradle +++ b/config.gradle @@ -112,7 +112,10 @@ ext { moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}", modulemedia : "com.mogo.module:module-media:${MOGO_MODULE_MEDIA_VERSION}", modulesearch : "com.mogo.module:module-search:${MOGO_MODULE_SEARCH_VERSION}", + // push modulepush : "com.mogo.module:module-push:${MOGO_MODULE_PUSH_VERSION}", + modulepushbase : "com.mogo.module:module-push-base:${MOGO_MODULE_PUSH_BASE_VERSION}", + modulepushnoop : "com.mogo.module:module-push-noop:${MOGO_MODULE_PUSH_NOOP_VERSION}", //运营位卡片 moduleadcard : "com.mogo.module:module-adcard:${MOGO_MODULE_AD_CARD_VERSION}", //统一返回键 diff --git a/gradle.properties b/gradle.properties index d6b1ec2825..8fb948eac3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -73,7 +73,9 @@ MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2 # v2x MOGO_MODULE_V2X_VERSION=1.1.53 # 推送 -MOGO_MODULE_PUSH_VERSION=1.0.1 +MOGO_MODULE_PUSH_VERSION=1.1.5.5 +MOGO_MODULE_PUSH_BASE_VERSION=1.1.5.5 +MOGO_MODULE_PUSH_NOOP_VERSION=1.1.5.5 # 广告资源位 MOGO_MODULE_AD_CARD_VERSION=1.0.1 # 探路上报和分享模块 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 a43c30f4af..a45a42bb6d 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 @@ -68,13 +68,27 @@ public class KwPresenter extends BaseMediaPresenter { }); kwapi.registerPlayerStatusListener((playerStatus, music) -> { - Logger.d(TAG, "onPlayerStatusListener: " + playerStatus); - Log.d(TAG, "onPlayerStatusListener: " + playerStatus); + Logger.d(TAG, "onPlayerStatusListener: " + playerStatus + " music: " + music.name); switch (playerStatus) { case BUFFERING: + if (currentMedia.getMediaName() == null || !currentMedia.getMediaName().equals(music.name)) { + // 说明是切了新歌,需要及时同步一下状态 + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + currentMedia.setMediaName(music.name); + currentMedia.setMediaImg(""); + mView.onMediaInfoChanged(currentMedia); + mView.onMusicPlaying(); + } kwapi.getSongPicUrl(music, onGetSongImgUrlListener); break; case PLAYING: + if (currentMedia.getMediaName() == null || !currentMedia.getMediaName().equals(music.name)) { + // 说明是切了新歌,需要及时同步一下状态 + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + currentMedia.setMediaName(music.name); + currentMedia.setMediaImg(""); + mView.onMediaInfoChanged(currentMedia); + } currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); kwapi.getSongPicUrl(music, onGetSongImgUrlListener); startTrackTrackProgress(); @@ -105,6 +119,43 @@ public class KwPresenter extends BaseMediaPresenter { if (!isBind) { // 未绑定,需要重新绑定,同时第一次绑定初始化也是在此处 kwapi.bindAutoSdkService(); + }else if(kwapi.isKuwoRunning()){ + Music currentMusic = kwapi.getNowPlayingMusic(); + if (currentMedia.getMediaName() == null && currentMusic != null) { + // 当前处于绑定状态,且有音乐信息,需判断是否正在播放,进行界面刷新 + Log.d(TAG, "step1==" + currentMusic.name); + if (kwapi.getPlayerStatus() == PlayerStatus.BUFFERING || kwapi.getPlayerStatus() == PlayerStatus.PLAYING) { + Logger.d(TAG, "当前可能正在播放音乐,需要更新=1=" + currentMusic.name); + currentMedia.setMediaName(currentMusic.name); + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + mView.onMediaInfoChanged(currentMedia); + mView.onMusicPlaying(); + kwapi.getSongPicUrl(currentMusic, onGetSongImgUrlListener); + } else if (kwapi.getPlayerStatus() == PlayerStatus.INIT) { + Logger.d(TAG, "当前可能正在播放音乐,需要更新=3=" + currentMusic.name); + currentMedia.setMediaName(currentMusic.name); + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP); + mView.onMediaInfoChanged(currentMedia); + mView.onMusicStopped(); + } + } else if (currentMedia.getMediaName() != null && currentMusic != null && !currentMedia.getMediaName().equals(currentMusic.name)) { + Log.d(TAG, "step2==media: " + currentMedia.getMediaName() + " " + + "musicName: " + currentMusic.name + " status: " + kwapi.getPlayerStatus()); + if (kwapi.getPlayerStatus() == PlayerStatus.BUFFERING || kwapi.getPlayerStatus() == PlayerStatus.PLAYING) { + Logger.d(TAG, "当前可能正在播放音乐,需要更新=2=" + currentMusic.name); + currentMedia.setMediaName(currentMusic.name); + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + mView.onMediaInfoChanged(currentMedia); + mView.onMusicPlaying(); + kwapi.getSongPicUrl(currentMusic, onGetSongImgUrlListener); + }else if (kwapi.getPlayerStatus() == PlayerStatus.INIT) { + Logger.d(TAG, "当前可能正在播放音乐,需要更新=4=" + currentMusic.name); + currentMedia.setMediaName(currentMusic.name); + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP); + mView.onMediaInfoChanged(currentMedia); + mView.onMusicStopped(); + } + } } } } 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 77cee5ce4e..6a0a8daab1 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 @@ -13,6 +13,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; import android.util.AttributeSet; +import android.util.Log; import android.widget.ImageView; import com.mogo.module.common.utils.CarSeries; @@ -32,7 +33,8 @@ public class AnimCircleImageView extends ImageView { int savedDegree; boolean isRotateEnable; boolean isRotating; - private int delayMilliseconds = 450; +// private int delayMilliseconds = 450; + private int delayMilliseconds = 2000; private int mRotateAngleStep = 3; public AnimCircleImageView(Context context) { @@ -79,6 +81,7 @@ public class AnimCircleImageView extends ImageView { } public void startAnim() { + Log.d("AnimCircle", "startAnim====" + isRotating); if (isRotating){ return; } @@ -86,9 +89,12 @@ public class AnimCircleImageView extends ImageView { isRotating = true; currentDegree = savedDegree; invalidate(); + Log.d("AnimCircle", "invalidate=="); } public void stopAnim() { + Log.d("AnimCircle", "stopAnim==="); + removeCallbacks(loopInvalidate); isRotating = false; isRotateEnable = false; savedDegree = currentDegree; @@ -100,7 +106,7 @@ public class AnimCircleImageView extends ImageView { @Override protected void onDraw(Canvas canvas) { - + Log.d("AnimCircle", "onDraw===="); try { if (mDrawbleSrc == null) return; @@ -146,7 +152,9 @@ public class AnimCircleImageView extends ImageView { canvas.drawBitmap(output, defaultWidth / 2 - radius, defaultHeight / 2 - radius, null); canvas.restore(); if (isRotateEnable) { - postInvalidateDelayed(delayMilliseconds); + removeCallbacks(loopInvalidate); + postDelayed(loopInvalidate, delayMilliseconds); +// postInvalidateDelayed(delayMilliseconds); } } else { canvas.save(); @@ -161,6 +169,8 @@ public class AnimCircleImageView extends ImageView { } + private Runnable loopInvalidate = this::invalidate; + private Bitmap getCuttedPicture(Drawable DrawbleSrc) { Bitmap mBitmapOrigin = ((BitmapDrawable) DrawbleSrc).getBitmap(); int mWidth = mBitmapOrigin.getWidth(); diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java index 818bf5e792..5a8ab8bafc 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java @@ -182,10 +182,14 @@ public class MediaWindow2 implements IMusicView { } if (mCircleImg != null) { - com.bumptech.glide.request.RequestOptions options = - new com.bumptech.glide.request.RequestOptions() - .placeholder(R.drawable.module_media_default_music_img); - GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(mCircleImg); + if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) { + com.bumptech.glide.request.RequestOptions options = + new com.bumptech.glide.request.RequestOptions() + .placeholder(R.drawable.module_media_default_music_img); + GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(mCircleImg); + }else{ + mCircleImg.setImageResource(R.drawable.module_media_default_music_img); + } } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index 9082bcadea..2f7d47750a 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -55,6 +55,7 @@ import com.mogo.service.module.MogoAction; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.service.statusmanager.StatusDescriptor; +import com.mogo.utils.TipToast; import com.mogo.utils.WorkThreadHandler; import com.mogo.utils.logger.Logger; @@ -286,6 +287,7 @@ public class MogoServices implements IMogoMapListener, mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ADAS_UI, this ); mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, this ); mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, this ); + mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, this ); mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() ); registerMogoReceiver( context ); @@ -474,10 +476,10 @@ public class MogoServices implements IMogoMapListener, } private void stopAutoRefreshStrategy() { - stopAutoRefreshStrategy(true); + stopAutoRefreshStrategy( true ); } - private void stopAutoRefreshStrategy(boolean stopOnlineCarRefresh) { + private void stopAutoRefreshStrategy( boolean stopOnlineCarRefresh ) { if ( DebugConfig.isDebug() ) { Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); } @@ -714,6 +716,12 @@ public class MogoServices implements IMogoMapListener, case ACC_STATUS: if ( isTrue ) { mADASController.showADAS(); + try { + MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers(); + } catch ( Exception e ) { + Logger.e( TAG, e, "error." ); + } + refreshStrategy(); } break; } @@ -756,7 +764,7 @@ public class MogoServices implements IMogoMapListener, Logger.w( TAG, "ignore refresh request case time < 0" ); return; } - stopAutoRefreshStrategy(stopOnlineCarRefresh); + stopAutoRefreshStrategy( stopOnlineCarRefresh ); mRefreshRemainingTime = time; long delay = ServiceConst.DECREASE_INTERVAL; if ( mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL ) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index d762476e0c..43613ad77f 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -293,6 +293,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, MogoLatLng centerPoint ) { // 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗 if ( onlineCarList == null || onlineCarList.isEmpty() ) { + MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_USER_DATA ); return; } @@ -324,9 +325,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener, String sn = getPrimaryKeyFromEntity( markerOnlineCar ); IMogoMarker mogoMarker = existCarMap.get( sn ); - if ( mogoMarker == null ) { + if ( mogoMarker == null || mogoMarker.isDestroyed() ) { mogoMarker = drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_LOW ); } + if ( mogoMarker != null ) { + mogoMarker.setVisible( true ); + } startSmooth( mogoMarker, markerOnlineCar, markerLocation ); } @@ -349,8 +353,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, } int size = getAppropriateSize( maxAmount, exploreWayList ); Map< String, IMogoMarker > existCarMap = purgeMarkerData( exploreWayList, ModuleNames.CARD_TYPE_ROAD_CONDITION ); - Logger.i( TAG, "existCarMap: size = %d", existCarMap.size() ); - for ( int i = 0; i < size; i++ ) { + Logger.i( TAG, "existCarMap: size = %d", existCarMap.size() );for ( int i = 0; i < size; i++ ) { MarkerExploreWay markerExploreWay = exploreWayList.get( i ); if ( !markerExploreWay.getCanLive() ) { MarkerLocation markerLocation = markerExploreWay.getLocation(); @@ -363,9 +366,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener, String sn = getPrimaryKeyFromEntity( markerExploreWay ); IMogoMarker mogoMarker = existCarMap.get( sn ); - if ( mogoMarker == null ) { + if ( mogoMarker == null || mogoMarker.isDestroyed() ) { Logger.d( TAG, "draw road condition, sn = %s", sn ); - drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH ); + mogoMarker = drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH ); + } + if ( mogoMarker != null ) { + mogoMarker.setVisible( true ); } } }