diff --git a/app/build.gradle b/app/build.gradle index a4be1c2467..9ec67a2001 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -281,4 +281,3 @@ def getGitCommit() { assert !gitCommit.isEmpty() gitCommit } - 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 b1e7afd023..53d2b568cc 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 @@ -133,9 +133,9 @@ public class AbsMogoApplication extends Application { } ); } - private static void getTicket(TicketInfoCallback callback){ + private static void getTicket( TicketInfoCallback callback ) { if ( DebugConfig.isLauncher() ) { - AccountClientManager.getTicket(callback); + AccountClientManager.getTicket( callback ); } else { AccountClientManager.getAppTicket( callback ); } diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/marker/CombineMovingPointOverlay.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/marker/CombineMovingPointOverlay.java new file mode 100644 index 0000000000..4d7d1fb929 --- /dev/null +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/marker/CombineMovingPointOverlay.java @@ -0,0 +1,330 @@ +package com.mogo.map.impl.amap.marker; + +import com.amap.api.maps.AMap; +import com.amap.api.maps.AMapUtils; +import com.amap.api.maps.model.BasePointOverlay; +import com.amap.api.maps.model.LatLng; +import com.autonavi.amap.mapcore.IPoint; +import com.autonavi.amap.mapcore.MapProjection; +import com.mogo.utils.logger.Logger; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +/** + * @author congtaowang + * @since 2020/6/15 + *

+ */ +class CombineMovingPointOverlay { + + private static final String TAG = "CombineMovingPointOverlay"; + + private AMap mAMap; + private long mDuration = 1_000L; + private long mStepDuration = 20L; + private LinkedList< LatLng > mPoints = new LinkedList<>(); + private LinkedList< Double > mEachDistance = new LinkedList<>(); + + private double mTotalDistance = 0.0D; + private double mRemainDistance = 0.0D; + private ExecutorService mThreadPools; + private Object mLock = new Object(); + private BasePointOverlay mBaseOverlay = null; + private int mIndex = 0; + private boolean mUseDefaultDescriptor = false; + AtomicBoolean mExitFlag = new AtomicBoolean( false ); + private MoveListener mMoveListener; + private Status mStatus; + private long mPauseMillis; + private long mAnimationBeginTime; + + public CombineMovingPointOverlay( AMap amap, BasePointOverlay baseOverlay ) { + mStatus = Status.Status1; + mAnimationBeginTime = System.currentTimeMillis(); + if ( amap != null && baseOverlay != null ) { + this.mAMap = amap; + this.mBaseOverlay = baseOverlay; + mThreadPools = new ThreadPoolExecutor( 1, 2, 5L, TimeUnit.SECONDS, new SynchronousQueue(), new ThreadFactoryImpl() ); + } + } + + public void setMoveListener( MoveListener moveListener ) { + this.mMoveListener = moveListener; + } + + public void setPoints( List< LatLng > list ) { + synchronized ( mLock ) { + if ( list != null && list.size() >= 2 ) { + stopMove(); + if ( mPoints != null ) { + mPoints.clear(); + } + Iterator< LatLng > iterator = list.listIterator(); + while ( iterator.hasNext() ) { + LatLng latLng = iterator.next(); + if ( latLng != null ) { + mPoints.add( latLng ); + } + } + + mEachDistance.clear(); + mTotalDistance = 0.0D; + + for ( int i = 0; i < mPoints.size(); i++ ) { + double distance = AMapUtils.calculateLineDistance( mPoints.get( i ), mPoints.get( i + 1 ) ); + mEachDistance.add( distance ); + mTotalDistance += distance; + } + + mRemainDistance = mTotalDistance; + mBaseOverlay.setPosition( mPoints.get( 0 ) ); + reset(); + } + } + } + + + public int getIndex() { + return mIndex; + } + + public BasePointOverlay getBaseOverlay() { + return mBaseOverlay; + } + + public void destroy() { + try { + removeMarker(); + mThreadPools.shutdown(); + synchronized ( mLock ) { + mPoints.clear(); + mEachDistance.clear(); + ; + } + } catch ( Exception e ) { + + } + } + + public void removeMarker() { + try { + reset(); + if ( mBaseOverlay != null ) { + mBaseOverlay.remove(); + mBaseOverlay = null; + } + } catch ( Exception e ) { + Logger.e( TAG, e, "error." ); + } + } + + public void stopMove() { + if ( mStatus == Status.Status3 ) { + mStatus = Status.Status4; + mPauseMillis = System.currentTimeMillis(); + } + } + + private void reset() { + if ( mStatus == Status.Status3 || mStatus == Status.Status4 ) { + mExitFlag.set( true ); + try { + mThreadPools.awaitTermination( mStepDuration + 20L, TimeUnit.MICROSECONDS ); + mBaseOverlay.setAnimation( null ); + mStatus = Status.Status1; + } catch ( InterruptedException e ) { + Logger.e( TAG, e, "error." ); + } + } + } + + public void resetIndex() { + mIndex = 0; + } + + + public void setTotalDuration( int seconds ) { + mDuration = seconds * 1_000L; + } + + public void startSmoothMove() { + if ( mStatus == Status.Status4 ) { + mStatus = Status.Status3; + long interval = System.currentTimeMillis() - mPauseMillis; + mAnimationBeginTime += interval; + } else { + if ( mStatus == Status.Status1 || mStatus == Status.Status5 ) { + if ( mPoints.size() <= 0 ) { + return; + } + mIndex = 0; + mThreadPools.execute( new MarkerMovingRunnable() ); + } + } + } + + public void setVisible( boolean visible ) { + if ( mBaseOverlay != null ) { + try { + mBaseOverlay.setVisible( visible ); + } catch ( Exception e ) { + Logger.e( TAG, e, "error." ); + } + } + } + + private class MarkerMovingRunnable implements Runnable { + + @Override + public void run() { + mAnimationBeginTime = System.currentTimeMillis(); + mStatus = Status.Status2; + mExitFlag.set( false ); + + try { + for ( ; !mExitFlag.get() && mIndex <= mPoints.size() - 1; Thread.sleep( mStepDuration ) ) { + synchronized ( mLock ) { + if ( mExitFlag.get() ) { + return; + } + if ( mStatus == Status.Status4 ) { + long interval = System.currentTimeMillis() - mAnimationBeginTime; + IPoint point = getCurPosition( interval ); + mBaseOverlay.setGeoPoint( point ); + mStatus = Status.Status3; + } + } + } + mStatus = Status.Status5; + } catch ( Exception e ) { + Logger.e( TAG, e, "error." ); + } + } + } + + private IPoint getCurPosition( long interval ) { + if ( interval > mDuration ) { + mExitFlag.set( true ); + IPoint point = new IPoint(); + mIndex = mPoints.size() - 1; + LatLng latLng = mPoints.get( mIndex ); + --mIndex; + mIndex = Math.max( mIndex, 0 ); + mRemainDistance = 0.0D; + MapProjection.lonlat2Geo( latLng.longitude, latLng.latitude, point ); + if ( mMoveListener != null ) { + mMoveListener.move( mRemainDistance ); + } + return point; + } else { + double step = interval * mTotalDistance / mDuration; + mRemainDistance = mTotalDistance - step; + int targetIndex = 0; + double val = 1.0D; + + for ( int i = 0; i < mEachDistance.size(); i++ ) { + double distance = mEachDistance.get( i ); + if ( step <= distance ) { + if ( distance > 0.0D ) { + val = step / distance; + } + targetIndex = i; + break; + } + step -= distance; + } + + if ( targetIndex != mIndex && mMoveListener != null ) { + mMoveListener.move( mRemainDistance ); + } + + mIndex = targetIndex; + LatLng latLng = mPoints.get( mIndex ); + LatLng latLng1 = mPoints.get( mIndex + 1 ); + IPoint point = new IPoint(); + MapProjection.lonlat2Geo( latLng.longitude, latLng.latitude, point ); + IPoint point1 = new IPoint(); + MapProjection.lonlat2Geo( latLng1.longitude, latLng1.latitude, point1 ); + + int xDelta = point1.x - point.x; + int yDelta = point1.y - point.y; + + if ( AMapUtils.calculateLineDistance( latLng, latLng1 ) > 1.0F ) { + float rotate = getRotate( point, point1 ); + setRotate( rotate ); + } + return new IPoint( ( ( int ) ( point.x + ( ( double ) xDelta ) * val ) ), ( ( int ) ( point.y + ( ( double ) yDelta ) * val ) ) ); + } + } + + private float getRotate( IPoint point, IPoint point1 ) { + if ( point != null && point1 != null ) { + double py1 = ( double ) point1.y; + double py = ( double ) point.y; + double px = ( double ) point.x; + return ( float ) ( Math.atan2( ( double ) point1.x - px, py - py1 ) / 3.141592653589793D * 180.0D ); + } else { + return 0.0F; + } + } + + public void setPoint( LatLng latLng ) { + if ( mBaseOverlay != null ) { + try { + mBaseOverlay.setPosition( latLng ); + } catch ( Exception e ) { + Logger.e( TAG, e, "error." ); + } + } + } + + public void setRotate( float rotate ) { + if ( mBaseOverlay == null ) { + return; + } + if ( mAMap == null ) { + return; + } + if ( mAMap.getCameraPosition() == null ) { + return; + } + mBaseOverlay.setRotateAngle( 360.0F - rotate + mAMap.getCameraPosition().bearing ); + } + + public LatLng getPosition() { + if ( mBaseOverlay != null ) { + return mBaseOverlay.getPosition(); + } + return null; + } + + private enum Status { + Status1, + Status2, + Status3, + Status4, + Status5 + } + + public interface MoveListener { + void move( double val ); + } + + private static class ThreadFactoryImpl implements ThreadFactory { + + private static int mCounter = 1; + + @Override + public Thread newThread( Runnable r ) { + return new Thread( r, "MoveSmoothThread - " + mCounter++ ); + } + } +} diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java index cc9250b150..631ac5de16 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java @@ -27,6 +27,8 @@ import com.mogo.service.fragmentmanager.IMogoFragmentManager; */ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresenter > implements AppsListView, FragmentStackTransactionListener { + private static final String TAG = "AppsListActivity"; + private BottomSheetBehavior mBottomSheetBehavior; private IMogoFragmentManager mMogoFragmentManager; @@ -38,12 +40,13 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent @Override protected void onCreate( @Nullable Bundle savedInstanceState ) { - overridePendingTransition( R.anim.module_apps_anim_enter, 0); - getWindow().addFlags( WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + overridePendingTransition( R.anim.module_apps_anim_enter, 0 ); + getWindow().addFlags( WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS ); if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ) { getWindow().setStatusBarColor( Color.BLACK ); } super.onCreate( savedInstanceState ); + AppServiceHandler.getApis().getStatusManagerApi().setAppListUIShow( TAG, true ); } @Override @@ -53,8 +56,9 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent @Override protected void initViews() { + getSupportFragmentManager().beginTransaction() - .add( R.id.module_apps_id_container, new AppsFragment() ) + .replace( R.id.module_apps_id_container, new AppsFragment() ) .commitAllowingStateLoss(); mBottomSheetBehavior = BottomSheetBehavior.from( findViewById( R.id.module_apps_id_container ) ); @@ -74,14 +78,14 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent } ); mBottomSheetBehavior.setState( BottomSheetBehavior.STATE_EXPANDED ); - mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( this ); + mMogoFragmentManager = AppServiceHandler.getApis().getFragmentManagerApi(); mMogoFragmentManager.addMainFragmentStackTransactionListener( this ); } @NonNull @Override protected AppsListPresenter createPresenter() { - return new AppsListPresenter(this); + return new AppsListPresenter( this ); } @Override @@ -100,12 +104,13 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent @Override public void closeAppsPanel() { finish(); - overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit); + overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit ); } @Override protected void onDestroy() { super.onDestroy(); + AppServiceHandler.getApis().getStatusManagerApi().setAppListUIShow( TAG, false ); mMogoFragmentManager.removeMainFragmentStackTransactionListener( this ); mMogoFragmentManager = null; mBottomSheetBehavior = null; 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 d7705da71e..942568fc7f 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 @@ -72,7 +72,6 @@ public class AppsPresenter extends Presenter< AppsView > { mAnalytics = mApis.getAnalyticsApi(); mMogoStatusManager = mApis.getStatusManagerApi(); - mMogoStatusManager.setAppListUIShow( TAG, true ); } private void renderAppsList() { @@ -202,7 +201,6 @@ public class AppsPresenter extends Presenter< AppsView > { @Override public void onDestroy( @NonNull LifecycleOwner owner ) { super.onDestroy( owner ); - mMogoStatusManager.setAppListUIShow( TAG, false ); AppsListChangedLiveData.getInstance().release(); mView = null; mLauncher.destroy(); diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java index 7eadd38ab6..df83f351c0 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppEnum.java @@ -14,6 +14,8 @@ import com.mogo.module.apps.R; * 基础类:均衡器、方控学习、蓝牙、FM、车载设置、AUX */ public enum AppEnum { + // 酷我音乐 + KwMusic("酷我音乐", "cn.kuwo.kwmusiccar", R.drawable.ic_kuwo), // 爱趣听 WeCarFlow("爱趣听","com.tencent.wecarflow", R.drawable.module_apps_ic_we_car_flow ), //"QQ音乐", diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java index 700564dce6..f1e00886b6 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java @@ -15,7 +15,8 @@ public class NavigatorApps { private static AppInfo app = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi, 1 ); private static AppInfo app_ = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable, 1 ); - private static AppInfo app2 = new AppInfo( "音乐", "com.tencent.wecarflow", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 ); +// private static AppInfo app2 = new AppInfo( "音乐", "com.tencent.wecarflow", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 ); + private static AppInfo app2 = new AppInfo( "音乐", "cn.kuwo.kwmusiccar", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 ); private static AppInfo app3 = new AppInfo( "车聊聊", "com.zhidao.imdemo", "", 0, null, R.drawable.module_apps_ic_navigator_im, 6 ); private static AppInfo app4 = new AppInfo( "全部应用", "com.mogo.launcher.applist", "", 0, null, R.drawable.module_apps_ic_navigator_applist, 4 ); diff --git a/modules/mogo-module-apps/src/main/res/drawable/ic_kuwo.webp b/modules/mogo-module-apps/src/main/res/drawable/ic_kuwo.webp new file mode 100644 index 0000000000..82330db5fa Binary files /dev/null and b/modules/mogo-module-apps/src/main/res/drawable/ic_kuwo.webp differ diff --git a/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml index e4753b0f9d..a9ba5a2fef 100644 --- a/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml @@ -24,6 +24,6 @@ 140px 140px 30px - 110px - 110px + 100px + 100px \ No newline at end of file diff --git a/modules/mogo-module-apps/src/main/res/values/dimens.xml b/modules/mogo-module-apps/src/main/res/values/dimens.xml index c9efac23e8..679816b821 100644 --- a/modules/mogo-module-apps/src/main/res/values/dimens.xml +++ b/modules/mogo-module-apps/src/main/res/values/dimens.xml @@ -24,6 +24,6 @@ 78px 78px 17px - 70px - 70px + 60px + 60px \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java index be7c7bbe23..3896ae58c4 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java @@ -1,11 +1,13 @@ package com.mogo.module.common.entity; +import com.mogo.commons.data.BaseData; + import java.io.Serializable; import java.util.List; @SuppressWarnings("unused") -public class MarkerCardResult implements Serializable { +public class MarkerCardResult extends BaseData { private List dataType; // 要查询的类型 private List carChat; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java index efc6a88649..f8ab53ca9d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWayItem.java @@ -6,11 +6,15 @@ import android.text.TextUtils; import java.io.Serializable; +/** + * 道路情报,V2X预警,地图道路事件POI,违章停车POI等 + */ @SuppressWarnings("unused") public class MarkerExploreWayItem implements Serializable { private String thumbnail; private String url; + private String content; public String getThumbnail() { if (TextUtils.isEmpty(thumbnail)) { @@ -34,11 +38,20 @@ public class MarkerExploreWayItem implements Serializable { this.url = url; } + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + @Override public String toString() { return "MarkerExploreWayItem{" + "thumbnail='" + thumbnail + '\'' + ", url='" + url + '\'' + + ", content='" + content + '\'' + '}'; } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java index e57e3270fe..a0afae8e89 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java @@ -9,33 +9,35 @@ package com.mogo.module.common.entity; */ public interface MarkerPoiTypeEnum { //加油站 - public String GAS_STATION = "10001"; + String GAS_STATION = "10001"; //交通检查 - public String TRAFFIC_CHECK = "10002"; + String TRAFFIC_CHECK = "10002"; //封路 - public String ROAD_CLOSED = "10003"; + String ROAD_CLOSED = "10003"; //商场打折 - public String SHOP_DISCOUNT = "10004"; + String SHOP_DISCOUNT = "10004"; //4S店 - public String FOURS_4S = "10005"; + String FOURS_4S = "10005"; //施工 - public String FOURS_ROAD_WORK = "10006"; + String FOURS_ROAD_WORK = "10006"; //拥堵 - public String FOURS_BLOCK_UP = "10007"; + String FOURS_BLOCK_UP = "10007"; //积水 - public String FOURS_PONDING = "10008"; + String FOURS_PONDING = "10008"; //超市打折 - public String FOURS_SHOP_FREE = "10009"; + String FOURS_SHOP_FREE = "10009"; //浓雾 - public String FOURS_FOG = "10010"; + String FOURS_FOG = "10010"; //结冰 - public String FOURS_ICE = "10011"; + String FOURS_ICE = "10011"; //停车场 - public String FOURS_PARKING = "10012"; + String FOURS_PARKING = "10012"; //事故 - public String FOURS_ACCIDENT = "10013"; + String FOURS_ACCIDENT = "10013"; //身边 - public String FOURS_NEALY = "10014"; + String FOURS_NEALY = "10014"; //实时路况 - public String FOURS_LIVING = "10015"; + String FOURS_LIVING = "10015"; + //违章停车 + String ILLEGAL_PARK_LIVING = "10016"; } \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java index daec2f73d1..42426edf27 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java @@ -56,9 +56,9 @@ public class MapCenterPointStrategy { { // 导航场景 vs 道路事件展示场景,定位视图右下角偏下 Map< Integer, MapCenterPoint > naviWithRoadEvent = new HashMap<>(); - naviWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.68333333333D ) ); - naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.68333333333D ) ); - naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.68333333333D ) ); + naviWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.73936170212766D ) ); + naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.73936170212766D ) ); + naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.73936170212766D ) ); naviWithRoadEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.683333333333D ) ); sStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent ); } @@ -76,9 +76,9 @@ public class MapCenterPointStrategy { { // 巡航场景 vs 道路事件展示场景 Map< Integer, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>(); - aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.585 ) ); - aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.585 ) ); - aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.585 ) ); + aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.68617 ) ); + aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.68617 ) ); + aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.68617 ) ); aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.599074074D ) ); sStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent ); } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java index 3cc8457df8..baa7151049 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewAnimHelper.java @@ -484,9 +484,9 @@ public class TopViewAnimHelper { arriveTimeGroup.setVisibility(View.GONE); int scene = 0; if (isTopViewOut) { - scene = Scene.AIMLESS_WITH_ROAD_EVENT; - } else { scene = Scene.AIMLESS; + } else { + scene = Scene.AIMLESS_WITH_ROAD_EVENT; } Logger.d(TAG, "hide navi setMapCenterPointByScene: " + scene); MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene); diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java index 48a0812257..937548ba6e 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java @@ -2,7 +2,6 @@ package com.mogo.module.main; import android.content.Intent; import android.location.Location; -import android.text.TextUtils; import android.view.MotionEvent; import com.mogo.map.MogoLatLng; @@ -21,20 +20,14 @@ import com.mogo.map.navi.MogoCongestionInfo; import com.mogo.map.navi.MogoNaviInfo; import com.mogo.map.navi.MogoTraffic; import com.mogo.map.uicontroller.EnumMapUI; -import com.mogo.module.common.entity.MarkerNoveltyInfo; -import com.mogo.module.common.entity.MarkerShareMusic; -import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.main.registercenter.MogoRegisterCenterHandler; -import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.receiver.MogoReceiver; import com.mogo.service.intent.IMogoIntentListener; import com.mogo.service.intent.IMogoIntentManager; import com.mogo.service.module.IMogoModuleLifecycle; import com.mogo.utils.logger.Logger; -import java.util.HashMap; import java.util.Iterator; -import java.util.Map; /** * @author congtaowang @@ -83,7 +76,6 @@ public class EventDispatchCenter implements IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() ); if ( listener != null ) { try { - trackMarkerClickEvent( marker ); return listener.onMarkerClicked( marker ); } catch ( Exception e ) { Logger.e( TAG, e, "error." ); @@ -92,28 +84,6 @@ public class EventDispatchCenter implements return false; } - /** - * marker 点击埋点 - * - * @param marker - */ - private void trackMarkerClickEvent( IMogoMarker marker ) { - if ( marker == null || TextUtils.isEmpty( marker.getOwner() ) ) { - return; - } - // 数据统计代码 - final Map< String, Object > properties = new HashMap<>(); - properties.put( "poitype", marker.getOwner() ); - MarkerShowEntity showEntity = ( MarkerShowEntity ) marker.getObject(); - Object bindObj = showEntity.getBindObj(); - if ( bindObj instanceof MarkerNoveltyInfo ) { - properties.put( "contenttype", ( ( MarkerNoveltyInfo ) bindObj ).getPoiType() ); - } else if ( bindObj instanceof MarkerShareMusic ) { - properties.put( "contenttype", ( ( MarkerShareMusic ) bindObj ).getShareType() + "" ); - } - MarkerServiceHandler.getMogoAnalytics().track( "Launcher_Icon_Click", properties ); - } - @Override public void onUpdateTraffic2( MogoTraffic traffic ) { Iterator< IMogoAimlessModeListener > iterator = MogoRegisterCenterHandler.getInstance().getAimlessModeListeners(); diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java index 73e215fa53..5553aeab37 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java @@ -147,6 +147,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme // 启动一些基本的服务:定位等 startBaseService(); + + Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); } ); MogoModulesManager.getInstance().loadMapModule( R.id.module_main_id_map_fragment_container ); @@ -159,8 +161,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme hideLayout(); } } ); - - Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); } private void startBaseService() { diff --git a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml index 02d9555475..1f9c30d179 100644 --- a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml +++ b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml @@ -9,7 +9,7 @@ + android:layout_height="match_parent"/> + + \ No newline at end of file diff --git a/modules/mogo-module-media/build.gradle b/modules/mogo-module-media/build.gradle index fb9eab7108..d734d287e0 100644 --- a/modules/mogo-module-media/build.gradle +++ b/modules/mogo-module-media/build.gradle @@ -46,6 +46,7 @@ dependencies { // 爱趣听sdk上传到了公司的maven,用来规避RELEASE时ClassDefNotFound异常,后续若爱趣听有新的sdk也需要上传maven implementation "com.mogo.tencent.wecarflow:mogo-wecarflow:+@aar" + implementation "com.mogo.kwmusic:mogo-kwmusic:+" if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.mogomap diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaCardViewProvider.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaCardViewProvider.java index c2e341752b..059a886869 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaCardViewProvider.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaCardViewProvider.java @@ -11,6 +11,7 @@ import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.navi.IMogoNaviListener; +import com.mogo.module.media.window.MediaWindow2; import com.mogo.service.module.IMogoModuleLifecycle; import com.mogo.service.module.IMogoModuleProvider; import com.mogo.service.module.ModuleType; diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/BaseMediaPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/BaseMediaPresenter.java index 103528a49a..9816d684a2 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/BaseMediaPresenter.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/BaseMediaPresenter.java @@ -50,4 +50,9 @@ public abstract class BaseMediaPresenter extends Presenter { * 下一首 */ public abstract void next(); + + /** + * 打开对应的应用 + */ + public abstract void openApp(); } 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 new file mode 100644 index 0000000000..75e49e751a --- /dev/null +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java @@ -0,0 +1,196 @@ +package com.mogo.module.media.presenter; + +import android.content.Context; +import android.os.Handler; +import android.os.Message; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.module.media.MediaConstants; +import com.mogo.module.media.constants.MusicConstant; +import com.mogo.module.media.model.MediaInfoData; +import com.mogo.module.media.view.IMusicView; +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; +import cn.kuwo.autosdk.api.PlayState; +import cn.kuwo.autosdk.api.PlayerStatus; +import cn.kuwo.base.bean.Music; + +/** + * 适配酷我的presenter + * + * @author tongchenfei + */ +public class KwPresenter extends BaseMediaPresenter { + private static final String TAG = "KwPresenter"; + private KWAPI kwapi; + private boolean isBind = false; + + private MediaInfoData currentMedia = new MediaInfoData(); + + public KwPresenter(IMusicView view) { + super(view); + } + + @Override + public void init(Context context) { + kwapi = KWAPI.createKWAPI(context, "auto"); + + kwapi.registerConnectedListener(b -> { + Logger.d(TAG, "onConnected: " + b); + isBind = b; + if (!isBind) { + mView.onMusicStopped(); + }else{ + PlayerStatus currentState = kwapi.getPlayerStatus(); + Logger.d(TAG, "check current status: " + currentState); + if(currentState == PlayerStatus.BUFFERING||currentState == PlayerStatus.PLAYING){ + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + kwapi.getSongPicUrl(kwapi.getNowPlayingMusic(), onGetSongImgUrlListener); + startTrackTrackProgress(); + mView.onMusicPlaying(); + } + } + }); + + kwapi.registerExitListener(() -> { + Logger.d(TAG, "onExit==="); + mView.onAppExit(); + }); + + kwapi.registerPlayerStatusListener((playerStatus, music) -> { + Logger.d(TAG, "onPlayerStatusListener: " + playerStatus); + switch (playerStatus) { + case BUFFERING: + kwapi.getSongPicUrl(music, onGetSongImgUrlListener); + break; + case PLAYING: + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING); + kwapi.getSongPicUrl(music, onGetSongImgUrlListener); + startTrackTrackProgress(); + mView.onMusicPlaying(); + break; + case INIT: + case PAUSE: + case STOP: + currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP); + stopTrackTrackProgress(); + mView.onMusicPause(); + break; + default: + break; + } + }); + + IMogoServiceApis serviceApis = + (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context); + + serviceApis.getStatusManagerApi().registerStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() { + @Override + public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { + if (isTrue) { + Logger.d(TAG, "onResume, isBind: " + isBind); + // 需要在resume时候判断绑定关系是否正常 + if (!isBind) { + // 未绑定,需要重新绑定,同时第一次绑定初始化也是在此处 + kwapi.bindAutoSdkService(); + } + } + } + }); + + kwapi.bindAutoSdkService(); + } + + @Override + public void play(MediaInfoData mediaInfoData) { +// if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_PLAY); +// } else { +// kwapi.randomPlayMusic(); +// } + } + + @Override + public void pause(MediaInfoData mediaInfoData) { + if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_PAUSE); + } + } + + @Override + public void stop(MediaInfoData mediaInfoData) { + + } + + @Override + public void pre() { + if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_PRE); + } + } + + @Override + public void next() { + if (kwapi.isKuwoRunning()) { + kwapi.setPlayState(PlayState.STATE_NEXT); + } + } + + private Handler.Callback callback = new Handler.Callback() { + @Override + public boolean handleMessage(Message msg) { + if (isTrackingProgress) { + mView.onMusicProgress(kwapi.getCurrentPos(), kwapi.getCurrentMusicDuration()); + msg.getTarget().sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, + MSG_TRACK_PROGRESS_DELAY); + } + return false; + } + }; + private Handler handler = new Handler(callback); + private static final int MSG_TRACK_PROGRESS = 1001; + private static final long MSG_TRACK_PROGRESS_DELAY = 1000; + + private boolean isTrackingProgress = false; + + private void startTrackTrackProgress() { + if(!isTrackingProgress) { + isTrackingProgress = true; + handler.sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, MSG_TRACK_PROGRESS_DELAY); + } + } + + private void stopTrackTrackProgress() { + if(isTrackingProgress) { + isTrackingProgress = false; + handler.removeMessages(MSG_TRACK_PROGRESS); + } + } + + 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)); + } + + @Override + public void onGetSongImgUrlFailed(Music music, int i) { + Logger.e(TAG, "onGetSongImgUrlFailed: " + i); + } + }; + + @Override + public void openApp(){ + kwapi.startAPP(true); + } +} diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java index 66ab3efecc..4aa6dd259c 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java @@ -195,4 +195,9 @@ public class WeCarFlowPresenter extends BaseMediaPresenter { public void next() { FlowPlayControl.getInstance().doNext(); } + + @Override + public void openApp() { + FlowPlayControl.getInstance().startPlayActivity(context); + } } diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java index d0379ff238..bf6eee1611 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/view/IMusicView.java @@ -18,4 +18,6 @@ public interface IMusicView extends IView { void onMusicStopped(); void onMusicProgress(long current,long total); + + void onAppExit(); } 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 280aee83e1..77cee5ce4e 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 @@ -79,7 +79,9 @@ public class AnimCircleImageView extends ImageView { } public void startAnim() { - if (isRotating == true) return; + if (isRotating){ + return; + } isRotateEnable = true; isRotating = true; currentDegree = savedDegree; diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java similarity index 98% rename from modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow.java rename to modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java index dfa6be7426..45ea10d832 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java @@ -1,4 +1,4 @@ -package com.mogo.module.media; +package com.mogo.module.media.window; import android.content.BroadcastReceiver; import android.content.Context; @@ -8,12 +8,14 @@ import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.TextView; import com.mogo.map.marker.IMogoMarker; import com.mogo.module.common.entity.MarkerShareMusic; import com.mogo.module.common.entity.MarkerShowEntity; +import com.mogo.module.media.MediaConstants; +import com.mogo.module.media.R; +import com.mogo.module.media.ServiceMediaHandler; import com.mogo.module.media.constants.LeTingFieldConstants; import com.mogo.module.media.constants.QQMusicFieldConstants; import com.mogo.module.media.listener.NoDoubleClickListener; @@ -30,7 +32,6 @@ import com.mogo.module.media.view.MediaView; import com.mogo.module.media.widget.AnimCircleImageView; import com.mogo.module.media.widget.NoScrollSeekBar; import com.mogo.module.media.widget.ScrollingTextView; -import com.mogo.module.service.marker.MapMarkerManager; import com.mogo.utils.ActivityLifecycleManager; import com.mogo.utils.ThreadPoolService; import com.mogo.utils.UiThreadHandler; @@ -65,15 +66,9 @@ public class MediaWindow implements MediaView{ private boolean mTwoChange = false; private boolean isFirstPlay = false; - private Runnable mRunnable = new Runnable() { - @Override - public void run() { - MusicControlBroadCast.sendGetMusicPlayStateBroadcast(); - } - }; + private Runnable mRunnable = MusicControlBroadCast::sendGetMusicPlayStateBroadcast; public void initMedia(Context context){ - mContext = context; mPresenter = new MediaPresenter(this); registerMediaReceiver(); diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java similarity index 91% rename from modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java rename to modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java index 21898f15df..818bf5e792 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java @@ -1,7 +1,6 @@ -package com.mogo.module.media; +package com.mogo.module.media.window; import android.content.Context; -import android.content.res.Resources; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; @@ -11,16 +10,17 @@ import android.widget.TextView; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.voice.AIAssist; import com.mogo.commons.voice.IMogoVoiceCmdCallBack; +import com.mogo.module.media.R; +import com.mogo.module.media.ServiceMediaHandler; import com.mogo.module.media.constants.MusicConstant; import com.mogo.module.media.listener.NoDoubleClickListener; import com.mogo.module.media.model.MediaInfoData; -import com.mogo.module.media.presenter.WeCarFlowPresenter; +import com.mogo.module.media.presenter.KwPresenter; import com.mogo.module.media.utils.Utils; import com.mogo.module.media.view.IMusicView; import com.mogo.module.media.widget.AnimCircleImageView; import com.mogo.module.media.widget.NoScrollSeekBar; import com.mogo.module.media.widget.ScrollingTextView; -import com.mogo.utils.LaunchUtils; import com.mogo.utils.WindowUtils; import com.mogo.utils.glide.GlideApp; import com.mogo.utils.logger.Logger; @@ -35,7 +35,7 @@ public class MediaWindow2 implements IMusicView { public static final String TAG = MediaWindow2.class.getName(); private Context mContext; - private WeCarFlowPresenter mPresenter; + private KwPresenter mPresenter; private MediaInfoData mMediaInfoData = new MediaInfoData(); @@ -54,7 +54,7 @@ public class MediaWindow2 implements IMusicView { public void initMedia(Context context) { mContext = context; - mPresenter = new WeCarFlowPresenter(this); + mPresenter = new KwPresenter(this); mPresenter.init(context); if(DebugConfig.isLauncher()) { @@ -108,7 +108,7 @@ public class MediaWindow2 implements IMusicView { mWindowView.setOnClickListener(new NoDoubleClickListener() { @Override public void onClicks(View view) { - openAqtApp(); + mPresenter.openApp(); } }); @@ -123,7 +123,7 @@ public class MediaWindow2 implements IMusicView { mPresenter.pause(mMediaInfoData); } } else { - openAqtApp(); + mPresenter.openApp(); } } }); @@ -169,6 +169,16 @@ public class MediaWindow2 implements IMusicView { if (mWindowCurrTime != null) { mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime())); } + + if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) { + // kw音乐做的容错 + if (mWindowPlayPause != null) { + mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play); + } + if (mCircleImg != null) { + mCircleImg.startAnim(); + } + } } if (mCircleImg != null) { @@ -221,6 +231,8 @@ public class MediaWindow2 implements IMusicView { if (mCircleImg != null) { mCircleImg.stopAnim(); } + + } @Override @@ -253,11 +265,8 @@ public class MediaWindow2 implements IMusicView { } } - private void openAqtApp() { - try { - LaunchUtils.launchByPkg(mContext, "com.tencent.wecarflow"); - } catch (Exception e) { - e.printStackTrace(); - } + @Override + public void onAppExit() { + mWindowView.setVisibility(View.GONE); } } 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 8a7f1e1c06..9837155cae 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 @@ -647,6 +647,10 @@ public class MogoServices implements IMogoMapListener, return; } + if ( !mStatusManager.isMainPageOnResume() ) { + return; + } + if ( mStatusManager.isSearchUIShow() ) { return; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/Utils.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/Utils.java index ef4534ac61..9978faf668 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/Utils.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/Utils.java @@ -66,7 +66,7 @@ public class Utils { } public static void main( String[] args ) { - double calculateLineDistance = calculateLineDistance( new MogoLatLng( 39.955533, 116.423262 ), new MogoLatLng( 39.955385, 116.414604 ) ); + double calculateLineDistance = calculateLineDistance( new MogoLatLng( 39.968598, 116.411121 ), new MogoLatLng( 39.968598, 116.411121 ) ); System.out.println( "距离点 calculateLineDistance:" + calculateLineDistance ); } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java index d564a1757d..d5195bf069 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java @@ -135,6 +135,9 @@ public class MapMarkerInfoView extends MapMarkerBaseView { case MarkerPoiTypeEnum.FOURS_LIVING: ivIcon.setImageResource( R.drawable.icon_map_marker_living_light ); break; + case MarkerPoiTypeEnum.ILLEGAL_PARK_LIVING: + ivIcon.setImageResource( R.drawable.module_service_ic_rc_illegal_park_light ); + break; default: ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2_light ); break; 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 e292dd6a94..064551593a 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 @@ -120,7 +120,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener, Map< String, Object > properties = new HashMap<>(); if ( marker.getObject() instanceof MarkerShowEntity ) { - properties.put( "sn", getCarSnFromMarker( marker ) ); + final String sn = getCarSnFromMarker( marker ); + if ( TextUtils.isEmpty( sn ) ) { + return false; + } + properties.put( "sn", sn ); if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerExploreWay ) { MarkerExploreWay exploreWay = ( MarkerExploreWay ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj(); properties.put( "dbid", exploreWay.getInfoId() ); @@ -482,7 +486,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, } else if ( entity instanceof MarkerNoveltyInfo ) { return ( ( MarkerNoveltyInfo ) entity ).getSn(); } else if ( entity instanceof MarkerExploreWay ) { - return ( ( MarkerExploreWay ) entity ).getInfoId(); + return ( ( MarkerExploreWay ) entity ).getUserInfo().getSn(); } } catch ( Exception e ) { @@ -844,6 +848,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener, } List< MogoLatLng > points = new ArrayList<>(); + + double lastLat = 0.0d; + double lastLon = 0.0d; + for ( int j = 0; j < poiList.size(); j++ ) { MarkerCarPois poi = poiList.get( j ); if ( poi == null || poi.getCoordinates() == null && poi.getCoordinates().size() != 2 ) { @@ -852,6 +860,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener, try { double lat = Double.valueOf( poi.getCoordinates().get( 1 ) + "" ); double lng = Double.valueOf( poi.getCoordinates().get( 0 ) + "" ); + + float distance = Utils.calculateLineDistance( lastLon, lastLat, lng, lat ); + lastLon = lng; + lastLat = lat; + if ( distance < 0.2f ) {// 距离过短,认为静止不动 + continue; + } + points.add( new MogoLatLng( lat, lng ) ); } catch ( Exception e ) { } @@ -859,6 +875,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener, if ( points.size() >= 1 ) { points.add( new MogoLatLng( markerLocation.getLat(), markerLocation.getLon() ) ); iMogoMarker.startSmooth( points, SMOOTH_DURATION ); + } else { + Logger.d( TAG, "静止小车,但是有相同的连续坐标" ); } } @@ -892,7 +910,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, return MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() || MarkerServiceHandler.getMogoStatusManager().isV2XShow() || !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched() - || !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched(); + || !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume(); } private void runOnTargetThread( Runnable runnable ) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java index 1c83655149..6d2d7affe2 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java @@ -24,8 +24,6 @@ import com.mogo.module.service.ServiceConst; public class MapMarkerView extends MapMarkerBaseView { private String TAG = "MapMarkerView"; - private ImageView ivBg; - public MapMarkerView( Context context ) { super( context ); } @@ -48,7 +46,6 @@ public class MapMarkerView extends MapMarkerBaseView { LayoutInflater.from( context ).inflate( R.layout.view_map_marker, this ); ivIcon = findViewById( R.id.ivIcon ); ivCar = findViewById( R.id.ivCar ); - ivBg = findViewById( R.id.ivBg ); } public void updateView( MarkerShowEntity markerShowEntity ) { @@ -101,6 +98,9 @@ public class MapMarkerView extends MapMarkerBaseView { case MarkerPoiTypeEnum.FOURS_LIVING: ivIcon.setImageResource( R.drawable.icon_map_marker_living ); break; + case MarkerPoiTypeEnum.ILLEGAL_PARK_LIVING: + ivIcon.setImageResource( R.drawable.module_service_ic_rc_illegal_park ); + break; case MarkerPoiTypeEnum.FOURS_PARKING: default: ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2 ); diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_call.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_call.png index 89680bd182..9a9321b3a6 100644 Binary files a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_call.png and b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_call.png differ diff --git a/modules/mogo-module-service/src/main/res/drawable/module_service_ic_call.png b/modules/mogo-module-service/src/main/res/drawable/module_service_ic_call.png index 3f90fd4af5..a66ed29d09 100644 Binary files a/modules/mogo-module-service/src/main/res/drawable/module_service_ic_call.png and b/modules/mogo-module-service/src/main/res/drawable/module_service_ic_call.png differ diff --git a/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park.png b/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park.png new file mode 100644 index 0000000000..6e1443d3b4 Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park.png differ diff --git a/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park_light.png b/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park_light.png new file mode 100644 index 0000000000..116f5ffb1a Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable/module_service_ic_rc_illegal_park_light.png differ diff --git a/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml b/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml index 5028bcbe89..0967298a46 100644 --- a/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml +++ b/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml @@ -7,14 +7,12 @@ android:background="@android:color/transparent" android:gravity="center" android:orientation="vertical" - android:paddingStart="@dimen/dp_5" - android:paddingEnd="@dimen/dp_5" tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"> - - + android:layout_marginBottom="@dimen/module_service_marker_bubble_icon_marginBottom" + tools:src="@drawable/icon_map_marker_road_block_up" /> diff --git a/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml b/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml index 1917bf59ae..028892962e 100644 --- a/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml +++ b/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml @@ -7,8 +7,6 @@ android:gravity="center" android:orientation="vertical" android:padding="1px" - android:paddingStart="@dimen/dp_5" - android:paddingEnd="@dimen/dp_5" tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"> 117px 50px 50px - 24px + 8px 1000px 390px 200px 200px + 10px + 10px + 100px + 80px + 80px + 24px + 20px + 120px \ No newline at end of file diff --git a/modules/mogo-module-service/src/main/res/values/dimens.xml b/modules/mogo-module-service/src/main/res/values/dimens.xml index 451d9a661b..03b1e6650a 100644 --- a/modules/mogo-module-service/src/main/res/values/dimens.xml +++ b/modules/mogo-module-service/src/main/res/values/dimens.xml @@ -1,15 +1,23 @@ 16dp - 8dp + 4dp 56px 65px 27px 27px - 14px + 4px 550px 208px 100px 100px + 100px + 10px + 54px + 44px + 44px + 14px + 12px + 64px \ No newline at end of file diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index 8e1839fde8..f877ac186b 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -74,16 +74,17 @@ public class MogoADASController implements IMogoADASController { init( AbsMogoApplication.getApp() ); } - if ( mStatusManager.isSearchUIShow() ) { - return; - } - if ( !mStatusManager.isMainPageOnResume() ) { - return; - } - int delay = CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ? 0 : 100; UiThreadHandler.postDelayed( () -> { + + if ( mStatusManager.isSearchUIShow() ) { + return; + } + if ( !mStatusManager.isMainPageOnResume() ) { + return; + } + try { AutopilotServiceManage.getInstance().showAdas(); } catch ( Exception e ) {