opt
This commit is contained in:
@@ -120,7 +120,7 @@ targetSdkVersion : 22,
|
||||
mogomoduleauth : "com.mogo.module:module-authorize:${MOGO_MODULE_AUTHORIZE_VERSION}",
|
||||
mogomoduleguide : "com.mogo.module:module-guide:${MOGO_MODULE_GUIDE_VERSION}",
|
||||
// 长链
|
||||
socketsdk : 'com.zhidao.socketsdk:socketsdk:2.1.1',
|
||||
socketsdk : 'com.zhidao.socketsdk:socketsdk:2.1.4',
|
||||
socketsdkconnsvrprotoco : 'com.zhidao.ptech:connsvr-protoco:0.1.23',
|
||||
socketsdkprotobufjava : 'com.google.protobuf:protobuf-java:3.5.1',
|
||||
// OBU
|
||||
|
||||
@@ -87,6 +87,10 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived( byte[] content ) {
|
||||
onMessageReceived( content, 0);
|
||||
}
|
||||
|
||||
public void onMessageReceived( byte[] content, long msgId ) {
|
||||
try {
|
||||
MogoConnsvr.Payload payload = MogoConnsvr.Payload.parseFrom( content );
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.main.windowview.FloatingViewHandler;
|
||||
@@ -30,7 +31,6 @@ import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
@@ -244,12 +244,21 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
super.onPause();
|
||||
mMogoStatusManager.setMainPageResumeStatus( TAG, false );
|
||||
mMogoStatusManager.setMainPageLaunchedStatus( TAG, false );
|
||||
if ( !mIsHomeKeyDown || !DebugConfig.isLauncher() ) {
|
||||
if ( shouldCloseADASPanel() ) {
|
||||
mServiceApis.getAdasControllerApi().closeADAS();
|
||||
}
|
||||
mIsHomeKeyDown = false;
|
||||
}
|
||||
|
||||
private boolean shouldCloseADASPanel(){
|
||||
// m4 系列因为按home键会造成页面pause后resume,造成adas panel 闪烁
|
||||
// f 系列加上上滑返回桌面后会走 mIsHomeKeyDown = true,但是不会造成页面pause
|
||||
// 独立 app 任何情况下都需要隐藏 adas
|
||||
return !mIsHomeKeyDown
|
||||
|| CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X
|
||||
|| !DebugConfig.isLauncher();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
|
||||
@@ -14,7 +14,6 @@ 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 cn.kuwo.autosdk.api.KWAPI;
|
||||
import cn.kuwo.autosdk.api.OnGetSongImgUrlListener;
|
||||
@@ -43,14 +42,14 @@ public class KwPresenter extends BaseMediaPresenter<IMusicView> {
|
||||
kwapi = KWAPI.createKWAPI(context, "auto");
|
||||
|
||||
kwapi.registerConnectedListener(b -> {
|
||||
Logger.d(TAG, "onConnected: " + b);
|
||||
Log.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);
|
||||
Log.d(TAG, "check current status: " + currentState);
|
||||
if(currentState == PlayerStatus.BUFFERING||currentState == PlayerStatus.PLAYING){
|
||||
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
|
||||
@@ -62,13 +61,13 @@ public class KwPresenter extends BaseMediaPresenter<IMusicView> {
|
||||
});
|
||||
|
||||
kwapi.registerExitListener(() -> {
|
||||
Logger.d(TAG, "onExit===");
|
||||
Log.d(TAG, "onExit===");
|
||||
Log.d(TAG, "onExit===");
|
||||
mView.onAppExit();
|
||||
});
|
||||
|
||||
kwapi.registerPlayerStatusListener((playerStatus, music) -> {
|
||||
Logger.d(TAG, "onPlayerStatusListener: " + playerStatus + " music: " + music.name);
|
||||
Log.d(TAG, "onPlayerStatusListener: " + playerStatus + " music: " + music.name);
|
||||
switch (playerStatus) {
|
||||
case BUFFERING:
|
||||
if (currentMedia.getMediaName() == null || !currentMedia.getMediaName().equals(music.name)) {
|
||||
@@ -113,7 +112,7 @@ public class KwPresenter extends BaseMediaPresenter<IMusicView> {
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (isTrue) {
|
||||
Logger.d(TAG, "onResume, isBind: " + isBind);
|
||||
Log.d(TAG, "onResume, isBind: " + isBind);
|
||||
Log.d(TAG, "onResume, isBind: " + isBind);
|
||||
// 需要在resume时候判断绑定关系是否正常
|
||||
if (!isBind) {
|
||||
@@ -125,14 +124,14 @@ public class KwPresenter extends BaseMediaPresenter<IMusicView> {
|
||||
// 当前处于绑定状态,且有音乐信息,需判断是否正在播放,进行界面刷新
|
||||
Log.d(TAG, "step1==" + currentMusic.name);
|
||||
if (kwapi.getPlayerStatus() == PlayerStatus.BUFFERING || kwapi.getPlayerStatus() == PlayerStatus.PLAYING) {
|
||||
Logger.d(TAG, "当前可能正在播放音乐,需要更新=1=" + currentMusic.name);
|
||||
Log.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);
|
||||
Log.d(TAG, "当前可能正在播放音乐,需要更新=3=" + currentMusic.name);
|
||||
currentMedia.setMediaName(currentMusic.name);
|
||||
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
@@ -142,14 +141,14 @@ public class KwPresenter extends BaseMediaPresenter<IMusicView> {
|
||||
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);
|
||||
Log.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);
|
||||
Log.d(TAG, "当前可能正在播放音乐,需要更新=4=" + currentMusic.name);
|
||||
currentMedia.setMediaName(currentMusic.name);
|
||||
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
@@ -237,16 +236,18 @@ public class KwPresenter extends BaseMediaPresenter<IMusicView> {
|
||||
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));
|
||||
if(currentMedia.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
|
||||
currentMedia.setMediaName(music.name);
|
||||
currentMedia.setMediaImg(s);
|
||||
Log.d(TAG,
|
||||
"onGetSongImgUrlSucessed: " + currentMedia);
|
||||
handler.post(() -> mView.onMediaInfoChanged(currentMedia));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetSongImgUrlFailed(Music music, int i) {
|
||||
Logger.e(TAG, "onGetSongImgUrlFailed: " + i);
|
||||
Log.e(TAG, "onGetSongImgUrlFailed: " + i);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.media.window;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -101,6 +102,7 @@ public class MediaWindow2 implements IMusicView {
|
||||
int statusBarHeight = WindowUtils.getStatusBarHeight(mContext);
|
||||
Logger.d(TAG,
|
||||
"yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight);
|
||||
Log.d(TAG, "addMediaWindoView");
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height));
|
||||
params.leftMargin = xPos;
|
||||
@@ -204,6 +206,7 @@ public class MediaWindow2 implements IMusicView {
|
||||
@Override
|
||||
public void onMusicPlaying() {
|
||||
Logger.d(TAG, "onMusicPlaying===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicPlaying===" + mMediaInfoData);
|
||||
isFirstPlay = false;
|
||||
updateWindowUI(false);
|
||||
if (mWindowPlayPause != null) {
|
||||
@@ -218,6 +221,7 @@ public class MediaWindow2 implements IMusicView {
|
||||
@Override
|
||||
public void onMusicPause() {
|
||||
Logger.d(TAG, "onMusicPause: ===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicPause: ===" + mMediaInfoData);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
@@ -230,6 +234,7 @@ public class MediaWindow2 implements IMusicView {
|
||||
@Override
|
||||
public void onMusicStopped() {
|
||||
Logger.d(TAG, "onMusicStopped===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicStopped===" + mMediaInfoData);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
@@ -244,6 +249,7 @@ public class MediaWindow2 implements IMusicView {
|
||||
@Override
|
||||
public void onMediaInfoChanged(MediaInfoData mediaInfoData) {
|
||||
Logger.d(TAG, "onMediaInfoChanged: " + mediaInfoData);
|
||||
Log.d(TAG, "onMediaInfoChanged:" + mediaInfoData);
|
||||
mMediaInfoData = mediaInfoData;
|
||||
addWindowView();
|
||||
updateWindowUI();
|
||||
|
||||
Reference in New Issue
Block a user