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
654c527c
Commit
654c527c
authored
Mar 06, 2020
by
jianglx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2020-3-6 首页改版
parent
a58b6cdc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
234 deletions
+38
-234
TransformationUtil2.java
.../java/com/ruiwenliu/wrapper/util/TransformationUtil2.java
+0
-3
HomeFragment.java
...java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
+13
-18
RvGridLayoutManager.java
...e/rv/module/ui/main/home/adapter/RvGridLayoutManager.java
+0
-72
HotTravelImageView.java
.../home/rv/module/ui/main/home/view/HotTravelImageView.java
+19
-0
HotTravelView.java
...om/rv/home/rv/module/ui/main/home/view/HotTravelView.java
+0
-127
fragment_home.xml
module_home/src/main/res/layout/fragment_home.xml
+5
-13
rv_item_hot_car_type.xml
module_home/src/main/res/layout/rv_item_hot_car_type.xml
+1
-1
No files found.
RvWrapper/src/main/java/com/ruiwenliu/wrapper/util/TransformationUtil2.java
View file @
654c527c
...
@@ -20,9 +20,6 @@ public class TransformationUtil2 extends ImageViewTarget<Bitmap> {
...
@@ -20,9 +20,6 @@ public class TransformationUtil2 extends ImageViewTarget<Bitmap> {
target
.
setImageBitmap
(
resource
);
target
.
setImageBitmap
(
resource
);
if
(
resource
==
null
)
return
;
if
(
resource
==
null
)
return
;
//获取原图的宽高
int
width
=
resource
.
getWidth
();
int
height
=
resource
.
getHeight
();
//获取imageView的宽
//获取imageView的宽
int
imageViewWidth
=
target
.
getWidth
();
int
imageViewWidth
=
target
.
getWidth
();
...
...
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
View file @
654c527c
...
@@ -58,7 +58,6 @@ import com.rv.home.rv.module.ui.main.home.bean.HomePopularBrigade;
...
@@ -58,7 +58,6 @@ 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
;
...
@@ -84,10 +83,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -84,10 +83,8 @@ 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
)
...
@@ -138,7 +135,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -138,7 +135,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
;
...
@@ -174,13 +171,11 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -174,13 +171,11 @@ 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
));
hotTravelView
.
setRadius
(
DisplayUtil
.
dip2px
(
_mActivity
,
20
));
mHotTravelAdapter
=
new
HotCarTypeAdapter
();
// 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
));
...
@@ -259,8 +254,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -259,8 +254,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
scrollview
.
setScrollViewListener
(
HomeFragment
.
this
);
scrollview
.
setScrollViewListener
(
HomeFragment
.
this
);
hotTravelView
.
setOnItemClickListener
((
o
,
position
)
->
{
mHotTravelAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
HomeHotGoodListBean
.
DataBean
data
=
(
HomeHotGoodListBean
.
DataBean
)
o
;
HomeHotGoodListBean
.
DataBean
data
=
(
HomeHotGoodListBean
.
DataBean
)
adapter
.
getItem
(
position
)
;
ARouter
.
getInstance
()
ARouter
.
getInstance
()
.
build
(
Constance
.
ACTIVITY_URL_TRAVELDETAILS
)
.
build
(
Constance
.
ACTIVITY_URL_TRAVELDETAILS
)
.
withString
(
"id"
,
data
.
getId
())
.
withString
(
"id"
,
data
.
getId
())
...
@@ -527,9 +522,9 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -527,9 +522,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
)
{
hotTravelView
.
setData
(
data
.
getData
());
//
hotTravelView.setData(data.getData());
//
mHotTravelAdapter.setType(String.valueOf(hotType));
mHotTravelAdapter
.
setType
(
String
.
valueOf
(
hotType
));
//
mHotTravelAdapter.setNewData(data.getData());
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/adapter/RvGridLayoutManager.java
deleted
100644 → 0
View file @
a58b6cdc
package
com
.
rv
.
home
.
rv
.
module
.
ui
.
main
.
home
.
adapter
;
import
android.content.Context
;
import
android.graphics.Rect
;
import
android.support.v7.widget.GridLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
public
class
RvGridLayoutManager
extends
GridLayoutManager
{
private
int
mChildPerLines
;
private
int
[]
mMeasuredDimension
=
new
int
[
2
];
public
RvGridLayoutManager
(
Context
context
,
int
spanCount
)
{
super
(
context
,
spanCount
);
this
.
mChildPerLines
=
spanCount
;
}
@Override
public
void
onMeasure
(
RecyclerView
.
Recycler
recycler
,
RecyclerView
.
State
state
,
int
widthSpec
,
int
heightSpec
)
{
final
int
heightMode
=
View
.
MeasureSpec
.
getMode
(
heightSpec
);
final
int
widthSize
=
View
.
MeasureSpec
.
getSize
(
widthSpec
);
final
int
heightSize
=
View
.
MeasureSpec
.
getSize
(
heightSpec
);
int
height
=
0
;
for
(
int
i
=
0
;
i
<
getItemCount
();
)
{
measureScrapChild
(
recycler
,
i
,
View
.
MeasureSpec
.
makeMeasureSpec
(
i
,
View
.
MeasureSpec
.
UNSPECIFIED
),
View
.
MeasureSpec
.
makeMeasureSpec
(
i
,
View
.
MeasureSpec
.
UNSPECIFIED
),
mMeasuredDimension
);
height
=
height
+
mMeasuredDimension
[
1
];
i
=
i
+
mChildPerLines
;
}
// If child view is more than screen size, there is no need to make it wrap content. We can use original onMeasure() so we can scroll view.
if
(
height
>
heightSize
)
{
switch
(
heightMode
)
{
case
View
.
MeasureSpec
.
EXACTLY
:
height
=
heightSize
;
case
View
.
MeasureSpec
.
AT_MOST
:
case
View
.
MeasureSpec
.
UNSPECIFIED
:
}
setMeasuredDimension
(
widthSize
,
height
);
}
else
{
super
.
onMeasure
(
recycler
,
state
,
widthSpec
,
heightSpec
);
}
}
private
void
measureScrapChild
(
RecyclerView
.
Recycler
recycler
,
int
position
,
int
widthSpec
,
int
heightSpec
,
int
[]
measuredDimension
)
{
View
view
=
recycler
.
getViewForPosition
(
position
);
// For adding Item Decor Insets to view
super
.
measureChildWithMargins
(
view
,
0
,
0
);
if
(
view
!=
null
)
{
RecyclerView
.
LayoutParams
p
=
(
RecyclerView
.
LayoutParams
)
view
.
getLayoutParams
();
int
childWidthSpec
=
ViewGroup
.
getChildMeasureSpec
(
widthSpec
,
getPaddingLeft
()
+
getPaddingRight
()
+
getDecoratedLeft
(
view
)
+
getDecoratedRight
(
view
),
p
.
width
);
int
childHeightSpec
=
ViewGroup
.
getChildMeasureSpec
(
heightSpec
,
getPaddingTop
()
+
getPaddingBottom
()
+
getPaddingBottom
()
+
getDecoratedBottom
(
view
),
p
.
height
);
view
.
measure
(
childWidthSpec
,
childHeightSpec
);
// Get decorated measurements
measuredDimension
[
0
]
=
getDecoratedMeasuredWidth
(
view
)
+
p
.
leftMargin
+
p
.
rightMargin
;
measuredDimension
[
1
]
=
getDecoratedMeasuredHeight
(
view
)
+
p
.
bottomMargin
+
p
.
topMargin
;
recycler
.
recycleView
(
view
);
}
}
}
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/view/HotTravelImageView.java
0 → 100644
View file @
654c527c
package
com
.
rv
.
home
.
rv
.
module
.
ui
.
main
.
home
.
view
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.widget.ImageView
;
public
class
HotTravelImageView
extends
ImageView
{
public
HotTravelImageView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
int
width
=
MeasureSpec
.
getSize
(
widthMeasureSpec
);
int
height
=
(
int
)
(
width
*
0.75
);
setMeasuredDimension
(
width
,
height
);
}
}
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/view/HotTravelView.java
deleted
100644 → 0
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 @
654c527c
...
@@ -301,21 +301,13 @@
...
@@ -301,21 +301,13 @@
</RelativeLayout>
</RelativeLayout>
<!--<android.support.v7.widget.RecyclerView-->
<android.support.v7.widget.RecyclerView
<!--android:layout_marginLeft="@dimen/size_10"-->
android:id=
"@+id/ry_home_hot_travel"
<!--android:layout_marginRight="@dimen/size_10"-->
<!--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=
"
wrap_content
"
android:layout_height=
"
420dp
"
android:layout_marginLeft=
"@dimen/
dp
_10"
android:layout_marginLeft=
"@dimen/
size
_10"
android:layout_marginTop=
"17dp"
android:layout_marginTop=
"17dp"
android:layout_marginRight=
"@dimen/
dp
_10"
/>
android:layout_marginRight=
"@dimen/
size
_10"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
...
...
module_home/src/main/res/layout/rv_item_hot_car_type.xml
View file @
654c527c
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<ImageView
<
com.rv.home.rv.module.ui.main.home.view.HotTravel
ImageView
android:id=
"@+id/iv_goods"
android:id=
"@+id/iv_goods"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
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