Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lify
RvApp
Commits
e8aae74e
Commit
e8aae74e
authored
Feb 24, 2020
by
419948809@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页改版的2020-2-24提交代码
parent
f3ad1d43
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
87 deletions
+129
-87
HomeFragment.java
...java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
+51
-19
fragment_home.xml
module_home/src/main/res/layout/fragment_home.xml
+78
-67
rv_item_hot_car_type.xml
module_home/src/main/res/layout/rv_item_hot_car_type.xml
+0
-1
No files found.
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
View file @
e8aae74e
...
@@ -19,7 +19,9 @@ import android.support.v7.widget.LinearLayoutManager;
...
@@ -19,7 +19,9 @@ import android.support.v7.widget.LinearLayoutManager;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.StaggeredGridLayoutManager
;
import
android.support.v7.widget.StaggeredGridLayoutManager
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -174,20 +176,20 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -174,20 +176,20 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
mHotTravelAdapter
=
new
HotCarTypeAdapter
();
mHotTravelAdapter
=
new
HotCarTypeAdapter
();
ryHomeHotTravel
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
ryHomeHotTravel
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
ryHomeHotTravel
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
)));
// 分割线。
ryHomeHotTravel
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
)
,
DisplayUtil
.
dip2px
(
_mActivity
,
8
)
));
// 分割线。
ryHomeHotTravel
.
setNestedScrollingEnabled
(
false
);
ryHomeHotTravel
.
setNestedScrollingEnabled
(
false
);
ryHomeHotTravel
.
setAdapter
(
mHotTravelAdapter
);
ryHomeHotTravel
.
setAdapter
(
mHotTravelAdapter
);
mCampAdapter
=
new
HotCarTypeAdapter
();
mCampAdapter
=
new
HotCarTypeAdapter
();
ryHomeCamp
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
ryHomeCamp
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
ryHomeCamp
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
)));
// 分割线。
ryHomeCamp
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
)
,
DisplayUtil
.
dip2px
(
_mActivity
,
8
)
));
// 分割线。
ryHomeCamp
.
setNestedScrollingEnabled
(
false
);
ryHomeCamp
.
setNestedScrollingEnabled
(
false
);
ryHomeCamp
.
setAdapter
(
mCampAdapter
);
ryHomeCamp
.
setAdapter
(
mCampAdapter
);
//精选活动
//精选活动
mActivityAdapter
=
new
SelectedEventsAdapter
();
mActivityAdapter
=
new
SelectedEventsAdapter
();
recyclerViewActivity
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
recyclerViewActivity
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
recyclerViewActivity
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
)));
// 分割线。
recyclerViewActivity
.
addItemDecoration
(
new
AbSpacesItemDecoration
1
(
DisplayUtil
.
dip2px
(
_mActivity
,
10
)));
// 分割线。
recyclerViewActivity
.
setNestedScrollingEnabled
(
false
);
recyclerViewActivity
.
setNestedScrollingEnabled
(
false
);
recyclerViewActivity
.
setAdapter
(
mActivityAdapter
);
recyclerViewActivity
.
setAdapter
(
mActivityAdapter
);
mActivityAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
mActivityAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
...
@@ -241,14 +243,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -241,14 +243,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
//房车游榜单
//房车游榜单
mRvTourAdapter
=
new
RVTourListAdapter
();
mRvTourAdapter
=
new
RVTourListAdapter
();
recyclerViewRvtourlist
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
recyclerViewRvtourlist
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
recyclerViewRvtourlist
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
)));
recyclerViewRvtourlist
.
addItemDecoration
(
new
AbSpacesItemDecoration
1
(
DisplayUtil
.
dip2px
(
_mActivity
,
10
)));
recyclerViewRvtourlist
.
setNestedScrollingEnabled
(
false
);
recyclerViewRvtourlist
.
setNestedScrollingEnabled
(
false
);
recyclerViewRvtourlist
.
setAdapter
(
mRvTourAdapter
);
recyclerViewRvtourlist
.
setAdapter
(
mRvTourAdapter
);
// //房车游榜单 标注
// //房车游榜单 标注
mRvTourLabelAdapter
=
new
RVTourListLabelAdapter
();
mRvTourLabelAdapter
=
new
RVTourListLabelAdapter
();
recyclerViewRvtourlistTitle
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
recyclerViewRvtourlistTitle
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
recyclerViewRvtourlistTitle
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
)));
recyclerViewRvtourlistTitle
.
addItemDecoration
(
new
AbSpacesItemDecoration
1
(
DisplayUtil
.
dip2px
(
_mActivity
,
10
)));
recyclerViewRvtourlistTitle
.
setNestedScrollingEnabled
(
false
);
recyclerViewRvtourlistTitle
.
setNestedScrollingEnabled
(
false
);
height
=
_mActivity
.
getWindowManager
().
getDefaultDisplay
().
getHeight
();
height
=
_mActivity
.
getWindowManager
().
getDefaultDisplay
().
getHeight
();
...
@@ -329,20 +331,50 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -329,20 +331,50 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
}
}
public
class
AbSpacesItemDecoration
extends
RecyclerView
.
ItemDecoration
{
public
class
AbSpacesItemDecoration
extends
RecyclerView
.
ItemDecoration
{
private
int
space
;
private
int
sh
;
private
int
sv
;
public
AbSpacesItemDecoration
(
int
space
)
{
public
AbSpacesItemDecoration
(
int
sh
,
int
sv
)
{
this
.
space
=
space
;
this
.
sh
=
sh
;
this
.
sv
=
sv
;
}
}
@Override
@Override
public
void
getItemOffsets
(
Rect
outRect
,
View
view
,
RecyclerView
parent
,
RecyclerView
.
State
state
)
{
public
void
getItemOffsets
(
Rect
outRect
,
View
view
,
RecyclerView
parent
,
RecyclerView
.
State
state
)
{
outRect
.
left
=
space
;
int
position
=
parent
.
getChildAdapterPosition
(
view
);
outRect
.
right
=
space
;
outRect
.
bottom
=
space
;
if
(
sh
!=
0
)
{
//注释这两行是为了上下间距相同
if
(
position
%
2
==
0
)
{
// if(parent.getChildAdapterPosition(view)==0){
outRect
.
right
=
sh
;
outRect
.
top
=
space
;
}
else
{
outRect
.
left
=
sh
;
}
}
if
(
sv
!=
0
)
{
if
(
position
<=
1
)
{
outRect
.
bottom
=
sv
;
}
else
{
outRect
.
top
=
sv
;
}
}
}
}
public
class
AbSpacesItemDecoration1
extends
RecyclerView
.
ItemDecoration
{
private
int
sh
;
public
AbSpacesItemDecoration1
(
int
sh
)
{
this
.
sh
=
sh
;
}
@Override
public
void
getItemOffsets
(
Rect
outRect
,
View
view
,
RecyclerView
parent
,
RecyclerView
.
State
state
)
{
if
(
sh
!=
0
)
{
int
position
=
parent
.
getChildAdapterPosition
(
view
);
if
(
position
!=
0
)
outRect
.
left
=
sh
;
}
}
}
}
}
...
@@ -662,19 +694,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -662,19 +694,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
}
}
private
void
indicatorChange
(
int
position
)
{
private
void
indicatorChange
(
int
position
)
{
if
(
llIndicator
==
null
)
return
;
if
(
llIndicator
==
null
)
return
;
llIndicator
.
removeAllViews
();
llIndicator
.
removeAllViews
();
for
(
int
i
=
0
;
i
<
images
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
images
.
size
();
i
++)
{
ImageView
imageView
=
new
ImageView
(
getContext
());
ImageView
imageView
=
new
ImageView
(
getContext
());
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
LinearLayout
.
LayoutParams
params
=
null
;
LinearLayout
.
LayoutParams
params
=
null
;
if
(
position
==
i
)
{
if
(
position
==
i
)
{
params
=
new
LinearLayout
.
LayoutParams
(
DisplayUtil
.
dip2px
(
getContext
(),
15
),
DisplayUtil
.
dip2px
(
getContext
(),
7
));
params
=
new
LinearLayout
.
LayoutParams
(
DisplayUtil
.
dip2px
(
getContext
(),
15
),
DisplayUtil
.
dip2px
(
getContext
(),
7
));
}
else
{
}
else
{
params
=
new
LinearLayout
.
LayoutParams
(
DisplayUtil
.
dip2px
(
getContext
(),
7
),
DisplayUtil
.
dip2px
(
getContext
(),
7
));
params
=
new
LinearLayout
.
LayoutParams
(
DisplayUtil
.
dip2px
(
getContext
(),
7
),
DisplayUtil
.
dip2px
(
getContext
(),
7
));
}
}
params
.
leftMargin
=
DisplayUtil
.
dip2px
(
getContext
(),
3
);
params
.
leftMargin
=
DisplayUtil
.
dip2px
(
getContext
(),
3
);
params
.
rightMargin
=
DisplayUtil
.
dip2px
(
getContext
(),
3
);
params
.
rightMargin
=
DisplayUtil
.
dip2px
(
getContext
(),
3
);
if
(
i
==
position
)
{
if
(
i
==
position
)
{
imageView
.
setImageResource
(
R
.
drawable
.
icon_show
);
imageView
.
setImageResource
(
R
.
drawable
.
icon_show
);
}
else
{
}
else
{
...
...
module_home/src/main/res/layout/fragment_home.xml
View file @
e8aae74e
...
@@ -266,6 +266,11 @@
...
@@ -266,6 +266,11 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/colorWrite"
android:orientation=
"vertical"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -290,7 +295,6 @@
...
@@ -290,7 +295,6 @@
android:layout_marginRight=
"@dimen/size_5"
android:layout_marginRight=
"@dimen/size_5"
android:drawableRight=
"@drawable/common_icon_rig_gray"
android:drawableRight=
"@drawable/common_icon_rig_gray"
android:drawablePadding=
"@dimen/dp_4"
android:drawablePadding=
"@dimen/dp_4"
android:paddingRight=
"5dp"
android:text=
"@string/rv_order_all_order"
android:text=
"@string/rv_order_all_order"
android:textColor=
"@color/text_Gray"
android:textColor=
"@color/text_Gray"
android:textSize=
"@dimen/size_12"
/>
android:textSize=
"@dimen/size_12"
/>
...
@@ -298,24 +302,30 @@
...
@@ -298,24 +302,30 @@
</RelativeLayout>
</RelativeLayout>
<android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:layout_marginLeft=
"@dimen/size_10"
android:layout_marginRight=
"@dimen/size_10"
android:id=
"@+id/ry_home_hot_travel"
android:id=
"@+id/ry_home_hot_travel"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"450dp"
android:layout_height=
"430dp"
android:layout_marginTop=
"17dp"
android:layout_marginTop=
"17dp"
/>
android:paddingLeft=
"@dimen/size_10"
</LinearLayout>
android:paddingRight=
"@dimen/size_10"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/colorWrite"
android:orientation=
"vertical"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_10
"
android:layout_marginTop=
"27dp
"
android:layout_marginRight=
"@dimen/dp_10"
>
android:layout_marginRight=
"@dimen/dp_10"
>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/rv_home_title_camp"
android:text=
"@string/rv_home_title_camp"
android:textColor=
"@color/colorMain"
android:textColor=
"@color/colorMain"
android:textSize=
"@dimen/text_16"
android:textSize=
"@dimen/text_16"
...
@@ -330,7 +340,6 @@
...
@@ -330,7 +340,6 @@
android:layout_marginRight=
"@dimen/size_5"
android:layout_marginRight=
"@dimen/size_5"
android:drawableRight=
"@drawable/common_icon_rig_gray"
android:drawableRight=
"@drawable/common_icon_rig_gray"
android:drawablePadding=
"@dimen/dp_4"
android:drawablePadding=
"@dimen/dp_4"
android:paddingRight=
"5dp"
android:text=
"@string/rv_order_all_order"
android:text=
"@string/rv_order_all_order"
android:textColor=
"@color/text_Gray"
android:textColor=
"@color/text_Gray"
android:textSize=
"@dimen/size_12"
/>
android:textSize=
"@dimen/size_12"
/>
...
@@ -340,10 +349,11 @@
...
@@ -340,10 +349,11 @@
<android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:id=
"@+id/ry_home_camp"
android:id=
"@+id/ry_home_camp"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"370dp
"
android:layout_height=
"wrap_content
"
android:layout_marginTop=
"17dp"
android:layout_marginTop=
"17dp"
android:paddingLeft=
"@dimen/size_10"
android:paddingLeft=
"@dimen/size_10"
android:paddingRight=
"@dimen/size_10"
/>
android:paddingRight=
"@dimen/size_10"
/>
</LinearLayout>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -378,7 +388,7 @@
...
@@ -378,7 +388,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:drawableRight=
"@drawable/common_icon_rig_black_gray"
android:drawableRight=
"@drawable/common_icon_rig_black_gray"
android:drawablePadding=
"@dimen/
size_5
"
android:drawablePadding=
"@dimen/
dp_4
"
android:text=
"全部"
android:text=
"全部"
android:textColor=
"@color/text_Gray"
android:textColor=
"@color/text_Gray"
android:textSize=
"@dimen/size_12"
/>
android:textSize=
"@dimen/size_12"
/>
...
@@ -388,8 +398,9 @@
...
@@ -388,8 +398,9 @@
android:id=
"@+id/recyclerView_home_activity"
android:id=
"@+id/recyclerView_home_activity"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingLeft=
"@dimen/dp_10"
android:layout_marginLeft=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
/>
android:layout_marginRight=
"@dimen/dp_10"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -467,8 +478,8 @@
...
@@ -467,8 +478,8 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:paddingLeft=
"@dimen/size_
10
"
android:paddingLeft=
"@dimen/size_
5
"
android:paddingRight=
"@dimen/size_
10
"
/>
android:paddingRight=
"@dimen/size_
5
"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
...
...
module_home/src/main/res/layout/rv_item_hot_car_type.xml
View file @
e8aae74e
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:gravity=
"center_horizontal"
android:gravity=
"center_horizontal"
android:layout_marginBottom=
"@dimen/size_16"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
<LinearLayout
<LinearLayout
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment