diff --git a/gradle.properties b/gradle.properties
index c0b58d1c24..00fd80c716 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -27,34 +27,34 @@ PASSWORD=xintai2018
RELEASE=false
# 模块版本
## 工程内模块
-MOGO_COMMONS_VERSION=1.2.1.4
-MOGO_UTILS_VERSION=1.2.1.4
-MAP_AMAP_VERSION=1.2.1.4
-MAP_AUTONAVI_VERSION=1.2.1.4
-MOGO_MAP_VERSION=1.2.1.4
-MOGO_MAP_API_VERSION=1.2.1.4
-MOGO_SERVICE_VERSION=1.2.1.4
-MOGO_SERVICE_API_VERSION=1.2.1.4
-MOGO_CONNECTION_VERSION=1.2.1.4
-MOGO_MODULE_APPS_VERSION=1.2.1.4
-MOGO_MODULE_NAVI_VERSION=1.2.1.4
-MOGO_MODULE_SHARE_VERSION=1.2.1.4
-MOGO_MODULE_COMMON_VERSION=1.2.1.4
-MOGO_MODULE_MAIN_VERSION=1.2.1.4
-MOGO_MODULE_MAP_VERSION=1.2.1.4
-MOGO_MODULE_SERVICE_VERSION=1.2.1.4
-MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.4
-MOGO_MODULE_SEARCH_VERSION=1.2.1.4
-MOGO_MODULE_BACK_VERSION=1.2.1.4
-MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.4
-MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.4
-MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.4
-MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.4
-MOGO_MODULE_GUIDE_VERSION=1.2.1.4
-MOGO_MODULE_MEDIA_VERSION=1.2.1.4
+MOGO_COMMONS_VERSION=1.2.1.5
+MOGO_UTILS_VERSION=1.2.1.5
+MAP_AMAP_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.6
-MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.0.0.6
+MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.2.1.5
+MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.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.19
+MOGO_MODULE_V2X_VERSION=1.1.22
# 推送
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 2c354eeebf..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 ) {
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/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);
}