修改top view展示逻辑,同时只展示一个view,不进行叠加展示
This commit is contained in:
@@ -24,37 +24,37 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
|
|||||||
USERNAME=xintai
|
USERNAME=xintai
|
||||||
PASSWORD=xintai2018
|
PASSWORD=xintai2018
|
||||||
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
|
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
|
||||||
RELEASE=false
|
RELEASE=true
|
||||||
# 模块版本
|
# 模块版本
|
||||||
## 工程内模块
|
## 工程内模块
|
||||||
MOGO_COMMONS_VERSION=1.2.1.2
|
MOGO_COMMONS_VERSION=1.2.1.3
|
||||||
MOGO_UTILS_VERSION=1.2.1.2
|
MOGO_UTILS_VERSION=1.2.1.3
|
||||||
MAP_AMAP_VERSION=1.2.1.2
|
MAP_AMAP_VERSION=1.2.1.3
|
||||||
MAP_AUTONAVI_VERSION=1.2.1.2
|
MAP_AUTONAVI_VERSION=1.2.1.3
|
||||||
MOGO_MAP_VERSION=1.2.1.2
|
MOGO_MAP_VERSION=1.2.1.3
|
||||||
MOGO_MAP_API_VERSION=1.2.1.2
|
MOGO_MAP_API_VERSION=1.2.1.3
|
||||||
MOGO_SERVICE_VERSION=1.2.1.2
|
MOGO_SERVICE_VERSION=1.2.1.3
|
||||||
MOGO_SERVICE_API_VERSION=1.2.1.2
|
MOGO_SERVICE_API_VERSION=1.2.1.3
|
||||||
MOGO_CONNECTION_VERSION=1.2.1.2
|
MOGO_CONNECTION_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_APPS_VERSION=1.2.1.2
|
MOGO_MODULE_APPS_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_NAVI_VERSION=1.2.1.2
|
MOGO_MODULE_NAVI_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_SHARE_VERSION=1.2.1.2
|
MOGO_MODULE_SHARE_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_COMMON_VERSION=1.2.1.2
|
MOGO_MODULE_COMMON_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_MAIN_VERSION=1.2.1.2
|
MOGO_MODULE_MAIN_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_MAP_VERSION=1.2.1.2
|
MOGO_MODULE_MAP_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_SERVICE_VERSION=1.2.1.2
|
MOGO_MODULE_SERVICE_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.2
|
MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_SEARCH_VERSION=1.2.1.2
|
MOGO_MODULE_SEARCH_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_BACK_VERSION=1.2.1.2
|
MOGO_MODULE_BACK_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.2
|
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.2
|
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.2
|
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.2
|
MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_GUIDE_VERSION=1.2.1.2
|
MOGO_MODULE_GUIDE_VERSION=1.2.1.3
|
||||||
MOGO_MODULE_MEDIA_VERSION=1.2.1.2
|
MOGO_MODULE_MEDIA_VERSION=1.2.1.3
|
||||||
|
|
||||||
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.0.0.4
|
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.0.0.5
|
||||||
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.0.0.4
|
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.0.0.5
|
||||||
|
|
||||||
|
|
||||||
## 工程外部模块
|
## 工程外部模块
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
|||||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||||
import com.mogo.utils.AppUtils;
|
|
||||||
import com.mogo.utils.LaunchUtils;
|
import com.mogo.utils.LaunchUtils;
|
||||||
import com.mogo.utils.ResourcesHelper;
|
import com.mogo.utils.ResourcesHelper;
|
||||||
import com.mogo.utils.UiThreadHandler;
|
import com.mogo.utils.UiThreadHandler;
|
||||||
@@ -184,6 +183,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
|||||||
|
|
||||||
private List< View > demoCache = new ArrayList<>();
|
private List< View > demoCache = new ArrayList<>();
|
||||||
|
|
||||||
|
private int[] heights = new int[]{100,200,300};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViews() {
|
protected void initViews() {
|
||||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||||
@@ -200,9 +201,12 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
|||||||
// // todo 测试动画
|
// // todo 测试动画
|
||||||
// View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
|
// View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
|
||||||
// TextView tv = v.findViewById(R.id.tvIndex);
|
// 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);
|
// 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
|
// @Override
|
||||||
// public void onViewAdded(View view) {
|
// public void onViewAdded(View view) {
|
||||||
// Logger.d(TAG, "onViewAdded: " + view);
|
// Logger.d(TAG, "onViewAdded: " + view);
|
||||||
@@ -212,6 +216,16 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
|||||||
// public void onViewRemoved(View view) {
|
// public void onViewRemoved(View view) {
|
||||||
// Logger.d(TAG, "onViewRemoved: " + 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();
|
showShareDialog();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.transition.TransitionManager;
|
|||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewGroup.LayoutParams;
|
||||||
import android.view.animation.BounceInterpolator;
|
import android.view.animation.BounceInterpolator;
|
||||||
import android.view.animation.OvershootInterpolator;
|
import android.view.animation.OvershootInterpolator;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -181,6 +182,31 @@ public class TopViewAnimHelper {
|
|||||||
if (topContainer.getChildCount() > 0) {
|
if (topContainer.getChildCount() > 0) {
|
||||||
// 顶部view已经有了内容,新增内容无需整体布局变化,只是新增布局加个动画
|
// 顶部view已经有了内容,新增内容无需整体布局变化,只是新增布局加个动画
|
||||||
viewCaches.add(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));
|
view.setTranslationY(-(params.height));
|
||||||
topContainer.addView(view, params);
|
topContainer.addView(view, params);
|
||||||
Logger.d(TAG, "顶部view已经有布局了,增加新增view滑入动画: " + view.getTranslationY() + " height:" +
|
Logger.d(TAG, "顶部view已经有布局了,增加新增view滑入动画: " + view.getTranslationY() + " height:" +
|
||||||
@@ -227,6 +253,7 @@ public class TopViewAnimHelper {
|
|||||||
statusListenerMap.get(view).beforeViewAddAnim(view);
|
statusListenerMap.get(view).beforeViewAddAnim(view);
|
||||||
}
|
}
|
||||||
topContainer.setChildAddedListener(child -> {
|
topContainer.setChildAddedListener(child -> {
|
||||||
|
topContainer.setChildAddedListener(null);
|
||||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||||
remainDistanceGroup.setVisibility(View.GONE);
|
remainDistanceGroup.setVisibility(View.GONE);
|
||||||
remainTimeGroup.setVisibility(View.GONE);
|
remainTimeGroup.setVisibility(View.GONE);
|
||||||
@@ -261,7 +288,7 @@ public class TopViewAnimHelper {
|
|||||||
|
|
||||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||||
(int) getDimen(R.dimen.dp_316));
|
computeNaviMarginTop(params.height));
|
||||||
}
|
}
|
||||||
constraintSet.applyTo(topMotionLayout);
|
constraintSet.applyTo(topMotionLayout);
|
||||||
ivTurnIcon.getLayoutParams().height =
|
ivTurnIcon.getLayoutParams().height =
|
||||||
@@ -455,7 +482,7 @@ public class TopViewAnimHelper {
|
|||||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_46));
|
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_46));
|
||||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||||
(int) getDimen(R.dimen.dp_316));
|
computeNaviMarginTop(topContainer.getHeight()));
|
||||||
// ivTurnIcon.getLayoutParams().height =
|
// ivTurnIcon.getLayoutParams().height =
|
||||||
// (int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_small_height);
|
// (int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_small_height);
|
||||||
// ivTurnIcon.getLayoutParams().width =
|
// ivTurnIcon.getLayoutParams().width =
|
||||||
@@ -524,6 +551,12 @@ public class TopViewAnimHelper {
|
|||||||
return (int) topMotionLayout.getContext().getResources().getDimension(resId);
|
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 {
|
interface OnTopViewAnimSimpleListener {
|
||||||
void onAnimStart();
|
void onAnimStart();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user