opt surrding ui

This commit is contained in:
lixiaopeng
2020-09-29 14:24:09 +08:00
parent 4f6360f622
commit 08df93bb6d
10 changed files with 26 additions and 12 deletions

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -40,6 +40,7 @@ import com.mogo.module.v2x.listener.SurroundingItemClickListener;
import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
import com.mogo.module.v2x.view.SurroundingEventView;
import com.mogo.module.common.view.NetworkLoadingView;
import com.mogo.module.v2x.view.SurroundingMarginDecoration;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.utils.WorkThreadHandler;
@@ -105,8 +106,9 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
// mRecyclerView.setHasFixedSize(true);
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2);
// int spacingInPixels = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_bottom_right_textsize);
// mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels));
int spacingInPixels = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_bottom_right_textsize);
int spacingInPixelsLeft = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_maigin_left);
mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels, spacingInPixelsLeft));
mRecyclerView.setLayoutManager(layoutManage);
mAdapter = new V2XSurroundingAdapter(getActivity(), poiInfosList, this);

View File

@@ -12,20 +12,24 @@ import androidx.recyclerview.widget.RecyclerView;
*/
public class SurroundingMarginDecoration extends RecyclerView.ItemDecoration {
private int margin ;
private int marginLeft ;
public SurroundingMarginDecoration(int space) {
public SurroundingMarginDecoration(int space, int left) {
margin = space;
marginLeft = left;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.bottom = margin;
outRect.right = 0;
//由于每行都只有2个所以第一个都是2的倍数把左边距设为0
//由于每行都只有2个所以第一个都是2的倍数
if (parent.getChildLayoutPosition(view) % 2 == 0) {
outRect.left = 0;
outRect.left = marginLeft;
outRect.right = 0;
} else {
outRect.left = margin;
outRect.right = marginLeft;
}
}

View File

@@ -52,9 +52,9 @@
android:id="@+id/surrounding_recycleview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/module_v2x_surrounding_list_margin_left"
android:layout_marginTop="@dimen/module_v2x_surrounding_empty_tv_margin_top"
android:visibility="visible" />
<!-- android:layout_marginLeft="@dimen/module_v2x_surrounding_list_margin_left"-->
<!--空数据显示-->
<RelativeLayout

View File

@@ -2,14 +2,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:layout_width="wrap_content"
android:layout_marginBottom="@dimen/module_v2x_surrounding_item_margin_left"
android:layout_marginLeft="@dimen/module_v2x_surrounding_item_margin_left"
android:layout_height="@dimen/module_v2x_surrounding_item_height">
<!-- android:layout_marginBottom="@dimen/module_v2x_surrounding_item_margin_left"-->
<!-- android:layout_marginLeft="@dimen/module_v2x_surrounding_item_margin_left"-->
<RelativeLayout
android:layout_width="@dimen/module_v2x_surrounding_item_width"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- @dimen/module_v2x_surrounding_item_width-->
<ImageView
android:id="@+id/iv_event_bg"
android:layout_width="match_parent"

View File

@@ -61,6 +61,7 @@
<dimen name="module_v2x_surrounding_top_textsize">18px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_left_textsize">20px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_right_textsize">16px</dimen>
<dimen name="module_v2x_surrounding_item_maigin_left">28px</dimen>
<dimen name="module_v2x_panel_width">82px</dimen>
<dimen name="module_v2x_panel_icon_cor">16px</dimen>

View File

@@ -61,6 +61,7 @@
<dimen name="module_v2x_surrounding_top_textsize">18px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_left_textsize">20px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_right_textsize">16px</dimen>
<dimen name="module_v2x_surrounding_item_maigin_left">28px</dimen>
<dimen name="module_v2x_panel_width">82px</dimen>
<dimen name="module_v2x_panel_icon_cor">16px</dimen>

View File

@@ -58,6 +58,8 @@
<dimen name="module_v2x_surrounding_top_textsize">32px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_left_textsize">36px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_right_textsize">30px</dimen>
<dimen name="module_v2x_surrounding_item_maigin_left">50px</dimen>
<dimen name="module_v2x_panel_width">120px</dimen>
<dimen name="module_v2x_panel_tab_height">158px</dimen>

View File

@@ -59,6 +59,7 @@
<dimen name="module_v2x_surrounding_top_textsize">32px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_left_textsize">36px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_right_textsize">30px</dimen>
<dimen name="module_v2x_surrounding_item_maigin_left">50px</dimen>
<dimen name="module_v2x_panel_icon_cor">30px</dimen>
<dimen name="module_v2x_panel_width">140px</dimen>

View File

@@ -57,6 +57,8 @@
<dimen name="module_v2x_surrounding_top_textsize">18px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_left_textsize">20px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_right_textsize">16px</dimen>
<dimen name="module_v2x_surrounding_item_maigin_left">28px</dimen>
<dimen name="module_v2x_panel_width">82px</dimen>
<dimen name="module_v2x_panel_icon_cor">16px</dimen>
<dimen name="share_empty_icon_width">117px</dimen>