diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index dced2281e8..d50f474f69 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -63,11 +63,11 @@ public class MogoApplication extends AbsMogoApplication { } MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) ); -// MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) ); + MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) ); MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) ); MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) ); -// MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) ); + MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) ); // 暂时去掉推送 // MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG)); diff --git a/gradle.properties b/gradle.properties index 06482c831c..8c5d7dbf54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,44 +27,44 @@ PASSWORD=xintai2018 RELEASE=false # 模块版本 ## 工程内模块 -MOGO_COMMONS_VERSION=1.2.1.3 -MOGO_UTILS_VERSION=1.2.1.3 -MAP_AMAP_VERSION=1.2.1.3 -MAP_CUSTOM_VERSION=1.2.1.3 -MAP_AUTONAVI_VERSION=1.2.1.3 -MOGO_MAP_VERSION=1.2.1.3 -MOGO_MAP_API_VERSION=1.2.1.3 -MOGO_SERVICE_VERSION=1.2.1.3 -MOGO_SERVICE_API_VERSION=1.2.1.3 -MOGO_CONNECTION_VERSION=1.2.1.3 -MOGO_MODULE_APPS_VERSION=1.2.1.3 -MOGO_MODULE_NAVI_VERSION=1.2.1.3 -MOGO_MODULE_SHARE_VERSION=1.2.1.3 -MOGO_MODULE_COMMON_VERSION=1.2.1.3 -MOGO_MODULE_MAIN_VERSION=1.2.1.3 -MOGO_MODULE_MAP_VERSION=1.2.1.3 -MOGO_MODULE_SERVICE_VERSION=1.2.1.3 -MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.3 -MOGO_MODULE_SEARCH_VERSION=1.2.1.3 -MOGO_MODULE_BACK_VERSION=1.2.1.3 -MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.3 -MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.3 -MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.3 -MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.3 -MOGO_MODULE_GUIDE_VERSION=1.2.1.3 -MOGO_MODULE_MEDIA_VERSION=1.2.1.3 +MOGO_COMMONS_VERSION=1.2.1.5 +MOGO_UTILS_VERSION=1.2.1.5 +MAP_AMAP_VERSION=1.2.1.5 +MAP_CUSTOM_VERSION=1.2.1.5 +MAP_AUTONAVI_VERSION=1.2.1.5 +MOGO_MAP_VERSION=1.2.1.5 +MOGO_MAP_API_VERSION=1.2.1.5 +MOGO_SERVICE_VERSION=1.2.1.5 +MOGO_SERVICE_API_VERSION=1.2.1.5 +MOGO_CONNECTION_VERSION=1.2.1.5 +MOGO_MODULE_APPS_VERSION=1.2.1.5 +MOGO_MODULE_NAVI_VERSION=1.2.1.5 +MOGO_MODULE_SHARE_VERSION=1.2.1.5 +MOGO_MODULE_COMMON_VERSION=1.2.1.5 +MOGO_MODULE_MAIN_VERSION=1.2.1.5 +MOGO_MODULE_MAP_VERSION=1.2.1.5 +MOGO_MODULE_SERVICE_VERSION=1.2.1.5 +MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.5 +MOGO_MODULE_SEARCH_VERSION=1.2.1.5 +MOGO_MODULE_BACK_VERSION=1.2.1.5 +MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.5 +MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.5 +MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.5 +MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.5 +MOGO_MODULE_GUIDE_VERSION=1.2.1.5 +MOGO_MODULE_MEDIA_VERSION=1.2.1.5 -MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.0.0.5 -MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.0.0.5 +MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.2.1.5 +MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.5 ## 工程外部模块 # 探路 MOGO_MODULE_TANLU_VERSION=1.1.0.1-SNAPSHOT # 车聊聊 -CARCHATTING_VERSION=1.0.6-SNAPSHOT +CARCHATTING_VERSION=1.0.6 # 车聊聊接口 -CARCHATTINGPROVIDER_VERSION=1.0.6-SNAPSHOT +CARCHATTINGPROVIDER_VERSION=1.0.6 # 视频引导 MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT # 视频引导接口 @@ -72,7 +72,7 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT # 在线车辆F MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2 # v2x -MOGO_MODULE_V2X_VERSION=1.1.132-SNAPSHOT +MOGO_MODULE_V2X_VERSION=1.1.24 # 推送 MOGO_MODULE_PUSH_VERSION=1.0.1 # 广告资源位 diff --git a/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java b/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java index 1f7b3c06d4..4d6edfbc86 100644 --- a/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java +++ b/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java @@ -6,7 +6,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.text.TextUtils; -import com.mogo.map.impl.amap.navi.NaviClient; import com.mogo.map.impl.amap.utils.IconTypeUtils; import com.mogo.map.navi.MogoNaviInfo; import com.mogo.map.navi.MogoNaviListenerHandler; @@ -81,7 +80,8 @@ public class AutoNaviReceiver extends BroadcastReceiver { int cameraType = intent.getIntExtra( GuideInfoExtraKey.CAMERA_TYPE, 0 ); if ( type == 0 || type == 1 ) { - if ( !MapState.getInstance().isNaving() ) { + if ( !MapState.getInstance().isNaving() + && MogoNaviListenerHandler.getInstance().hasDelegateListener() ) { MapState.getInstance().setNaving( true ); MogoNaviListenerHandler.getInstance().onStartNavi(); } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviListenerHandler.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviListenerHandler.java index 042db244bc..a4f7ec758c 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviListenerHandler.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviListenerHandler.java @@ -33,6 +33,13 @@ public class MogoNaviListenerHandler implements IMogoNaviListener2, IMogoNaviLis */ private IMogoNaviListener mDelegateListener = null; + /** + * @return + */ + public boolean hasDelegateListener(){ + return mDelegateListener != null; + } + /** * 上层模块代理对象 */ 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 631ac5de16..34a738ac9e 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 @@ -11,11 +11,9 @@ import android.view.WindowManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.alibaba.android.arouter.launcher.ARouter; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.mogo.commons.mvp.MvpActivity; import com.mogo.module.apps.model.AppsModel; -import com.mogo.service.MogoServicePaths; import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; import com.mogo.service.fragmentmanager.IMogoFragmentManager; @@ -33,7 +31,6 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent private IMogoFragmentManager mMogoFragmentManager; public static void start( Activity context ) { - AppServiceHandler.getApis().getAdasControllerApi().closeADAS(); Intent starter = new Intent( context, AppsListActivity.class ); context.startActivity( starter ); } @@ -98,6 +95,12 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent @Override protected void onRestoreInstanceState( Bundle savedInstanceState ) { super.onRestoreInstanceState( savedInstanceState ); + AppServiceHandler.getApis().getAdasControllerApi().closeADAS(); + } + + @Override + protected void onSaveInstanceState( Bundle outState ) { + super.onSaveInstanceState( outState ); AppsModel.getInstance( this ).release(); } diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppsModel.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppsModel.java index a7be4b8197..7235c69ed9 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppsModel.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppsModel.java @@ -36,7 +36,6 @@ public class AppsModel { private AppsModel( Context context ) { mContext = context; - mAppFilter = new AppFilterImpl( context ); } public static AppsModel getInstance( Context context ) { @@ -69,6 +68,9 @@ public class AppsModel { } return; } + if ( mAppFilter == null ) { + mAppFilter = new AppFilterImpl( mContext ); + } final PackageManager packageManager = mContext.getPackageManager(); List< PackageInfo > packages = packageManager.getInstalledPackages( 0 ); int counter = 0; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/dialog/BaseFloatDialog.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/dialog/BaseFloatDialog.java new file mode 100644 index 0000000000..3a66bd5939 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/dialog/BaseFloatDialog.java @@ -0,0 +1,32 @@ +package com.mogo.module.common.dialog; + +import android.app.Dialog; +import android.content.Context; +import android.view.WindowManager; + +import androidx.annotation.NonNull; + +import com.mogo.module.common.R; + +/** + * 浮在各种wm上面的dialog基类,调用了window.setType + * + * @author tongchenfei + */ +public class BaseFloatDialog extends Dialog { + public BaseFloatDialog(@NonNull Context context) { + this(context, R.style.BaseFloatDialogStyle); + } + + public BaseFloatDialog(@NonNull Context context, int themeResId) { + super(context, themeResId); + addFlag(); + } + + private void addFlag() { + getWindow().setType(WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + 10); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN + | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION + | WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE); + } +} diff --git a/modules/mogo-module-common/src/main/res/values/styles.xml b/modules/mogo-module-common/src/main/res/values/styles.xml new file mode 100644 index 0000000000..162fe17f3e --- /dev/null +++ b/modules/mogo-module-common/src/main/res/values/styles.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index f49414dd40..bc8988abcc 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -7,7 +7,9 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.TypedValue; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; @@ -49,14 +51,17 @@ import com.mogo.service.module.IMogoRegisterCenter; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.service.statusmanager.StatusDescriptor; +import com.mogo.service.windowview.IMogoTopViewStatusListener; import com.mogo.utils.LaunchUtils; import com.mogo.utils.ResourcesHelper; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.logger.Logger; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Random; /** @@ -184,6 +189,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent private List< View > demoCache = new ArrayList<>(); private int[] heights = new int[]{100,200,300}; + private int currentHeight; @Override protected void initViews() { @@ -202,10 +208,10 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent // View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null); // TextView tv = v.findViewById(R.id.tvIndex); // Random random = new Random(); -// int height = heights[random.nextInt(3)]; -// tv.setText(demoCache.size()+" height: "+height + ": " + v); +// currentHeight = heights[random.nextInt(3)]; +// tv.setText(demoCache.size()+" height: "+currentHeight + ": " + v); // demoCache.add(v); -// LayoutParams params = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, height); +// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, currentHeight); // mApis.getTopViewManager().addView(v, params,new IMogoTopViewStatusListener() { // @Override // public void onViewAdded(View view) { @@ -261,6 +267,31 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent // Logger.d(TAG, "isViewAdded===" + isViewAdded); // mApis.getTopViewManager().removeView(v); // } +// View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null); +// TextView tv = v.findViewById(R.id.tvIndex); +// tv.setText("sub view "+demoCache.size()+" height: "+currentHeight + ": " + v); +// demoCache.add(v); +// mApis.getTopViewManager().addSubView(v,new IMogoTopViewStatusListener() { +// @Override +// public void onViewAdded(View view) { +// Logger.d(TAG, "onSubViewAdded: " + view); +// } +// +// @Override +// public void onViewRemoved(View view) { +// Logger.d(TAG, "onSubViewRemoved: " + view); +// } +// +// @Override +// public void beforeViewAddAnim(View view) { +// Logger.d(TAG, "beforeSubViewAddAnim: " + view); +// } +// +// @Override +// public void beforeViewRemoveAnim(View view) { +// Logger.d(TAG, "beforeSubViewRemoveAnim: " + view); +// } +// }); // 原始逻辑 final MogoLocation location = mMogoLocationClient.getLastKnowLocation(); if ( location != null ) { @@ -423,7 +454,13 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent if ( naviinfo == null ) { return; } - mNaviInfo.notifyChanged( naviinfo ); + if ( mNaviInfo != null ) { + if ( !mNaviInfo.isVisible() ) { + // 避免导航先开启,再开启app的情况 + onStartNavi(); + } + mNaviInfo.notifyChanged( naviinfo ); + } } @Override diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java index 59970e730e..6264550e08 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java @@ -26,7 +26,7 @@ public class NaviInfoView extends BaseNaviInfoView { private TextView remainingTimeUnit; private TextView arriveTime; - public void inflate(View view){ + public void inflate( View view ) { turnIcon = view.findViewById( R.id.module_map_id_navi_next_info_road_turn_icon ); distance = view.findViewById( R.id.module_map_id_navi_next_info_distance ); distanceUnit = view.findViewById( R.id.module_map_id_navi_next_info_distance_unit ); @@ -39,6 +39,11 @@ public class NaviInfoView extends BaseNaviInfoView { arriveTime = view.findViewById( R.id.module_map_id_arrive_time ); } + public boolean isVisible() { + return turnIcon != null && turnIcon.getVisibility() == View.VISIBLE; + } + + @Override public void notifyChanged( MogoNaviInfo naviInfo ) { super.notifyChanged( naviInfo ); 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 01570674a2..d669f9ecc3 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 @@ -110,20 +110,25 @@ public class TopViewAnimHelper { @Override public void onTransitionEnd(Transition transition) { - if (isTopViewOut) { - topContainer.removeAllViews(); - } +// if (isTopViewOut) { +// topContainer.removeAllViews(); +// } if (listener != null) { listener.onAnimEnd(); } Logger.d(TAG, "onTransitionEnd: " + currentAnimatingView); IMogoTopViewStatusListener listener; if (isTopViewOut) { - viewCaches.remove(currentAnimatingView); - listener = statusListenerMap.remove(currentAnimatingView); - if (listener != null) { - listener.onViewRemoved(currentAnimatingView); + int lastCount = topContainer.getChildCount(); + for (int i = 0; i < lastCount; i++) { + View child = topContainer.getChildAt(i); + viewCaches.remove(child); + listener = statusListenerMap.remove(child); + if (listener != null) { + listener.onViewRemoved(child); + } } + topContainer.removeAllViews(); } else { listener = statusListenerMap.get(currentAnimatingView); if (listener != null) { @@ -159,6 +164,100 @@ public class TopViewAnimHelper { private View currentAnimatingView = null; + public void addSubView(View subView, ViewGroup.LayoutParams params, + IMogoTopViewStatusListener statusListener) { + if (isTopViewOut || topContainer.getChildCount() == 0) { + throw new IllegalStateException("no base view in top view"); + } + if (subView == null) { + throw new IllegalArgumentException("method addTopView params view is null"); + } + if (params == null) { + throw new IllegalArgumentException("method addTopView params LayoutParams is null"); + } + + // 是在已经添加过view之后,才能添加sub view,所以直接走增加小view的逻辑就行 + if (!viewCaches.contains(subView)) { + viewCaches.add(subView); + statusListenerMap.put(subView, statusListener); + subView.setTranslationY(0); + subView.setTranslationY(-(params.height)); + topContainer.addView(subView, params); + Logger.d(TAG, "添加subView: " + subView.getTranslationY() + " height:" + + " " + subView.getHeight() + " paramsHeight: " + params.height); + if (statusListenerMap.get(subView) != null) { + statusListenerMap.get(subView).beforeViewAddAnim(subView); + } + subView.animate().translationY(0).setDuration(500).setListener(new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animation) { + + } + + @Override + public void onAnimationEnd(Animator animation) { + IMogoTopViewStatusListener listener = statusListenerMap.get(subView); + if (listener != null) { + listener.onViewAdded(subView); + } + } + + @Override + public void onAnimationCancel(Animator animation) { + + } + + + @Override + public void onAnimationRepeat(Animator animation) { + + } + }).start(); + } + + } + + public void removeSubView(View subView) { + if (topContainer.getChildCount() < 2) { + throw new IllegalStateException("view count not enough"); + } + Logger.d(TAG, + "小view退出: " + subView.getTranslationY() + " height: " + subView.getHeight()); + if (statusListenerMap.get(subView) != null) { + statusListenerMap.get(subView).beforeViewRemoveAnim(subView); + } + subView.animate().translationY(-(subView.getHeight())).setDuration(500).setListener(new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animation) { + + } + + @Override + public void onAnimationEnd(Animator animation) { + Logger.d(TAG, "onAnimationEnd: " + subView); + viewCaches.remove(subView); + topContainer.removeView(subView); + IMogoTopViewStatusListener listener = statusListenerMap.remove(subView); + if (listener != null) { + listener.onViewRemoved(subView); + } else { + Logger.d(TAG, "listener is null"); + } + } + + @Override + public void onAnimationCancel(Animator animation) { + viewCaches.remove(subView); + topContainer.removeView(subView); + } + + @Override + public void onAnimationRepeat(Animator animation) { + + } + }).start(); + } + public void startTopInAnim(View view, ViewGroup.LayoutParams params, IMogoTopViewStatusListener statusListener) { @@ -183,16 +282,22 @@ public class TopViewAnimHelper { // 顶部view已经有了内容,新增内容无需整体布局变化,只是新增布局加个动画 viewCaches.add(view); - // 生硬的删掉上一个view - View lastView = topContainer.getChildAt(0); - if (statusListenerMap.get(lastView) != null) { - statusListenerMap.get(lastView).beforeViewRemoveAnim(lastView); - } - topContainer.removeView(lastView); - viewCaches.remove(lastView); - if (statusListenerMap.get(lastView) != null) { - statusListenerMap.remove(lastView).onViewRemoved(lastView); + // 生硬的删掉之前的view + int lastCount = topContainer.getChildCount(); + Logger.d(TAG, "进入动画,lastCount: " + lastCount); + for (int i = 0; i < lastCount; i++) { + View lastView = topContainer.getChildAt(i); + if (statusListenerMap.get(lastView) != null) { + statusListenerMap.get(lastView).beforeViewRemoveAnim(lastView); + } + viewCaches.remove(lastView); + if (statusListenerMap.get(lastView) != null) { + statusListenerMap.remove(lastView).onViewRemoved(lastView); + } } + Logger.d(TAG, "生硬的删掉了之前的view: " + viewCaches.size()); + topContainer.removeAllViews(); + // 如果高度变化,生硬的变化一下高度 Logger.d(TAG,"container.height: "+topContainer.getHeight()); if (topContainer.getHeight() != params.height) { @@ -306,10 +411,6 @@ public class TopViewAnimHelper { Logger.d(TAG, "show top setMapCenterPointByScene: " + scene); MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene); }); - -// handler.post(() -> { -// -// }); } } } @@ -318,7 +419,9 @@ public class TopViewAnimHelper { * 退出最新的(也就是最上面的)view */ private void startLatestTopOutAnim() { - if (topContainer.getChildCount() > 0) { + if(topContainer.getChildCount()>1){ + removeSubView(topContainer.getChildAt(topContainer.getChildCount() - 1)); + }else if (topContainer.getChildCount() > 0) { startTopOutAnim(topContainer.getChildAt(topContainer.getChildCount() - 1)); } } @@ -331,46 +434,46 @@ public class TopViewAnimHelper { Logger.d("TopViewAnimHelper", "startTopOutAnim====="); if (!isTopViewOut && viewCaches.contains(view)) { - if (topContainer.getChildCount() > 1) { - // 顶部view包含多个view,只推出当前view,不进行整体上移 - Logger.d(TAG, - "小view退出: " + view.getTranslationY() + " height: " + view.getHeight()); - if (statusListenerMap.get(view) != null) { - statusListenerMap.get(view).beforeViewRemoveAnim(view); - } - view.animate().translationY(-(view.getHeight())).setDuration(500).setListener(new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animation) { - - } - - @Override - public void onAnimationEnd(Animator animation) { - Logger.d(TAG, "onAnimationEnd: " + view); - viewCaches.remove(view); - topContainer.removeView(view); - IMogoTopViewStatusListener listener = statusListenerMap.remove(view); - if (listener != null) { - listener.onViewRemoved(view); - } else { - Logger.d(TAG, "listener is null"); - } - } - - @Override - public void onAnimationCancel(Animator animation) { - viewCaches.remove(view); - topContainer.removeView(view); - } - - @Override - public void onAnimationRepeat(Animator animation) { - - } - }).start(); - } else { +// if (topContainer.getChildCount() > 1) { +// // 顶部view包含多个view,只推出当前view,不进行整体上移 +// Logger.d(TAG, +// "小view退出: " + view.getTranslationY() + " height: " + view.getHeight()); +// if (statusListenerMap.get(view) != null) { +// statusListenerMap.get(view).beforeViewRemoveAnim(view); +// } +// view.animate().translationY(-(view.getHeight())).setDuration(500).setListener(new Animator.AnimatorListener() { +// @Override +// public void onAnimationStart(Animator animation) { +// +// } +// +// @Override +// public void onAnimationEnd(Animator animation) { +// Logger.d(TAG, "onAnimationEnd: " + view); +// viewCaches.remove(view); +// topContainer.removeView(view); +// IMogoTopViewStatusListener listener = statusListenerMap.remove(view); +// if (listener != null) { +// listener.onViewRemoved(view); +// } else { +// Logger.d(TAG, "listener is null"); +// } +// } +// +// @Override +// public void onAnimationCancel(Animator animation) { +// viewCaches.remove(view); +// topContainer.removeView(view); +// } +// +// @Override +// public void onAnimationRepeat(Animator animation) { +// +// } +// }).start(); +// } else { // 顶部view仅剩一个view,需要整体上移 - currentAnimatingView = view; +// currentAnimatingView = view; if (statusListenerMap.get(view) != null) { statusListenerMap.get(view).beforeViewRemoveAnim(view); } @@ -426,7 +529,7 @@ public class TopViewAnimHelper { Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene); MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene); } - } +// } } public void showNaviView() { diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewManager.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewManager.java index cd238dd6c6..41198a70d4 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewManager.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewManager.java @@ -3,6 +3,7 @@ package com.mogo.module.extensions.utils; import android.content.Context; import android.view.View; import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.module.extensions.R; @@ -29,6 +30,7 @@ public class TopViewManager implements IMogoTopViewManager { // } private Context context; + private LayoutParams parentParams; @Override public void init(Context context) { this.context = context; @@ -54,14 +56,30 @@ public class TopViewManager implements IMogoTopViewManager { @Override public void addView(View view, ViewGroup.LayoutParams params, IMogoTopViewStatusListener statusListener) { + parentParams = params; TopViewAnimHelper.getInstance().startTopInAnim(view, params, statusListener); } + @Override + public void addSubView(View view) { + addSubView(view, null); + } + + @Override + public void addSubView(View view, IMogoTopViewStatusListener statusListener) { + TopViewAnimHelper.getInstance().addSubView(view, parentParams, statusListener); + } + @Override public void removeView(View view) { TopViewAnimHelper.getInstance().startTopOutAnim(view); } + @Override + public void removeSubView(View view) { + TopViewAnimHelper.getInstance().removeSubView(view); + } + @Override public boolean isViewAdded(View view) { return TopViewAnimHelper.getInstance().isViewAdded(view); diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml index 3110dc5404..827a2becac 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml @@ -71,7 +71,7 @@ android:id="@+id/ivUserHeadImg" android:layout_width="@dimen/module_ext_height" android:layout_height="@dimen/module_ext_height" - android:layout_marginEnd="@dimen/dp_16" + android:layout_marginEnd="@dimen/dp_30" android:src="@drawable/model_ext_default_user_head" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml index 631cd4f0d8..3f7fae420a 100644 --- a/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml @@ -54,7 +54,7 @@ 20px - 120px + 100px 60px 60px 32px diff --git a/modules/mogo-module-extensions/src/main/res/values/dimens.xml b/modules/mogo-module-extensions/src/main/res/values/dimens.xml index 161772cb13..4d06184316 100644 --- a/modules/mogo-module-extensions/src/main/res/values/dimens.xml +++ b/modules/mogo-module-extensions/src/main/res/values/dimens.xml @@ -56,7 +56,7 @@ 8px - 66px + 56px 32px 32px diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java index ea7e2d70fe..8eef0ad064 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java @@ -62,6 +62,9 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener { public void notifyXizhiNavStatus( int status ) { + if ( CustomNaviInterrupter.getInstance().interrupt() ) { + return; + } Intent intent = new Intent( ACTION_NAV_SEND ); intent.putExtra( "KEY_TYPE", 10019 ); intent.putExtra( "EXTRA_STATE", status ); 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 9d2d86b3ff..ca22d02c50 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 @@ -333,8 +333,6 @@ public class MogoServices implements IMogoMapListener, if ( DebugConfig.isLaunchLocationService() ) { initLocationServiceProcess( context ); } - - requestAutoNaviLastStatus(); } private void initLocationServiceProcess( Context context ) { @@ -703,12 +701,6 @@ public class MogoServices implements IMogoMapListener, restartAutoRefreshAtTime( 2_000L ); } mIsMainPageFirstResume = false; - try { - // 请求地图最后一次保存的状态 - requestAutoNaviLastStatus(); - } catch ( Exception e ) { - e.printStackTrace(); - } } else { unregisterInternalUnWakeupWords(); stopAutoRefreshStrategy(); @@ -721,13 +713,6 @@ public class MogoServices implements IMogoMapListener, } } - private void requestAutoNaviLastStatus(){ - Intent intent = new Intent(); - intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV"); - intent.putExtra("KEY_TYPE", 10061); - mContext.sendBroadcast(intent); - } - private void notifySeekHelpingStatusChanged( boolean seekHelpingStatus ) { Intent intent = new Intent( "com.mogo.launcher.adas.app" ); try { @@ -871,7 +856,7 @@ public class MogoServices implements IMogoMapListener, @Override public void onTransaction( int size ) { if ( size == 0 ) { - mUiController.showMyLocation( !mNavi.isNaviing() ); + mUiController.showMyLocation( true ); AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK ); if ( mStatusManager.isSearchUIShow() ) { mStatusManager.setSearchUIShow( TAG, false ); diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/LaucherShareDialog.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/LaucherShareDialog.java index b61adebe34..2153c9a17e 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/LaucherShareDialog.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/LaucherShareDialog.java @@ -12,6 +12,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.module.common.dialog.BaseFloatDialog; import com.mogo.module.common.utils.CarSeries; import com.mogo.module.share.R; import com.mogo.module.share.constant.ShareConstants; @@ -36,7 +37,7 @@ import java.util.Map; * 由于和左侧Adas冲突,改成了windowManager方式实现,这种实现方式的问题是,无法监测back键的事件 * @since 2020-01-10 */ -public class LaucherShareDialog implements View.OnClickListener { +public class LaucherShareDialog extends BaseFloatDialog implements View.OnClickListener { private static final String TAG = "LaucherShareDialog"; private boolean isShown = false; @@ -60,36 +61,49 @@ public class LaucherShareDialog implements View.OnClickListener { private WindowManager windowManager; - public LaucherShareDialog(@NonNull Context context) { +// public LaucherShareDialog(@NonNull Context context) { +// this.mContext = context; +// mApis = (IMogoServiceApis) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation(context); +// mAnalytics = mApis.getAnalyticsApi(); +// mStatusManager = mApis.getStatusManagerApi(); +// } + + private View body; + + public LaucherShareDialog(Context context) { + super(context); this.mContext = context; mApis = (IMogoServiceApis) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation(context); mAnalytics = mApis.getAnalyticsApi(); mStatusManager = mApis.getStatusManagerApi(); + + initView(); + initListener(); } - private View body; private void initView() { Logger.d(TAG, "test-------3"); - body = LayoutInflater.from(mContext).inflate(R.layout.launcher_dialog_share_2, null); - body.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - dismiss(); - } - }); + setContentView(R.layout.launcher_dialog_share_2); +// body = LayoutInflater.from(mContext).inflate(R.layout.launcher_dialog_share_2, null); +// body.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// dismiss(); +// } +// }); - tvBlock = body.findViewById(R.id.tvBlock); - tvTrafficCheck = body.findViewById(R.id.tvTrafficCheck); - tvClosure = body.findViewById(R.id.tvClosure); - tvNeedHelp = body.findViewById(R.id.tvSeekHelp); + tvBlock = findViewById(R.id.tvBlock); + tvTrafficCheck = findViewById(R.id.tvTrafficCheck); + tvClosure = findViewById(R.id.tvClosure); + tvNeedHelp = findViewById(R.id.tvSeekHelp); - tvAccident = body.findViewById(R.id.tvAccident); - tvRealTimeTraffic = body.findViewById(R.id.tvRealTimeTraffic); - tvStagnantWater = body.findViewById(R.id.tvStagnantWater); - tvRoadIcy = body.findViewById(R.id.tvRoadIcy); - tvDenseFog = body.findViewById(R.id.tvDenseFog); - tvConstruction = body.findViewById(R.id.tvConstruction); + tvAccident = findViewById(R.id.tvAccident); + tvRealTimeTraffic = findViewById(R.id.tvRealTimeTraffic); + tvStagnantWater = findViewById(R.id.tvStagnantWater); + tvRoadIcy = findViewById(R.id.tvRoadIcy); + tvDenseFog = findViewById(R.id.tvDenseFog); + tvConstruction = findViewById(R.id.tvConstruction); } @@ -220,46 +234,46 @@ public class LaucherShareDialog implements View.OnClickListener { } - public void show(){ - Logger.d(TAG,"使用windowManager实现"); - if (!isShown) { - windowManager = (WindowManager) mContext.getApplicationContext().getSystemService(Context.WINDOW_SERVICE); - WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; - } else { - layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; - } - layoutParams.format = PixelFormat.TRANSLUCENT; - layoutParams.gravity = Gravity.START | Gravity.TOP; -// mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; - // FLAG_LAYOUT_IN_SCREEN:将window放置在整个屏幕之内,无视其他的装饰(比如状态栏); FLAG_NOT_TOUCH_MODAL:不阻塞事件传递到后面的窗口 - layoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; - if (CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X) { - layoutParams.width = 1920; - layoutParams.height = 1080; - }else { - layoutParams.width = WindowUtils.getScreenWidth(mContext); - layoutParams.height = WindowUtils.getScreenHeight(mContext); - } - Logger.d("ShareDialog", "width: " + layoutParams.width + " height: " + layoutParams.height); - //后面变暗区域透明... - layoutParams.dimAmount = 0; - layoutParams.x = 0; - layoutParams.y = 0; - initView(); - initListener(); - windowManager.addView(body, layoutParams); - isShown = true; - } - } +// public void show(){ +// Logger.d(TAG,"使用windowManager实现"); +// if (!isShown) { +// windowManager = (WindowManager) mContext.getApplicationContext().getSystemService(Context.WINDOW_SERVICE); +// WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { +// layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; +// } else { +// layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; +// } +// layoutParams.format = PixelFormat.TRANSLUCENT; +// layoutParams.gravity = Gravity.START | Gravity.TOP; +//// mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; +// // FLAG_LAYOUT_IN_SCREEN:将window放置在整个屏幕之内,无视其他的装饰(比如状态栏); FLAG_NOT_TOUCH_MODAL:不阻塞事件传递到后面的窗口 +// layoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; +// if (CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X) { +// layoutParams.width = 1920; +// layoutParams.height = 1080; +// }else { +// layoutParams.width = WindowUtils.getScreenWidth(mContext); +// layoutParams.height = WindowUtils.getScreenHeight(mContext); +// } +// Logger.d("ShareDialog", "width: " + layoutParams.width + " height: " + layoutParams.height); +// //后面变暗区域透明... +// layoutParams.dimAmount = 0; +// layoutParams.x = 0; +// layoutParams.y = 0; +// initView(); +// initListener(); +// windowManager.addView(body, layoutParams); +// isShown = true; +// } +// } - public void dismiss(){ - if (isShown && windowManager != null && body != null) { - windowManager.removeViewImmediate(body); - windowManager = null; - isShown = false; - } - } +// public void dismiss(){ +// if (isShown && windowManager != null && body != null) { +// windowManager.removeViewImmediate(body); +// windowManager = null; +// isShown = false; +// } +// } } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt index 545ab05cce..61fcc30ad9 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt @@ -2,6 +2,7 @@ package com.mogo.module.share.manager import android.content.Context import android.content.Intent +import com.mogo.commons.debug.DebugConfig import com.mogo.commons.voice.AIAssist import com.mogo.module.share.ShareControl import com.mogo.module.share.dialog.LaucherShareDialog @@ -18,7 +19,9 @@ object UploadHelper { TipToast.tip("正在上报,请稍后重试") }else { ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true) - AIAssist.getInstance(context).speakTTSVoice("感谢分享,正在上传") + if(DebugConfig.getAIType() == DebugConfig.AI_TYPE_TXZ) { + AIAssist.getInstance(context).speakTTSVoice("感谢分享,正在上传") + } Logger.d("UploadHelper", "upload ----> $type") val intent = Intent() intent.action = "com.zhidao.share.roadcondition.action" diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewManager.java b/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewManager.java index 2f871f14bc..81e7550c91 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewManager.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewManager.java @@ -42,16 +42,39 @@ public interface IMogoTopViewManager extends IProvider { void addView(View view, ViewGroup.LayoutParams params, IMogoTopViewStatusListener statusListener); + /** + * 在1/2屏添加一个sub view,叠加在主view上面显示 + * 给了一个默认的LayoutParams(MatchParent,dp_350) + * + * @param view 增加的view + */ + void addSubView(View view); + + /** + * 在1/2屏添加一个sub view,叠加在主view上面显示,可通过设置监听,来监听增加的view的状态 + * 给了一个默认的LayoutParams(MatchParent,dp_350) + * + * @param statusListener 状态监听 + * @param view 增加的view + */ + void addSubView(View view, IMogoTopViewStatusListener statusListener); + /** * 移除view,如果是最后一个view,会有移除动画 - * @param view + * @param view 待移除的 view */ void removeView(View view); + /** + * 移除sub view + * @param view 待移除的sub view + */ + void removeSubView(View view); + /** * 这个view是否已经被添加进了顶部布局 - * @param view - * @return + * @param view 待查询的view + * @return true-已经添加 false-未添加 */ boolean isViewAdded(View view); }