diff --git a/.idea/misc.xml b/.idea/misc.xml
index cd77a1f062..21e99e2dc0 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
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/gradle.properties b/gradle.properties
index dbd37bcd37..b0e37af401 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -61,7 +61,7 @@ MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
## 工程外部模块
# 探路
-MOGO_MODULE_TANLU_VERSION=1.2.1.9
+MOGO_MODULE_TANLU_VERSION=1.2.1.11
# 车聊聊
CARCHATTING_VERSION=1.2.0
# 车聊聊接口
@@ -79,11 +79,9 @@ 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.11
MOGO_MODULE_EVENT_PANEL_VERSION = 1.0.0-SNAPSHOT
-
# Boost分包
BOOST_MULTIDEX_VERSION=1.0.0
# hook ARouter分包实现
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 );
- }
- }
-
/**
* 扩容
*
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..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) {
// 未绑定,需要重新绑定,同时第一次绑定初始化也是在此处
@@ -120,6 +126,8 @@ public class KwPresenter extends BaseMediaPresenter {
public void pause(MediaInfoData mediaInfoData) {
if (kwapi.isKuwoRunning()) {
kwapi.setPlayState(PlayState.STATE_PAUSE);
+ }else{
+ kwapi.startAPP(true);
}
}