opt
This commit is contained in:
@@ -1,21 +1,34 @@
|
||||
package com.mogo.module.v2x.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amap.api.maps.model.Text;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 周边
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEventViewHolder>{
|
||||
private List<SurroundingResponse.ResultBean.PoiInfosBean> mPoiInfosList;
|
||||
private Context mContext;
|
||||
private TextView mAddressTv;
|
||||
|
||||
//TODO 数据
|
||||
public SurroundingEventAdapter(Context context) {
|
||||
|
||||
public SurroundingEventAdapter(Context context, List<SurroundingResponse.ResultBean.PoiInfosBean> poiInfosList) {
|
||||
mContext = context;
|
||||
mPoiInfosList = poiInfosList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,21 +39,24 @@ public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEve
|
||||
@NonNull
|
||||
@Override
|
||||
public SurroundingEventViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
return null;
|
||||
View inflate = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.module_fragment_surrounding_event_item, parent, false);
|
||||
return new SurroundingEventViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SurroundingEventViewHolder holder, int position) {
|
||||
final SurroundingResponse.ResultBean.PoiInfosBean poiInfosBean = mPoiInfosList.get(position);
|
||||
if (poiInfosBean == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// mAddressTv = holder.itemView.findViewById(R.id.tv_information);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
return mPoiInfosList == null ? 0 : mPoiInfosList.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.mogo.module.v2x.fragment;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
@@ -15,27 +18,47 @@ import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
|
||||
import com.mogo.module.v2x.view.SurroundingEventView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.view.View.OVER_SCROLL_NEVER;
|
||||
|
||||
/**
|
||||
* 周边事件
|
||||
*/
|
||||
public class SurroundingEventFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView {
|
||||
|
||||
private static final String TAG = "SurroundingEventFragment";
|
||||
private RecyclerView recyclerView;
|
||||
private View view;
|
||||
private static final String TAG = "SurroundingFragment";
|
||||
private RecyclerView mRecyclerView;
|
||||
private RelativeLayout mEmptyLayout;
|
||||
private TextView mShareTv;
|
||||
private TextView mFreshTv;
|
||||
private SurroundingEventAdapter mAdapter;
|
||||
private SurroundingEventPresenter surroundingEventPresenter;
|
||||
private List<SurroundingResponse.ResultBean.PoiInfosBean> poiInfosList = new ArrayList<>();
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_event_panel_fragment_surrounding_event;
|
||||
return R.layout.module_event_panel_fragment_surrounding;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
Log.d("liyz", "initViews --------> ");
|
||||
initRecyclerView();
|
||||
mRecyclerView = findViewById(R.id.surrounding_recycleview);
|
||||
mEmptyLayout = findViewById(R.id.layout_empty_data_show);
|
||||
mShareTv = findViewById(R.id.tv_main_share);
|
||||
mFreshTv = findViewById(R.id.tv_main_refresh);
|
||||
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 1);
|
||||
mRecyclerView.setLayoutManager(layoutManage);
|
||||
|
||||
mAdapter = new SurroundingEventAdapter(getActivity(), poiInfosList); //TODO
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
initData();
|
||||
|
||||
}
|
||||
@@ -54,15 +77,9 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
|
||||
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
// recyclerView = view.findViewById(R.id.c);
|
||||
// mAdapter = new SurroundingEventAdapter(getActivity()); //TODO
|
||||
// recyclerView.setAdapter(mAdapter);
|
||||
// LinearLayoutManager linearLayoutManager =
|
||||
// new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
// recyclerView.setLayoutManager(linearLayoutManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取和刷新数据
|
||||
*/
|
||||
private void initData() {
|
||||
surroundingEventPresenter.getSurroundingEventData();
|
||||
}
|
||||
@@ -73,14 +90,31 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
|
||||
@Override
|
||||
public void showSurroudingData(SurroundingResponse data) {
|
||||
if (data.getResult() != null) {
|
||||
SurroundingResponse.ResultBean resultBean = data.getResult();
|
||||
SurroundingResponse.ResultBean resultBean = data.getResult();
|
||||
if (resultBean != null && resultBean.getPoiInfos() != null && resultBean.getPoiInfos().size() > 0) {
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
|
||||
poiInfosList.clear();
|
||||
poiInfosList.addAll(resultBean.getPoiInfos());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (poiInfosList != null) {
|
||||
poiInfosList.clear();
|
||||
poiInfosList = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,4 +122,5 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androud="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:background="@color/live_video_background_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!--顶部layout-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="周边5公里,共有23条数据 "
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!--列表相关-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/list_layout_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/layout_top">
|
||||
|
||||
<!--空数据显示-->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/surrounding_recycleview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_empty_data_show"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_empty_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30px"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="周边5公里,暂无交通事件" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_empty_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_main_empty_1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30px"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="你可以试着分享一个事件给其他车主" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_share"
|
||||
android:layout_width="150px"
|
||||
android:layout_height="50px"
|
||||
android:layout_below="@+id/tv_main_empty_2"
|
||||
android:layout_marginLeft="300px"
|
||||
android:layout_marginTop="60px"
|
||||
android:background="@drawable/bg_v2x_event_live_show"
|
||||
android:gravity="center"
|
||||
android:text="去分享"
|
||||
android:textColor="@color/live_video_background_color"
|
||||
android:textSize="12px"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_refresh"
|
||||
android:layout_width="150px"
|
||||
android:layout_height="50px"
|
||||
android:layout_below="@+id/tv_main_empty_2"
|
||||
android:layout_marginLeft="200px"
|
||||
android:layout_marginTop="60px"
|
||||
android:layout_toRightOf="@+id/tv_main_share"
|
||||
android:background="@drawable/bg_v2x_event_live_show"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/live_video_background_color"
|
||||
android:text="刷新"
|
||||
android:textSize="12px"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="Surrounding Event"
|
||||
android:textColor="#fff"
|
||||
android:textSize="40sp" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_empty_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30px"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="40dp"
|
||||
android:textColor="#ffffff"
|
||||
android:text="hello" />
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/ivEventImg"
|
||||
android:layout_width="@dimen/module_v2x_event_image_width"
|
||||
android:layout_height="@dimen/module_v2x_event_image_height"
|
||||
android:scaleType="center"
|
||||
app:miv_failureHolder="@drawable/icon_default_black_logo"
|
||||
app:miv_overlayImageId="@drawable/icon_default_black_logo"
|
||||
app:miv_placeHolder="@drawable/icon_default_black_logo" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
<resources>
|
||||
<color name="live_video_progress_bar_loading_color">#256BFF</color>
|
||||
<color name="live_video_background_color">#3F4057</color>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user