优化出行动态展示·
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* 这是LinearLayoutManager设置Item间距的的一个辅助类
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private int space;
|
||||
|
||||
public SpacesItemDecoration(int space) {
|
||||
this.space = space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view,
|
||||
RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.left = space;
|
||||
outRect.right = space;
|
||||
outRect.bottom = space;
|
||||
|
||||
// Add top margin only for the first item to avoid double space between items
|
||||
if (parent.getChildPosition(view) == 0) {
|
||||
outRect.top = space;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
val colorStateList = ColorStateList(states, colors)
|
||||
tabView.text = tabsTitle[position]
|
||||
tabView.textSize = normalSize.toFloat()
|
||||
tabView.typeface = Typeface.DEFAULT_BOLD
|
||||
tabView.setTextColor(colorStateList)
|
||||
tab.customView = tabView
|
||||
})
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.SpacesItemDecoration;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XScenarioHistoryAdapter;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener;
|
||||
@@ -45,6 +46,7 @@ public class V2XScenarioHistoryFragment
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
mV2XScenarioHistoryAdapter = new V2XScenarioHistoryAdapter(mV2XHistoryScenarioData);
|
||||
mRecyclerView.setAdapter(mV2XScenarioHistoryAdapter);
|
||||
mRecyclerView.addItemDecoration(new SpacesItemDecoration(14));
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tvMessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/dp_60"
|
||||
android:paddingTop="@dimen/dp_30"
|
||||
android:paddingEnd="@dimen/dp_60"
|
||||
android:paddingBottom="@dimen/dp_30"
|
||||
android:text="今日出行遇到的交通事件"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_36"
|
||||
android:textStyle="bold" />
|
||||
@@ -17,7 +17,7 @@
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_130"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -38,6 +38,19 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tabLayout" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnHidePanels"
|
||||
android:layout_width="@dimen/dp_88"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginEnd="@dimen/dp_40"
|
||||
android:background="@drawable/v2x_icon_event_live_close"
|
||||
android:textColor="#000"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tabLayout"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tabLayout" />
|
||||
|
||||
</com.mogo.module.v2x.view.RoundConstraintLayout>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFF"
|
||||
tools:listitem="@layout/module_v2x_event_share_item" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/dp_60"
|
||||
android:paddingTop="@dimen/dp_30"
|
||||
android:paddingEnd="@dimen/dp_60"
|
||||
android:paddingBottom="@dimen/dp_30"
|
||||
android:text="今日出行遇到的交通事件"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_36"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="@dimen/dp_40"
|
||||
android:paddingEnd="@dimen/dp_40"
|
||||
tools:listitem="@layout/item_v2x_illegal_parking" />
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user