增加了VR模式的适配方案 VH 采用三木运算判断当前模式,动态加载不同layout
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -83,6 +83,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -56,6 +56,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
*/
|
||||
public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private static final String TAG = "V2XRoadEventVH";
|
||||
private static final boolean isVrMap = false;
|
||||
private MogoImageView ivEventImg;
|
||||
private MogoImageView ivReportHead;
|
||||
private ImageView ivEventPlay;
|
||||
@@ -138,7 +139,10 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
}
|
||||
|
||||
public V2XRoadEventVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false));
|
||||
super(isVrMap ?
|
||||
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false) :
|
||||
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false)
|
||||
);
|
||||
init(itemView);
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:background="@drawable/v2x_alert_window_bg"
|
||||
app:roundLayoutRadius="@dimen/dp_30">
|
||||
|
||||
<com.mogo.module.v2x.view.RoundLayout
|
||||
android:id="@+id/rlRoadEventImg"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/v2x_555A_F5F5"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:roundLayoutRadius="@dimen/dp_18">
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/ivEventImg"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:scaleType="center"
|
||||
app:miv_failureHolder="@drawable/v2x_icon_live_logo"
|
||||
app:miv_overlayImageId="@drawable/v2x_icon_live_logo"
|
||||
app:miv_placeHolder="@drawable/v2x_icon_live_logo" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventPlay"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/v2x_icon_event_play"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvEventTypeTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/ivEventImg"
|
||||
android:background="@drawable/bg_v2x_event_type_blue"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_10"
|
||||
android:paddingTop="@dimen/dp_3"
|
||||
android:paddingRight="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_3"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/module_v2x_event_type_title_text_size"
|
||||
tools:text="道路施工" />
|
||||
</com.mogo.module.v2x.view.RoundLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvEventAddress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:layout_marginRight="@dimen/dp_30"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textSize="@dimen/module_v2x_event_title_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rlRoadEventImg"
|
||||
app:layout_constraintStart_toEndOf="@+id/rlRoadEventImg"
|
||||
app:layout_constraintTop_toTopOf="@+id/rlRoadEventImg"
|
||||
tools:text="东城区北三环中路辅路小黄庄路口" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventDistanceLogo"
|
||||
android:layout_width="@dimen/dp_35"
|
||||
android:layout_height="@dimen/dp_35"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:src="@drawable/v2x_icon_help_navi"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvEventAddress" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvEventDistance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:alpha="0.6"
|
||||
android:textColor="@color/v2x_FFF_666"
|
||||
android:textSize="@dimen/module_v2x_event_sub_title_text_size"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivEventDistanceLogo"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventDistanceLogo"
|
||||
app:layout_constraintTop_toTopOf="@id/ivEventDistanceLogo"
|
||||
tools:text="距离 300m" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvEventTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:alpha="0.6"
|
||||
android:textColor="@color/v2x_FFF_999"
|
||||
android:textSize="@dimen/module_v2x_event_sub_title_text_size"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivEventDistanceLogo"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvEventDistance"
|
||||
app:layout_constraintTop_toTopOf="@id/ivEventDistanceLogo"
|
||||
tools:text="2020/01/02 12:54" />
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/ivEventHead"
|
||||
android:layout_width="@dimen/module_v2x_event_head_size"
|
||||
android:layout_height="@dimen/module_v2x_event_head_size"
|
||||
android:layout_marginEnd="@dimen/dp_28"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:miv_borderColor="#4cffffff"
|
||||
app:miv_failureHolder="@drawable/icon_default_user_head"
|
||||
app:miv_overlayImageId="@drawable/icon_default_user_head"
|
||||
app:miv_placeHolder="@drawable/icon_default_user_head"
|
||||
app:miv_shape="circle"
|
||||
app:miv_shapeBorderWidth="@dimen/dp_4" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventLive"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size_detail"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size_detail"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:src="@drawable/selector_live_btn"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventReportTrue"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size_detail"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size_detail"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/v2x_selector_icon_report_true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivEventLive"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventLive"
|
||||
app:layout_goneMarginLeft="@dimen/dp_10"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventReportErr"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size_detail"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size_detail"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:src="@drawable/v2x_selector_icon_report_err"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivEventLive"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventReportTrue"
|
||||
app:layout_goneMarginLeft="@dimen/dp_10"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventCallChart"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size_detail"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size_detail"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:src="@drawable/selector_talk_btn"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivEventLive"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventReportErr"
|
||||
app:layout_goneMarginLeft="@dimen/dp_10"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventEventNav"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size_detail"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size_detail"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:src="@drawable/selector_nav_btn"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivEventLive"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventCallChart"
|
||||
app:layout_goneMarginLeft="@dimen/dp_10"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.mogo.module.v2x.view.HeartLikeView
|
||||
android:id="@+id/ivEventZan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivEventLive"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventEventNav"
|
||||
app:layout_goneMarginLeft="@dimen/dp_10"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user