modify topView bugs
This commit is contained in:
@@ -197,10 +197,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.carcallprovider
|
||||
implementation rootProject.ext.dependencies.carcall
|
||||
|
||||
implementation rootProject.ext.dependencies.modulepush, {
|
||||
exclude group: 'com.mogo.module', module: 'module-common'
|
||||
}
|
||||
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
implementation rootProject.ext.dependencies.moduletanlu, {
|
||||
exclude group: 'com.mogo.module', module: 'module-share'
|
||||
|
||||
@@ -55,6 +55,8 @@ public class TopViewAnimHelper {
|
||||
private Transition transition = new AutoTransition();
|
||||
private TextView cameraMode;
|
||||
|
||||
private float topHeight = 0f;
|
||||
|
||||
private Handler handler = new Handler();
|
||||
|
||||
private TopViewAnimHelper() {
|
||||
@@ -261,7 +263,7 @@ public class TopViewAnimHelper {
|
||||
public void startTopInAnim(View view, ViewGroup.LayoutParams params,
|
||||
IMogoTopViewStatusListener statusListener) {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
if (topMotionLayout == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -299,7 +301,7 @@ public class TopViewAnimHelper {
|
||||
topContainer.removeAllViews();
|
||||
|
||||
// 如果高度变化,生硬的变化一下高度
|
||||
Logger.d(TAG,"container.height: "+topContainer.getHeight());
|
||||
Logger.d(TAG, "container.height: " + topContainer.getHeight());
|
||||
if (topContainer.getHeight() != params.height) {
|
||||
constraintSet.clone(topMotionLayout);
|
||||
LayoutParams p = topContainer.getLayoutParams();
|
||||
@@ -309,7 +311,7 @@ public class TopViewAnimHelper {
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||
computeNaviMarginTop(params.height));
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
Logger.d(TAG,"改变container的高度===");
|
||||
Logger.d(TAG, "改变container的高度===");
|
||||
}
|
||||
|
||||
view.setTranslationY(-(params.height));
|
||||
@@ -387,9 +389,10 @@ public class TopViewAnimHelper {
|
||||
R.id.module_map_id_navi_next_info_turn_info, ConstraintSet.RIGHT,
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_46));
|
||||
|
||||
constraintSet.clear(ivTurnIcon.getId(),ConstraintSet.TOP);
|
||||
constraintSet.clear(ivTurnIcon.getId(), ConstraintSet.TOP);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
naviBg.getId(), ConstraintSet.BOTTOM, (int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
|
||||
naviBg.getId(), ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
|
||||
|
||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||
@@ -419,16 +422,16 @@ public class TopViewAnimHelper {
|
||||
* 退出最新的(也就是最上面的)view
|
||||
*/
|
||||
private void startLatestTopOutAnim() {
|
||||
if(topContainer.getChildCount()>1){
|
||||
if (topContainer.getChildCount() > 1) {
|
||||
removeSubView(topContainer.getChildAt(topContainer.getChildCount() - 1));
|
||||
}else if (topContainer.getChildCount() > 0) {
|
||||
} else if (topContainer.getChildCount() > 0) {
|
||||
startTopOutAnim(topContainer.getChildAt(topContainer.getChildCount() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
public void startTopOutAnim(View view) {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
if (topMotionLayout == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -441,7 +444,8 @@ public class TopViewAnimHelper {
|
||||
// if (statusListenerMap.get(view) != null) {
|
||||
// statusListenerMap.get(view).beforeViewRemoveAnim(view);
|
||||
// }
|
||||
// view.animate().translationY(-(view.getHeight())).setDuration(500).setListener(new Animator.AnimatorListener() {
|
||||
// view.animate().translationY(-(view.getHeight())).setDuration(500).setListener
|
||||
// (new Animator.AnimatorListener() {
|
||||
// @Override
|
||||
// public void onAnimationStart(Animator animation) {
|
||||
//
|
||||
@@ -472,69 +476,70 @@ public class TopViewAnimHelper {
|
||||
// }
|
||||
// }).start();
|
||||
// } else {
|
||||
// 顶部view仅剩一个view,需要整体上移
|
||||
// 顶部view仅剩一个view,需要整体上移
|
||||
// currentAnimatingView = view;
|
||||
if (statusListenerMap.get(view) != null) {
|
||||
statusListenerMap.get(view).beforeViewRemoveAnim(view);
|
||||
}
|
||||
isTopViewOut = true;
|
||||
if (statusListenerMap.get(view) != null) {
|
||||
statusListenerMap.get(view).beforeViewRemoveAnim(view);
|
||||
}
|
||||
isTopViewOut = true;
|
||||
// if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
// tvNextRoad.setTextSize(getDimen(R.dimen
|
||||
// .module_ext_navi_info_panel_next_info_road_textSize));
|
||||
// }
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
remainDistanceGroup.setVisibility(View.VISIBLE);
|
||||
remainTimeGroup.setVisibility(View.VISIBLE);
|
||||
arriveTimeGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
constraintSet.clone(topMotionLayout);
|
||||
|
||||
constraintSet.clear(R.id.module_entrance_id_top_container, ConstraintSet.TOP);
|
||||
constraintSet.connect(R.id.module_entrance_id_top_container, ConstraintSet.BOTTOM,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
|
||||
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
|
||||
checkCameraModePosition(false);
|
||||
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
// 约束设置需要在applyTo()方法之前执行,visiable设置需要在applyTo()
|
||||
// 方法之后执行才能生效,所以分开了两个判断,至于为什么这么做才能生效,不得而知
|
||||
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
|
||||
constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BASELINE);
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM,
|
||||
ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom));
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.LEFT,
|
||||
tvNextDistance.getId(), ConstraintSet.LEFT,
|
||||
0);
|
||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, 0);
|
||||
constraintSet.connect(ivTurnIcon.getId(),ConstraintSet.TOP,naviBg.getId(),ConstraintSet.TOP,0);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
naviBg.getId(), ConstraintSet.BOTTOM, 0);
|
||||
}
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
|
||||
ivTurnIcon.getLayoutParams().height =
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_height);
|
||||
ivTurnIcon.getLayoutParams().width =
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_width);
|
||||
naviBg.getLayoutParams().height =
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.module_ext_navi_info_panel_height);
|
||||
int scene = 0;
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
scene = Scene.NAVI;
|
||||
} else {
|
||||
scene = Scene.AIMLESS;
|
||||
}
|
||||
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
remainDistanceGroup.setVisibility(View.VISIBLE);
|
||||
remainTimeGroup.setVisibility(View.VISIBLE);
|
||||
arriveTimeGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
constraintSet.clone(topMotionLayout);
|
||||
|
||||
constraintSet.clear(R.id.module_entrance_id_top_container, ConstraintSet.TOP);
|
||||
constraintSet.connect(R.id.module_entrance_id_top_container, ConstraintSet.BOTTOM,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
|
||||
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
|
||||
checkCameraModePosition(false);
|
||||
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
// 约束设置需要在applyTo()方法之前执行,visiable设置需要在applyTo()
|
||||
// 方法之后执行才能生效,所以分开了两个判断,至于为什么这么做才能生效,不得而知
|
||||
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
|
||||
constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BASELINE);
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM,
|
||||
ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom));
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.LEFT,
|
||||
tvNextDistance.getId(), ConstraintSet.LEFT,
|
||||
0);
|
||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, 0);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
|
||||
ConstraintSet.TOP, 0);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
naviBg.getId(), ConstraintSet.BOTTOM, 0);
|
||||
}
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
|
||||
ivTurnIcon.getLayoutParams().height =
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_height);
|
||||
ivTurnIcon.getLayoutParams().width =
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_width);
|
||||
naviBg.getLayoutParams().height =
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.module_ext_navi_info_panel_height);
|
||||
int scene = 0;
|
||||
if (naviBg.getVisibility() == View.VISIBLE) {
|
||||
scene = Scene.NAVI;
|
||||
} else {
|
||||
scene = Scene.AIMLESS;
|
||||
}
|
||||
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void showNaviView() {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
if (topMotionLayout == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -564,7 +569,8 @@ public class TopViewAnimHelper {
|
||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||
0);
|
||||
constraintSet.connect(ivTurnIcon.getId(),ConstraintSet.TOP,naviBg.getId(),ConstraintSet.TOP,0);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
|
||||
ConstraintSet.TOP, 0);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
naviBg.getId(), ConstraintSet.BOTTOM, 0);
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
@@ -593,9 +599,10 @@ public class TopViewAnimHelper {
|
||||
// naviBg.getLayoutParams().height =
|
||||
// (int) topMotionLayout.getContext().getResources().getDimension(R.dimen
|
||||
// .module_ext_navi_info_panel_small_height);
|
||||
constraintSet.clear(ivTurnIcon.getId(),ConstraintSet.TOP);
|
||||
constraintSet.clear(ivTurnIcon.getId(), ConstraintSet.TOP);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
naviBg.getId(), ConstraintSet.BOTTOM, (int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
|
||||
naviBg.getId(), ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
scene = Scene.NAVI;
|
||||
}
|
||||
@@ -606,7 +613,7 @@ public class TopViewAnimHelper {
|
||||
|
||||
public void hideNaviView() {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
if (topMotionLayout == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ public class TopViewManager implements IMogoTopViewManager {
|
||||
|
||||
private Context context;
|
||||
private LayoutParams parentParams;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
@@ -28,14 +29,14 @@ public class TopViewManager implements IMogoTopViewManager {
|
||||
|
||||
@Override
|
||||
public void addView(View view) {
|
||||
addView(view, new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT),null);
|
||||
addView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) context.getResources().getDimension(R.dimen.dp_350)), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView(View view, IMogoTopViewStatusListener statusListener) {
|
||||
addView(view, new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT),statusListener);
|
||||
addView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) context.getResources().getDimension(R.dimen.dp_350)), statusListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user