Commit f031befa authored by 419948809@qq.com's avatar 419948809@qq.com

首页改版的首次提交代码

parent d2f1ce7a
......@@ -347,7 +347,7 @@ public class Banner extends FrameLayout implements OnPageChangeListener {
setScaleType(imageView);
Object url = null;
if (i == 0) {
url = imagesUrl.get(count - 1);
url = imagesUrl.get(count - 1);
} else if (i == count + 1) {
url = imagesUrl.get(0);
} else {
......
......@@ -8,8 +8,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
flavorDimensions "default"
versionCode 157
versionName "1.5.7"
versionCode 158
versionName "1.5.8"
multiDexEnabled true
......
......@@ -2,6 +2,7 @@ package com.ruiwenliu.wrapper.base;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -10,6 +11,7 @@ import com.ruiwenliu.wrapper.R;
import com.ruiwenliu.wrapper.inter.OnViewHolder;
import com.ruiwenliu.wrapper.presenter.MvpPresenter;
import com.ruiwenliu.wrapper.util.ViewHolder;
import com.yuyife.okgo.OkGoUtil;
/**
......
......@@ -3,7 +3,7 @@
package="com.rv.home">
<application>
<activity android:name=".rv.module.ui.main.home.CarVRActivity"></activity>
<activity android:name=".rv.module.ui.main.home.CarVRActivity" />
<activity
android:name=".rv.module.ui.main.home.order.ChargeDetailsActivity"
android:screenOrientation="portrait" />
......@@ -19,6 +19,8 @@
<activity
android:name=".rv.module.ui.main.home.SalesroomActivity"
android:screenOrientation="portrait" />
<activity android:name=".rv.module.ui.main.home.CarRentActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
\ No newline at end of file
package com.rv.home.rv.module.ui.main.home;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.base.utils.ui.datetime.selector.util.TextUtil;
import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.util.GpsManager;
import com.ruiwenliu.wrapper.util.LocationManager;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.DateUtils;
import com.rv.component.utils.MyUtils;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.ui.main.home.bean.CityPickerBean;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
import com.rv.home.rv.module.ui.main.home.presenter.CarRentPresenter;
import java.util.LinkedHashMap;
import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
public class CarRentActivity extends BaseStatusActivity<CarRentPresenter> implements GpsManager.GpsChangeListener {
private static final int TYPE_REQUEST_CITY = 10000;
@BindView(R2.id.ll_rent)
LinearLayout llRent;
@BindView(R2.id.tv_home_get_address)
TextView tvHomeGetAddress;
@BindView(R2.id.ll_return)
LinearLayout llReturn;
@BindView(R2.id.tv_home_out_address)
TextView tvHomeOutAddress;
@BindView(R2.id.tv_home_get_time)
TextView tvHomeGetTime;
@BindView(R2.id.tv_home_get_week)
TextView tvHomeGetWeek;
@BindView(R2.id.tv_home_day)
TextView tvHomeDay;
@BindView(R2.id.tv_home_out_time)
TextView tvHomeOutTime;
@BindView(R2.id.tv_home_out_week)
TextView tvHomeOutWeek;
@BindView(R2.id.tv_home_select_car)
Button tvHomeSelectCar;
private String outCityName;
private String getCompanyName; // 取车公司
private String outCompanyName; // 还车公司
private double latLatitude; // 当前的经纬度
private double lonLongitude; // 当前的经纬度
// private double getLatitude; // 取车地点的经纬度
// private double getLongitude; // 取车地点的经纬度
//
// private double outLatitude; // 还车公司经纬度
// private double outLongitude; // 还车公司经纬度
private String begDate = ""; // 租车起始时间
private String endDate = ""; // 还车时间
private String getCityName; // 取车城市
private int getCityId; // 取车城市id
private int outCityId; // 还车城市id
private int getCompanyId; // 取车公司id
private int outCompanyId; // 还车公司id
private LocationManager locationManager;
private long rentDay = 2;//租车天数
public static Intent getIntent(Context context, String cityName) {
Log.e("xxxxxxxxxxxxxx",cityName) ;
Intent intent = new Intent(context, CarRentActivity.class);
intent.putExtra("cityName", cityName);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected int setLayout() {
return R.layout.activity_car_rent;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(getString(R.string.rv_home_title_recent_info));
GpsManager.getInstance(this).bindGpsListener(this);
setDefaultTime();
initGps();
}
@Override
protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent);
getCityName = outCityName = intent.getStringExtra("cityName");
if (!TextUtils.isEmpty(getCityName)) {
getShopList();
}
}
@Override
public void onShowResult(int requestType, BaseBean result) {
switch (requestType) {
case 0:
processData((ShopListBean) result);
break;
}
}
/**
* 获取门店列表
*/
private void getShopList() {
int addrCity = 0;
String json = UtilsManager.getInstance().getJson(mActivity, "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
for (ListsBean lsBean : cityBean.getLists()) {
if (!TextUtils.isEmpty(getCityName)) {
if (getCityName.equals(lsBean.getName())) {
addrCity = lsBean.getId();
}
}
}
}
Log.e("xxxxxxxx",String.valueOf(addrCity)) ;
Map<String, Object> map = new LinkedHashMap<>();
map.put("page", 1);
map.put("limit", 1);
map.put("addrCity", String.valueOf(addrCity));
mPresenter.getData(RvFrameConfig.VEHICLE_POST, 0, ApiConfig.HTTP_URL_SHOP_LIST, ShopListBean.class, map, false);
}
/**
* 处理最近门店请求结果
*
* @param bean
*/
private void processData(ShopListBean bean) {
if (bean.getData() != null && bean.getData().getTotalCount() > 0) {
getCompanyName = bean.getData().getData().get(0).getName();
StringBuffer getBuffer = new StringBuffer();
if (!TextUtils.isEmpty(getCompanyName)) {
getBuffer.append(getCompanyName);
}
if (!TextUtils.isEmpty(getCityName)) {
getBuffer.append("(").append(getCityName).append(")");
}
if (getBuffer != null && getBuffer.length() > 0) {
tvHomeGetAddress.setText(getBuffer.toString());
} else {
tvHomeGetAddress.setText("");
}
tvHomeGetAddress.setTextColor(getResources().getColor(R.color.colorMain));
// getLatitude = bean.getData().getData().get(0).getLatitude();
// getLongitude = bean.getData().getData().get(0).getLongitude();
getCompanyId = bean.getData().getData().get(0).getId();
outCompanyName = bean.getData().getData().get(0).getName();
StringBuffer outBuffer = new StringBuffer();
if (!TextUtils.isEmpty(outCompanyName)) {
outBuffer.append(outCompanyName);
}
if (!TextUtils.isEmpty(outCityName)) {
outBuffer.append("(").append(outCityName).append(")");
}
if (outBuffer != null && outBuffer.length() > 0) {
tvHomeOutAddress.setText(outBuffer.toString());
} else {
tvHomeOutAddress.setText("");
}
tvHomeOutAddress.setTextColor(getResources().getColor(R.color.colorMain));
// outLatitude = bean.getData().getData().get(0).getLatitude();
// outLongitude = bean.getData().getData().get(0).getLongitude();
outCompanyId = bean.getData().getData().get(0).getId();
} else {
getCompanyName = "";
tvHomeGetAddress.setText(getCompanyName);
// getLatitude = 0;
// getLongitude = 0;
outCompanyName = "";
tvHomeOutAddress.setText(outCompanyName);
// outLatitude = 0;
// outLongitude = 0;
}
}
/**
* 设置默认时间
*/
private void setDefaultTime() {
String time = DateUtils.formatDate28(DateUtils.timestampToString1(DateUtils.getCurTimeMillis()), 2);
String hh = DateUtils.formatDate21(time);
String mm = DateUtils.formatDate22(time);
String begTime = "";
if (Double.valueOf(mm) > 30) { //判断当前分钟是否已经超过30,如果超过了取整加30分钟
begTime = DateUtils.formatDate19(hh + ":30");
} else {
begTime = hh + ":30";
}
if (DateUtils.formatDate20(begTime) > DateUtils.formatDate20("22:30")) { //如果当前时间大于 22:30,日期往后加一,时间改成早上8:00
begDate = MyUtils.getFetureDate(1) + " " + "08:30";
endDate = MyUtils.getFetureDate(3) + " " + "08:30";
} else {
begDate = MyUtils.getFetureDate(0) + " " + begTime;
endDate = MyUtils.getFetureDate(2) + " " + begTime;
}
tvHomeGetTime.setText(DateUtils.formatDate66(begDate));
tvHomeGetWeek.setText("周" + MyUtils.getWeek(DateUtils.formatDate16(begDate)));
tvHomeOutTime.setText(DateUtils.formatDate66(endDate));
tvHomeOutWeek.setText("周" + MyUtils.getWeek(DateUtils.formatDate16(endDate)));
rentDay = getCountDay(begDate, endDate);
tvHomeDay.setText(String.format("%1$s%2$s", rentDay, getString(R.string.rv_days)));
}
/**
* 计算天数
*
* @param endDate2
* @param begDate2
* @return
*/
private long getCountDay(String begDate2, String endDate2) {
long second = DateUtils.compareDateSecond3(endDate2, begDate2); //两个时间相差的秒数
long day = second / 86400; //天数
long remainder = second % 86400; //余数 秒
if (day == 0) { //不够24小时也算一天
day = day + 1;
} else if (remainder > 14400) { //4小时内天数不增加,否则加一
day = day + 1;
}
return day;
}
@OnClick({R2.id.ll_rent, R2.id.tv_home_get_address, R2.id.ll_return, R2.id.tv_home_out_address, R2.id.ll_home_item_select_data,
R2.id.tv_home_select_car})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.tv_home_get_address || id == R.id.ll_rent) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_SELECTSHOP)
.withDouble("mLat", latLatitude)
.withDouble("mLon", lonLongitude)
.withString("cityName", getCityName)
.withInt("shopType", 1)
.navigation(mActivity, TYPE_REQUEST_CITY);
} else if (id == R.id.ll_return || id == R.id.tv_home_out_address) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_SELECTSHOP)
.withDouble("mLat", latLatitude)
.withDouble("mLon", lonLongitude)
.withString("cityName", outCityName)
.withInt("shopType", 2)
.navigation(mActivity, TYPE_REQUEST_CITY);
} else if (id == R.id.ll_home_item_select_data) {
//选择日期
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CALENDAR)
.withString("begDate", begDate)
.withString("endDate", endDate)
.navigation(mActivity, 108);
} else if (id == R.id.tv_home_select_car) {
//租房车 立即选车
if (rentDay < 1) {
showToast(getString(R.string.rv_day_toast));
return;
}
if (TextUtil.isEmpty(tvHomeGetAddress.getText().toString().trim()) ||
TextUtil.isEmpty(tvHomeOutAddress.getText().toString().trim())) {
showToast("请选择取/还车地址");
return;
}
mPresenter.sendData(getCityId,outCityId,getCompanyId,outCompanyId,
latLatitude,lonLongitude,getCityName,
getCompanyName,
outCityName,
outCompanyName,
begDate, endDate, rentDay,
begDate,
endDate
);
}
}
/**
* 初始化定位
*/
public void initGps() {
if(locationManager == null){
locationManager = new LocationManager(mActivity);
}
locationManager.getLocationDetail(new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation location) {
latLatitude = location.getLatitude();
lonLongitude = location.getLongitude();
locationManager.stopLocation();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case TYPE_REQUEST_CITY: //城市列表
if (data == null) return;
int type = data.getIntExtra("type", 1);
String requestData = data.getStringExtra("location");
if (type == 1) {
getCompanyName = data.getStringExtra("company");
getCompanyId = data.getIntExtra("company_id", 1);
getCityName = requestData;
getCityId = data.getIntExtra("id", 0);
StringBuffer buffer = new StringBuffer();
if (!TextUtils.isEmpty(getCompanyName)) {
buffer.append(getCompanyName);
}
if (!TextUtils.isEmpty(getCityName)) {
buffer.append("(").append(getCityName).append(")");
}
if (buffer.length() > 0) {
tvHomeGetAddress.setText(buffer.toString());
} else {
tvHomeGetAddress.setText("");
}
// getLatitude = data.getDoubleExtra("latitude", 0);
// getLongitude = data.getDoubleExtra("longitude", 0);
} else if (type == 2) {
outCompanyName = data.getStringExtra("company");
outCompanyId = data.getIntExtra("company_id", 1);
outCityName = requestData;
outCityId = data.getIntExtra("id", 0);
StringBuffer buffer = new StringBuffer();
if (!TextUtils.isEmpty(outCompanyName)) {
buffer.append(outCompanyName);
}
if (!TextUtils.isEmpty(outCityName)) {
buffer.append("(").append(outCityName).append(")");
}
if (buffer.length() > 0) {
tvHomeOutAddress.setText(buffer.toString());
} else {
tvHomeOutAddress.setText("");
}
// outLatitude = data.getDoubleExtra("latitude", 0);
// outLongitude = data.getDoubleExtra("longitude", 0);
}
break;
case 108:
if (resultCode == 200) {
begDate = data.getStringExtra("begDate");
endDate = data.getStringExtra("endDate");
rentDay = getCountDay(begDate, endDate); //天数
}
tvHomeGetTime.setText(DateUtils.formatDate66(begDate));
tvHomeOutTime.setText(DateUtils.formatDate66(endDate));
tvHomeGetWeek.setText("周" + MyUtils.getWeek(begDate));
tvHomeOutWeek.setText("周" + MyUtils.getWeek(endDate));
tvHomeDay.setText(String.format("%1$s%2$s", rentDay, getString(R.string.rv_days)));
break;
default:
break;
}
}
@Override
public void gpsChange(boolean b) {
if(b){
initGps();
}
}
@Override
public void onDestroy() {
super.onDestroy();
GpsManager.getInstance(this).unbindGpsListener(this);
}
}
......@@ -83,8 +83,6 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
private int mPage;
private double mLat;
private double mLon;
private double outLongitude;
private double outLatitude;
private boolean mBool;
private int selectType;
private CarAttributePw mCarPw;
......@@ -96,12 +94,10 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
private long copyDay;//租车天数
private CheckPriceDialog checkPriceDialog;
public static Intent getIntent(Context context, double lat, double lon, double outLatitude, double outLongitude, boolean bool, OrderDataBean bean, String startTime, String endTime) {
public static Intent getIntent(Context context, double lat, double lon, boolean bool, OrderDataBean bean, String startTime, String endTime) {
return new Intent(context, CarRentalListActivity.class)
.putExtra("lat", lat)
.putExtra("lon", lon)
.putExtra("outLatitude", outLatitude)
.putExtra("outLongitude", outLongitude)
.putExtra("bean", bean)
.putExtra("bool", bool)
.putExtra("startTime", startTime)
......@@ -125,8 +121,6 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
listScreeningId = new ArrayList<>();
mLat = intent.getDoubleExtra("lat", 0);
mLon = intent.getDoubleExtra("lon", 0);
outLatitude = intent.getDoubleExtra("outLatitude", 0);
outLongitude = intent.getDoubleExtra("outLongitude", 0);
mBool = intent.getBooleanExtra("bool", false);
titleView.setImageResource(R.id.iv_title_right, R.drawable.rv_rentingcar_icon_plat);
titleView.setChildClickListener(R.id.iv_title_right, new View.OnClickListener() {
......
......@@ -6,7 +6,6 @@ import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
......@@ -14,82 +13,54 @@ import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.search.core.SearchResult;
import com.baidu.mapapi.search.geocode.GeoCodeOption;
import com.baidu.mapapi.search.geocode.GeoCodeResult;
import com.baidu.mapapi.search.geocode.GeoCoder;
import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener;
import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult;
import com.base.utils.ui.datetime.selector.util.TextUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.SPConstance;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.inter.ImInitListenter;
import com.ruiwenliu.wrapper.util.GpsManager;
import com.ruiwenliu.wrapper.util.LocationManager;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.ruiwenliu.wrapper.util.listener.SwitchFragment;
import com.ruiwenliu.wrapper.util.permission.RxPermission;
import com.ruiwenliu.wrapper.weight.refresh.IFooterWrapper;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.Cookie;
import com.rv.component.utils.DateUtils;
import com.rv.component.utils.DisplayUtil;
import com.rv.component.utils.LogUtil;
import com.rv.component.utils.MyUtils;
import com.rv.component.utils.ObservableScrollView;
import com.rv.component.utils.RvCache;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.ui.login.LoginRvActivity;
import com.rv.home.rv.module.ui.main.home.adapter.HotCarTypeAdapter;
import com.rv.home.rv.module.ui.main.home.adapter.RVEnthusiastAdapter;
import com.rv.home.rv.module.ui.main.home.adapter.RVTourListAdapter;
import com.rv.home.rv.module.ui.main.home.adapter.RVTourListLabelAdapter;
import com.rv.home.rv.module.ui.main.home.adapter.SelectedEventsAdapter;
import com.rv.home.rv.module.ui.main.home.bean.BeanHomeBanner;
import com.rv.home.rv.module.ui.main.home.bean.CityPickerBean;
import com.rv.home.rv.module.ui.main.home.bean.HomeHotGoodListBean;
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.ListsBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderDataBean;
import com.rv.home.rv.module.ui.main.home.bean.SelectedActivitiesBean;
import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
import com.rv.home.rv.module.ui.main.home.presenter.HomePresenter;
import com.xxrv.video.activity.TriListActivity;
import com.xxrv.video.bean.circle.DiscoveryDataBean;
import com.yuyife.banner.Banner;
import com.yuyife.banner.BannerConfig;
import com.yuyife.banner.listener.OnBannerListener;
import com.yuyife.banner.loader.ImageLoader;
import com.yuyife.okgo.OkGoUtil;
......@@ -100,40 +71,19 @@ import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
/**
* 首页
*/
public class HomeFragment extends BaseFragment<HomePresenter> implements ObservableScrollView.ScrollViewListener, SimpleRefreshLayout.OnSimpleRefreshListener, GpsManager.GpsChangeListener {
@BindView(R2.id.ll_layout_home_renting_a_car)
LinearLayout llLayoutRentingACar;
@BindView(R2.id.ll_layout_home_rv_tour)
LinearLayout llLayoutRvTour;
@BindView(R2.id.home_banner)
Banner mineBanner;
@BindView(R2.id.tv_item_home_rv_tour)
TextView tvItemRvTour;
@BindView(R2.id.tv_item_home_renting_a_car)
TextView tvItemRentingACar;
@BindView(R2.id.tv_home_get_address)
TextView headTvGetShop;
@BindView(R2.id.tv_home_out_address)
TextView headTvOutShop;
@BindView(R2.id.tv_home_get_time)
TextView tvGetTime;
@BindView(R2.id.tv_home_get_week)
TextView tvGetWeek;
@BindView(R2.id.tv_home_day)
TextView tvDay;
@BindView(R2.id.tv_home_out_time)
TextView tvOutTime;
@BindView(R2.id.tv_home_out_week)
TextView tvOutWeek;
@BindView(R2.id.recyclerView_home_content)
RecyclerView recyclerViewContent;
@BindView(R2.id.ry_home_hot_travel)
RecyclerView ryHomeHotTravel;
@BindView(R2.id.ry_home_camp)
RecyclerView ryHomeCamp ;
@BindView(R2.id.recyclerView_home_activity)
RecyclerView recyclerViewActivity;
@BindView(R2.id.recyclerView_home_rvtourlist)
......@@ -150,24 +100,6 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
TextView searchInput;
@BindView(R2.id.iv_home_travel_server_image)
ImageView travelServerImage;
@BindView(R2.id.tv_home_rv_city)
TextView tvRvCity;
@BindView(R2.id.tv_home_rv_hot_label1)
TextView tvRvHotLabel1;
@BindView(R2.id.tv_home_rv_hot_label2)
TextView tvRvHotLabel2;
@BindView(R2.id.tv_home_rv_hot_label3)
TextView tvRvHotLabel3;
@BindView(R2.id.tv_home_hot_rvtour)
TextView tvHotRvtour;
@BindView(R2.id.tv_home_hot_entertainment_camp)
TextView tvHotEntertainmentCamp;
@BindView(R2.id.tv_home_hot_car_rental)
TextView tvHotCarRental;
@BindView(R2.id.tv_home_see_more_popular)
TextView tvSeeMorePopular;
@BindView(R2.id.rl_home_item_layout)
RelativeLayout rlItemLayout;
@BindView(R2.id.os_scrollview_home)
ObservableScrollView scrollview;
@BindView(R2.id.ll_home_item_title)
......@@ -178,81 +110,40 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
LinearLayout llItemSearch;
@BindView(R2.id.refresh_home)
SimpleRefreshLayout mSimpleRefreshLayout;
@BindView(R2.id.ll_home_item_hot_rvtour)
LinearLayout llItemHotRvtour;
@BindView(R2.id.ll_home_item_hot_entertainment_camp)
LinearLayout llItemHotEntertainmentCamp;
@BindView(R2.id.ll_home_item_hot_car_rental)
LinearLayout llItemHotCarRental;
@BindView(R2.id.tv_home_hot_rvtour_hint)
TextView tvHotRvtourHint;
@BindView(R2.id.tv_home_hot_entertainment_hint)
TextView tvHotEntertainmentHint;
@BindView(R2.id.tv_home_hot_car_rental_hint)
TextView tvHotCarRentalHint;
@BindView(R2.id.iv_home_travel_city_text_hint)
ImageView ivTravelCityTextHint;
@BindView(R2.id.iv_home_search_input_hint)
ImageView ivSearchInputHint;
Unbinder unbinder1;
@BindView(R2.id.ll_car_recent)
LinearLayout llCarRecent ;
@BindView(R2.id.ll_car_travel)
LinearLayout llCarTravel ;
@BindView(R2.id.ll_car_camp)
LinearLayout llCarCamp ;
@BindView(R2.id.ll_car_discovery)
LinearLayout llCarDiscovery ;
@BindView(R2.id.ll_car_buy)
LinearLayout llCarBuy;
private ArrayList<String> images = new ArrayList<>(); //图片(默认采用网络地址)
private List<String> titles = new ArrayList<>(); //图片标题
private final int TYPE_REQUEST_CITY = 1;//城市列表
private final int REQUEST_GET_CODE = 10001; // 取车地址选择请求码
private final int REQUEST_RETURN_CODE = 10002; // 换车地址选择请求码
private String nowCity = "";
private int getSwitchType;//取车开关类型
private int outSwitchType;//还车开关类型
private double latLatitude = 0;
private double lonLongitude;
private LatLng mLatLng;//当前城市经纬度
private String getCompanyName;
private String outCompanyName;
private int getCompanyId; // 取车公司id
private int outCompanyId; // 取车公司id;
private double getLatitude;
private double getLongitude;
private double outLatitude = 0;
private double outLongitude;
private int getCityId;//取车城市ID
private int outCityId;//还车城市ID
private String getCityName;
private String outCityName;
private int vVTourCityId;// 房车游城市ID
private int mTravelCityId;// 头城市ID
private OrderDataBean dataBean;
private long copyDay = 2;//租车天数
private LocationManager locationManager;
private GeoCoder geoCoder;
private List<HomePopularBrigade.DataBean> hotData; //热门标签
private double rvTourLatitude = 0;
private double rvTourLongitude;
private final int REQUEST_RECENT_CODE = 10000 ;
private double travelCityLatitude = 0;//头城市
private double travelCityLongitude = 0;
private String begDate = "";
private String endDate = "";
private String hotType = "2";
private LocationManager locationManager;
private HotCarTypeAdapter mAdapter;
private HotCarTypeAdapter mHotTravelAdapter;
private HotCarTypeAdapter mCampAdapter ;
private SelectedEventsAdapter mActivityAdapter;
private RVEnthusiastAdapter mRvEnthusiast;
private RVTourListAdapter mRvTourAdapter;
private RVTourListLabelAdapter mRvTourLabelAdapter;
private int height;
private int countPage;
private int mPage;
private int height ;
public static HomeFragment getInstance(int type) {
Bundle bundl = new Bundle();
bundl.putInt("type", type);
......@@ -276,32 +167,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
setBanner();
Drawable drawable = getResources().getDrawable(R.drawable.icon_day_times);
drawable.setBounds(0, 0, DisplayUtil.dip2px(getContext(), 25), DisplayUtil.dip2px(getContext(), 5));
tvDay.setCompoundDrawables(null, null, null, drawable);
setDefaultTime();
llItemHotRvtour.setSelected(true);
tvItemRvTour.setSelected(true);
hotType = "2";
tvHotRvtourHint.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotRvtour.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotRvtour.getPaint().setFakeBoldText(true);
ViewTreeObserver observer = rlItemLayout.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
rlItemLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
height = rlItemLayout.getHeight() - 120;
rlItemLayout.getWidth();
scrollview.setScrollViewListener(HomeFragment.this);
}
});
mAdapter = new HotCarTypeAdapter();
recyclerViewContent.setLayoutManager(new GridLayoutManager(getContext(), 2));
recyclerViewContent.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。
recyclerViewContent.setNestedScrollingEnabled(false);
recyclerViewContent.setAdapter(mAdapter);
mHotTravelAdapter = new HotCarTypeAdapter();
ryHomeHotTravel.setLayoutManager(new GridLayoutManager(getContext(), 2));
ryHomeHotTravel.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。
ryHomeHotTravel.setNestedScrollingEnabled(false);
ryHomeHotTravel.setAdapter(mHotTravelAdapter);
mCampAdapter = new HotCarTypeAdapter();
ryHomeCamp.setLayoutManager(new GridLayoutManager(getContext(), 2));
ryHomeCamp.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。
ryHomeCamp.setNestedScrollingEnabled(false);
ryHomeCamp.setAdapter(mCampAdapter);
//精选活动
mActivityAdapter = new SelectedEventsAdapter();
......@@ -309,14 +187,11 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
recyclerViewActivity.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。
recyclerViewActivity.setNestedScrollingEnabled(false);
recyclerViewActivity.setAdapter(mActivityAdapter);
mActivityAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
SelectedActivitiesBean.SelectedActivityItem item = (SelectedActivitiesBean.SelectedActivityItem) adapter.getItem(position);
mPresenter.saveOnclick("3", String.valueOf(item.getId()));
if (item != null && !TextUtils.isEmpty(item.getUrl()) && !TextUtils.isEmpty(item.getName())) {
mPresenter.toTarget(getActivity(), item.getUrl(), item.getName(),String.valueOf(item.getId()));
}
mActivityAdapter.setOnItemClickListener((adapter, view, position) -> {
SelectedActivitiesBean.SelectedActivityItem item = (SelectedActivitiesBean.SelectedActivityItem) adapter.getItem(position);
mPresenter.saveOnclick("3", String.valueOf(item.getId()));
if (item != null && !TextUtils.isEmpty(item.getUrl()) && !TextUtils.isEmpty(item.getName())) {
mPresenter.toTarget(getActivity(), item.getUrl(), item.getName(),String.valueOf(item.getId()));
}
});
......@@ -346,32 +221,20 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
mRvEnthusiast.setEnableLoadMore(true);
mRvEnthusiast.disableLoadMoreIfNotFullPage();
mRvEnthusiast.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
if (recyclerViewRvEnthusiast != null) {
recyclerViewRvEnthusiast.postDelayed(new Runnable() {
@Override
public void run() {
if (mPage >= countPage) {
mRvEnthusiast.loadMoreEnd();
} else {
mPage++;
loadDisCovery(mPage);
}
}
}, 200);
}
mRvEnthusiast.setOnLoadMoreListener(() -> {
if (recyclerViewRvEnthusiast != null) {
recyclerViewRvEnthusiast.postDelayed(() -> {
if (mPage >= countPage) {
mRvEnthusiast.loadMoreEnd();
} else {
mPage++;
loadDisCovery(mPage);
}
}, 200);
}
}, recyclerViewRvEnthusiast);
// recyclerViewRvEnthusiast.setLayoutManager(new GridLayoutManager(getContext(), 2));
// recyclerViewRvEnthusiast.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。
// recyclerViewRvEnthusiast.addItemDecoration(new flow(10));
// recyclerViewRvEnthusiast.setNestedScrollingEnabled(false);
// recyclerViewRvEnthusiast.setAdapter(mRvEnthusiast);
//房车游榜单
mRvTourAdapter = new RVTourListAdapter();
recyclerViewRvtourlist.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
......@@ -384,129 +247,74 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
recyclerViewRvtourlistTitle.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
recyclerViewRvtourlistTitle.addItemDecoration(new AbSpacesItemDecoration(20));
recyclerViewRvtourlistTitle.setNestedScrollingEnabled(false);
recyclerViewRvtourlistTitle.setAdapter(mRvTourLabelAdapter);
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
HomeHotGoodListBean.DataBean data = (HomeHotGoodListBean.DataBean) adapter.getItem(position);
if ("2".equals(hotType)) {
//热门旅行
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_TRAVELDETAILS)
.withString("id", data.getId())
.withString("name", data.getName())
.withString("content", data.getName1())
.withString("url", data.getImgUrl())
.withDouble("price", Double.valueOf(data.getPrice()))
.navigation();
} else if ("3".equals(hotType)) {
//娱乐营地
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CAMPDETAIL)
.withString("id", data.getId())
.withString("longitude", data.getLongitude())
.withString("latitude", data.getLatitude())
.navigation();
} else if ("4".equals(hotType)) {
//优质车型
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_DETAILCARPURCHASE)
.withString("carId", data.getId())
.withString("icon", data.getIcon())
.withString("name", data.getName())
.withString("keyword", data.getName1())
.withInt("score", 0)
.withDouble("buyPrice", Double.valueOf(data.getPrice()))
.navigation();
height = _mActivity.getWindowManager().getDefaultDisplay().getHeight() ;
scrollview.setScrollViewListener(HomeFragment.this);
}
}
mHotTravelAdapter.setOnItemClickListener((adapter, view, position) -> {
HomeHotGoodListBean.DataBean data = (HomeHotGoodListBean.DataBean) adapter.getItem(position);
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_TRAVELDETAILS)
.withString("id", data.getId())
.withString("name", data.getName())
.withString("content", data.getName1())
.withString("url", data.getImgUrl())
.withDouble("price", Double.valueOf(data.getPrice()))
.navigation();
});
mCampAdapter.setOnItemClickListener((adapter, view, position) -> {
HomeHotGoodListBean.DataBean data = (HomeHotGoodListBean.DataBean) adapter.getItem(position);
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CAMPDETAIL)
.withString("id", data.getId())
.withString("longitude", data.getLongitude())
.withString("latitude", data.getLatitude())
.navigation();
});
mRvTourLabelAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
mRvTourLabelAdapter.setSelectPosition(position);
recyclerViewRvtourlist.scrollToPosition(position);
}
mRvTourLabelAdapter.setOnItemClickListener((adapter, view, position) -> {
mRvTourLabelAdapter.setSelectPosition(position);
recyclerViewRvtourlist.scrollToPosition(position);
});
mRvTourAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
mRvTourLabelAdapter.setSelectPosition(position);
recyclerViewRvtourlistTitle.scrollToPosition(position);
HomePopularBrigade.DataBean beanHot = (HomePopularBrigade.DataBean) adapter.getItem(position);
ARouter.getInstance().build(Constance.ACTIVITY_URL_POPULARTOURLIST).withString("name", beanHot.getName()).withString("id", beanHot.getId()).navigation();
}
mRvTourAdapter.setOnItemClickListener((adapter, view, position) -> {
mRvTourLabelAdapter.setSelectPosition(position);
recyclerViewRvtourlistTitle.scrollToPosition(position);
HomePopularBrigade.DataBean beanHot = (HomePopularBrigade.DataBean) adapter.getItem(position);
ARouter.getInstance().build(Constance.ACTIVITY_URL_POPULARTOURLIST).withString("name", beanHot.getName()).withString("id", beanHot.getId()).navigation();
});
//房车发烧友
mRvEnthusiast.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
DiscoveryDataBean item = (DiscoveryDataBean) adapter.getItem(position);
if (item != null) {
if ("2".equals(item.getBody().getType())) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_DETAILPAT)
.withString("id", item.getMsgId())
.withString("title", item.getBody().getText())
.withString("iconUrl", item.getBody().getImages().get(0).getOurl())
.withString("userName", item.getNickname())
.withString("userUrl", item.getPicUrl())
.navigation();
} else if ("4".equals(item.getBody().getType())) {
List<DiscoveryDataBean> data = new ArrayList<>();
data.add(item);
startActivity(TriListActivity.getIntent(_mActivity, 0, 0, data, false));
}
mRvEnthusiast.setOnItemClickListener((adapter, view, position) -> {
DiscoveryDataBean item = (DiscoveryDataBean) adapter.getItem(position);
if (item != null) {
if ("2".equals(item.getBody().getType())) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_DETAILPAT)
.withString("id", item.getMsgId())
.withString("title", item.getBody().getText())
.withString("iconUrl", item.getBody().getImages().get(0).getOurl())
.withString("userName", item.getNickname())
.withString("userUrl", item.getPicUrl())
.navigation();
} else if ("4".equals(item.getBody().getType())) {
List<DiscoveryDataBean> data = new ArrayList<>();
data.add(item);
startActivity(TriListActivity.getIntent(_mActivity, 0, 0, data, false));
}
}
});
}
/**
* 设置默认时间
*/
private void setDefaultTime() {
String time = DateUtils.formatDate28(DateUtils.timestampToString1(DateUtils.getCurTimeMillis()), 2);
String hh = DateUtils.formatDate21(time);
String mm = DateUtils.formatDate22(time);
String begTime = "";
if (Double.valueOf(mm) > 30) { //判断当前分钟是否已经超过30,如果超过了取整加30分钟
begTime = DateUtils.formatDate19(hh + ":30");
} else {
begTime = hh + ":30";
}
if (DateUtils.formatDate20(begTime) > DateUtils.formatDate20("22:30")) { //如果当前时间大于 22:30,日期往后加一,时间改成早上8:00
begDate = MyUtils.getFetureDate(1) + " " + "08:30";
endDate = MyUtils.getFetureDate(3) + " " + "08:30";
} else {
begDate = MyUtils.getFetureDate(0) + " " + begTime;
endDate = MyUtils.getFetureDate(2) + " " + begTime;
}
tvGetTime.setText(DateUtils.formatDate66(begDate));
tvGetWeek.setText("周" + MyUtils.getWeek(DateUtils.formatDate16(begDate)));
tvOutTime.setText(DateUtils.formatDate66(endDate));
tvOutWeek.setText("周" + MyUtils.getWeek(DateUtils.formatDate16(endDate)));
copyDay = getCountDay(begDate, endDate);
tvDay.setText(String.format("%1$s%2$s", copyDay, getContext().getString(R.string.rv_days)));
}
@Override
public void onRefresh() {
loadBannerData();
hotData();
recommendGood(hotType);
recommendGood(2);
recommendGood(3);
getSelectedActivities();
onFreshLoadDisCovery();
}
......@@ -515,7 +323,6 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
public void gpsChange(boolean b) {
if (b) {
initGps();
initCity();
}
}
......@@ -549,7 +356,6 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view);
StaggeredGridLayoutManager.LayoutParams lp = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
if (lp.getSpanIndex() % 2 == 0) {
......@@ -563,44 +369,21 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
}
}
public class flow extends RecyclerView.ItemDecoration {
private int space;
public flow(int space) {
this.space = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
if (parent.getChildAdapterPosition(view) % 2 == 0) {
outRect.top = 40;
} else {
outRect.top = space;
}
outRect.bottom = space;
outRect.left = space;
outRect.right = space;
}
}
private void getSelectedActivities() {
Map<String, Object> header = new HashMap<>();
if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
header.put("Authorization", OkGoUtil.getToken());
}
mPresenter.getDataHead(RvFrameConfig.HOST, 4, ApiConfig.HTTP_URL_SELECTED_ACTIVITIES, SelectedActivitiesBean.class, header, false);
mPresenter.getDataHead(RvFrameConfig.HOST, 6, ApiConfig.HTTP_URL_SELECTED_ACTIVITIES, SelectedActivitiesBean.class, header, false);
}
@Override
protected void loadData(Bundle savedInstanceState) {
loadBannerData();
hotData();
recommendGood(hotType);
recommendGood(2);
recommendGood(3);
getSelectedActivities();
onFreshLoadDisCovery();
}
......@@ -623,7 +406,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("page", page);
mPresenter.postData(RvFrameConfig.HOST, 5, ApiConfig.RVENTHUSIAST_HOTMSG_LIST, HomeRecommendBean.class, map, headMap, false);
mPresenter.postData(RvFrameConfig.HOST, 7, ApiConfig.RVENTHUSIAST_HOTMSG_LIST, HomeRecommendBean.class, map, headMap, false);
}
/**
......@@ -632,18 +415,18 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
private void loadBannerData() {
HashMap<String, String> map = new HashMap<>();
map.put("type", "0");
mPresenter.getData(3, ApiConfig.HTTP_URL_FIND_BANNERLIST, BeanHomeBanner.class, map, false);
mPresenter.getData(5, ApiConfig.HTTP_URL_FIND_BANNERLIST, BeanHomeBanner.class, map, false);
}
/**
* 推荐商品 type 2-旅游 ;3-营地
*/
private void recommendGood(String type) {
private void recommendGood(int type) {
HashMap<String, String> map = new HashMap<>();
map.put("type", type);
map.put("type", String.valueOf(type));
map.put("limit ", "4");
mPresenter.getData(2, ApiConfig.QUERY_HOT_GOODLIST, HomeHotGoodListBean.class, map, false);
mPresenter.getData(type, ApiConfig.QUERY_HOT_GOODLIST, HomeHotGoodListBean.class, map, false);
}
/**
......@@ -662,25 +445,23 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
mSimpleRefreshLayout.onRefreshComplete();
mSimpleRefreshLayout.setPullDownEnable(true);
switch (requestType) {
case 0:
processData((ShopListBean) result);
break;
case 1:
setHotData((HomePopularBrigade) result);
break;
case 2:
setRecommendGood((HomeHotGoodListBean) result);
break;
case 3:
setRecommendGood((HomeHotGoodListBean) result,requestType);
break;
case 5:
bannerData((BeanHomeBanner) result);
break;
case 4:
case 6:
SelectedActivitiesBean bean = (SelectedActivitiesBean) result;
if (bean != null && bean.getData() != null && bean.getData().size() > 0) {
mActivityAdapter.setNewData(bean.getData());
}
break;
case 5:
case 7:
setRecommend((HomeRecommendBean) result);
break;
}
......@@ -706,29 +487,25 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
}
}
private void setRecommendGood(HomeHotGoodListBean data) {
mAdapter.setType(hotType);
mAdapter.setNewData(data.getData());
private void setRecommendGood(HomeHotGoodListBean data,int hotType) {
if(hotType == 2){
mHotTravelAdapter.setType(String.valueOf(hotType));
mHotTravelAdapter.setNewData(data.getData());
}else if(hotType == 3){
mCampAdapter.setType(String.valueOf(hotType));
mCampAdapter.setNewData(data.getData());
}
}
private void setHotData(HomePopularBrigade data) {
hotData = data.getData();
if (data != null && hotData.size() > 2) {
tvRvHotLabel1.setText(hotData.get(0).getName());
tvRvHotLabel2.setText(hotData.get(1).getName());
tvRvHotLabel3.setText(hotData.get(2).getName());
}
mRvTourAdapter.setNewData(hotData);
mRvTourLabelAdapter.setNewData(hotData);
mRvTourAdapter.setNewData(data.getData());
mRvTourLabelAdapter.setNewData(data.getData());
}
@OnClick({R2.id.tv_home_travel_city_layout, R2.id.ll_home_item_search, R2.id.tv_item_home_rv_tour, R2.id.tv_item_home_renting_a_car,
R2.id.tv_home_get_address, R2.id.tv_home_out_address, R2.id.ll_home_item_select_data, R2.id.tv_home_select_car,
R2.id.ll_home_item_rv_city, R2.id.tv_home_book_now, R2.id.ll_home_item_rv_hot_label1, R2.id.ll_home_item_rv_hot_label2, R2.id.ll_home_item_rv_hot_label3,
R2.id.ll_home_item_hot_rvtour, R2.id.ll_home_item_hot_entertainment_camp, R2.id.ll_home_item_hot_car_rental, R2.id.tv_home_see_more_popular,
R2.id.ll_home_item_top, R2.id.iv_home_travel_server_image, R2.id.tv_home_car_rental_guide, R2.id.ll_home_item_activity_all, R2.id.ll_rent, R2.id.ll_return, R2.id.cardview})
@OnClick({R2.id.tv_home_travel_city_layout, R2.id.ll_home_item_search,
R2.id.ll_home_item_top, R2.id.iv_home_travel_server_image, R2.id.ll_home_item_activity_all,R2.id.tv_camp_more
,R2.id.tv_hot_travel_more,R2.id.ll_car_recent,R2.id.ll_car_buy,R2.id.ll_car_camp,R2.id.ll_car_discovery,R2.id.ll_car_travel})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.tv_home_travel_city_layout) {
......@@ -737,104 +514,22 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.build(Constance.ACTIVITY_URL_CITYLIST)
.withInt("mCityType", 4)
.withString("mNowCity", travelCityText.getText().toString())
.withInt("mCityId", mTravelCityId)
.navigation(getActivity(), TYPE_REQUEST_CITY);
} else if (id == R.id.ll_home_item_search) {
//搜索
String city = tvRvCity.getText().toString().trim();
if (!TextUtils.isEmpty(city)) {
String hint = city.substring(city.length() - 1);
if ("市".equals(hint)) { //判断后面是否是带市结尾的,去掉
city = city.substring(0, city.length() - 1);
}
}
} else if(id == R.id.ll_car_travel){
SwitchFragment.sChangeFragment.changge(1);
} else if(id == R.id.ll_car_camp){
SwitchFragment.sChangeFragment.changge(2);
} else if(id == R.id.ll_car_discovery){
SwitchFragment.sChangeFragment.changge(3);
} else if(id == R.id.ll_car_buy){
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_TRAVELSEARCH)
.withDouble("latLatitude", 0)
.withDouble("lonLongitude", 0)
.withString("city", city)
.build(Constance.ACTIVITY_URL_CARPURCHASELIST)
.navigation();
} else if (id == R.id.tv_item_home_rv_tour) {
tvItemRvTour.setSelected(true);
tvItemRentingACar.setSelected(false);
llLayoutRentingACar.setVisibility(View.VISIBLE);
llLayoutRvTour.setVisibility(View.GONE);
} else if (id == R.id.tv_item_home_renting_a_car) {
tvItemRvTour.setSelected(false);
tvItemRentingACar.setSelected(true);
llLayoutRentingACar.setVisibility(View.GONE);
llLayoutRvTour.setVisibility(View.VISIBLE);
} else if (id == R.id.tv_home_get_address || id == R.id.ll_rent) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_SELECTSHOP)
.withDouble("mLat", latLatitude)
.withDouble("mLon", lonLongitude)
.withString("cityName", TextUtils.isEmpty(getCityName) ? nowCity : getCityName)
.withInt("shopType", 1)
.navigation(_mActivity, TYPE_REQUEST_CITY);
// startActivityForResult(SelectShopActivity.getIntent(getActivity(), 1, "", , latLatitude, lonLongitude), TYPE_REQUEST_CITY);
} else if (id == R.id.ll_return || id == R.id.tv_home_out_address) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_SELECTSHOP)
.withDouble("mLat", latLatitude)
.withDouble("mLon", lonLongitude)
.withString("cityName", TextUtils.isEmpty(outCityName) ? nowCity : outCityName)
.withInt("shopType", 2)
.navigation(_mActivity, TYPE_REQUEST_CITY);
// startActivityForResult(SelectShopActivity.getIntent(getActivity(), 2, "", TextUtils.isEmpty(outCityName) ? nowCity : outCityName, latLatitude, lonLongitude), TYPE_REQUEST_CITY);
} else if (id == R.id.ll_home_item_select_data) {
//选择日期
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CALENDAR)
.withString("begDate", begDate)
.withString("endDate", endDate)
.navigation(_mActivity, 108);
} else if (id == R.id.tv_home_select_car) {
//租房车 立即选车
if (copyDay < 1) {
showToast(getContext().getString(R.string.rv_day_toast));
return;
}
if (TextUtil.isEmpty(headTvGetShop.getText().toString().trim()) || TextUtil.isEmpty(headTvOutShop.getText().toString().trim())) {
showToast("请选择取/还车地址");
return;
}
sendData(getCityName,
getCompanyName,
outCityName,
outCompanyName,
begDate, endDate, copyDay,
begDate,
endDate
);
} else if (id == R.id.ll_home_item_rv_city) {
//房车游选择城市
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CITYLIST)
.withInt("mCityType", 3)
.withString("mNowCity", tvRvCity.getText().toString())
.withInt("mCityId", vVTourCityId)
.navigation(getActivity(), TYPE_REQUEST_CITY);
} else if (id == R.id.tv_home_book_now) {
//房车游 立即预定
geoCoder.geocode(new GeoCodeOption()
.city(tvRvCity.getText().toString())
.address(tvRvCity.getText().toString()));
String city = tvRvCity.getText().toString().trim();
}
else if (id == R.id.ll_home_item_search) {
//搜索
String city = travelCityText.getText().toString().trim();
if (!TextUtils.isEmpty(city)) {
String hint = city.substring(city.length() - 1);
if ("市".equals(hint)) { //判断后面是否是带市结尾的,去掉
......@@ -849,120 +544,18 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withString("city", city)
.navigation();
} else if (id == R.id.ll_home_item_rv_hot_label1) {
//热门标签1
if (hotData != null && hotData.size() > 0) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_POPULARTOURLIST)
.withString("name", hotData.get(0).getName())
.withString("id", hotData.get(0).getId())
.navigation();
}
} else if (id == R.id.ll_home_item_rv_hot_label2) {
//热门标签2
if (hotData != null && hotData.size() > 1) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_POPULARTOURLIST)
.withString("name", hotData.get(1).getName())
.withString("id", hotData.get(1).getId())
.navigation();
}
} else if (id == R.id.ll_home_item_rv_hot_label3) {
//热门标签3
if (hotData != null && hotData.size() > 2) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_POPULARTOURLIST)
.withString("name", hotData.get(2).getName())
.withString("id", hotData.get(2).getId())
.navigation();
}
} else if (id == R.id.ll_home_item_hot_rvtour) {
//热门旅行
llItemHotRvtour.setSelected(true);
llItemHotEntertainmentCamp.setSelected(false);
llItemHotCarRental.setSelected(false);
tvHotRvtourHint.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotRvtour.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotEntertainmentHint.setTextColor(getResources().getColor(R.color.textGray));
tvHotEntertainmentCamp.setTextColor(getResources().getColor(R.color.textGray));
tvHotCarRentalHint.setTextColor(getResources().getColor(R.color.textGray));
tvHotCarRental.setTextColor(getResources().getColor(R.color.textGray));
tvHotRvtour.getPaint().setFakeBoldText(true);
tvHotEntertainmentCamp.getPaint().setFakeBoldText(false);
tvHotCarRental.getPaint().setFakeBoldText(false);
tvSeeMorePopular.setText("更多热门旅行线路");
mAdapter.getData().clear();
mAdapter.notifyDataSetChanged();
recommendGood("2");
hotType = "2";
} else if (id == R.id.ll_home_item_hot_entertainment_camp) {
//娱乐营地
llItemHotRvtour.setSelected(false);
llItemHotEntertainmentCamp.setSelected(true);
llItemHotCarRental.setSelected(false);
tvHotRvtourHint.setTextColor(getResources().getColor(R.color.textGray));
tvHotRvtour.setTextColor(getResources().getColor(R.color.textGray));
tvHotEntertainmentHint.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotEntertainmentCamp.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotCarRentalHint.setTextColor(getResources().getColor(R.color.textGray));
tvHotCarRental.setTextColor(getResources().getColor(R.color.textGray));
tvHotRvtour.getPaint().setFakeBoldText(false);
tvHotEntertainmentCamp.getPaint().setFakeBoldText(true);
tvHotCarRental.getPaint().setFakeBoldText(false);
tvSeeMorePopular.setText("更多娱乐营地");
mAdapter.getData().clear();
mAdapter.notifyDataSetChanged();
recommendGood("3");
hotType = "3";
} else if (id == R.id.ll_home_item_hot_car_rental) {
//购房车
llItemHotRvtour.setSelected(false);
llItemHotEntertainmentCamp.setSelected(false);
llItemHotCarRental.setSelected(true);
tvHotRvtourHint.setTextColor(getResources().getColor(R.color.textGray));
tvHotRvtour.setTextColor(getResources().getColor(R.color.textGray));
tvHotEntertainmentHint.setTextColor(getResources().getColor(R.color.textGray));
tvHotEntertainmentCamp.setTextColor(getResources().getColor(R.color.textGray));
tvHotCarRentalHint.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotCarRental.setTextColor(getResources().getColor(R.color.colorWrite));
tvHotRvtour.getPaint().setFakeBoldText(false);
tvHotEntertainmentCamp.getPaint().setFakeBoldText(false);
tvHotCarRental.getPaint().setFakeBoldText(true);
tvSeeMorePopular.setText("更多优质车型");
mAdapter.getData().clear();
mAdapter.notifyDataSetChanged();
recommendGood("4");
hotType = "4";
} else if (id == R.id.tv_home_see_more_popular) {
}
else if (id == R.id.tv_hot_travel_more) {
//查看更多热门
if ("2".equals(hotType)) {
//热门旅行
SwitchFragment.sChangeFragment.changge(1);
} else if ("3".equals(hotType)) {
//娱乐营地
SwitchFragment.sChangeFragment.changge(2);
SwitchFragment.sChangeFragment.changge(1);
} else if(id == R.id.tv_camp_more){
SwitchFragment.sChangeFragment.changge(2);
}
} else if ("4".equals(hotType)) {
//优质车型
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CARPURCHASELIST)
.navigation();
}
} else if (id == R.id.ll_home_item_top) {
else if (id == R.id.ll_home_item_top) {
scrollview.fullScroll(View.FOCUS_UP);
} else if (id == R.id.iv_home_travel_server_image) {
if (isLogin()) {
if (mPresenter.isLogin(_mActivity)) {
if (_mActivity instanceof ImInitListenter && !((ImInitListenter) _mActivity).isBindService()) {
showToast("Im初始化中...");
......@@ -975,32 +568,12 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
intent.setComponent(name);
startActivity(intent);
}
} else if (id == R.id.tv_home_car_rental_guide) {
//租车指南
ARouter.getInstance().build(Constance.ACTIVITY_URL_WEBVIEW)
.withString("title", "租车指南")
.withString("url", ApiConfig.HTTP_URL_CAR_TYPE_NOTICE)
.withInt("type", 1)
.navigation();
} else if (id == R.id.ll_home_item_activity_all) {
showToast("亲,该功能还在开发中。。。");
} else if (id == R.id.cardview) {
return;
}
}
/**
* 判断是否登录
*
* @return
*/
private boolean isLogin() {
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
startActivity(LoginRvActivity.getIntent(_mActivity, 0));
return false;
else if (id == R.id.ll_home_item_activity_all) {
showToast("亲,该功能还在开发中。。。");
} else if(id == R.id.ll_car_recent){
startActivityForResult(CarRentActivity.getIntent(_mActivity,travelCityText.getText().toString().trim()),REQUEST_RECENT_CODE);
}
return true;
}
@Override
......@@ -1012,170 +585,23 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
return;
}
List<Fragment> fragments = getChildFragmentManager().getFragments();
ArrayList<HomeFragment> list = new ArrayList<>();
if (fragments == null || fragments.isEmpty()) {
list.add(HomeFragment.getInstance(0));
} else {
for (Fragment fragment : fragments) {
if (fragment instanceof HomeFragment) {
list.add((HomeFragment) fragment);
}
}
}
if (resultCode == RESULT_OK) {
int type = data.getIntExtra("type", 1);
String requestData = data.getStringExtra("location");
switch (requestCode) {
case TYPE_REQUEST_CITY://城市列表
if (type == 1) {
getCompanyName = data.getStringExtra("company");
getCompanyId = data.getIntExtra("company_id", 1);
getCityName = requestData;
getCityId = data.getIntExtra("id", 0);
StringBuffer buffer = new StringBuffer();
if (!TextUtils.isEmpty(getCompanyName)) {
buffer.append(getCompanyName);
}
if (!TextUtils.isEmpty(getCityName)) {
buffer.append("(").append(getCityName).append(")");
}
if (headTvGetShop != null) {
if (buffer.length() > 0) {
headTvGetShop.setText(buffer.toString());
} else {
headTvGetShop.setText("");
}
}
getLatitude = data.getDoubleExtra("latitude", 0);
getLongitude = data.getDoubleExtra("longitude", 0);
setRequestData(type, requestData, getLatitude, getLongitude);
} else if (type == 2) {
outCompanyName = data.getStringExtra("company");
outCompanyId = data.getIntExtra("company_id", 1);
outCityName = requestData;
outCityId = data.getIntExtra("id", 0);
StringBuffer buffer = new StringBuffer();
if (!TextUtils.isEmpty(outCompanyName)) {
buffer.append(outCompanyName);
}
if (!TextUtils.isEmpty(outCityName)) {
buffer.append("(").append(outCityName).append(")");
}
if (headTvOutShop != null) {
if (buffer.length() > 0) {
headTvOutShop.setText(buffer.toString());
} else {
headTvOutShop.setText("");
}
}
outLatitude = data.getDoubleExtra("latitude", 0);
outLongitude = data.getDoubleExtra("longitude", 0);
setRequestData(type, requestData, outLatitude, outLongitude);
} else if (type == 3) {
if (tvRvCity != null) {
tvRvCity.setText("");
}
vVTourCityId = data.getIntExtra("id", 0);
setRequestData(type, requestData, 0, 0);
} else if (type == 4) {
if (travelCityText != null) {
travelCityText.setText("");
}
mTravelCityId = data.getIntExtra("id", 0);
getCityId = outCityId = mTravelCityId;
getCityName = outCityName = requestData;
vVTourCityId = mTravelCityId;
setRequestData(type, requestData, 0, 0);
if (type == 4) {
if (!TextUtils.isEmpty(requestData))
travelCityText.setText(requestData);
}
break;
}
} else if (resultCode == 200 && requestCode == 108) {
begDate = data.getStringExtra("begDate");
endDate = data.getStringExtra("endDate");
copyDay = getCountDay(begDate, endDate); //天数
case REQUEST_RECENT_CODE: // 租车返回信息
// copyDay = DateUtils.compareDateDay(endDate, begDate) + 1;
if (tvGetTime != null) {
tvGetTime.setText(DateUtils.formatDate66(begDate));
}
if (tvOutTime != null) {
tvOutTime.setText(DateUtils.formatDate66(endDate));
}
if (tvGetWeek != null) {
tvGetWeek.setText("周" + MyUtils.getWeek(begDate));
}
if (tvOutWeek != null) {
tvOutWeek.setText("周" + MyUtils.getWeek(endDate));
}
if (tvDay != null) {
tvDay.setText(String.format("%1$s%2$s", copyDay, getContext().getString(R.string.rv_days)));
break;
}
}
}
/**
* 计算天数
*
* @param endDate2
* @param begDate2
* @return
*/
private long getCountDay(String begDate2, String endDate2) {
long second = DateUtils.compareDateSecond3(endDate2, begDate2); //两个时间相差的秒数
long day = (long) second / 86400; //天数
long remainder = (long) second % 86400; //余数 秒
if (day == 0) { //不够24小时也算一天
day = day + 1;
} else if (remainder > 14400) { //4小时内天数不增加,否则加一
day = day + 1;
}
return day;
}
/**
* 设置返回结果参数
*
* @param type
* @param data
* @param lat
* @param lon
*/
private void setRequestData(int type, String data, double lat, double lon) {
switch (type) {
case 1:
// tvGet.setText(data);
break;
case 2:
// tvOut.setText(data);
break;
case 3:
rvTourLatitude = lat;
rvTourLongitude = lon;
if (tvRvCity != null && !TextUtils.isEmpty(data)) {
tvRvCity.setText(data);
}
break;
case 4:
if (travelCityText != null && !TextUtils.isEmpty(data))
travelCityText.setText(data);
// headTvGetCity.setText(data);
// headTvOutCity.setText(data);
if (tvRvCity != null && !TextUtils.isEmpty(data)) {
tvRvCity.setText(data);
}
getShopList(false);
// geoCoder.geocode(new GeoCodeOption()
// .city(data)
// .address(data));
break;
}
}
private List<BeanHomeBanner.DataBean> listsBanners = new ArrayList<>();
private void bannerData(BeanHomeBanner data) {
......@@ -1190,10 +616,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
}
}
setBanner();
}
private void setBanner() {
mineBanner.isAutoPlay(true)
.setBannerTitles(titles)
......@@ -1203,30 +627,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
GlideManager.getInstance(context).loadImage2(path, imageView);
GlideManager.getInstance(context).loadRoundImage2(path, imageView, 6);
}
})
.setOnBannerListener(new OnBannerListener() {
@Override
public void OnBannerClick(int position) {
.setOnBannerListener(position -> {
LogUtil.d("position=" + position);
LogUtil.d("position=" + position);
if (listsBanners.size() > 0) {
BeanHomeBanner.DataBean bean = listsBanners.get(position);
mPresenter.saveOnclick("2", bean.getId());
if (bean != null && !TextUtils.isEmpty(bean.getUrl())) {
mPresenter.toTarget(getActivity(), bean.getUrl(), bean.getTitle(),bean.getId());
}
if (listsBanners.size() > 0) {
BeanHomeBanner.DataBean bean = listsBanners.get(position);
mPresenter.saveOnclick("2", bean.getId());
if (bean != null && !TextUtils.isEmpty(bean.getUrl())) {
mPresenter.toTarget(getActivity(), bean.getUrl(), bean.getTitle(), bean.getId());
}
/* if (localImages != null && localImages.size() > 0) {
Bundle bundle = new Bundle();
bundle.putInt(ActivityImageBrowseInt.KEY_BACKGROUND, R.color.colorPrimary);
bundle.putIntegerArrayList(ActivityImageBrowseInt.KEY_IMAGE, (ArrayList<Integer>) localImages);
IntentUtil.startActivity(_mActivity, ActivityImageBrowseInt.class, bundle);
}*/
}
})
.start();
......@@ -1234,175 +647,12 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
mineBanner.updateBannerStyle(BannerConfig.CIRCLE_INDICATOR);
}
/**
* 处理最近门店请求结果
*
* @param bean
*/
private void processData(ShopListBean bean) {
if (bean.getData() != null && bean.getData().getTotalCount() > 0) {
if (headTvGetShop != null) {
getCompanyName = bean.getData().getData().get(0).getName();
StringBuffer buffer = new StringBuffer();
if (!TextUtils.isEmpty(getCompanyName)) {
buffer.append(getCompanyName);
}
if (!TextUtils.isEmpty(getCityName)) {
buffer.append("(").append(getCityName).append(")");
}
if (buffer != null && buffer.length() > 0) {
headTvGetShop.setText(buffer.toString());
} else {
headTvGetShop.setText("");
}
headTvGetShop.setTextColor(_mActivity.getResources().getColor(R.color.colorMain));
getLatitude = bean.getData().getData().get(0).getLatitude();
getLongitude = bean.getData().getData().get(0).getLongitude();
getCompanyId = bean.getData().getData().get(0).getId();
}
if (headTvOutShop != null) {
outCompanyName = bean.getData().getData().get(0).getName();
StringBuffer buffer = new StringBuffer();
if (!TextUtils.isEmpty(outCompanyName)) {
buffer.append(outCompanyName);
}
if (!TextUtils.isEmpty(outCityName)) {
buffer.append("(").append(outCityName).append(")");
}
if (buffer != null && buffer.length() > 0) {
headTvOutShop.setText(buffer.toString());
} else {
headTvOutShop.setText("");
}
headTvOutShop.setTextColor(_mActivity.getResources().getColor(R.color.colorMain));
outLatitude = bean.getData().getData().get(0).getLatitude();
outLongitude = bean.getData().getData().get(0).getLongitude();
outCompanyId = bean.getData().getData().get(0).getId();
}
} else {
getCompanyName = "";
headTvGetShop.setText(getCompanyName);
getLatitude = 0;
getLongitude = 0;
outCompanyName = "";
headTvOutShop.setText(outCompanyName);
outLatitude = 0;
outLongitude = 0;
}
}
/**
* 获取门店列表
*/
private void getShopList(boolean type) {
int addrCity = 0;
if (type) {
String json = UtilsManager.getInstance().getJson(getContext(), "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
for (ListsBean lsBean : cityBean.getLists()) {
if (!TextUtils.isEmpty(nowCity)) {
if (nowCity.equals(lsBean.getName())) {
addrCity = lsBean.getId();
}
}
}
}
} else {
addrCity = mTravelCityId;
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("page", 1);
map.put("limit", 1);
map.put("addrCity", String.valueOf(addrCity));
mPresenter.getData(RvFrameConfig.VEHICLE_POST, 0, ApiConfig.HTTP_URL_SHOP_LIST, ShopListBean.class, map, false);
}
/**
* 传参
*
* @param starCity
* @param starAddress
* @param endCity
* @param endAddress
* @param getTime
* @param outTime
* @param day
* @param startTime
* @param endTime
*/
private void sendData(String starCity, String starAddress, String endCity, String endAddress, String getTime, String outTime, long day, String startTime, String endTime) {
if (dataBean == null) {
dataBean = new OrderDataBean();
}
if (getCityId > 0) {
dataBean.setStartCity(getCityId);
}
if (outCityId > 0) {
dataBean.setEndCity(outCityId);
} else {
String json = UtilsManager.getInstance().getJson(getContext(), "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
for (ListsBean lsBean : cityBean.getLists()) {
if (!TextUtils.isEmpty(starCity) && starCity.equals(lsBean.getName())) {
dataBean.setStartCity(lsBean.getId());
}
if (!TextUtils.isEmpty(endCity) && endCity.equals(lsBean.getName())) {
dataBean.setEndCity(lsBean.getId());
}
}
}
}
dataBean.setDayNum(Integer.valueOf(day + ""));
dataBean.setStartCityName(starCity);
dataBean.setStartAddr(starAddress);
dataBean.setStartTime(DateUtils.StringToTimeMillis2(getTime));
dataBean.setEndTime(DateUtils.StringToTimeMillis2(outTime));
dataBean.setEndCityName(endCity);
dataBean.setEndCompanyId(outCompanyId);
dataBean.setEndAddr(endAddress);
dataBean.setDriverType(2);
dataBean.setStartCompanyId(getCompanyId);
startActivity(CarRentalListActivity.getIntent(getContext(), latLatitude, lonLongitude, outLatitude, outLongitude, false, dataBean, startTime, endTime));
}
@Override
public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy) {
if (y <= height) {
Log.i("homeFragment", "onScrollChanged: " + y);
Log.i("homeFragment", "height: " + height);
float scale = (float) y / height;
float alpha = (255 * scale);
llItemTop.setVisibility(View.GONE);
//只是layout背景透明(仿知乎滑动效果)
llItemSearch.setBackground(getResources().getDrawable(R.drawable.shape_rv_textview_home_translucent));
travelCityText.setTextColor(getResources().getColor(R.color.colorWrite));
travelServerImage.setImageResource(R.drawable.rv_rentingcar_icon_service_white);
ivTravelCityTextHint.setImageResource(R.drawable.rv_common_icon_up_arrow2);
ivSearchInputHint.setImageResource(R.drawable.rv_common_icon_search2);
searchInput.setHintTextColor(getResources().getColor(R.color.colorWrite));
if (y <= 3) {
llItemTitle.setBackgroundColor(Color.argb(0, 0, 0, 0));
} else {
llItemTitle.setBackgroundColor(Color.argb((int) alpha, 255, 255, 255));
}
} else {
llItemTop.setVisibility(View.VISIBLE);
llItemSearch.setBackground(getResources().getDrawable(R.drawable.shape_rv_textview_home_search));
travelServerImage.setImageResource(R.drawable.rentingcar_icon_service_orangeorange);
travelCityText.setTextColor(getResources().getColor(R.color.colorMain));
ivTravelCityTextHint.setImageResource(R.drawable.rv_common_icon_up_arrow);
ivSearchInputHint.setImageResource(R.drawable.rv_common_icon_search);
searchInput.setHintTextColor(getResources().getColor(R.color.text_Gray));
llItemTitle.setBackgroundColor(Color.argb(255, 255, 255, 255));
}
}
......@@ -1418,7 +668,6 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
).subscribe(aBoolean -> {
if (aBoolean == true) {
initGps();
initCity();
} else {
new AlertDialog.Builder(_mActivity).setTitle("需要定位权限")
.setMessage("位置权限已关闭,开启以便滴房车正常使用")
......@@ -1436,73 +685,25 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
});
} else {
initGps();
initCity();
}
}
private void initCity() {
geoCoder = GeoCoder.newInstance();
geoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() {
@Override
public void onGetGeoCodeResult(GeoCodeResult result) {
if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
//没有检索到结果
} else {
rvTourLatitude = result.getLocation().latitude;
rvTourLongitude = result.getLocation().longitude;
}
//获取地理编码结果
}
@Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
//没有找到检索结果
} else {
rvTourLatitude = result.getLocation().latitude;
rvTourLongitude = result.getLocation().longitude;
}
}
});
}
/**
* 初始化定位
*/
public void initGps() {
locationManager = new LocationManager(getContext());
if(locationManager == null){
locationManager = new LocationManager(getContext());
}
locationManager.getLocationDetail(new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation location) {
//此处的BDLocation为定位结果信息类,通过它的各种get方法可获取定位相关的全部结果
//以下只列举部分获取经纬度相关(常用)的结果信息
//更多结果信息获取说明,请参照类参考中BDLocation类中的说明
//获取定位精度,默认值为0.0f
float radius = location.getRadius();
//获取经纬度坐标类型,以LocationClientOption中设置过的坐标类型为准
String coorType = location.getCoorType();
//获取定位类型、定位错误返回码,具体信息可参照类参考中BDLocation类中的说明
int errorCode = location.getLocType();
// setGpsContent("count=:",String.valueOf(count));
// setGpsContent("latitude:",String.valueOf(location.getLatitude()));
// setGpsContent("longitude:",String.valueOf(location.getLongitude()));
// setGpsContent("城市:",location.getCity());
// setGpsContent("街道:",location.getAddrStr());
// setGpsContent("当前位置:",location.getLocationDescribe());
latLatitude = location.getLatitude();
lonLongitude = location.getLongitude();
mLatLng = new LatLng(location.getLatitude(), location.getLongitude());
getCityId = 0;
outCityId = 0;
getCityName = outCityName = location.getCity();
tvRvCity.setText(location.getCity());
travelCityText.setText(location.getCity());
rvTourLatitude = latLatitude;
rvTourLongitude = lonLongitude;
getCityName = outCityName = nowCity = location.getCity();
if(location != null){
if(!TextUtils.isEmpty (location.getCity())){
travelCityText.setText(location.getCity());
}
}
locationManager.stopLocation();
getShopList(true);
}
});
}
......@@ -1516,9 +717,6 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
@Override
public void onDestroy() {
super.onDestroy();
if (geoCoder != null) {
geoCoder.destroy();
}
if (locationManager != null) {
locationManager.onDestroy();
}
......
package com.rv.home.rv.module.ui.main.home.presenter;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.rv.component.utils.DateUtils;
import com.rv.home.rv.module.ui.main.home.CarRentalListActivity;
import com.rv.home.rv.module.ui.main.home.bean.CityPickerBean;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderDataBean;
public class CarRentPresenter extends CommonPresenter {
/**
* 传参
*
* @param starCity
* @param starAddress
* @param endCity
* @param endAddress
* @param getTime
* @param outTime
* @param day
* @param startTime
* @param endTime
*/
public void sendData(int getCityId,int outCityId,int getCompanyId ,int outCompanyId,
double latLatitude,double lonLongitude,
String starCity, String starAddress, String endCity, String endAddress,
String getTime, String outTime, long day, String startTime, String endTime) {
OrderDataBean dataBean = new OrderDataBean();
if (getCityId > 0) {
dataBean.setStartCity(getCityId);
}
if (outCityId > 0) {
dataBean.setEndCity(outCityId);
} else {
String json = UtilsManager.getInstance().getJson(getPresenterContext(), "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
for (ListsBean lsBean : cityBean.getLists()) {
if (!TextUtils.isEmpty(starCity) && starCity.equals(lsBean.getName())) {
dataBean.setStartCity(lsBean.getId());
}
if (!TextUtils.isEmpty(endCity) && endCity.equals(lsBean.getName())) {
dataBean.setEndCity(lsBean.getId());
}
}
}
}
dataBean.setDayNum(Integer.valueOf(day + ""));
dataBean.setStartCityName(starCity);
dataBean.setStartAddr(starAddress);
dataBean.setStartTime(DateUtils.StringToTimeMillis2(getTime));
dataBean.setEndTime(DateUtils.StringToTimeMillis2(outTime));
dataBean.setEndCityName(endCity);
dataBean.setEndCompanyId(outCompanyId);
dataBean.setEndAddr(endAddress);
dataBean.setDriverType(2);
dataBean.setStartCompanyId(getCompanyId);
getPresenterContext().startActivity(CarRentalListActivity.getIntent(getPresenterContext(), latLatitude, lonLongitude, false, dataBean, startTime, endTime));
}
}
......@@ -64,7 +64,7 @@ public class HomePresenter extends CommonPresenter {
*
* @return
*/
private boolean isLogin(Context context) {
public boolean isLogin(Context context) {
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
context.startActivity(LoginRvActivity.getIntent(context, 0));
return false;
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_50"/>
<solid android:color="@color/gray_50ffffff" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".rv.module.ui.main.home.CarRentActivity">
<LinearLayout
android:background="@color/white"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15"
android:id="@+id/ll_layout_home_renting_a_car"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_rent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rv_get_car_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_get_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/size_5"
android:layout_weight="1"
android:gravity="left|center_vertical"
android:hint="@string/rv_get_car_hint"
android:textColorHint="@color/textMain"
android:textSize="@dimen/text_16" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:id="@+id/ll_return"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginBottom="@dimen/size_10"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rv_get_out_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_out_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/size_5"
android:layout_weight="1"
android:gravity="left|center_vertical"
android:hint="@string/rv_get_out_hint"
android:textColorHint="@color/textMain"
android:textSize="@dimen/text_16" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:id="@+id/ll_home_item_select_data"
android:layout_width="match_parent"
android:layout_height="@dimen/size_60"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_item_get_time"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/shape_rv_bg_yellow_small"
android:paddingLeft="@dimen/size_3"
android:paddingTop="@dimen/size_1"
android:paddingRight="@dimen/size_3"
android:paddingBottom="@dimen/size_1"
android:text="@string/rv_get"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_get_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text=""
android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_get_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_home_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:drawableBottom="@drawable/icon_day_times"
android:gravity="center"
android:text=""
android:textSize="@dimen/text_14" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_item_alsotime"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/shape_rv_main_small"
android:paddingLeft="@dimen/size_3"
android:paddingTop="@dimen/size_1"
android:paddingRight="@dimen/size_3"
android:paddingBottom="@dimen/size_1"
android:text="@string/rv_out"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_out_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text=""
android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_out_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/tv_home_select_car"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:background="@drawable/shape_rv_bg_shallow_dark_yellow_circle"
android:gravity="center"
android:text="立即选车"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_16" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -7,12 +7,13 @@
android:orientation="vertical">
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/refresh_home"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.rv.component.utils.ObservableScrollView
android:id="@+id/os_scrollview_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -24,424 +25,132 @@
android:descendantFocusability="beforeDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_home_item_layout"
<com.yuyife.banner.Banner
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginTop="@dimen/size_80"
android:id="@+id/home_banner"
android:layout_width="match_parent"
android:layout_height="@dimen/size_580">
android:layout_height="@dimen/size_170" />
<com.yuyife.banner.Banner
android:id="@+id/home_banner"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/white"
android:paddingTop="@dimen/size_20"
android:paddingBottom="@dimen/dp_10"
android:weightSum="5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/size_230">
android:id="@+id/ll_car_recent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:src="@drawable/icon_home_recent"
android:layout_width="47dp"
android:layout_height="47dp" />
<TextView
android:layout_marginTop="@dimen/size_15"
android:textSize="@dimen/sp_14"
android:textColor="@color/textGray"
android:text="@string/rv_home_car_recent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_car_travel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
<ImageView
android:src="@drawable/icon_home_travel"
android:layout_width="47dp"
android:layout_height="47dp" />
<TextView
android:layout_marginTop="@dimen/size_15"
android:textSize="@dimen/size_12"
android:textColor="@color/textGray"
android:text="@string/rv_home_car_travel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_car_camp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:src="@drawable/icon_home_camp"
android:layout_width="47dp"
android:layout_height="47dp" />
<TextView
android:layout_marginTop="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_marginBottom="@dimen/size_25"
app:cardBackgroundColor="@color/colorWrite"
app:cardCornerRadius="10dp"
app:cardElevation="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_item_home_rv_tour"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/selector_home_item_button_left"
android:gravity="center"
android:text="租房车"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_item_home_renting_a_car"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/selector_home_item_button_right"
android:gravity="center"
android:text="房车游"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_245"
android:orientation="vertical"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
<LinearLayout
android:id="@+id/ll_layout_home_renting_a_car"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_rent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rv_get_car_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_get_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/size_5"
android:layout_weight="1"
android:gravity="left|center_vertical"
android:hint="@string/rv_get_car_hint"
android:textColorHint="@color/textMain"
android:textSize="@dimen/text_16" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:id="@+id/ll_return"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginBottom="@dimen/size_10"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rv_get_out_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_out_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/size_5"
android:layout_weight="1"
android:gravity="left|center_vertical"
android:hint="@string/rv_get_out_hint"
android:textColorHint="@color/textMain"
android:textSize="@dimen/text_16" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:id="@+id/ll_home_item_select_data"
android:layout_width="match_parent"
android:layout_height="@dimen/size_60"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_item_get_time"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/shape_rv_bg_yellow_small"
android:paddingLeft="@dimen/size_3"
android:paddingTop="@dimen/size_1"
android:paddingRight="@dimen/size_3"
android:paddingBottom="@dimen/size_1"
android:text="@string/rv_get"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_get_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text=""
android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_get_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_home_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:drawableBottom="@drawable/icon_day_times"
android:gravity="center"
android:text=""
android:textSize="@dimen/text_14" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_item_alsotime"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/shape_rv_main_small"
android:paddingLeft="@dimen/size_3"
android:paddingTop="@dimen/size_1"
android:paddingRight="@dimen/size_3"
android:paddingBottom="@dimen/size_1"
android:text="@string/rv_out"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_out_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text=""
android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_home_out_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:gravity="center_vertical"
android:orientation="horizontal">
<Button
android:id="@+id/tv_home_select_car"
android:layout_width="0dp"
android:layout_height="@dimen/size_40"
android:layout_weight="1"
android:background="@drawable/shape_rv_bg_shallow_dark_yellow_circle"
android:gravity="center"
android:text="立即选车"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_home_car_rental_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_20"
android:drawableRight="@drawable/common_icon_rig_black"
android:drawablePadding="@dimen/size_2"
android:text="租车指南"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_layout_home_rv_tour"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:id="@+id/ll_home_item_rv_city"
android:layout_width="match_parent"
android:layout_height="@dimen/size_60"
android:layout_marginTop="@dimen/size_10"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_home_rv_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请选择目的地城市"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_15" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10"
android:src="@drawable/rv_common_icon_up_arrow" />
</LinearLayout>
<include layout="@layout/common_line" />
<Button
android:id="@+id/tv_home_book_now"
android:layout_width="match_parent"
android:layout_height="@dimen/size_40"
android:layout_marginTop="@dimen/size_20"
android:background="@drawable/shape_rv_bg_shallow_dark_yellow_circle"
android:gravity="center"
android:text="立即预订"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_16" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_20"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="@dimen/size_50"
android:layout_height="@dimen/size_20"
android:background="@drawable/shape_rv_bg_crimson_xiao_fang"
android:gravity="center"
android:text="热门"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_home_item_rv_hot_label1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/tv_home_rv_hot_label1"
android:layout_width="@dimen/size_60"
android:layout_height="@dimen/size_35"
android:background="@drawable/shape_rv_dark_gray_circle"
android:ellipsize="end"
android:gravity="center"
android:maxLength="3"
android:singleLine="true"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_home_item_rv_hot_label2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/tv_home_rv_hot_label2"
android:layout_width="@dimen/size_60"
android:layout_height="@dimen/size_35"
android:background="@drawable/shape_rv_dark_gray_circle"
android:ellipsize="end"
android:gravity="center"
android:maxLength="3"
android:singleLine="true"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_home_item_rv_hot_label3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/tv_home_rv_hot_label3"
android:layout_width="@dimen/size_60"
android:layout_height="@dimen/size_35"
android:background="@drawable/shape_rv_dark_gray_circle"
android:ellipsize="end"
android:gravity="center"
android:maxLength="3"
android:singleLine="true"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
android:textSize="@dimen/size_12"
android:textColor="@color/textGray"
android:text="@string/rv_home_car_camp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_car_discovery"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
</RelativeLayout>
<ImageView
android:src="@drawable/icon_home_discovery"
android:layout_width="47dp"
android:layout_height="47dp" />
<TextView
android:layout_marginTop="@dimen/size_15"
android:textSize="@dimen/size_12"
android:textColor="@color/textGray"
android:text="@string/rv_home_discovery"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_car_buy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:src="@drawable/icon_home_buy"
android:layout_width="47dp"
android:layout_height="47dp"/>
<TextView
android:layout_marginTop="@dimen/size_15"
android:textSize="@dimen/size_12"
android:textColor="@color/textGray"
android:text="@string/rv_home_buy_car"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<!--每周特惠-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -451,134 +160,81 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="3dp"
app:cardMaxElevation="@dimen/size_10">
<LinearLayout
android:id="@+id/ll_home_item_hot_rvtour"
android:layout_width="@dimen/size_100"
android:layout_height="@dimen/size_50"
android:background="@drawable/selector_home_item_hot_button"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_hot_rvtour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="热门旅行"
android:textColor="@color/textGray"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_home_hot_rvtour_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="精选房车游路线"
android:textColor="@color/text_Gray"
android:textSize="@dimen/text_10" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_marginLeft="@dimen/size_15"
android:text="@string/rv_home_title_hot_travle"
android:textStyle="bold"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_hot_travel_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:cardElevation="3dp"
app:cardMaxElevation="@dimen/size_10">
<LinearLayout
android:id="@+id/ll_home_item_hot_entertainment_camp"
android:layout_width="@dimen/size_100"
android:layout_height="@dimen/size_50"
android:layout_centerInParent="true"
android:background="@drawable/selector_home_item_hot_button"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_hot_entertainment_camp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="娱乐营地"
android:textColor="@color/textGray"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_home_hot_entertainment_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="娱乐休息两不误"
android:textColor="@color/text_Gray"
android:textSize="@dimen/text_10" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_10"
android:drawableRight="@drawable/common_icon_rig_gray"
android:drawablePadding="@dimen/dp_4"
android:text="@string/rv_order_all_order"
android:textColor="@color/text_Gray"
android:textSize="@dimen/size_12" />
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/ry_home_hot_travel"
android:layout_width="match_parent"
android:layout_height="@dimen/size_410"
android:layout_marginTop="@dimen/size_10"
android:paddingLeft="@dimen/size_10"
android:paddingRight="@dimen/size_10" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_15"
android:text="@string/rv_home_title_camp"
android:textColor="@color/colorMain"
android:textStyle="bold"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_camp_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:cardElevation="3dp"
app:cardMaxElevation="@dimen/size_10">
<LinearLayout
android:id="@+id/ll_home_item_hot_car_rental"
android:layout_width="@dimen/size_100"
android:layout_height="@dimen/size_50"
android:layout_alignParentRight="true"
android:background="@drawable/selector_home_item_hot_button"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_hot_car_rental"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="购房车"
android:textColor="@color/textGray"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_home_hot_car_rental_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="精心打造你的房车"
android:textColor="@color/text_Gray"
android:textSize="@dimen/text_10" />
</LinearLayout>
</android.support.v7.widget.CardView>
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/size_5"
android:drawableRight="@drawable/common_icon_rig_gray"
android:paddingRight="5dp"
android:drawablePadding="@dimen/dp_4"
android:text="@string/rv_order_all_order"
android:textColor="@color/text_Gray"
android:textSize="@dimen/size_12" />
</RelativeLayout>
<!---->
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView_home_content"
android:id="@+id/ry_home_camp"
android:layout_width="match_parent"
android:layout_height="@dimen/size_410"
android:layout_marginTop="@dimen/size_10"
android:paddingLeft="@dimen/size_10"
android:paddingRight="@dimen/size_10" />
<TextView
android:id="@+id/tv_home_see_more_popular"
android:layout_width="@dimen/size_240"
android:layout_height="@dimen/size_40"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/size_20"
android:background="@drawable/shape_rv_button_gray_circle"
android:gravity="center"
android:text="更多热门旅行线路" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_30"
android:layout_marginTop="@dimen/size_20"
android:paddingLeft="@dimen/size_15"
android:text="精选活动"
android:textColor="@color/colorMain"
......@@ -701,6 +357,7 @@
android:id="@+id/ll_home_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
app:use_type="use_padding_top">
......@@ -714,7 +371,7 @@
android:id="@+id/tv_home_travel_city_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_5"
android:layout_marginLeft="@dimen/dp_10"
android:clickable="true"
android:gravity="center"
android:orientation="horizontal">
......@@ -724,14 +381,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/ui_dimen_common_small"
android:textColor="@color/colorWrite"
android:textSize="@dimen/_ui_text_size_h6" />
android:textColor="@color/textGray"
android:text="东莞市"
android:textSize="@dimen/text_16" />
<ImageView
android:id="@+id/iv_home_travel_city_text_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rv_common_icon_up_arrow2" />
android:src="@drawable/home_icon_downward" />
</LinearLayout>
<LinearLayout
......@@ -751,7 +409,7 @@
android:layout_height="15dp"
android:layout_marginLeft="@dimen/ui_dimen_margin_h1"
android:layout_marginRight="@dimen/ui_dimen_common_small"
android:src="@drawable/rv_common_icon_search2" />
android:src="@drawable/common_icon_search" />
<TextView
android:id="@+id/tv_home_search_input"
......@@ -763,9 +421,9 @@
android:hint="搜索目的地/旅游线"
android:paddingLeft="@dimen/ui_dimen_common"
android:paddingRight="@dimen/ui_dimen_padding_h1"
android:textColor="@color/colorTextH1"
android:textColorHint="@color/colorWrite"
android:textSize="@dimen/_ui_text_size_h7" />
android:textColor="@color/colorGray"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/sp_14" />
</LinearLayout>
<ImageView
......@@ -776,7 +434,7 @@
android:padding="@dimen/size_5"
android:paddingRight="@dimen/ui_dimen_common"
android:scaleType="centerInside"
android:src="@drawable/rv_rentingcar_icon_service_white" />
android:src="@drawable/common_journey_service_gray" />
<LinearLayout
android:id="@+id/ll_home_item_top"
......@@ -788,16 +446,16 @@
android:visibility="gone">
<ImageView
android:layout_width="@dimen/size_20"
android:layout_height="@dimen/size_20"
android:layout_width="21dp"
android:layout_height="21dp"
android:padding="@dimen/size_2"
android:src="@drawable/common_icon_stick" />
android:src="@drawable/common_icon_top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="回顶部"
android:textColor="@color/gray_FFB74B"
android:textColor="@color/gray"
android:textSize="@dimen/text_8" />
</LinearLayout>
</LinearLayout>
......
......@@ -47,10 +47,10 @@
<string name="rv_ok">确定</string>
<string name="rv_rental_car">租房车</string>
<string name="rv_rental_car_content">开启生活新旅程</string>
<string name="rv_get_car_address">取车公司</string>
<string name="rv_get_car_address">您在哪取车</string>
<string name="rv_get_car_address_">取车地址:</string>
<string name="rv_get_car_hint">请选择取车分公司</string>
<string name="rv_get_out_address">还车公司</string>
<string name="rv_get_out_address">您在哪还车</string>
<string name="rv_get_out_address_">还车地址:</string>
<string name="rv_get_out_hint">请选择还车分公司</string>
<string name="rv_full_time_driver">欣新专职司机(600/天)</string>
......@@ -175,5 +175,15 @@
<string name="tv_boarding">立即上车</string>
<string name="tv_cancelled">已取消</string>
<string name="rv_collection_data_null">您还没有收藏的信息哦</string>
<string name="rv_home_car_recent">房车租赁</string>
<string name="rv_home_car_travel">房车旅行</string>
<string name="rv_home_car_camp">房车营地</string>
<string name="rv_home_discovery">发现</string>
<string name="rv_home_buy_car">购房车</string>
<string name="rv_home_title_hot_travle">热门旅行</string>
<string name="rv_home_title_camp">娱乐营地</string>
<string name="rv_home_title_recent_info">租车信息</string>
<!--=================================================房车结束========================================-->
</resources>
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