Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
tongchenfei
2020-11-02 17:49:28 +08:00
20 changed files with 700 additions and 75 deletions

View File

@@ -56,7 +56,7 @@ public class AutoNaviClient implements IMogoNavi {
private final Context mContext;
private AutoNaviClient( Context context ) {
mContext = context;
mContext = context.getApplicationContext();
}
public static AutoNaviClient getInstance( Context context ) {

View File

@@ -5,7 +5,7 @@ import android.content.pm.PackageInfo;
import android.text.TextUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.utils.CarSeries;
import com.mogo.commons.debug.DebugConfig;
import java.io.BufferedReader;
import java.io.File;
@@ -29,7 +29,7 @@ public class AppFilterImpl {
private static List< String > sExternalConfigPackages = new ArrayList<>();
static {
if ( CarSeries.getSeries() != CarSeries.CAR_SERIES_F80X ) {
if ( !DebugConfig.getProductFlavor().startsWith( "f8" ) ) {
final String[] values = AbsMogoApplication.getApp().getResources().getStringArray( R.array.module_apps_array_filter_packages );
if ( values != null ) {
mFilterPackages = new ArrayList( Arrays.asList( values ) );

View File

@@ -50,6 +50,7 @@ import com.mogo.module.extensions.navi.NaviInfoView;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.utils.EntranceViewHolder;
import com.mogo.module.extensions.utils.TopViewAnimHelper;
import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.analytics.IMogoAnalytics;
@@ -265,6 +266,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
if (rootView != null) {
TopViewAnimHelper.getInstance().init(rootView);
TopViewNoLinkageAnimHelper.getInstance().init(rootView);
}
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
@@ -601,6 +603,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW, this);
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
TopViewNoLinkageAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
mClickShareVoiceStrings =
getContext().getResources().getStringArray(R.array.click_share_voice_guide_array);
@@ -616,6 +619,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
isClickShare = false;
TopViewAnimHelper.getInstance().removeAllView();
TopViewAnimHelper.getInstance().clear();
TopViewNoLinkageAnimHelper.getInstance().removeAllView();
TopViewNoLinkageAnimHelper.getInstance().clear();
EntranceViewHolder.getInstance().release();
}

View File

@@ -51,6 +51,30 @@ public class TopViewManager implements IMogoTopViewManager {
TopViewAnimHelper.getInstance().startTopInAnim(view, params, statusListener);
}
@Override
public void addViewNoLinkage(View view) {
addViewNoLinkage(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
(int) context.getResources().getDimension(R.dimen.dp_350)), null);
}
@Override
public void addViewNoLinkage(View view, IMogoTopViewStatusListener statusListener) {
addViewNoLinkage(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
(int) context.getResources().getDimension(R.dimen.dp_350)), statusListener);
}
@Override
public void addViewNoLinkage(View view, ViewGroup.LayoutParams params) {
addViewNoLinkage(view, params, null);
}
@Override
public void addViewNoLinkage(View view, ViewGroup.LayoutParams params,
IMogoTopViewStatusListener statusListener) {
parentParams = params;
TopViewNoLinkageAnimHelper.getInstance().startTopInAnim(view, params, statusListener);
}
@Override
public void addSubView(View view) {
addSubView(view, null);
@@ -66,6 +90,11 @@ public class TopViewManager implements IMogoTopViewManager {
TopViewAnimHelper.getInstance().startTopOutAnim(view);
}
@Override
public void removeViewNoLinkage(View view) {
TopViewNoLinkageAnimHelper.getInstance().startTopOutAnim(view);
}
@Override
public void removeSubView(View view) {
TopViewAnimHelper.getInstance().removeSubView(view);
@@ -75,4 +104,9 @@ public class TopViewManager implements IMogoTopViewManager {
public boolean isViewAdded(View view) {
return TopViewAnimHelper.getInstance().isViewAdded(view);
}
@Override
public boolean isViewNoLinkageAdded(View view) {
return TopViewNoLinkageAnimHelper.getInstance().isViewAdded(view);
}
}

View File

@@ -0,0 +1,535 @@
package com.mogo.module.extensions.utils;
import android.animation.Animator;
import android.os.Handler;
import android.transition.AutoTransition;
import android.transition.Transition;
import android.transition.TransitionManager;
import android.util.ArrayMap;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Group;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.navi.TopView;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 顶部动画帮助类,与其他控件无关练
*
* @author tongchenfei
*/
public class TopViewNoLinkageAnimHelper {
private static final String TAG = "TopViewNoLinkageAnimHelper";
private ConstraintLayout topMotionLayout;
private Group remainTimeGroup, remainDistanceGroup, arriveTimeGroup;
private View naviBg;
private ImageView ivTurnIcon;
private TextView tvNextDistance;
private TextView tvNextRoad;
private TextView tvNextDistanceUnit;
private TextView tvTurnInfo;
private TopView topContainerNoLinkage;
private ConstraintSet constraintSet;
private Transition transition;
private TextView cameraMode;
private float topHeight = 0f;
private Handler handler = new Handler();
private TopViewNoLinkageAnimHelper() {
}
private volatile static TopViewNoLinkageAnimHelper instance = null;
public static TopViewNoLinkageAnimHelper getInstance() {
if (instance == null) {
synchronized (TopViewNoLinkageAnimHelper.class) {
if (instance == null) {
instance = new TopViewNoLinkageAnimHelper();
}
}
}
return instance;
}
private IMogoMapUIController mogoMapUIController;
public void setIMogoMapUIController(IMogoMapUIController mogoMapUIController) {
this.mogoMapUIController = mogoMapUIController;
}
public void init(ConstraintLayout rootView) {
init(rootView, null);
}
public void init(ConstraintLayout rootView, OnTopViewAnimSimpleListener listener) {
constraintSet = new ConstraintSet();
transition = new AutoTransition();
topMotionLayout = rootView;
naviBg = rootView.findViewById(R.id.module_map_id_navi_bg);
remainTimeGroup = rootView.findViewById(R.id.remainTimeGroup);
remainDistanceGroup = rootView.findViewById(R.id.remainDistanceGroup);
arriveTimeGroup = rootView.findViewById(R.id.arriveTimeGroup);
topContainerNoLinkage = rootView.findViewById(R.id.module_entrance_id_top_container_no_linkage);
tvNextDistanceUnit = rootView.findViewById(R.id.module_map_id_navi_next_info_distance_unit);
tvTurnInfo = rootView.findViewById(R.id.module_map_id_navi_next_info_turn_info);
topContainerNoLinkage.setSlideListener(this::startLatestTopOutAnim);
ivTurnIcon = rootView.findViewById(R.id.module_map_id_navi_next_info_road_turn_icon);
tvNextDistance = rootView.findViewById(R.id.module_map_id_navi_next_info_distance);
tvNextRoad = rootView.findViewById(R.id.module_map_id_navi_next_info_road);
transition.setDuration(200);
transition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
if (listener != null) {
listener.onAnimStart();
}
}
@Override
public void onTransitionEnd(Transition transition) {
// if (isTopViewOut) {
// topContainer.removeAllViews();
// }
if (listener != null) {
listener.onAnimEnd();
}
Logger.d(TAG, "onTransitionEnd: " + currentAnimatingView);
IMogoTopViewStatusListener listener;
if (isTopViewOut) {
int lastCount = topContainerNoLinkage.getChildCount();
for (int i = 0; i < lastCount; i++) {
View child = topContainerNoLinkage.getChildAt(i);
viewCaches.remove(child);
listener = statusListenerMap.remove(child);
if (listener != null) {
listener.onViewRemoved(child);
}
}
topContainerNoLinkage.removeAllViews();
} else {
listener = statusListenerMap.get(currentAnimatingView);
if (listener != null) {
listener.onViewAdded(currentAnimatingView);
}
}
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
cameraMode = rootView.findViewById(R.id.module_ext_id_north);
// 初始化默认隐藏导航
hideNaviView();
}
private volatile boolean isTopViewOut = true;
private List<View> viewCaches = new ArrayList<>();
private Map<View, IMogoTopViewStatusListener> statusListenerMap = new ArrayMap<>();
private View currentAnimatingView = null;
public void addSubView(View subView, LayoutParams params,
IMogoTopViewStatusListener statusListener) {
if (isTopViewOut || topContainerNoLinkage.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));
topContainerNoLinkage.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 (topContainerNoLinkage.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);
topContainerNoLinkage.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);
topContainerNoLinkage.removeView(subView);
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).start();
}
public void startTopInAnim(View view, LayoutParams params,
IMogoTopViewStatusListener statusListener) {
if (topMotionLayout == null) {
return;
}
Logger.d(TAG, "startTopInAnim=====" + isTopViewOut);
if (view == null) {
throw new IllegalArgumentException("method addTopView params view is null");
}
if (params == null) {
throw new IllegalArgumentException("method addTopView params LayoutParams is null");
}
if (!viewCaches.contains(view)) {
// 判断此view是否已经增加到了顶部view如果增加过就不增加了
view.setTranslationY(0);
statusListenerMap.put(view, statusListener);
Logger.d(TAG, "开始执行");
isTopViewOut = false;
if (topContainerNoLinkage.getChildCount() > 0) {
// 顶部view已经有了内容新增内容无需整体布局变化只是新增布局加个动画
viewCaches.add(view);
// 生硬的删掉之前的view
int lastCount = topContainerNoLinkage.getChildCount();
Logger.d(TAG, "进入动画lastCount: " + lastCount);
for (int i = 0; i < lastCount; i++) {
View lastView = topContainerNoLinkage.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());
topContainerNoLinkage.removeAllViews();
// 同时设置一下隐藏状态
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, false);
// 如果高度变化,生硬的变化一下高度
Logger.d(TAG, "container.height: " + topContainerNoLinkage.getHeight());
if (topContainerNoLinkage.getHeight() != params.height) {
constraintSet.clone(topMotionLayout);
LayoutParams p = topContainerNoLinkage.getLayoutParams();
p.height = params.height;
topContainerNoLinkage.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));
topContainerNoLinkage.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) {
}
@Override
public void onAnimationEnd(Animator animation) {
IMogoTopViewStatusListener listener = statusListenerMap.get(view);
if (listener != null) {
listener.onViewAdded(view);
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).start();
} else {
// 顶部view还没有内容需要整体下移
currentAnimatingView = view;
viewCaches.add(view);
topContainerNoLinkage.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);
}
topContainerNoLinkage.setChildAddedListener(child -> {
topContainerNoLinkage.setChildAddedListener(null);
constraintSet.clone(topMotionLayout);
constraintSet.clear(R.id.module_entrance_id_top_container_no_linkage,
ConstraintSet.BOTTOM);
constraintSet.connect(R.id.module_entrance_id_top_container_no_linkage, ConstraintSet.TOP,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
checkCameraModePosition(false);
constraintSet.applyTo(topMotionLayout);
int scene = Scene.AIMLESS_WITH_ROAD_EVENT;
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
});
}
}
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, true);
}
/**
* 退出最新的也就是最上面的view
*/
private void startLatestTopOutAnim() {
if (topContainerNoLinkage.getChildCount() > 1) {
removeSubView(topContainerNoLinkage.getChildAt(topContainerNoLinkage.getChildCount() - 1));
} else if (topContainerNoLinkage.getChildCount() > 0) {
startTopOutAnim(topContainerNoLinkage.getChildAt(topContainerNoLinkage.getChildCount() - 1));
}
}
public void startTopOutAnim(View view) {
if (topMotionLayout == null) {
return;
}
Logger.d(TAG, "startTopOutAnim=====");
if (!isTopViewOut && viewCaches.contains(view)) {
// 顶部view仅剩一个view需要整体上移
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewRemoveAnim(view);
}
isTopViewOut = true;
constraintSet.clone(topMotionLayout);
constraintSet.clear(R.id.module_entrance_id_top_container_no_linkage, ConstraintSet.TOP);
constraintSet.connect(R.id.module_entrance_id_top_container_no_linkage, ConstraintSet.BOTTOM,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
checkCameraModePosition(false);
constraintSet.applyTo(topMotionLayout);
int scene = Scene.AIMLESS;
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, false);
}
}
public void hideNaviView() {
if (topMotionLayout == null) {
return;
}
Logger.d(TAG, "hideNaviView=====");
setNaviVisibility(View.GONE);
remainDistanceGroup.setVisibility(View.GONE);
remainTimeGroup.setVisibility(View.GONE);
arriveTimeGroup.setVisibility(View.GONE);
int scene = 0;
if (isTopViewOut) {
scene = Scene.AIMLESS;
} else {
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
}
Logger.d(TAG, "hide navi setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
checkCameraModePosition(true);
}
private void checkCameraModePosition(boolean isNeedClone) {
if (isNeedClone) {
constraintSet.clone(topMotionLayout);
}
if (naviBg.getVisibility() == View.VISIBLE) {
constraintSet.connect(cameraMode.getId(), ConstraintSet.TOP, naviBg.getId(),
ConstraintSet.BOTTOM, (int) getDimen(R.dimen.dp_30));
} else {
if (isTopViewOut) {
constraintSet.connect(cameraMode.getId(), ConstraintSet.TOP, naviBg.getId(),
ConstraintSet.BOTTOM,
(int) getDimen(R.dimen.module_ext_north_goneMarginTop));
} else {
constraintSet.connect(cameraMode.getId(), ConstraintSet.TOP,
R.id.module_entrance_id_top_container_no_linkage,
ConstraintSet.BOTTOM,
(int) getDimen(R.dimen.dp_30));
}
}
if (isNeedClone) {
constraintSet.applyTo(topMotionLayout);
}
}
private float getDimen(int resId) {
return (int) topMotionLayout.getContext().getResources().getDimensionPixelSize(resId);
}
private int computeNaviMarginTop(int height) {
int result = (int) (height - (getDimen(R.dimen.module_ext_top_over_navi_height)) - getDimen(R.dimen.module_common_shadow_width_pos));
Logger.d(TAG, "computeNaviMarginTop: " + height + " result: " + result);
return result;
}
interface OnTopViewAnimSimpleListener {
void onAnimStart();
void onAnimEnd();
}
public boolean isViewAdded(View view) {
return viewCaches.contains(view);
}
private void setNaviVisibility(int visibility) {
ivTurnIcon.setVisibility(visibility);
tvNextRoad.setVisibility(visibility);
tvNextDistance.setVisibility(visibility);
remainTimeGroup.setVisibility(visibility);
remainDistanceGroup.setVisibility(visibility);
arriveTimeGroup.setVisibility(visibility);
naviBg.setVisibility(visibility);
tvNextDistanceUnit.setVisibility(visibility);
tvTurnInfo.setVisibility(visibility);
}
public void removeAllView() {
Logger.d(TAG, "remove all view");
isTopViewOut = true;
int lastCount = topContainerNoLinkage.getChildCount();
for (int i = 0; i < lastCount; i++) {
View child = topContainerNoLinkage.getChildAt(i);
viewCaches.remove(child);
IMogoTopViewStatusListener listener = statusListenerMap.remove(child);
if (listener != null) {
listener.beforeViewRemoveAnim(child);
listener.onViewRemoved(child);
}
}
topContainerNoLinkage.removeAllViews();
hideNaviView();
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
}
public void clear() {
topMotionLayout = null;
remainTimeGroup = null;
remainDistanceGroup = null;
arriveTimeGroup = null;
naviBg = null;
ivTurnIcon = null;
tvNextDistance = null;
tvNextRoad = null;
tvNextDistanceUnit = null;
tvTurnInfo = null;
topContainerNoLinkage = null;
cameraMode = null;
transition = null;
}
}

View File

@@ -64,6 +64,8 @@
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop"
tools:visibility="visible" />
<!--关联别的控件的头部容器-->
<com.mogo.module.extensions.navi.TopView
android:id="@+id/module_entrance_id_top_container"
android:layout_width="match_parent"
@@ -74,6 +76,17 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<!--没有关联别的控件的头部弹窗容器-->
<com.mogo.module.extensions.navi.TopView
android:id="@+id/module_entrance_id_top_container_no_linkage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<LinearLayout
android:id="@+id/module_ext_id_display_overview"
android:layout_width="@dimen/module_ext_button_width"

View File

@@ -93,6 +93,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
}
private void loadPoiTypeIconInUiThread(String url,int res) {
ivIcon.setImageResource(res);
if (!url.isEmpty()) {
ivIcon.setPlaceHolder(res);
ivIcon.setFailureHolder(res);
@@ -118,11 +119,6 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
Logger.e(TAG, "loadImageWithMarker onFailure.");
}
});
}else{
ivIcon.setImageResource(res);
}
if (mMarker != null) {
mMarker.setIcon(fromView(MapMarkerBaseView.this));
}
}

View File

@@ -48,25 +48,25 @@ public class V2XPushLiveCarScenario extends AbsV2XScenario<V2XPushMessageEntity>
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
boolean isWindowShow = V2XServiceManager.getMoGoV2XStatusManager().isLeftLiveVideoShow();
if (isWindowShow) {
close();
}
setV2XMessageEntity(v2XMessageEntity);
if (v2XMessageEntity != null &&
(v2XMessageEntity.getContent().getVideoSn() != null ||
!TextUtils.isEmpty(v2XMessageEntity.getContent().getVideoUrl()))) {
show();
if (!isSameScenario(v2XMessageEntity)
&& V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
boolean isWindowShow = V2XServiceManager.getMoGoV2XStatusManager().isLeftLiveVideoShow();
if (isWindowShow) {
close();
}
setV2XMessageEntity(v2XMessageEntity);
if (v2XMessageEntity != null &&
(v2XMessageEntity.getContent().getVideoSn() != null ||
!TextUtils.isEmpty(v2XMessageEntity.getContent().getVideoUrl()))) {
show();
} else {
TipToast.shortTip("附近没有可直播车机");
Logger.e(V2XConst.MODULE_NAME, "直播地址为null");
}
} else {
TipToast.shortTip("附近没有可直播车机");
Logger.e(V2XConst.MODULE_NAME, "直播地址为null");
setV2XMessageEntity(v2XMessageEntity);
Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
}
// if (!isSameScenario(v2XMessageEntity)
// && V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
// } else {
// setV2XMessageEntity(v2XMessageEntity);
// Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
// }
}
@Override
@@ -77,21 +77,16 @@ public class V2XPushLiveCarScenario extends AbsV2XScenario<V2XPushMessageEntity>
@Override
public void showWindow() {
if (getV2XWindow() != null) {
// ViewGroup.LayoutParams layoutParams =
// new ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT,
// (int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height));
// V2XServiceManager
// .getMogoTopViewManager()
// .addView(getV2XWindow().getView(), layoutParams, this);
// getV2XWindow().show(getV2XMessageEntity().getContent());
// V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, true);
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources()
.getDimension(R.dimen.v2x_video_window_height));
V2XServiceManager
.getIMogoWindowManager()
.addView(getV2XWindow().getView(), 0, 0, false);
.getMogoTopViewManager()
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true);
V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, true);
}
}

View File

@@ -70,8 +70,8 @@ public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V
pushVideoClose.setOnClickListener(v -> {
//移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(this);
.getMogoTopViewManager()
.removeViewNoLinkage(this);
});
}
@@ -144,8 +144,8 @@ public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V
// 移出Window详细信息
//移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(this);
.getMogoTopViewManager()
.removeViewNoLinkage(this);
};
} else {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);

View File

@@ -2,15 +2,16 @@ package com.mogo.module.v2x.scenario.scene.livecar;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventWindow;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
@@ -48,19 +49,13 @@ public class V2XRoadLiveCarScenario extends AbsV2XScenario<List<V2XEventShowEnti
try {
List<V2XEventShowEntity> v2XRoadEventEntity = v2XMessageEntity.getContent();
if (v2XRoadEventEntity != null) {
if (!isSameScenario(v2XMessageEntity)
&& V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
if (v2XMessageEntity.isShowState()) {
mV2XRoadLiveCarScenario.setV2XWindow(new V2XRoadLiveCarWindow());
setV2XMessageEntity(v2XMessageEntity);
show();
} else {
setV2XMessageEntity(v2XMessageEntity);
Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
close();
}
} else {
close();
}
} catch (Exception e) {
e.printStackTrace();
@@ -78,11 +73,16 @@ public class V2XRoadLiveCarScenario extends AbsV2XScenario<List<V2XEventShowEnti
public void showWindow() {
Log.d(TAG, getV2XWindow().toString());
if (getV2XWindow() != null) {
getV2XWindow().show(getV2XMessageEntity().getContent());
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources()
.getDimension(R.dimen.v2x_video_window_height));
V2XServiceManager
.getIMogoWindowManager()
.addView(getV2XWindow().getView(), 0, 0, false);
V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true);
.getMogoTopViewManager()
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, true);
}
}

View File

@@ -13,10 +13,10 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -195,8 +195,8 @@ public class V2XRoadLiveCarWindow extends RelativeLayout
//移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(this);
.getMogoTopViewManager()
.removeViewNoLinkage(this);
}
@Override

View File

@@ -178,7 +178,7 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
private void playLiveVideo(MarkerCarInfo.CarLiveInfo carLiveInfo) {
try {
if (mLivePlayer != null) {
mLivePlayer.startPlay(carLiveInfo.getVideoUrl(), TXLivePlayer.PLAY_TYPE_LIVE_RTMP);
mLivePlayer.startPlay("rtmp://58.200.131.2:1935/livetv/hunantv", TXLivePlayer.PLAY_TYPE_LIVE_RTMP);
mLivePlayer.setPlayListener(new ITXLivePlayListener() {
@Override
public void onPlayEvent(int event, Bundle bundle) {

View File

@@ -3,17 +3,19 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/v2x_alert_window_live_bg">
android:layout_height="wrap_content"
android:background="@drawable/v2x_alert_window_bg"
android:clipToPadding="false">
<com.mogo.module.v2x.view.V2XLiveGSYVideoView
android:id="@+id/videoPlayer"
android:layout_width="match_parent"
android:layout_height="@dimen/v2x_video_window_height"
android:layout_height="@dimen/v2x_video_window_height_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:roundLayoutRadius="@dimen/dp_30" />
<com.mogo.service.imageloader.MogoImageView
android:id="@+id/ivReportHead"

View File

@@ -3,10 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rlRoadEventDetail"
android:layout_width="match_parent"
android:layout_height="@dimen/v2x_video_window_height"
android:layout_marginLeft="@dimen/v2x_right_context_margin"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_25"
android:layout_height="@dimen/v2x_video_window_height_content"
android:clipToPadding="false">
<include
@@ -14,6 +11,7 @@
layout="@layout/item_v2x_live_video"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/pushVideoClose"
android:layout_width="wrap_content"

View File

@@ -4,11 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rlRoadEventDetail"
android:layout_width="match_parent"
android:layout_height="@dimen/v2x_video_window_height"
android:background="@drawable/v2x_alert_window_live_bg"
android:layout_marginLeft="@dimen/v2x_right_context_margin"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_30">
android:layout_height="@dimen/v2x_video_window_height_content"
android:clipToPadding="false">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvRoadEventList"
@@ -27,8 +24,8 @@
android:id="@+id/tvEventStubClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:background="@drawable/bg_count_down"
android:paddingLeft="@dimen/dp_12"
android:paddingTop="@dimen/dp_3"

View File

@@ -14,7 +14,7 @@
android:layout_marginTop="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_327"
android:background="#D9FFFFFF"
android:background="@drawable/module_v2x_shadow_bkg"
app:roundLayoutRadius="@dimen/dp_28">
<com.mogo.module.v2x.view.SimpleCoverVideoPlayer

View File

@@ -105,6 +105,7 @@
<!---->
<dimen name="v2x_right_context_margin">460px</dimen>
<dimen name="v2x_video_window_height_content">464px</dimen>
<dimen name="v2x_video_window_height">474px</dimen>
</resources>

View File

@@ -106,6 +106,7 @@
<!---->
<dimen name="v2x_right_context_margin">460px</dimen>
<dimen name="v2x_video_window_height_content">464px</dimen>
<dimen name="v2x_video_window_height">474px</dimen>
</resources>

View File

@@ -103,6 +103,7 @@
<!--适配直播框-->
<dimen name="v2x_right_context_margin">830px</dimen>
<dimen name="v2x_video_window_height_content">664px</dimen>
<dimen name="v2x_video_window_height">674px</dimen>

View File

@@ -42,6 +42,40 @@ public interface IMogoTopViewManager extends IProvider {
void addView(View view, ViewGroup.LayoutParams params,
IMogoTopViewStatusListener statusListener);
/**
* 在1/2屏添加一个view如果没显示会有动画
* 给了一个默认的LayoutParams(MatchParent,dp_350)
*
* @param view 增加的view
*/
void addViewNoLinkage(View view);
/**
* 在1/2屏添加一个view如果没显示会有动画,可通过设置监听来监听增加的view的状态
* 给了一个默认的LayoutParams(MatchParent,dp_350)
*
* @param statusListener 状态监听
* @param view 增加的view
*/
void addViewNoLinkage(View view, IMogoTopViewStatusListener statusListener);
/**
* 在1/2屏添加一个view如果没显示会有动画
* @param view 增加的view
* @param params 相关参数
*/
void addViewNoLinkage(View view, ViewGroup.LayoutParams params);
/**
* 在1/2屏添加一个view如果没显示会有动画可通过设置监听来监听增加的view的状态与其他控件没有联动
* @param view 增加的view
* @param params 相关参数
* @param statusListener 状态监听
*/
void addViewNoLinkage(View view, ViewGroup.LayoutParams params,
IMogoTopViewStatusListener statusListener);
/**
* 在1/2屏添加一个sub view叠加在主view上面显示
* 给了一个默认的LayoutParams(MatchParent,dp_350)
@@ -65,6 +99,12 @@ public interface IMogoTopViewManager extends IProvider {
*/
void removeView(View view);
/**
* 移除view如果是最后一个view会有移除动画
* @param view 待移除的 view
*/
void removeViewNoLinkage(View view);
/**
* 移除sub view
* @param view 待移除的sub view
@@ -77,4 +117,11 @@ public interface IMogoTopViewManager extends IProvider {
* @return true-已经添加 false-未添加
*/
boolean isViewAdded(View view);
/**
* 这个view是否已经被添加进了顶部布局
* @param view 待查询的view
* @return true-已经添加 false-未添加
*/
boolean isViewNoLinkageAdded(View view);
}