修改topview在vr模式下的位置
This commit is contained in:
@@ -37,7 +37,7 @@ public class MainIndependentActivity extends MainActivity {
|
||||
// 事件面板
|
||||
FrameLayout.LayoutParams eventPanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );
|
||||
eventPanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
|
||||
mEntrance.setLayoutParams( eventPanelParams );
|
||||
mEventPanel.setLayoutParams( eventPanelParams );
|
||||
|
||||
// 事件面板
|
||||
FrameLayout.LayoutParams historyMessagePanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -13,6 +14,8 @@ import com.mogo.module.extensions.utils.ExtensionsConfig;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -20,13 +23,15 @@ import com.mogo.utils.logger.Logger;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
|
||||
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener {
|
||||
private static final String TAG = "MainLauncherActivity";
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
ExtensionsConfig.setNeedRequestUserInfo( true );
|
||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
|
||||
StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,6 +94,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mServiceApis.getStatusManagerApi().unregisterStatusChangedListener(TAG,
|
||||
StatusDescriptor.VR_MODE, this);
|
||||
try {
|
||||
// acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
|
||||
Process.killProcess( Process.myPid() );
|
||||
@@ -110,4 +117,17 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
sendBroadcast( intent );
|
||||
Logger.d( TAG, "send msg to AI Voice" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (isTrue) {
|
||||
FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode );
|
||||
mEntrance.setLayoutParams( entranceParams );
|
||||
}else{
|
||||
FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_out_vr_mode );
|
||||
mEntrance.setLayoutParams( entranceParams );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >204px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
|
||||
</resources>
|
||||
@@ -79,6 +79,7 @@ import java.util.Random;
|
||||
|
||||
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
|
||||
import static com.mogo.module.common.utils.SPConst.getSpGuide;
|
||||
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
|
||||
@@ -170,6 +171,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
private boolean toggle = false;
|
||||
|
||||
private View mOnlineCarEntrance;
|
||||
private TextView tvEnterVrMode;
|
||||
private TextView tvExitVrMode;
|
||||
|
||||
private Runnable mLockCarRunnable = new Runnable() {
|
||||
@Override
|
||||
@@ -387,6 +390,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "APP_Find_Mogoer", properties );
|
||||
}
|
||||
} );
|
||||
tvEnterVrMode = findViewById(R.id.module_ext_enter_vr_mode);
|
||||
tvEnterVrMode.setOnClickListener((v)->{
|
||||
// 进入vr模式
|
||||
enterVrMode();
|
||||
});
|
||||
|
||||
tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode);
|
||||
tvExitVrMode.setOnClickListener((v)->{
|
||||
// 退出vr模式
|
||||
exitVrMode();
|
||||
});
|
||||
|
||||
dealWeatherContainer();
|
||||
|
||||
@@ -394,6 +408,28 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
debugCrashWarn();
|
||||
}
|
||||
|
||||
private void enterVrMode(){
|
||||
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, true);
|
||||
tvEnterVrMode.setVisibility(View.GONE);
|
||||
mMove2CurrentLocation.setVisibility(View.GONE);
|
||||
mUploadRoadCondition.setVisibility(View.GONE);
|
||||
mWeatherContainer.setVisibility(View.GONE);
|
||||
mMsgContainer.setVisibility(View.GONE);
|
||||
|
||||
tvExitVrMode.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void exitVrMode(){
|
||||
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, false);
|
||||
tvEnterVrMode.setVisibility(View.VISIBLE);
|
||||
mMove2CurrentLocation.setVisibility(View.VISIBLE);
|
||||
mUploadRoadCondition.setVisibility(View.VISIBLE);
|
||||
// mWeatherContainer.setVisibility(View.VISIBLE);
|
||||
// mMsgContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
tvExitVrMode.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void debugCrashWarn(){
|
||||
thresholdSetContainer = findViewById(R.id.thresholdSetContainer);
|
||||
topEditC = findViewById(R.id.etTopC);
|
||||
@@ -649,8 +685,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mMogoNavi = mService.getNavi(getContext());
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoNaviListener(TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoMapListener(TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener(TAG, this);
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager(getContext());
|
||||
@@ -817,6 +853,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
@Override
|
||||
public void renderWeatherInfo(String temp, String desc, int iconId) {
|
||||
if(mApis.getStatusManagerApi().isVrMode()){
|
||||
return;
|
||||
}
|
||||
boolean hidden = false;
|
||||
if (iconId != 0) {
|
||||
mWeatherIcon.setImageResource(iconId);
|
||||
@@ -833,6 +872,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
@Override
|
||||
public void renderMsgInfo(boolean hasMsg, int amount) {
|
||||
if (mApis.getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
mMsgContainer.setVisibility(hasMsg ? View.VISIBLE : View.GONE);
|
||||
mMsgCounter.setText(amount > MAX_DISPLAY_MSG_AMOUNT ?
|
||||
getString(R.string.module_ext_str_dots) : String.valueOf(amount));
|
||||
@@ -954,8 +996,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mMogoRegisterCenter != null) {
|
||||
mMogoRegisterCenter.unregisterMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoNaviListener(TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoMapListener(TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoAimlessModeListener(TAG);
|
||||
}
|
||||
if (mStatusManager != null) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
<View
|
||||
android:id="@+id/module_map_id_navi_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/module_ext_navi_info_panel_width"
|
||||
android:layout_height="@dimen/module_ext_navi_info_panel_height"
|
||||
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
|
||||
android:focusable="true"
|
||||
|
||||
@@ -61,13 +61,12 @@
|
||||
|
||||
<com.mogo.module.extensions.navi.TopView
|
||||
android:id="@+id/module_entrance_id_top_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/module_ext_top_view_width"
|
||||
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" />
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_ext_id_display_overview"
|
||||
@@ -101,6 +100,20 @@
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_enter_vr_mode"
|
||||
android:layout_marginRight="@dimen/module_common_shadow_width_pos"
|
||||
android:layout_width="@dimen/module_ext_operation_panel_share_width"
|
||||
android:layout_height="@dimen/module_ext_operation_panel_share_height"
|
||||
android:background="@drawable/module_ext_dw_upload_road_condition_bkg"
|
||||
android:text="VR"
|
||||
android:textSize="@dimen/module_ext_enter_vr_mode_text_size"
|
||||
android:textColor="#fff"
|
||||
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_move2_current_location"
|
||||
app:layout_constraintBottom_toTopOf="@+id/module_entrance_id_move2_current_location"
|
||||
android:layout_marginBottom="@dimen/module_ext_enter_vr_mode_margin_bottom"
|
||||
android:gravity="center"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/module_entrance_id_move2_current_location"
|
||||
android:layout_width="@dimen/module_ext_operation_panel_width"
|
||||
@@ -111,6 +124,20 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_exit_vr_mode"
|
||||
android:layout_width="@dimen/module_ext_operation_panel_width"
|
||||
android:layout_height="@dimen/module_ext_operation_panel_move2_height"
|
||||
android:text="退出"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/module_ext_shadow_bkg"
|
||||
android:textSize="@dimen/module_ext_exit_vr_mode_text_size"
|
||||
android:textColor="#fff"
|
||||
android:gravity="center" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_entrance_id_upload_road_condition"
|
||||
android:layout_width="@dimen/module_ext_operation_panel_share_width"
|
||||
@@ -268,6 +295,7 @@
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="btnShowDrawableTipNoSize,btnShowDrawableTip,btnShowTextTip,btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView,btnDebugAddBottomLayerView" />
|
||||
|
||||
<include layout="@layout/module_ext_layout_crash_threshold_set" />
|
||||
<include layout="@layout/module_ext_layout_crash_threshold_set"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -78,7 +78,8 @@
|
||||
<dimen name="module_ext_user_img_height">103px</dimen>
|
||||
|
||||
<!-- module_map_layout_navi_info_panel.xml-->
|
||||
<dimen name="module_ext_navi_info_panel_width">1058px</dimen>
|
||||
<dimen name="module_ext_top_view_width">1058px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_width">1038px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_height">210px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_small_height">144px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_width">159px</dimen>
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<dimen name="module_ext_user_img_height">56px</dimen>
|
||||
|
||||
<!-- module_map_layout_navi_info_panel.xml-->
|
||||
<dimen name="module_ext_top_view_width">1058px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_width">544px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_height">117px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_small_height">80px</dimen>
|
||||
@@ -162,4 +163,8 @@
|
||||
<dimen name="module_ext_destination_online_car_paddingRight">14px</dimen>
|
||||
|
||||
<dimen name="module_common_shadow_width_pos">8px</dimen>
|
||||
<dimen name="module_ext_enter_vr_mode_text_size">44px</dimen>
|
||||
<dimen name="module_ext_exit_vr_mode_text_size">30px</dimen>
|
||||
<dimen name="module_ext_exit_vr_mode_width">120px</dimen>
|
||||
<dimen name="module_ext_enter_vr_mode_margin_bottom">170px</dimen>
|
||||
</resources>
|
||||
@@ -12,6 +12,7 @@ import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.v2x.R
|
||||
import com.mogo.module.v2x.V2XConst.MODULE_NAME
|
||||
import com.mogo.module.v2x.V2XServiceManager
|
||||
@@ -22,6 +23,8 @@ import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView
|
||||
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener
|
||||
import com.mogo.module.v2x.voice.V2XVoiceConstants
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
|
||||
@@ -30,7 +33,7 @@ import com.mogo.utils.logger.Logger
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>() {
|
||||
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>(),IMogoStatusChangedListener {
|
||||
|
||||
private val TAG = "EventPanelFragment"
|
||||
|
||||
@@ -178,6 +181,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val x = resources.getDimensionPixelSize(if (DebugConfig.isLauncher()) {
|
||||
R.dimen.module_v2x_event_panel_in_launcher_btn_x
|
||||
} else {
|
||||
@@ -186,13 +190,23 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
val y = resources.getDimensionPixelSize(R.dimen.module_v2x_event_panel_btn_y)
|
||||
V2XServiceManager.getMogoEntranceButtonController()
|
||||
.addBottomLayerView(mV2XEventPanelHistoryCountView, x, y)
|
||||
|
||||
mV2XEventPanelHistoryCountView?.visibility = if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
|
||||
View.GONE
|
||||
}else{
|
||||
View.VISIBLE
|
||||
}
|
||||
changeEventCount()
|
||||
|
||||
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this)
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
MogoApisHandler.getInstance().apis.statusManagerApi.unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this)
|
||||
mediator?.detach()
|
||||
// 避免内存泄漏
|
||||
fragment = null
|
||||
@@ -246,4 +260,13 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
// mV2XEventPanelHistoryCountView?.changeMsgCount(0)
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
|
||||
if (isTrue) {
|
||||
// 在vr模式
|
||||
mV2XEventPanelHistoryCountView?.visibility = View.GONE
|
||||
}else{
|
||||
mV2XEventPanelHistoryCountView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,12 @@ import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.alarm.V2XAlarmServer;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
|
||||
import com.mogo.module.v2x.utils.LocationUtils;
|
||||
import com.mogo.module.v2x.utils.MarkerUtils;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.module.v2x.utils.TrackUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -165,6 +167,10 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
|
||||
v2XMessageEntity.setShowState(true);
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
}
|
||||
if (!ObuConfig.useObuLocation) {
|
||||
// 绿波车速引导刷新划线
|
||||
V2XObuEventScenario.getInstance().updateLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
public MogoLocation getLastCarLocation() {
|
||||
|
||||
Reference in New Issue
Block a user