This commit is contained in:
lixiaopeng
2020-11-20 12:28:23 +08:00
parent 81ca0b9467
commit 32ff2cf6b3
4 changed files with 129 additions and 47 deletions

View File

@@ -6,15 +6,21 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.adapter.holder.V2XSurroundingDetailVH;
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.view.HeartLikeView;
import com.mogo.module.v2x.view.HeartUnLikeView;
import com.mogo.utils.DateTimeUtils;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -26,10 +32,12 @@ import java.util.List;
public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroundingDetailVH> {
private List<MarkerExploreWay> markerExploreWays;
private Context mContext;
private ImageView mTypeImageView;
private TextView mTypeTv;
private TextView mAddressTv;
private TextView mUserNameTv;
private TextView mTimeTv;
private HeartLikeView mHeartLikeView;
private HeartUnLikeView mUnHeartLikeView;
public V2XSurroundingDetailAdapter(Context context, List<MarkerExploreWay> list) {
@@ -57,18 +65,52 @@ public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroun
return;
}
// mTypeImageView = holder.itemView.findViewById(R.id.iv_event_type);
mTypeTv = holder.itemView.findViewById(R.id.surrounding_road_type);
mAddressTv = holder.itemView.findViewById(R.id.surrounding_road_type_address);
mUserNameTv = holder.itemView.findViewById(R.id.surrounding_username);
mTimeTv = holder.itemView.findViewById(R.id.surrounding_time);
mTypeTv = holder.itemView.findViewById(R.id.surrounding_road_type);
mHeartLikeView = holder.itemView.findViewById(R.id.surrounding_road_like);
mUnHeartLikeView = holder.itemView.findViewById(R.id.surrounding_road_unlike);
mUserNameTv.setText( exploreWay.getUserInfo() != null ? ("用户" + exploreWay.getUserInfo().getUserName() + "分享") : "蘑菇用户分享");
mTypeTv.setText(getTypeName(exploreWay.getPoiType()));
mAddressTv.setText(exploreWay.getAddr());
mTimeTv.setText(DateTimeUtils.getTimeText(exploreWay.getGenerateTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm));
// mTypeImageView.setBackgroundResource(getTypeSmallRes(surroundingConstruction.getPoiType()));
mHeartLikeView.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
roadReportTrue(exploreWay);
});
mUnHeartLikeView.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
roadReportErr(exploreWay);
});
}
/**
* 反馈路况正确
*/
private void roadReportTrue(MarkerExploreWay exploreWay) {
if (exploreWay != null) {
RoadConditionUtils.sendShareReceiverInfo(
exploreWay.getInfoId(),
exploreWay.getPoiType(),
2);
}
}
/**
* 反馈路况错误
*/
private void roadReportErr(MarkerExploreWay exploreWay) {
if (exploreWay != null) {
RoadConditionUtils.sendShareReceiverInfo(
exploreWay.getInfoId(),
exploreWay.getPoiType(),
3);
}
}
@Override
public int getItemCount() {
@@ -113,4 +155,6 @@ public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroun
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -167,33 +167,35 @@
<ImageView
android:id="@+id/back_image"
android:layout_width="25px"
android:layout_height="25px"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:src="@drawable/v2x_back_image"
android:layout_marginLeft="@dimen/module_v2x_surrounding_margin_left"
android:src="@drawable/icon_report_err" />
android:layout_width="43px"
android:layout_height="43px"/>
<TextView
android:id="@+id/tv_brief_detail"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_marginLeft="10px"
android:layout_toRightOf="@+id/back_image"
android:layout_centerVertical="true"
android:layout_marginTop="8px"
android:layout_marginLeft="19px"
android:text="周围5公里共15条交通信息"
android:textColor="@color/v2x_white"
android:textSize="@dimen/module_v2x_surrounding_top_textsize" />
android:textSize="18px" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/surrounding_detail_recycleview"
android:layout_marginTop="30dp"
android:layout_marginLeft="@dimen/module_v2x_surrounding_margin_left"
android:layout_marginRight="@dimen/module_v2x_surrounding_margin_left"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:visibility="visible" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -1,53 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/surrounding_road_type_item"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/surrounding_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_50"
android:layout_marginRight="@dimen/dp_50"
android:layout_marginBottom="@dimen/dp_14"
android:background="@drawable/bg_v2x_event_list_item">
<TextView
android:id="@+id/surrounding_road_type"
android:layout_width="wrap_content"
android:id="@+id/surrounding_road_type_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20px"
android:layout_marginTop="20px"
android:background="@drawable/bg_v2x_event_type_read"
android:gravity="center"
android:paddingLeft="6px"
android:paddingTop="3px"
android:paddingRight="6px"
android:paddingBottom="3px"
android:text="道路类型"
android:textColor="@color/v2x_white"
android:textSize="@dimen/panel_list_item_title_size" />
android:layout_marginTop="@dimen/dp_24"
android:layout_marginRight="@dimen/dp_30"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/v2x_FFF_333"
android:textSize="18px"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/surrounding_road_like"
app:layout_constraintStart_toStartOf="@id/surrounding_road_type"
app:layout_constraintTop_toTopOf="parent"
tools:text="小黄庄北街与北三环辅路交叉口小黄庄北街与北三环辅路交叉口" />
<TextView
android:id="@+id/surrounding_road_type_address"
android:id="@+id/surrounding_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/surrounding_road_type"
android:ellipsize="end"
android:layout_marginLeft="20px"
android:layout_marginTop="12px"
android:textStyle="bold"
android:lines="1"
android:textColor="@color/v2x_FFF_333"
android:textSize="@dimen/share_item_address" />
android:alpha="0.6"
android:textColor="@color/v2x_FFF_666"
android:textSize="16px"
android:layout_marginStart="@dimen/dp_36"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/surrounding_road_type_address"
tools:text="赵云" />
<TextView
android:id="@+id/surrounding_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/surrounding_road_type_address"
android:layout_alignLeft="@id/surrounding_road_type"
android:layout_marginTop="@dimen/dp_3"
android:layout_marginBottom="@dimen/dp_24"
android:alpha="0.5"
android:gravity="left"
android:alpha="0.6"
android:textColor="@color/v2x_FFF_666"
android:textSize="@dimen/share_item_text_size" />
</RelativeLayout>
android:textSize="16px"
android:layout_marginStart="@dimen/dp_80"
app:layout_constraintStart_toStartOf="@+id/surrounding_username"
app:layout_constraintTop_toBottomOf="@+id/surrounding_road_type_address"
tools:text="2020-1-12" />
<TextView
android:id="@+id/surrounding_road_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_36"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_36"
android:background="@drawable/bg_v2x_event_type_read"
android:gravity="center"
android:paddingLeft="5px"
android:paddingTop="3px"
android:paddingRight="5px"
android:paddingBottom="3px"
android:text="违章停车"
android:textColor="#ffffff"
android:textSize="14px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/surrounding_username" />
<com.mogo.module.v2x.view.HeartLikeView
android:id="@+id/surrounding_road_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_40"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/surrounding_road_unlike"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.module.v2x.view.HeartUnLikeView
android:id="@+id/surrounding_road_unlike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="26px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>