From 01d90428870af03452a997afe00b82174f8e9493 Mon Sep 17 00:00:00 2001 From: renwj Date: Wed, 8 Mar 2023 19:52:11 +0800 Subject: [PATCH] =?UTF-8?q?[dev=5Farch=5Fopt=5F3.0]=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E4=BA=91=E9=80=9A=E8=AF=9D=E7=AA=97=E5=8F=A3=E8=A2=AB=E9=81=AE?= =?UTF-8?q?=E6=8C=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...hatting_launcher_calling_hawk_eye_view.xml | 2 - .../eagle/core/function/main/MainActivity.kt | 41 ++++++++++++++----- .../res/layout/module_main_activity_main.xml | 18 ++------ 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml index 13272210f3..311f50e690 100644 --- a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml @@ -13,7 +13,6 @@ android:id="@+id/module_carchatting_call_head" android:layout_width="@dimen/module_call_chat_calling_iv_hawk_eye_width_height" android:layout_height="@dimen/module_call_chat_calling_iv_hawk_eye_width_height" - android:scaleType="centerInside" android:src="@mipmap/module_carchatting_hawk_eye_default_head_img" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -25,7 +24,6 @@ android:layout_width="@dimen/module_call_chat_hawk_eye_circle_btn_size" android:layout_height="@dimen/module_call_chat_hawk_eye_circle_btn_size" android:layout_marginEnd="@dimen/module_call_chat_calling_iv_hawk_eye_margin_left_right" - android:scaleType="centerInside" android:src="@mipmap/module_carchatting_launcher_calling_hangup" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.kt index c7d20aea1f..c0ace51269 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.kt @@ -73,10 +73,10 @@ open class MainActivity : MvpActivity(), MainView, } override fun initViews() { + injectFloatView() injectStatusBar() window.setBackgroundDrawable(null) initConnectInfoRV() - FloatingViewHandler.init(module_main_id_floating_view) CallerHmiManager.init(this) //申请悬浮窗权限 @@ -90,23 +90,42 @@ open class MainActivity : MvpActivity(), MainView, } private fun injectStatusBar() { - val decorView = this.window.decorView as FrameLayout + val decorView = this.window.decorView as? FrameLayout ?: return val contentView = - (decorView.findViewById(android.R.id.content) as ViewGroup).getChildAt(0) + (decorView.findViewById(android.R.id.content) as? ViewGroup)?.getChildAt(0) ?: return contentView.fitsSystemWindows = false decorView.clipToPadding = false var statusBarView = decorView.findViewWithTag("status_bar") if (statusBarView == null) { statusBarView = statusBar - statusBarView.setTag("status_bar") + statusBarView.tag = "status_bar" + val params = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT, + ) + params.topMargin = 0 + params.gravity = Gravity.TOP + decorView.addView(statusBarView, params) + } + } + + private fun injectFloatView() { + val decorView = this.window.decorView as? FrameLayout ?: return + val contentView = + (decorView.findViewById(android.R.id.content) as? ViewGroup)?.getChildAt(0) ?: return + contentView.fitsSystemWindows = false + decorView.clipToPadding = false + var floatContainer = decorView.findViewWithTag("float_container") + if (floatContainer == null) { + floatContainer = FrameLayout(this) + floatContainer.tag = "float_container" + FloatingViewHandler.init(floatContainer) + val params = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT, + ) + decorView.addView(floatContainer, params) } - val statusBarLP = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT, - ) - statusBarLP.topMargin = 0 - statusBarLP.gravity = Gravity.TOP - decorView.addView(statusBarView, statusBarLP) } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml index 96184c4e54..0b1e1b60cd 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml @@ -6,23 +6,11 @@ android:background="@drawable/main_splash_bg" android:orientation="vertical"> + - - - - - - - - + android:layout_height="match_parent" />