opt 事件面板按钮不出现问题

This commit is contained in:
tongchenfei
2020-09-01 18:40:05 +08:00
parent a19a655957
commit 88e34b83e6
7 changed files with 61 additions and 12 deletions

View File

@@ -2,6 +2,8 @@ package com.mogo.module.extensions.bean;
import android.view.View;
import java.util.Objects;
/**
* 底层view封装
*
@@ -12,7 +14,8 @@ public class BottomLayerViewWrapper {
private int x;
private int y;
public BottomLayerViewWrapper(){}
public BottomLayerViewWrapper() {
}
public BottomLayerViewWrapper(View view, int x, int y) {
this.view = view;
@@ -20,6 +23,25 @@ public class BottomLayerViewWrapper {
this.y = y;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BottomLayerViewWrapper wrapper = (BottomLayerViewWrapper) o;
return x == wrapper.x &&
y == wrapper.y &&
view.equals(wrapper.view);
}
@Override
public int hashCode() {
return Objects.hash(view);
}
public View getView() {
return view;
}

View File

@@ -58,12 +58,26 @@ public class EntranceViewHolder {
"\n x: " + x + ", y: " + y);
BottomLayerViewWrapper wrapper = new BottomLayerViewWrapper(view, x, y);
if(rootViewGroup == null) {
preAddView.add(wrapper);
if(!preAddView.contains(wrapper)) {
preAddView.add(wrapper);
}
}else{
realAddView(wrapper);
if(!containView(view)) {
realAddView(wrapper);
}
}
}
private boolean containView(View view) {
int count = rootViewGroup.getChildCount();
for (int i = 0; i < count; i++) {
if(rootViewGroup.getChildAt(i).equals(view)){
return true;
}
}
return false;
}
/**
* 使用的时候需要预先判断rootViewGroup是否为空本方法默认rootViewGroup不为空
*/

View File

@@ -14,7 +14,8 @@
<include
layout="@layout/include_navi_info_panle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/module_ext_id_north"

View File

@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<LinearLayout
android:id="@+id/module_ext_id_weather_container"
android:layout_width="wrap_content"
android:layout_height="@dimen/module_ext_height"
android:layout_marginEnd="@dimen/module_ext_weather_margin_end"
app:layout_goneMarginEnd="0dp"
android:background="@drawable/module_ext_drawable_weather_bkg"
android:gravity="center"
android:paddingStart="@dimen/module_ext_weather_container_paddingLeft"
android:paddingEnd="@dimen/module_ext_weather_container_paddingRight"
android:layout_marginEnd="@dimen/module_ext_msg_marginRight"
android:visibility="invisible"
app:layout_constraintRight_toLeftOf="@+id/module_ext_id_msg"
app:layout_constraintRight_toLeftOf="@+id/ivUserHeadImg"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
@@ -36,13 +37,14 @@
android:id="@+id/module_ext_id_msg"
android:layout_width="@dimen/module_ext_height"
android:layout_height="@dimen/module_ext_height"
android:layout_marginStart="@dimen/module_ext_notice_margin_start"
android:layout_marginEnd="@dimen/module_ext_msg_marginRight"
android:background="@drawable/module_ext_drawable_msg_container_bkg"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/ivUserHeadImg"
app:layout_constraintRight_toLeftOf="@+id/ivUserHeadImg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/ivUserHeadImg"
tools:visibility="gone">
tools:visibility="visible">
<ImageView
android:layout_width="wrap_content"
@@ -70,8 +72,8 @@
android:layout_width="@dimen/module_ext_height"
android:layout_height="@dimen/module_ext_height"
android:src="@drawable/model_ext_default_user_head"
app:layout_constraintBottom_toBottomOf="@+id/module_ext_id_weather_container"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_ext_id_weather_container"
app:layout_constraintBottom_toBottomOf="@+id/module_ext_id_weather_container"
tools:visibility="gone"/>
tools:visibility="visible" />
</merge>

View File

@@ -144,4 +144,6 @@
<dimen name="module_ext_display_overview_icon_marginTop">20px</dimen>
<dimen name="module_ext_top_over_navi_height">34px</dimen>
<dimen name="module_ext_notice_margin_start">175px</dimen>
<dimen name="module_ext_weather_margin_end">485px</dimen>
</resources>

View File

@@ -60,6 +60,8 @@
<dimen name="module_ext_paddingRight">32px</dimen>
<dimen name="module_ext_paddingLeft">32px</dimen>
<dimen name="module_ext_notice_margin_start">98px</dimen>
<dimen name="module_ext_voice_textSize">22px</dimen>
<dimen name="module_ext_time_textSize">28px</dimen>
<dimen name="module_ext_date_marginRight">22px</dimen>
@@ -148,4 +150,6 @@
<dimen name="module_ext_display_overview_icon_marginTop">10px</dimen>
<dimen name="module_ext_top_over_navi_height">19px</dimen>
<dimen name="module_ext_weather_margin_end">231px</dimen>
</resources>

View File

@@ -131,13 +131,17 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
showPanel()
}
}
V2XServiceManager.getMogoEntranceButtonController().addBottomLayerView(mV2XEventPanelHistoryCountView)
changeEventCount()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onResume() {
super.onResume()
V2XServiceManager.getMogoEntranceButtonController().addBottomLayerView(mV2XEventPanelHistoryCountView)
}
override fun onDestroyView() {
mediator?.detach()
super.onDestroyView()