Merge branch 'qa' into dev_custom_map
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
|
||||
@@ -109,7 +109,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();
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测车机激活状态
|
||||
*
|
||||
|
||||
@@ -60,7 +60,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.11
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.2.0
|
||||
# 车聊聊接口
|
||||
@@ -78,8 +78,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.11
|
||||
|
||||
# Boost分包
|
||||
BOOST_MULTIDEX_VERSION=1.0.0
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩容
|
||||
*
|
||||
|
||||
@@ -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<IMusicView> {
|
||||
|
||||
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<IMusicView> {
|
||||
|
||||
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<IMusicView> {
|
||||
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<IMusicView> {
|
||||
public void pause(MediaInfoData mediaInfoData) {
|
||||
if (kwapi.isKuwoRunning()) {
|
||||
kwapi.setPlayState(PlayState.STATE_PAUSE);
|
||||
}else{
|
||||
kwapi.startAPP(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user