diff --git a/gradle.properties b/gradle.properties index 697b89654d..ce2fec7504 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,37 +24,37 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ USERNAME=xintai PASSWORD=xintai2018 # 编译模式: false - 依赖本地版本, true - 依赖 maven 版本 -RELEASE=false +RELEASE=true # 模块版本 ## 工程内模块 -MOGO_COMMONS_VERSION=1.2.1 -MOGO_UTILS_VERSION=1.2.1 -MAP_AMAP_VERSION=1.2.1 -MAP_AUTONAVI_VERSION=1.2.1 -MOGO_MAP_VERSION=1.2.1 -MOGO_MAP_API_VERSION=1.2.1 -MOGO_SERVICE_VERSION=1.2.1 -MOGO_SERVICE_API_VERSION=1.2.1 -MOGO_CONNECTION_VERSION=1.2.1 -MOGO_MODULE_APPS_VERSION=1.2.1 -MOGO_MODULE_NAVI_VERSION=1.2.1 -MOGO_MODULE_SHARE_VERSION=1.2.1 -MOGO_MODULE_COMMON_VERSION=1.2.1 -MOGO_MODULE_MAIN_VERSION=1.2.1 -MOGO_MODULE_MAP_VERSION=1.2.1 -MOGO_MODULE_SERVICE_VERSION=1.2.1 -MOGO_MODULE_EXTENSIONS_VERSION=1.2.1 -MOGO_MODULE_SEARCH_VERSION=1.2.1 -MOGO_MODULE_BACK_VERSION=1.2.1 -MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1 -MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1 -MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1 -MOGO_MODULE_AUTHORIZE_VERSION=1.2.1 -MOGO_MODULE_GUIDE_VERSION=1.2.1 -MOGO_MODULE_MEDIA_VERSION=1.2.1 +MOGO_COMMONS_VERSION=1.2.1.3 +MOGO_UTILS_VERSION=1.2.1.3 +MAP_AMAP_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_MODULE_MAIN_LAUNCHER_VERSION = 1.0.0.2 -MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.0.0.2 +MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.0.0.5 +MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.0.0.5 ## 工程外部模块 @@ -71,7 +71,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.14 +MOGO_MODULE_V2X_VERSION=1.1.132-SNAPSHOT # 推送 MOGO_MODULE_PUSH_VERSION=1.0.1 # 广告资源位 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 9648fe49a8..f49414dd40 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 @@ -49,7 +49,6 @@ 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.utils.AppUtils; import com.mogo.utils.LaunchUtils; import com.mogo.utils.ResourcesHelper; import com.mogo.utils.UiThreadHandler; @@ -184,6 +183,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent private List< View > demoCache = new ArrayList<>(); + private int[] heights = new int[]{100,200,300}; + @Override protected void initViews() { mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() ); @@ -200,9 +201,12 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent // // todo 测试动画 // View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null); // TextView tv = v.findViewById(R.id.tvIndex); -// tv.setText(demoCache.size() + ": " + v); +// Random random = new Random(); +// int height = heights[random.nextInt(3)]; +// tv.setText(demoCache.size()+" height: "+height + ": " + v); // demoCache.add(v); -// mApis.getTopViewManager().addView(v, new IMogoTopViewStatusListener() { +// LayoutParams params = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, height); +// mApis.getTopViewManager().addView(v, params,new IMogoTopViewStatusListener() { // @Override // public void onViewAdded(View view) { // Logger.d(TAG, "onViewAdded: " + view); @@ -212,6 +216,16 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent // public void onViewRemoved(View view) { // Logger.d(TAG, "onViewRemoved: " + view); // } +// +// @Override +// public void beforeViewAddAnim(View view) { +// Logger.d(TAG, "beforeViewAddAnim: " + view); +// } +// +// @Override +// public void beforeViewRemoveAnim(View view) { +// Logger.d(TAG, "beforeViewRemoveAnim: " + view); +// } // }); // 原始逻辑 showShareDialog(); diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java index a4ef3f3a3e..0f98f21a68 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java @@ -82,6 +82,12 @@ public class TopView extends FrameLayout { }); } + @Override + public void onViewRemoved(View child) { + super.onViewRemoved(child); + Logger.d("TopView", "onViewRemoved: " + child); + } + public interface OnChildAddedListener { /** * 子view添加完成,但是并不确定已经绘制完成 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 f52b467232..01570674a2 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 @@ -8,6 +8,7 @@ import android.transition.TransitionManager; import android.util.ArrayMap; import android.view.View; import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; import android.view.animation.BounceInterpolator; import android.view.animation.OvershootInterpolator; import android.widget.ImageView; @@ -152,7 +153,7 @@ public class TopViewAnimHelper { hideNaviView(); } - private boolean isTopViewOut = true; + private volatile boolean isTopViewOut = true; private List viewCaches = new ArrayList<>(); private Map statusListenerMap = new ArrayMap<>(); @@ -174,16 +175,45 @@ public class TopViewAnimHelper { } if (!viewCaches.contains(view)) { // 判断此view是否已经增加到了顶部view,如果增加过就不增加了 + view.setTranslationY(0); statusListenerMap.put(view, statusListener); Logger.d(TAG, "开始执行"); isTopViewOut = false; if (topContainer.getChildCount() > 0) { // 顶部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); + } + // 如果高度变化,生硬的变化一下高度 + Logger.d(TAG,"container.height: "+topContainer.getHeight()); + if (topContainer.getHeight() != params.height) { + constraintSet.clone(topMotionLayout); + LayoutParams p = topContainer.getLayoutParams(); + p.height = params.height; + topContainer.setLayoutParams(p); + constraintSet.connect(naviBg.getId(), ConstraintSet.TOP, + R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, + computeNaviMarginTop(params.height)); + constraintSet.applyTo(topMotionLayout); + Logger.d(TAG,"改变container的高度==="); + } + view.setTranslationY(-(params.height)); topContainer.addView(view, params); Logger.d(TAG, "顶部view已经有布局了,增加新增view滑入动画: " + view.getTranslationY() + " height:" + " " + view.getHeight() + " paramsHeight: " + params.height); + if (statusListenerMap.get(view) != null) { + statusListenerMap.get(view).beforeViewAddAnim(view); + } view.animate().translationY(0).setDuration(500).setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { @@ -217,8 +247,13 @@ public class TopViewAnimHelper { // tvNextRoad.setTextSize(getDimen(R.dimen.dp_34)); // } topContainer.addView(view, params); - + Logger.d(TAG, "整体进入==== view.visibility: " + view.getVisibility() + " view" + + ".position: (" + view.getX() + ", " + view.getY() + ") params.width: " + params.width + " params.height: " + params.height); + if (statusListenerMap.get(view) != null) { + statusListenerMap.get(view).beforeViewAddAnim(view); + } topContainer.setChildAddedListener(child -> { + topContainer.setChildAddedListener(null); if (naviBg.getVisibility() == View.VISIBLE) { remainDistanceGroup.setVisibility(View.GONE); remainTimeGroup.setVisibility(View.GONE); @@ -253,7 +288,7 @@ public class TopViewAnimHelper { constraintSet.connect(naviBg.getId(), ConstraintSet.TOP, R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, - (int) getDimen(R.dimen.dp_316)); + computeNaviMarginTop(params.height)); } constraintSet.applyTo(topMotionLayout); ivTurnIcon.getLayoutParams().height = @@ -300,6 +335,9 @@ public class TopViewAnimHelper { // 顶部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) { @@ -333,6 +371,9 @@ public class TopViewAnimHelper { } else { // 顶部view仅剩一个view,需要整体上移 currentAnimatingView = view; + if (statusListenerMap.get(view) != null) { + statusListenerMap.get(view).beforeViewRemoveAnim(view); + } isTopViewOut = true; // if (naviBg.getVisibility() == View.VISIBLE) { // tvNextRoad.setTextSize(getDimen(R.dimen @@ -441,7 +482,7 @@ public class TopViewAnimHelper { (int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_46)); constraintSet.connect(naviBg.getId(), ConstraintSet.TOP, R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, - (int) getDimen(R.dimen.dp_316)); + computeNaviMarginTop(topContainer.getHeight())); // ivTurnIcon.getLayoutParams().height = // (int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_small_height); // ivTurnIcon.getLayoutParams().width = @@ -510,6 +551,12 @@ public class TopViewAnimHelper { return (int) topMotionLayout.getContext().getResources().getDimension(resId); } + private int computeNaviMarginTop(int height) { + int result = (int) (height - (getDimen(R.dimen.dp_350) - getDimen(R.dimen.dp_316))); + Logger.d(TAG, "computeNaviMarginTop: " + height + " result: " + result); + return result; + } + interface OnTopViewAnimSimpleListener { void onAnimStart(); diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewStatusListener.java b/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewStatusListener.java index db9df440b4..c3316b01ed 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewStatusListener.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewStatusListener.java @@ -19,4 +19,16 @@ public interface IMogoTopViewStatusListener { * @param view 移除的view */ void onViewRemoved(View view); + + /** + * view添加动画开始之前 + * @param view 添加的view + */ + void beforeViewAddAnim(View view); + + /** + * view 移除动画开始之前 + * @param view 移除的view + */ + void beforeViewRemoveAnim(View view); }