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
a58b6cdc
Commit
a58b6cdc
authored
Mar 02, 2020
by
419948809@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页改版的2020-3-2提交代码
parent
e8aae74e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
311 additions
and
21 deletions
+311
-21
HomeFragment.java
...java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
+20
-15
HotTravelView.java
...om/rv/home/rv/module/ui/main/home/view/HotTravelView.java
+127
-0
fragment_home.xml
module_home/src/main/res/layout/fragment_home.xml
+14
-6
rv_hot_travel_view.xml
module_home/src/main/res/layout/rv_hot_travel_view.xml
+150
-0
No files found.
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
View file @
a58b6cdc
...
@@ -19,9 +19,7 @@ import android.support.v7.widget.LinearLayoutManager;
...
@@ -19,9 +19,7 @@ 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
;
...
@@ -60,6 +58,7 @@ import com.rv.home.rv.module.ui.main.home.bean.HomePopularBrigade;
...
@@ -60,6 +58,7 @@ import com.rv.home.rv.module.ui.main.home.bean.HomePopularBrigade;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeRecommendBean
;
import
com.rv.home.rv.module.ui.main.home.bean.SelectedActivitiesBean
;
import
com.rv.home.rv.module.ui.main.home.bean.SelectedActivitiesBean
;
import
com.rv.home.rv.module.ui.main.home.presenter.HomePresenter
;
import
com.rv.home.rv.module.ui.main.home.presenter.HomePresenter
;
import
com.rv.home.rv.module.ui.main.home.view.HotTravelView
;
import
com.xxrv.video.activity.TriListActivity
;
import
com.xxrv.video.activity.TriListActivity
;
import
com.xxrv.video.bean.circle.DiscoveryDataBean
;
import
com.xxrv.video.bean.circle.DiscoveryDataBean
;
import
com.yuyife.banner.Banner
;
import
com.yuyife.banner.Banner
;
...
@@ -85,8 +84,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -85,8 +84,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
Banner
mineBanner
;
Banner
mineBanner
;
@BindView
(
R2
.
id
.
ll_indicator
)
@BindView
(
R2
.
id
.
ll_indicator
)
LinearLayout
llIndicator
;
LinearLayout
llIndicator
;
@BindView
(
R2
.
id
.
ry_home_hot_travel
)
// @BindView(R2.id.ry_home_hot_travel)
RecyclerView
ryHomeHotTravel
;
// RecyclerView ryHomeHotTravel;
@BindView
(
R2
.
id
.
hot_travel_view
)
HotTravelView
hotTravelView
;
@BindView
(
R2
.
id
.
ry_home_camp
)
@BindView
(
R2
.
id
.
ry_home_camp
)
RecyclerView
ryHomeCamp
;
RecyclerView
ryHomeCamp
;
@BindView
(
R2
.
id
.
recyclerView_home_activity
)
@BindView
(
R2
.
id
.
recyclerView_home_activity
)
...
@@ -137,7 +138,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -137,7 +138,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
private
LocationManager
locationManager
;
private
LocationManager
locationManager
;
private
HotCarTypeAdapter
mHotTravelAdapter
;
//
private HotCarTypeAdapter mHotTravelAdapter;
private
HotCarTypeAdapter
mCampAdapter
;
private
HotCarTypeAdapter
mCampAdapter
;
private
SelectedEventsAdapter
mActivityAdapter
;
private
SelectedEventsAdapter
mActivityAdapter
;
private
RVEnthusiastAdapter
mRvEnthusiast
;
private
RVEnthusiastAdapter
mRvEnthusiast
;
...
@@ -173,12 +174,13 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -173,12 +174,13 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
Drawable
drawable
=
getResources
().
getDrawable
(
R
.
drawable
.
icon_day_times
);
Drawable
drawable
=
getResources
().
getDrawable
(
R
.
drawable
.
icon_day_times
);
drawable
.
setBounds
(
0
,
0
,
DisplayUtil
.
dip2px
(
getContext
(),
25
),
DisplayUtil
.
dip2px
(
getContext
(),
5
));
drawable
.
setBounds
(
0
,
0
,
DisplayUtil
.
dip2px
(
getContext
(),
25
),
DisplayUtil
.
dip2px
(
getContext
(),
5
));
mHotTravelAdapter
=
new
HotCarTypeAdapter
();
hotTravelView
.
setRadius
(
DisplayUtil
.
dip2px
(
_mActivity
,
20
));
// mHotTravelAdapter = new HotCarTypeAdapter();
ryHomeHotTravel
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
//
ryHomeHotTravel
.
addItemDecoration
(
new
AbSpacesItemDecoration
(
DisplayUtil
.
dip2px
(
_mActivity
,
5
),
DisplayUtil
.
dip2px
(
_mActivity
,
8
)));
// 分割线。
// ryHomeHotTravel.setLayoutManager(new GridLayoutManager(getContext(), 2));
ryHomeHotTravel
.
setNestedScrollingEnabled
(
false
);
// ryHomeHotTravel.addItemDecoration(new AbSpacesItemDecoration(DisplayUtil.dip2px(_mActivity, 5), DisplayUtil.dip2px(_mActivity, 8)));// 分割线。
ryHomeHotTravel
.
setAdapter
(
mHotTravelAdapter
);
// ryHomeHotTravel.setNestedScrollingEnabled(false);
// ryHomeHotTravel.setAdapter(mHotTravelAdapter);
mCampAdapter
=
new
HotCarTypeAdapter
();
mCampAdapter
=
new
HotCarTypeAdapter
();
ryHomeCamp
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
ryHomeCamp
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
...
@@ -255,9 +257,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -255,9 +257,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
height
=
_mActivity
.
getWindowManager
().
getDefaultDisplay
().
getHeight
();
height
=
_mActivity
.
getWindowManager
().
getDefaultDisplay
().
getHeight
();
scrollview
.
setScrollViewListener
(
HomeFragment
.
this
);
scrollview
.
setScrollViewListener
(
HomeFragment
.
this
);
mHotTravelAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
HomeHotGoodListBean
.
DataBean
data
=
(
HomeHotGoodListBean
.
DataBean
)
adapter
.
getItem
(
position
);
hotTravelView
.
setOnItemClickListener
((
o
,
position
)
->
{
HomeHotGoodListBean
.
DataBean
data
=
(
HomeHotGoodListBean
.
DataBean
)
o
;
ARouter
.
getInstance
()
ARouter
.
getInstance
()
.
build
(
Constance
.
ACTIVITY_URL_TRAVELDETAILS
)
.
build
(
Constance
.
ACTIVITY_URL_TRAVELDETAILS
)
.
withString
(
"id"
,
data
.
getId
())
.
withString
(
"id"
,
data
.
getId
())
...
@@ -267,6 +270,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -267,6 +270,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.
withDouble
(
"price"
,
Double
.
valueOf
(
data
.
getPrice
()))
.
withDouble
(
"price"
,
Double
.
valueOf
(
data
.
getPrice
()))
.
navigation
();
.
navigation
();
});
});
mCampAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
mCampAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
HomeHotGoodListBean
.
DataBean
data
=
(
HomeHotGoodListBean
.
DataBean
)
adapter
.
getItem
(
position
);
HomeHotGoodListBean
.
DataBean
data
=
(
HomeHotGoodListBean
.
DataBean
)
adapter
.
getItem
(
position
);
ARouter
.
getInstance
()
ARouter
.
getInstance
()
...
@@ -523,8 +527,9 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -523,8 +527,9 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
private
void
setRecommendGood
(
HomeHotGoodListBean
data
,
int
hotType
)
{
private
void
setRecommendGood
(
HomeHotGoodListBean
data
,
int
hotType
)
{
if
(
hotType
==
2
)
{
if
(
hotType
==
2
)
{
mHotTravelAdapter
.
setType
(
String
.
valueOf
(
hotType
));
hotTravelView
.
setData
(
data
.
getData
());
mHotTravelAdapter
.
setNewData
(
data
.
getData
());
// mHotTravelAdapter.setType(String.valueOf(hotType));
// mHotTravelAdapter.setNewData(data.getData());
}
else
if
(
hotType
==
3
)
{
}
else
if
(
hotType
==
3
)
{
mCampAdapter
.
setType
(
String
.
valueOf
(
hotType
));
mCampAdapter
.
setType
(
String
.
valueOf
(
hotType
));
mCampAdapter
.
setNewData
(
data
.
getData
());
mCampAdapter
.
setNewData
(
data
.
getData
());
...
...
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/view/HotTravelView.java
0 → 100644
View file @
a58b6cdc
package
com
.
rv
.
home
.
rv
.
module
.
ui
.
main
.
home
.
view
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.util.AttributeSet
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.base.utils.ui.datetime.selector.util.TextUtil
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.ruiwenliu.wrapper.util.TransformationUtil2
;
import
com.ruiwenliu.wrapper.util.glide.GlideOptions
;
import
com.rv.component.utils.DisplayUtil
;
import
com.rv.home.R
;
import
com.rv.home.rv.module.ui.main.home.bean.HomeHotGoodListBean
;
import
java.util.List
;
public
class
HotTravelView
extends
LinearLayout
{
private
LinearLayout
llTravelItem1
,
llTravelItem2
,
llTravelItem3
,
llTravelItem4
;
private
List
<
HomeHotGoodListBean
.
DataBean
>
lists
;
private
int
radius
=
0
;
public
HotTravelView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
initView
();
}
private
void
initView
()
{
View
view
=
LayoutInflater
.
from
(
getContext
()).
inflate
(
R
.
layout
.
rv_hot_travel_view
,
this
,
false
);
llTravelItem1
=
view
.
findViewById
(
R
.
id
.
ll_travel_1
);
llTravelItem2
=
view
.
findViewById
(
R
.
id
.
ll_travel_2
);
llTravelItem3
=
view
.
findViewById
(
R
.
id
.
ll_travel_3
);
llTravelItem4
=
view
.
findViewById
(
R
.
id
.
ll_travel_4
);
addView
(
view
);
}
public
void
setData
(
List
<
HomeHotGoodListBean
.
DataBean
>
lists
)
{
if
(
lists
==
null
||
lists
.
size
()
==
0
)
return
;
this
.
lists
=
lists
;
llTravelItem1
.
setVisibility
(
VISIBLE
);
setItemView
(
llTravelItem1
,
lists
.
get
(
0
));
if
(
lists
.
size
()
>
1
)
{
llTravelItem2
.
setVisibility
(
VISIBLE
);
setItemView
(
llTravelItem2
,
lists
.
get
(
1
));
}
if
(
lists
.
size
()
>
2
)
{
llTravelItem3
.
setVisibility
(
VISIBLE
);
setItemView
(
llTravelItem3
,
lists
.
get
(
2
));
}
if
(
lists
.
size
()
>
3
)
{
llTravelItem4
.
setVisibility
(
VISIBLE
);
setItemView
(
llTravelItem4
,
lists
.
get
(
3
));
}
}
private
void
setItemView
(
LinearLayout
linearLayout
,
HomeHotGoodListBean
.
DataBean
bean
)
{
setImage
(
bean
.
getIcon
(),(
ImageView
)
linearLayout
.
getChildAt
(
0
));
TextView
tvContent
=
(
TextView
)
linearLayout
.
getChildAt
(
1
);
if
(!
TextUtils
.
isEmpty
(
bean
.
getName
()))
{
tvContent
.
setText
(
bean
.
getName
());
}
else
{
tvContent
.
setText
(
""
);
}
TextView
tvPrice
=
(
TextView
)
linearLayout
.
getChildAt
(
2
);
if
(!
TextUtil
.
isEmpty
(
bean
.
getPrice
()))
{
tvPrice
.
setText
(
String
.
format
(
"¥%1$s%2$s"
,
bean
.
getPrice
(),
getContext
().
getString
(
R
.
string
.
rv_one_person
)));
}
else
{
tvPrice
.
setText
(
""
);
}
}
private
void
setImage
(
String
url
,
ImageView
image
){
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
drawable
.
glide_icon_placeholder
).
error
(
com
.
ruiwenliu
.
wrapper
.
R
.
drawable
.
glide_icon_error
);
TransformationUtil2
utils
=
new
TransformationUtil2
(
image
);
Glide
.
with
(
getContext
())
.
asBitmap
()
.
load
(
url
)
.
apply
(
options
)
.
apply
(
RequestOptions
.
bitmapTransform
(
new
RoundedCorners
(
radius
)))
.
into
(
utils
);
}
public
void
setRadius
(
int
radius
){
this
.
radius
=
radius
;
}
public
void
setOnItemClickListener
(
OnItemClickListener
listener
)
{
llTravelItem1
.
setOnClickListener
(
view
->
{
if
(
listener
!=
null
&&
lists
!=
null
&&
lists
.
size
()
>
0
)
{
listener
.
onItemClick
(
lists
.
get
(
0
),
0
);
}
});
llTravelItem2
.
setOnClickListener
(
view
->
{
if
(
listener
!=
null
&&
lists
!=
null
&&
lists
.
size
()
>
1
)
{
listener
.
onItemClick
(
lists
.
get
(
1
),
1
);
}
});
llTravelItem3
.
setOnClickListener
(
view
->
{
if
(
listener
!=
null
&&
lists
!=
null
&&
lists
.
size
()
>
2
)
{
listener
.
onItemClick
(
lists
.
get
(
2
),
2
);
}
});
llTravelItem4
.
setOnClickListener
(
view
->
{
if
(
listener
!=
null
&&
lists
!=
null
&&
lists
.
size
()
>
3
)
{
listener
.
onItemClick
(
lists
.
get
(
3
),
0
);
}
});
}
public
interface
OnItemClickListener
{
void
onItemClick
(
Object
o
,
long
position
);
}
}
module_home/src/main/res/layout/fragment_home.xml
View file @
a58b6cdc
...
@@ -301,13 +301,21 @@
...
@@ -301,13 +301,21 @@
</RelativeLayout>
</RelativeLayout>
<android.support.v7.widget.RecyclerView
<!--<android.support.v7.widget.RecyclerView-->
android:layout_marginLeft=
"@dimen/size_10"
<!--android:layout_marginLeft="@dimen/size_10"-->
android:layout_marginRight=
"@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_height="430dp"-->
<!--android:layout_marginTop="17dp" />-->
<com.rv.home.rv.module.ui.main.home.view.HotTravelView
android:id=
"@+id/hot_travel_view"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"430dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"17dp"
/>
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginTop=
"17dp"
android:layout_marginRight=
"@dimen/dp_10"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
...
...
module_home/src/main/res/layout/rv_hot_travel_view.xml
0 → 100644
View file @
a58b6cdc
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#ffffff"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/ll_travel_1"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:orientation=
"vertical"
android:visibility=
"invisible"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:scaleType=
"fitXY"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_10"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textColor=
"@color/textMain"
android:textSize=
"@dimen/text_16"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:textColor=
"@color/colorAuxiliaryRed"
android:textSize=
"@dimen/sp_14"
android:textStyle=
"bold"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_travel_2"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_weight=
"1"
android:orientation=
"vertical"
android:visibility=
"invisible"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:scaleType=
"fitXY"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_10"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textColor=
"@color/textMain"
android:textSize=
"@dimen/text_16"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:textColor=
"@color/colorAuxiliaryRed"
android:textSize=
"@dimen/sp_14"
android:textStyle=
"bold"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_marginTop=
"17dp"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/ll_travel_3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:orientation=
"vertical"
android:visibility=
"invisible"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:scaleType=
"fitXY"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_10"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textColor=
"@color/textMain"
android:textSize=
"@dimen/text_16"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:textColor=
"@color/colorAuxiliaryRed"
android:textSize=
"@dimen/sp_14"
android:textStyle=
"bold"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_travel_4"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_weight=
"1"
android:orientation=
"vertical"
android:visibility=
"invisible"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:scaleType=
"fitXY"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_10"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textColor=
"@color/textMain"
android:textSize=
"@dimen/text_16"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:textColor=
"@color/colorAuxiliaryRed"
android:textSize=
"@dimen/sp_14"
android:textStyle=
"bold"
/>
</LinearLayout>
</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