Commit fb3385ce authored by jianglx's avatar jianglx

2020-3-19 首页,旅游,营地和发现间距的界面的优化,包括图片的尺寸已经间距的调整

parent 12c51d15
......@@ -8,7 +8,6 @@ import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
......@@ -71,7 +70,7 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
private BannerScroller mScroller;
private OnBannerListener listener;
private DisplayMetrics dm;
private boolean isHome = false ;
private boolean isHome = false;
private WeakHandler handler = new WeakHandler();
......@@ -111,6 +110,25 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
initViewPagerScroll();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
if (heightMode == MeasureSpec.EXACTLY) { //match_parent 或者 指定高度
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = (widthSize * 9 / 16);
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
int spec = MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY);
child.measure(widthMeasureSpec, spec);
}
setMeasuredDimension(widthSize, heightSize);
}
private void handleTypedArray(Context context, AttributeSet attrs) {
if (attrs == null) {
return;
......@@ -237,6 +255,15 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
return this;
}
public Banner setIndicatorVisiable(boolean b) {
if (b) {
indicator.setVisibility(VISIBLE);
} else {
indicator.setVisibility(GONE);
}
return this;
}
public void update(List<?> imageUrls, List<String> titles) {
this.titles.clear();
this.titles.addAll(titles);
......@@ -252,9 +279,9 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
start();
}
public Banner isHome(boolean b){
this.isHome = b ;
return this ;
public Banner isHome(boolean b) {
this.isHome = b;
return this;
}
public void updateBannerStyle(int bannerStyle) {
......@@ -299,7 +326,7 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
}
private void setBannerStyleUI() {
int visibility =count > 1 ? View.VISIBLE : View.GONE;
int visibility = count > 1 ? View.VISIBLE : View.GONE;
switch (bannerStyle) {
case BannerConfig.CIRCLE_INDICATOR:
// indicator.setVisibility(visibility);
......@@ -351,10 +378,9 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
if (imageView == null) {
imageView = new ImageView(context);
}
imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)) ;
imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
setScaleType(imageView);
Object url ;
Object url;
if (i == 0) {
url = imagesUrl.get(count - 1);
} else if (i == count + 1) {
......@@ -362,14 +388,14 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
} else {
url = imagesUrl.get(i - 1);
}
if(isHome){
if (isHome) {
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(30, 0, 30, 0);
layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)) ;
layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
layout.addView(imageView);
imageViews.add(layout);
}else {
} else {
imageViews.add(imageView);
}
if (imageLoader != null)
......@@ -579,7 +605,7 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
@Override
public void onPageSelected(int position) {
currentItem=position;
currentItem = position;
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageSelected(toRealPosition(position));
}
......
......@@ -584,6 +584,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL
* 检测版本
*/
private void checkVersion() {
hasGetVersionInfo = true;
Map<String, Object> headMap = new LinkedHashMap<>();
String versionName = updateAppUtils.getAppVersionName(this);
......
......@@ -27,11 +27,11 @@ public class TransformationUtil3 extends ImageViewTarget<Bitmap> {
//获取imageView的宽
int imageViewWidth = target.getWidth();
int imageViewHeight = 0;
if((width*0.1f)/(height*0.1f) < 0.75){
if ((width * 0.1f) / (height * 0.1f) < 0.75) {
//计算图片等比例放大后的高
imageViewHeight = 2*imageViewWidth;
}else{
imageViewHeight = imageViewWidth ;
imageViewHeight = (int) (1.5f * imageViewWidth);
} else {
imageViewHeight = imageViewWidth;
}
ViewGroup.LayoutParams params = target.getLayoutParams();
......
package com.rv.home.rv.module.ui.main.home.view;
package com.ruiwenliu.wrapper.weight;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
public class HotTravelImageView extends ImageView {
public HotTravelImageView(Context context, AttributeSet attrs) {
public class Rv4_3ImageView extends ImageView {
public Rv4_3ImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
......
......@@ -6,6 +6,7 @@
<item name="colorPrimaryDark">@color/stateColor</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
......@@ -27,8 +28,7 @@
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<!-- 自定义AlertDialog的样式 -->
<style name="Alert_Dialog_Style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
......@@ -61,6 +61,7 @@
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.6</item>
</style>
<style name="AppTheme.NoActionBar.SwipeBack">
<!--<item name="android:windowIsTranslucent">false</item>-->
</style>
......@@ -83,4 +84,10 @@
<item name="windowNoTitle">true</item>
</style>
<style name="margin_left_right">
<item name="android:layout_marginLeft">@dimen/dp_10</item>
<item name="android:layout_marginRight">@dimen/dp_10</item>
</style>
</resources>
......@@ -34,6 +34,7 @@ import com.rv.camp.bean.CampTypeBean;
import com.rv.camp.camp.CampSearchActivity;
import com.rv.camp.camp.CampShopShowActivity;
import com.rv.camp.presenter.CampPresenter;
import com.rv.component.utils.DisplayUtil;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -97,7 +98,7 @@ public class CampFragment extends BaseFragment<CampPresenter> implements BaseQui
campAdapter = new CampListAdapter();
rvContent.setItemAnimator(null);
rvContent.setLayoutManager(new GridLayoutManager(_mActivity, 2));
rvContent.addItemDecoration(new AbSpacesItemDecoration(20, 10));// 分割线。
rvContent.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。
// rvContent.setNestedScrollingEnabled(false);
rvContent.setAdapter(campAdapter);
......@@ -353,28 +354,28 @@ public class CampFragment extends BaseFragment<CampPresenter> implements BaseQui
public class AbSpacesItemDecoration extends RecyclerView.ItemDecoration {
private int left;
private int right;
private int hx;
public AbSpacesItemDecoration(int left, int right) {
this.left = left;
this.right = right;
private int vx;
public AbSpacesItemDecoration(int hx) {
this(hx, hx);
}
public AbSpacesItemDecoration(int hx, int vx) {
this.hx = hx;
this.vx = vx;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int childCount = parent.getChildCount();
if ((childCount - 1) % 2 == 0) {
outRect.left = left;
outRect.right = right;
outRect.bottom = right;
outRect.top = right;
int position = parent.getChildAdapterPosition(view);
if (position % 2 == 1) {
outRect.left = hx;
} else {
outRect.left = right;
outRect.right = left;
outRect.bottom = right;
outRect.top = right;
outRect.right = vx;
}
outRect.top = 2 * hx;
}
}
......
......@@ -18,7 +18,7 @@ public class CampListAdapter extends BaseQuickAdapter<CampListBean.DataBeanX.Dat
}
@Override
protected void convert(BaseViewHolder helper, final CampListBean.DataBeanX.DataBean item) {
GlideManager.getInstance(mContext).loadRoundImage(item.getLogo(), (ImageView)helper.getView(R.id.iv_icon),8);
GlideManager.getInstance(mContext).loadRoundImage(item.getLogo(), (ImageView)helper.getView(R.id.iv_icon),7);
helper.setText(R.id.tv_type,item.getStoreTypeName());
helper.setText(R.id.tv_name,item.getName());
helper.setText(R.id.tv_city,item.getCityName());
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomRightRadius="7dp"
android:topLeftRadius="7dp" />
<gradient
android:angle="0"
android:centerColor="#3DDB7C"
android:endColor="#32CF70"
android:startColor="#57F396" />
</shape>
\ No newline at end of file
......@@ -48,8 +48,8 @@
android:layout_marginLeft="@dimen/size_8"
android:layout_marginRight="@dimen/size_5"
android:layout_weight="1"
android:gravity="center"
android:background="@drawable/shape_rv_travel_search_line"
android:gravity="center"
android:orientation="horizontal">
<ImageView
......@@ -95,6 +95,8 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1">
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
......
......@@ -20,11 +20,15 @@
android:id="@+id/tv_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorWrite"
android:background="@drawable/rv_campsite_icon_label"
android:gravity="center"
android:background="@drawable/campsite_icon_label"
android:textSize="@dimen/text_10"
android:text="湖泊型"/>
android:paddingLeft="5dp"
android:paddingTop="3dp"
android:paddingRight="5dp"
android:paddingBottom="3dp"
android:text="湖泊型"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
</RelativeLayout>
<TextView
......@@ -43,9 +47,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_5"
android:paddingLeft="@dimen/size_5"
android:drawablePadding="@dimen/size_5"
android:drawableLeft="@drawable/campsite_icon_citylocation"
android:drawablePadding="@dimen/size_5"
android:paddingLeft="@dimen/size_5"
android:text="惠州"
android:textColor="@color/gray_707070"
android:textSize="@dimen/text_10" />
......
......@@ -91,7 +91,7 @@ public class PatFragment extends BaseFragment<DiscoveryPresenter> implements Sim
rvContent.setLayoutManager(staggeredGridLayoutManager);
// rvContent.setLayoutManager(new GridLayoutManager(_mActivity, 2));
rvContent.addItemDecoration(new AbSpacesItemDecoration(20, 10));// 分割线。
rvContent.addItemDecoration(new AbSpacesItemDecoration(30, 10));// 分割线。
rvContent.setAdapter(mAdapter);
mAdapter.bindToRecyclerView(rvContent);
mAdapter.setEnableLoadMore(true);
......
......@@ -85,7 +85,7 @@ public class RecommendFragment extends BaseFragment<DiscoveryPresenter> implemen
});
rvContent.setLayoutManager(staggeredGridLayoutManager);
rvContent.addItemDecoration(new AbSpacesItemDecoration(20, 10));// 分割线。
rvContent.addItemDecoration(new AbSpacesItemDecoration(30, 10));// 分割线。
rvContent.setAdapter(mRecommendAdapter);
mRecommendAdapter.bindToRecyclerView(rvContent);
mRecommendAdapter.setEnableLoadMore(true);
......
......@@ -83,7 +83,7 @@ public class ShortVideoFragment extends BaseFragment<DiscoveryPresenter> impleme
rvContent.setLayoutManager(staggeredGridLayoutManager);
// rvContent.setLayoutManager(new GridLayoutManager(_mActivity, 2));
rvContent.addItemDecoration(new AbSpacesItemDecoration(20, 10));// 分割线。
rvContent.addItemDecoration(new AbSpacesItemDecoration(30, 10));// 分割线。
rvContent.setAdapter(mAdapter);
mAdapter.bindToRecyclerView(rvContent);
mAdapter.setEnableLoadMore(true);
......
......@@ -174,20 +174,20 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
mHotTravelAdapter = new HotCarTypeAdapter();
ryHomeHotTravel.setLayoutManager(new GridLayoutManager(getContext(), 2));
ryHomeHotTravel.addItemDecoration(new AbSpacesItemDecoration(DisplayUtil.dip2px(_mActivity, 5), DisplayUtil.dip2px(_mActivity, 8)));// 分割线。
ryHomeHotTravel.addItemDecoration(new AbSpacesItemDecoration(10, DisplayUtil.dip2px(_mActivity, 8)));// 分割线。
ryHomeHotTravel.setNestedScrollingEnabled(false);
ryHomeHotTravel.setAdapter(mHotTravelAdapter);
mCampAdapter = new HotCarTypeAdapter();
ryHomeCamp.setLayoutManager(new GridLayoutManager(getContext(), 2));
ryHomeCamp.addItemDecoration(new AbSpacesItemDecoration(DisplayUtil.dip2px(_mActivity, 5), DisplayUtil.dip2px(_mActivity, 8)));// 分割线。
ryHomeCamp.addItemDecoration(new AbSpacesItemDecoration(10, DisplayUtil.dip2px(_mActivity, 8)));// 分割线。
ryHomeCamp.setNestedScrollingEnabled(false);
ryHomeCamp.setAdapter(mCampAdapter);
//精选活动
mActivityAdapter = new SelectedEventsAdapter();
recyclerViewActivity.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
recyclerViewActivity.addItemDecoration(new AbSpacesItemDecoration1(DisplayUtil.dip2px(_mActivity, 10)));// 分割线。
recyclerViewActivity.addItemDecoration(new AbSpacesItemDecoration1(20));// 分割线。
recyclerViewActivity.setNestedScrollingEnabled(false);
recyclerViewActivity.setAdapter(mActivityAdapter);
mActivityAdapter.setOnItemClickListener((adapter, view, position) -> {
......@@ -216,7 +216,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
});
recyclerViewRvEnthusiast.setLayoutManager(staggeredGridLayoutManager);
recyclerViewRvEnthusiast.addItemDecoration(new AbSpacesItemDecoration2(DisplayUtil.dip2px(_mActivity, 5), DisplayUtil.dip2px(_mActivity, 5)));// 分割线。
recyclerViewRvEnthusiast.addItemDecoration(new AbSpacesItemDecoration2(10, 10));// 分割线。
recyclerViewRvEnthusiast.setNestedScrollingEnabled(false);
recyclerViewRvEnthusiast.setAdapter(mRvEnthusiast);
......@@ -241,7 +241,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
//房车游榜单
mRvTourAdapter = new RVTourListAdapter();
recyclerViewRvtourlist.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
recyclerViewRvtourlist.addItemDecoration(new AbSpacesItemDecoration1(DisplayUtil.dip2px(_mActivity, 10)));
recyclerViewRvtourlist.addItemDecoration(new AbSpacesItemDecoration1(20));
recyclerViewRvtourlist.setNestedScrollingEnabled(false);
recyclerViewRvtourlist.setAdapter(mRvTourAdapter);
......
......@@ -41,7 +41,7 @@ public class HotCarTypeAdapter extends BaseQuickAdapter<HomeHotGoodListBean.Data
.asBitmap()
.load(bean.getIcon())
.apply(options)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(DisplayUtil.dip2px(mContext,6))).override(image.getWidth(), image.getHeight()))
.apply(RequestOptions.bitmapTransform(new RoundedCorners(DisplayUtil.dip2px(mContext,7))).override(image.getWidth(), image.getHeight()))
.into(utils);
helper.setText(R.id.tv_name, bean.getName());
......
......@@ -38,7 +38,7 @@ public class RVEnthusiastAdapter extends BaseQuickAdapter<DiscoveryDataBean, Bas
.asBitmap()
.load(body.getImages().get(0).getOurl())
.apply(options)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(DisplayUtil.dip2px(mContext,6))))
.apply(RequestOptions.bitmapTransform(new RoundedCorners(DisplayUtil.dip2px(mContext,7))))
.into(utils);
}
......
......@@ -18,7 +18,7 @@ public class RVTourListAdapter extends BaseQuickAdapter<HomePopularBrigade.DataB
@Override
protected void convert(BaseGlideHolder helper, HomePopularBrigade.DataBean bean) {
helper.loadRoundImage(mContext,bean.getImg(), (ImageView) helper.getView(R.id.iv_rv_tour),6);
helper.loadRoundImage(mContext,bean.getImg(), (ImageView) helper.getView(R.id.iv_rv_tour),7);
helper.setText(R.id.tv_lab,bean.getName()) ;
// GlideManager.getInstance(mContext).loadImage(bean.getImg(), (ImageView)helper.getView(R.id.iv_rv_tour));
}
......
......@@ -20,7 +20,7 @@ public class SelectedEventsAdapter extends BaseQuickAdapter<SelectedActivitiesBe
// GlideManager.getInstance(mContext).loadRoundImage(string, (ImageView)helper.getView(R.id.iv_activity),6);
// helper.setImageDrawable(R.id.iv_activity,mContext.getResources().getDrawable(integer));
if(!TextUtils.isEmpty(item.getPicture())) {
GlideManager.getInstance(mContext).loadRoundImage2(item.getPicture(), (ImageView) helper.getView(R.id.iv_activity), 6);
GlideManager.getInstance(mContext).loadRoundImage2(item.getPicture(), (ImageView) helper.getView(R.id.iv_activity), 7);
}
}
}
......@@ -304,7 +304,7 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/ry_home_hot_travel"
android:layout_width="match_parent"
android:layout_height="420dp"
android:layout_height="425dp"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="17dp"
android:layout_marginRight="@dimen/size_10" />
......@@ -478,8 +478,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingLeft="@dimen/size_5"
android:paddingRight="@dimen/size_5" />
android:paddingLeft="7dp"
android:paddingRight="7dp" />
</LinearLayout>
</LinearLayout>
......
......@@ -9,7 +9,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.rv.home.rv.module.ui.main.home.view.HotTravelImageView
<com.ruiwenliu.wrapper.weight.Rv4_3ImageView
android:id="@+id/iv_goods"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/size_240"
android:layout_height="@dimen/size_150"
android:orientation="vertical">
<ImageView
......@@ -16,10 +16,11 @@
android:id="@+id/tv_lab"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginBottom="@dimen/dp_10"
android:paddingLeft="@dimen/size_15"
android:gravity="center_vertical"
android:layout_gravity="bottom|left"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:background="@drawable/rv_bg_explain"
android:layout_width="match_parent"
android:layout_height="@dimen/size_30" />
</FrameLayout>
\ No newline at end of file
......@@ -9,6 +9,7 @@ import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -41,6 +42,7 @@ import com.ruiwenliu.wrapper.util.permission.RxPermission;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.component.utils.Cookie;
import com.rv.component.utils.DisplayUtil;
import com.rv.component.utils.LocationRecord;
import com.rv.tourism.adapter.AllPopularAdapter;
import com.rv.tourism.adapter.PopularBrigadeAdapter;
......@@ -76,6 +78,8 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
//BaseQuickAdapter.RequestLoadMoreListener,
@BindView(R2.id.travel_city_text)
TextView travelCityText;
@BindView(R2.id.ll_indicator)
LinearLayout llIndicator;
@BindView(R2.id.search_input)
TextView searchInput;
@BindView(R2.id.travel_banner)
......@@ -136,14 +140,14 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
//热门游
mPopularBrigadeAdapter = new PopularBrigadeAdapter();
rvPopularBrigade.setLayoutManager(new LinearLayoutManager(_mActivity, LinearLayoutManager.HORIZONTAL, false));
// rvPopularBrigade.addItemDecoration(new AbSpacesItemDecoration(20,10));// 分割线。
rvPopularBrigade.addItemDecoration(new AbSpacesItemDecoration(20));// 分割线。
rvPopularBrigade.setNestedScrollingEnabled(false);
rvPopularBrigade.setAdapter(mPopularBrigadeAdapter);
//全部热门旅游
mAllPopularAdapter = new AllPopularAdapter();
rvPopularMore.setLayoutManager(new GridLayoutManager(_mActivity, 3));
rvPopularMore.addItemDecoration(new AbSpacesItemDecoration2(20, 10));// 分割线。
rvPopularMore.addItemDecoration(new AbSpacesItemDecoration2(10, 20));// 分割线。
// rvPopularMore.setNestedScrollingEnabled(false);
rvPopularMore.setAdapter(mAllPopularAdapter);
......@@ -439,6 +443,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
.setBannerTitles(titles)
.setImages(images)
.setDelayTime(3000)
.setIndicatorVisiable(true)
.setImageLoader(new ImageLoader() {
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
......@@ -456,6 +461,23 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
.start();
travelBanner.updateBannerStyle(BannerConfig.CIRCLE_INDICATOR);
travelBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
}
@Override
public void onPageSelected(int i) {
indicatorChange(i);
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
}
@Override
......@@ -529,26 +551,16 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
public class AbSpacesItemDecoration extends RecyclerView.ItemDecoration {
private int left;
private int right;
public AbSpacesItemDecoration(int left, int right) {
public AbSpacesItemDecoration(int left) {
this.left = left;
this.right = right;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int childCount = parent.getChildCount();
if ((childCount - 1) % 2 == 0) {
int position = parent.getChildAdapterPosition(view);
if (position != 0) {
outRect.left = left;
outRect.right = right;
outRect.bottom = right;
outRect.top = right;
} else {
outRect.left = right;
outRect.right = left;
outRect.bottom = right;
outRect.top = right;
}
}
}
......@@ -556,33 +568,52 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
public class AbSpacesItemDecoration2 extends RecyclerView.ItemDecoration {
private int left;
private int right;
private int h;
private int v;
public AbSpacesItemDecoration2(int left, int right) {
this.left = left;
this.right = right;
public AbSpacesItemDecoration2(int h, int v) {
this.h = h;
this.v = v;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int childCount = parent.getChildCount();
if (childCount % 3 == 1) {
outRect.left = left;
outRect.right = right;
outRect.bottom = right;
outRect.top = right;
} else if (childCount % 3 == 2) {
outRect.left = right;
outRect.right = right;
outRect.bottom = right;
outRect.top = right;
} else if (childCount % 3 == 0) {
outRect.left = right;
outRect.right = left;
outRect.bottom = right;
outRect.top = right;
int position = parent.getChildAdapterPosition(view);
if (position % 3 == 1) {
outRect.left = h;
outRect.right = h;
} else if (position % 3 == 2) {
outRect.left = h;
} else if (position % 3 == 0) {
outRect.right = h;
}
if (position / 3 != 0) {
outRect.top = v;
}
}
}
private void indicatorChange(int position) {
if (llIndicator == null) return;
llIndicator.removeAllViews();
for (int i = 0; i < images.size(); i++) {
ImageView imageView = new ImageView(getContext());
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
LinearLayout.LayoutParams params = null;
if (position == i) {
params = new LinearLayout.LayoutParams(DisplayUtil.dip2px(getContext(), 7), DisplayUtil.dip2px(getContext(), 7));
} else {
params = new LinearLayout.LayoutParams(DisplayUtil.dip2px(getContext(), 7), DisplayUtil.dip2px(getContext(), 7));
}
params.leftMargin = DisplayUtil.dip2px(getContext(), 3);
params.rightMargin = DisplayUtil.dip2px(getContext(), 3);
if (i == position) {
imageView.setImageResource(R.drawable.gray_radius);
} else {
imageView.setImageResource(R.drawable.white_radius);
}
llIndicator.addView(imageView, params);
}
}
......
......@@ -17,7 +17,7 @@ public class PopularBrigadeAdapter extends BaseQuickAdapter<BeanPopularBrigade.D
@Override
protected void convert(BaseViewHolder helper, BeanPopularBrigade.DataBean item) {
GlideManager.getInstance(mContext).loadRoundImage(item.getImg(), (ImageView)helper.getView(R.id.iv_icon),8);
GlideManager.getInstance(mContext).loadRoundImage(item.getImg(), (ImageView)helper.getView(R.id.iv_icon),7);
helper.setText(R.id.tv_hot,item.getName());
}
}
......@@ -18,7 +18,7 @@ public class TourAroundAdapter extends BaseQuickAdapter<BeanTourAround.DataBeanX
@Override
protected void convert(BaseViewHolder helper, BeanTourAround.DataBeanX.DataBean item) {
GlideManager.getInstance(mContext).loadRoundImage(item.getCover(), (ImageView)helper.getView(R.id.iv_icon),10);
GlideManager.getInstance(mContext).loadRoundImage(item.getCover(), (ImageView)helper.getView(R.id.iv_icon),7);
helper.setText(R.id.tv_title,item.getName());
// helper.setText(R.id.tv_city,item.get)
helper.setText(R.id.tv_people,item.getStock());
......
......@@ -42,7 +42,7 @@
<com.yuyife.banner.Banner
android:id="@+id/travel_banner"
android:layout_width="match_parent"
android:layout_height="@dimen/size_220" />
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
......
......@@ -113,14 +113,32 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yuyife.banner.Banner
android:id="@+id/travel_banner"
android:layout_width="match_parent"
android:layout_height="@dimen/size_220" />
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/ll_indicator"
android:layout_width="match_parent"
android:layout_height="@dimen/size_30"
android:layout_alignParentBottom="true"
android:background="@drawable/rv_bg_explain"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
<LinearLayout
style="@style/margin_left_right"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginBottom="@dimen/dp_10"
android:background="@color/colorWrite"
android:orientation="vertical">
......@@ -128,55 +146,55 @@
android:id="@+id/ll_item_popular_brigade_many"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="@dimen/size_12"
android:paddingBottom="@dimen/size_12">
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_15"
android:layout_weight="1"
android:text="热门游"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
android:textSize="@dimen/size_18"
android:textStyle="bold" />
<TextView
android:id="@+id/iv_popular_brigade_many"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/common_icon_rig_black_gray"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15"
android:drawablePadding="@dimen/size_5"
android:text="全部"
android:textSize="@dimen/text_10" />
android:textSize="@dimen/sp_12" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_popular_brigade"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_10" />
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_10"
android:background="#F7F5F6" />
<LinearLayout
style="@style/margin_left_right"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginTop="@dimen/size_12"
android:background="@color/colorWrite"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginTop="@dimen/size_12"
android:layout_marginBottom="@dimen/size_12"
android:text="周边游"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
android:textSize="@dimen/size_18" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_tour_around"
......@@ -202,9 +220,9 @@
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/size_60"
android:layout_marginTop="@dimen/size_20"
android:gravity="center"
android:text="— 选择旅游类型 —"
android:layout_marginTop="@dimen/size_20"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_16" />
......@@ -212,8 +230,10 @@
android:id="@+id/rv_popular_more"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingBottom="@dimen/size_40"
android:layout_weight="1" />
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:paddingBottom="@dimen/size_40" />
<ImageView
android:id="@+id/travel_hot_more_close"
......
......@@ -2,22 +2,20 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:layout_height="@dimen/size_70">
android:layout_height="wrap_content">
<ImageView
<com.ruiwenliu.wrapper.weight.Rv4_3ImageView
android:id="@+id/iv_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tv_hot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="@dimen/size_20"
android:layout_alignParentBottom="true"
android:paddingBottom="@dimen/size_5"
android:paddingTop="@dimen/size_5"
android:background="@drawable/shape_rv_bg_translucent_black_half"
android:background="@drawable/rv_bg_explain"
android:gravity="center"
android:text="新疆游"
android:textColor="@color/colorWrite"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginLeft="@dimen/size_15"
android:layout_width="@dimen/size_130"
android:layout_height="@dimen/size_80">
android:layout_width="108.47dp"
android:layout_height="75.33dp">
<ImageView
android:id="@+id/iv_icon"
......@@ -13,13 +12,11 @@
<TextView
android:id="@+id/tv_hot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="@dimen/size_30"
android:layout_alignParentBottom="true"
android:paddingBottom="@dimen/size_5"
android:paddingTop="@dimen/size_5"
android:background="@drawable/shape_rv_bg_translucent_black_half"
android:background="@drawable/rv_bg_explain"
android:gravity="center"
android:text="新疆游"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
android:textSize="@dimen/sp_14" />
</RelativeLayout>
\ No newline at end of file
......@@ -7,15 +7,13 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_marginBottom="@dimen/size_15"
android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="@dimen/size_150"
android:layout_height="@dimen/size_100"
android:layout_width="122dp"
android:layout_height="86.67dp"
android:scaleType="centerCrop" />
<LinearLayout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment