From 34e56321820c0b94a1e4960b2ee38d858942f7f6 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Thu, 2 Jul 2020 10:21:30 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=85=B7=E6=88=91?= =?UTF-8?q?=E9=9F=B3=E4=B9=90=E4=B8=8E=E8=93=9D=E7=89=99=E9=9F=B3=E4=B9=90?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E6=92=AD=E6=94=BE=E6=97=B6=EF=BC=8C=E9=85=B7?= =?UTF-8?q?=E6=88=91=E9=9F=B3=E4=B9=90=E7=8A=B6=E6=80=81=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=82=B9=E5=87=BB=E6=B5=AE=E7=AA=97=E6=B2=A1?= =?UTF-8?q?=E5=8F=8D=E5=BA=94=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mogo/module/media/presenter/KwPresenter.java | 2 ++ 1 file changed, 2 insertions(+) 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 058866c6fb..970bc7f4db 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 @@ -120,6 +120,8 @@ public class KwPresenter extends BaseMediaPresenter { public void pause(MediaInfoData mediaInfoData) { if (kwapi.isKuwoRunning()) { kwapi.setPlayState(PlayState.STATE_PAUSE); + }else{ + kwapi.startAPP(true); } } From a6e94ae89748a5c89938e8e4ccfe53d18c6ee50b Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Thu, 2 Jul 2020 10:51:18 +0800 Subject: [PATCH 2/6] opt --- .../com/mogo/commons/AbsMogoApplication.java | 2 +- .../java/com/mogo/commons/device/Devices.java | 22 ++++++++++++++ .../com/mogo/module/apps/AppsAdapter.java | 21 +++++++++----- .../com/mogo/module/apps/AppsPresenter.java | 29 ------------------- 4 files changed, 37 insertions(+), 37 deletions(-) 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 53d2b568cc..943ad1417d 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 @@ -107,7 +107,7 @@ public class AbsMogoApplication extends Application { // 2 - 本地缓存,聚合上报,积累30条埋点上报,或者积累60秒上报一次。 AnalyticsConfig.getInstance( sApp ).setMode( DebugConfig.isDebug() ? 0 : 2 ); AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() ); - + Devices.init( getApp() ); Devices.checkBindState(); } ); } diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java index f9c5470fce..56eaa84ac1 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java @@ -1,10 +1,14 @@ package com.mogo.commons.device; import android.content.ContentResolver; +import android.content.Context; +import android.database.ContentObserver; import android.database.Cursor; import android.net.Uri; import com.mogo.commons.AbsMogoApplication; +import com.mogo.utils.ThreadPoolService; +import com.mogo.utils.logger.Logger; public /** @@ -15,10 +19,28 @@ public */ class Devices { + private static final String TAG = "Devices"; + public static final Uri CONTENT_URI_BIND = Uri.parse( "content://com.zhidao.guide.lock.product.bindstatus/status" ); private static boolean sIsBind = false; + public static void init( Context context ) { + if ( context == null ) { + return; + } + context.getContentResolver().registerContentObserver( CONTENT_URI_BIND, true, new ContentObserver( null ) { + @Override + public void onChange( boolean selfChange ) { + super.onChange( selfChange ); + ThreadPoolService.execute( () -> { + checkBindState(); + Logger.d( TAG, "lock status changed. the last val = " + sIsBind ); + } ); + } + } ); + } + /** * 检测车机激活状态 * diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsAdapter.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsAdapter.java index 4d33051d1b..a0f7739aa2 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsAdapter.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsAdapter.java @@ -11,6 +11,7 @@ import androidx.annotation.NonNull; import com.mogo.module.apps.model.AppInfo; +import java.util.ArrayList; import java.util.List; /** @@ -24,17 +25,23 @@ public class AppsAdapter extends BaseAdapter { private List< AppInfo > mAppInfos; public AppsAdapter( List< AppInfo > appInfos ) { - this.mAppInfos = appInfos; - } - - public void refreshAppInfos( List< AppInfo > mAppInfos ) { - this.mAppInfos = mAppInfos; - notifyDataSetChanged(); + List< AppInfo > newList = new ArrayList<>( appInfos ); + this.mAppInfos = new ArrayList<>(); + if ( newList != null && !newList.isEmpty() ) { + for ( AppInfo appInfo : newList ) { + if ( mAppInfos.contains( appInfo ) ) { + continue; + } + mAppInfos.add( appInfo ); + } + } } @Override public int getCount() { - return mAppInfos == null ? 0 : mAppInfos.size(); + int size = mAppInfos == null ? 0 : mAppInfos.size(); + size = size > AppsConst.TOTAL_SIZE_EACH_PAGE ? AppsConst.TOTAL_SIZE_EACH_PAGE : size; + return size; } @Override 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 87d43203e1..8c7fef9224 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 @@ -80,11 +80,6 @@ public class AppsPresenter extends Presenter< AppsView > { Logger.d( TAG, "apps: %s", appInfoList ); final Map< Integer, List< AppInfo > > result = addOthersEntrances( appInfoList ); - try { - filterSamePackage( result ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); - } UiThreadHandler.post( () -> { if ( mView != null ) { mView.renderApps( result ); @@ -159,30 +154,6 @@ public class AppsPresenter extends Presenter< AppsView > { return result; } - private void filterSamePackage( Map< Integer, List< AppInfo > > appInfoMap ) { - if ( appInfoMap == null || appInfoMap.isEmpty() ) { - return; - } - for ( Map.Entry< Integer, List< AppInfo > > integerListEntry : appInfoMap.entrySet() ) { - if ( integerListEntry == null ) { - continue; - } - List< AppInfo > oldList = integerListEntry.getValue(); - if ( oldList == null - || oldList.size() > AppsConst.TOTAL_SIZE_EACH_PAGE ) { - return; - } - List< AppInfo > appInfos = new ArrayList<>(); - for ( AppInfo appInfo : oldList ) { - if ( appInfos.contains( appInfo ) ) { - continue; - } - appInfos.add( appInfo ); - } - integerListEntry.setValue( appInfos ); - } - } - /** * 扩容 * From 0c9efb1f7cd9d3c1acaf0ec7f0782b7d9838fdd7 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 2 Jul 2020 12:33:20 +0800 Subject: [PATCH 3/6] modify tanlu verison --- .idea/misc.xml | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 21e99e2dc0..cd77a1f062 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index b5f2401cc1..add6d144a1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -77,7 +77,7 @@ MOGO_MODULE_PUSH_VERSION=1.0.1 # 广告资源位 MOGO_MODULE_AD_CARD_VERSION=1.0.1 # 探路上报和分享模块 -TANLULIB_VERSION=1.2.1.9 +TANLULIB_VERSION=1.2.1.10 # Boost分包 From 0d1f5a99c0fba5f8cbdc7e25aff49c4945f3ed8c Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 2 Jul 2020 12:44:31 +0800 Subject: [PATCH 4/6] opt --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index add6d144a1..c5e886d1bc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -59,7 +59,7 @@ MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.9 ## 工程外部模块 # 探路 -MOGO_MODULE_TANLU_VERSION=1.2.1.9 +MOGO_MODULE_TANLU_VERSION=1.2.1.10 # 车聊聊 CARCHATTING_VERSION=1.2.0 # 车聊聊接口 From 307e0aed8abd852d915a1e8d9c91e64b5453ae1c Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Thu, 2 Jul 2020 13:18:58 +0800 Subject: [PATCH 5/6] add log --- .../java/com/mogo/module/media/presenter/KwPresenter.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 970bc7f4db..a43c30f4af 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 @@ -3,6 +3,7 @@ package com.mogo.module.media.presenter; import android.content.Context; import android.os.Handler; import android.os.Message; +import android.util.Log; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.module.media.MediaConstants; @@ -43,12 +44,14 @@ public class KwPresenter extends BaseMediaPresenter { kwapi.registerConnectedListener(b -> { Logger.d(TAG, "onConnected: " + b); + Log.d(TAG, "onConnected: " + b); isBind = b; if (!isBind) { mView.onMusicStopped(); }else{ PlayerStatus currentState = kwapi.getPlayerStatus(); Logger.d(TAG, "check current status: " + currentState); + Log.d(TAG, "check current status: " + currentState); if(currentState == PlayerStatus.BUFFERING||currentState == PlayerStatus.PLAYING){ currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); kwapi.getSongPicUrl(kwapi.getNowPlayingMusic(), onGetSongImgUrlListener); @@ -60,11 +63,13 @@ public class KwPresenter extends BaseMediaPresenter { kwapi.registerExitListener(() -> { Logger.d(TAG, "onExit==="); + Log.d(TAG, "onExit==="); mView.onAppExit(); }); kwapi.registerPlayerStatusListener((playerStatus, music) -> { Logger.d(TAG, "onPlayerStatusListener: " + playerStatus); + Log.d(TAG, "onPlayerStatusListener: " + playerStatus); switch (playerStatus) { case BUFFERING: kwapi.getSongPicUrl(music, onGetSongImgUrlListener); @@ -95,6 +100,7 @@ public class KwPresenter extends BaseMediaPresenter { public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { if (isTrue) { Logger.d(TAG, "onResume, isBind: " + isBind); + Log.d(TAG, "onResume, isBind: " + isBind); // 需要在resume时候判断绑定关系是否正常 if (!isBind) { // 未绑定,需要重新绑定,同时第一次绑定初始化也是在此处 From ec17dc1ef6ed8fa208bbd56fca88238bed762d81 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 2 Jul 2020 14:47:31 +0800 Subject: [PATCH 6/6] upgrade tanlu version --- gradle.properties | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index c5e886d1bc..0c9e485ceb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -59,7 +59,7 @@ MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.9 ## 工程外部模块 # 探路 -MOGO_MODULE_TANLU_VERSION=1.2.1.10 +MOGO_MODULE_TANLU_VERSION=1.2.1.11 # 车聊聊 CARCHATTING_VERSION=1.2.0 # 车聊聊接口 @@ -77,8 +77,7 @@ MOGO_MODULE_PUSH_VERSION=1.0.1 # 广告资源位 MOGO_MODULE_AD_CARD_VERSION=1.0.1 # 探路上报和分享模块 -TANLULIB_VERSION=1.2.1.10 - +TANLULIB_VERSION=1.2.1.11 # Boost分包 BOOST_MULTIDEX_VERSION=1.0.0