Commit 391c1631 authored by jianglx's avatar jianglx

租车城市选择的修改,精选活动的跳转

parent 23feca33
......@@ -37,9 +37,9 @@ public class UtilsManager {
private Context mContext = null;
public static UtilsManager getInstance(Context context) {
if (instance ==null){
synchronized (UtilsManager.class){
if (instance ==null){
if (instance == null) {
synchronized (UtilsManager.class) {
if (instance == null) {
instance = new UtilsManager(context);
}
}
......@@ -48,9 +48,9 @@ public class UtilsManager {
}
public static UtilsManager getInstance() {
if (instance ==null){
synchronized (UtilsManager.class){
if (instance ==null){
if (instance == null) {
synchronized (UtilsManager.class) {
if (instance == null) {
instance = new UtilsManager();
}
}
......@@ -198,7 +198,7 @@ public class UtilsManager {
/**
* 读取本地文件的方法
*
* 恐有内存泄漏
* @param context
* @param fileName
* @return
......
package com.rv.component.utils;
public class LocationUtils {
private static final double EARTH_RADIUS = 6371393; // 平均半径,单位:m
/**
* 通过AB点经纬度获取距离
*
* @return 距离(单位 : 米)
*/
public static double getDistance(double lat_a, double lng_a, double lat_b, double lng_b) {
// 经纬度(角度)转弧度。弧度用作参数,以调用Math.cos和Math.sin
double radiansAX = Math.toRadians(lng_a); // A经弧度
double radiansAY = Math.toRadians(lat_a); // A纬弧度
double radiansBX = Math.toRadians(lng_b); // B经弧度
double radiansBY = Math.toRadians(lat_b); // B纬弧度
// 公式中“cosβ1cosβ2cos(α1-α2)+sinβ1sinβ2”的部分,得到∠AOB的cos值
double cos = Math.cos(radiansAY) * Math.cos(radiansBY) * Math.cos(radiansAX - radiansBX)
+ Math.sin(radiansAY) * Math.sin(radiansBY);
double acos = Math.acos(cos); // 反余弦值
return EARTH_RADIUS * acos; // 最终结果
}
}
......@@ -3,7 +3,8 @@
package="com.rv.home">
<application>
<activity android:name=".rv.module.ui.main.home.order.MemberOrderDetailsActivity"></activity>
<activity android:name=".rv.module.ui.main.home.order.MemberOrderDetailsActivity" />
<activity android:name=".rv.module.ui.main.home.SalesroomActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -92,4 +92,6 @@ public class ApiConfig {
public static String HTTP_URL_INVITE_LIST = RvFrameConfig.HOST + "/api/admin/relation/pages";
public static String HTTP_URL_CONSUME_LIST = RvFrameConfig.HOST + "/api/admin/walletDetail/page";
public static String HTTP_URL_SELECTED_ACTIVITIES = RvFrameConfig.HOST + "/api/activity/activityList/app/unauth/activity/findAll"; // 精选活动
}
......@@ -206,6 +206,7 @@ public class LoginRvActivity extends BaseLoginActivity<CommonPresenter> {
Map<String, Object> map = new LinkedHashMap<>();
map.put("username", getPhone());
map.put("type", 4);
map.put("code", Cooker.getStringValue(getApplicationContext(), "code"));
mPresenter.postData(0, ApiConfig.HTTP_URL_SEND_CODE, SendCodeBean.class, map, true);
}
......@@ -216,6 +217,7 @@ public class LoginRvActivity extends BaseLoginActivity<CommonPresenter> {
Map<String, Object> map = new LinkedHashMap<>();
map.put("openid", openid);
map.put("isQQ", isQQ);
map.put("code", Cooker.getStringValue(getApplicationContext(), "code"));
mPresenter.postData(1, ApiConfig.HTTP_URL_OTHER_LOGIN, RegisteredBean.class, map, true);
}
......
......@@ -7,9 +7,11 @@ import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.TextView;
import android.widget.EditText;
import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
......@@ -17,17 +19,19 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.url.Constance;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.LogUtil;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.basic.BaseStatusActivity;
import com.ruiwenliu.wrapper.weight.SideLetterBar;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.home.rv.module.basic.bean.MultiItemBean;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.main.home.adapter.CityListAdapter;
import com.rv.home.rv.module.ui.main.home.bean.CityHeadBean;
import com.rv.home.rv.module.ui.main.home.bean.CityPickerBean;
import com.rv.home.rv.module.ui.main.home.bean.HotCityBean;
import com.rv.home.rv.module.ui.main.home.bean.HotCityListBean;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import java.io.BufferedReader;
......@@ -48,11 +52,8 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
@BindView(R2.id.recyclerView)
RecyclerView recyclerView;
@BindView(R2.id.tv_letter_overlay)
TextView tvLetterOverlay;
@BindView(R2.id.side_letter_bar)
SideLetterBar sideLetterBar;
@BindView(R2.id.edt_search)
EditText edtSearch;
@Autowired
int mCityType;
@Autowired
......@@ -61,6 +62,7 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
int mCityId;
// private Map<String,String> mapSave;
private Disposable mDisposable = null;
private CityListAdapter cityListAdapter;
// public static Intent getIntent(Context context, int type, String city, int id) {
// return new Intent(context, CityListActivity.class).putExtra("type", type).putExtra("location", city).putExtra("id", id);
......@@ -81,35 +83,18 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
// mCityType = intent.getIntExtra("type", 1);
// mNowCity = intent.getStringExtra("location");
// mCityId = intent.getIntExtra("id", 1);
final List<MultiItemBean> list = getListData(mNowCity);
List<MultiItemBean> lists = new ArrayList<>();
final CityListAdapter cityListAdapter = new CityListAdapter(lists);
// hotCityAdapter = new HotCityAdapter(this, getHotCitys());
// gridView.setAdapter(hotCityAdapter);
cityListAdapter = new CityListAdapter(new ArrayList<MultiItemBean>(), listener);
recyclerView.setLayoutManager(new GridLayoutManager(this, 6));
recyclerView.setAdapter(cityListAdapter);
recyclerView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorLine));
/**
* 设置每个Item的横排显示数量
* 注意:======对应GridLayoutManager设置
*/
cityListAdapter.setSpanSizeLookup(new BaseQuickAdapter.SpanSizeLookup() {
@Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int position) {
return list.get(position).getSpanSize();
}
});
cityListAdapter.setNewData(list);
sideLetterBar.setOverlay(tvLetterOverlay);
sideLetterBar.setOnLetterChangedListener(new SideLetterBar.OnLetterChangedListener() {
@Override
public void onLetterChanged(String letter) {
int position = cityListAdapter.getSelectIndex(letter);
if (position == -1) {
return;
}
recyclerView.scrollToPosition(position);
return cityListAdapter.getData().get(position).getSpanSize();
}
});
recyclerView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorLine));
cityListAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
......@@ -128,11 +113,17 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
}
}
});
setData(null);
edtSearch.addTextChangedListener(watcher);
}
private void setData(String searchCity) {
List<MultiItemBean> list = getListData(searchCity);
cityListAdapter.setNewData(list);
}
@Override
protected void loadData(Bundle savedInstanceState, Intent intent) {
}
@Override
......@@ -140,52 +131,41 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
}
private List<MultiItemBean> getListData(String now_city) {
private List<HotCityBean> getHotCitys() {
List<HotCityBean> lists = new ArrayList<>();
lists.add(new HotCityBean("北京", 110100));
lists.add(new HotCityBean("上海", 310100));
lists.add(new HotCityBean("东莞", 441900));
lists.add(new HotCityBean("深圳", 440300));
lists.add(new HotCityBean("广州", 440100));
lists.add(new HotCityBean("杭州", 330100));
lists.add(new HotCityBean("南昌", 360100));
lists.add(new HotCityBean("西安", 610100));
return lists;
}
private List<MultiItemBean> getListData(String searchCity) {
List<MultiItemBean> list = new ArrayList<>();
if (!TextUtils.isEmpty(now_city)) {
list.add(new HotCityBean(now_city, mCityId));
list.add(new CityHeadBean("当前城市/已访问城市"));
}
list.add(new CityHeadBean("热门城市"));
list.add(new HotCityBean("北京市", 110100));
list.add(new HotCityBean("上海市", 310100));
list.add(new HotCityBean("东莞市", 441900));
list.add(new HotCityBean("深圳市", 440300));
list.add(new HotCityBean("广州市", 440100));
list.add(new HotCityBean("杭州市", 330100));
list.add(new HotCityBean("南昌市", 360100));
list.add(new HotCityBean("西安市", 610100));
list.add(new HotCityListBean(getHotCitys()));
String json = getJson(this, "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
list.add(new CityHeadBean(cityBean.getTitle()));
if (TextUtils.isEmpty(searchCity)) {
list.add(new CityHeadBean(cityBean.getTitle()));
}
for (ListsBean lsBean : cityBean.getLists()) {
list.add(lsBean);
if (!TextUtils.isEmpty(searchCity)) {
if (lsBean.getName().contains(searchCity)) {
list.add(lsBean);
}
} else {
list.add(lsBean);
}
}
}
return list;
}
/**
* 获取拼音的首字母(大写)
*
* @param pinyin
* @return
*/
public String getFirstLetter(final String pinyin) {
if (TextUtils.isEmpty(pinyin)) return "";
String c = pinyin.substring(0, 1);
Pattern pattern = Pattern.compile("^[A-Za-z]+$");
if (pattern.matcher(c).matches()) {
return c.toUpperCase();
}
return "";
}
/**
* 读取本地文件的方法
*
......@@ -193,7 +173,7 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
* @param fileName
* @return
*/
public String getJson(Context context, String fileName) {
private String getJson(Context context, String fileName) {
StringBuilder stringBuilder = new StringBuilder();
try {
AssetManager assetManager = context.getAssets();
......@@ -257,6 +237,31 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
});
}
private TextWatcher watcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
LogUtil.d("CharSequence==", s.toString());
setData(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
}
};
private CityListAdapter.GridClickListener listener = new CityListAdapter.GridClickListener() {
@Override
public void click(HotCityBean hotCityBean) {
sendData(hotCityBean.hotCityName, hotCityBean.hotCityId);
}
};
}
......
......@@ -13,6 +13,7 @@ import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
......@@ -68,11 +69,13 @@ 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.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.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;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -105,14 +108,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
TextView headTvGetCity;
@BindView(R2.id.tv_get_address)
TextView headTvGetShop;
@BindView(R2.id.switch_get)
Switch switchGet;
@BindView(R2.id.tv_out_city)
TextView headTvOutCity;
@BindView(R2.id.tv_out_address)
TextView headTvOutShop;
@BindView(R2.id.switch_out)
Switch switchOut;
@BindView(R2.id.tv_get_time)
TextView tvGetTime;
@BindView(R2.id.tv_get_week)
......@@ -195,6 +194,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
private final int TYPE_REQUEST_CITY = 1;//城市列表
private final int TYPE_REQUEST_SHOP = 2;//门店列表
private final int TYPE_REQUEST_ADDRESS = 3;//地址选择
private final int REQUEST_GET_CODE = 10001; // 取车地址选择请求码
private final int REQUEST_RETURN_CODE = 10002; // 换车地址选择请求码
Unbinder unbinder2;
Unbinder unbinder3;
......@@ -210,6 +213,8 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
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;
......@@ -231,7 +236,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
private HotCarTypeAdapter mAdapter;
private SelectedEventsAdapter mActivityAdapter;
// private RVEnthusiastAdapter mRvEnthusiast;
// private RVEnthusiastAdapter mRvEnthusiast;
private RVTourListAdapter mRvTourAdapter;
private RVTourListLabelAdapter mRvTourLabelAdapter;
......@@ -297,6 +302,20 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
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);
if (item != null && !TextUtils.isEmpty(item.getUrl()) && !TextUtils.isEmpty(item.getName())) {
ComponentName componentName = new ComponentName(getActivity(), "com.rv.share.WebViewActivity");
Intent intent = new Intent();
intent.setComponent(componentName);
intent.putExtra("url", item.getUrl());
intent.putExtra("title", item.getName());
startActivity(intent);
}
}
});
//房车发烧友
// mRvEnthusiast = new RVEnthusiastAdapter();
......@@ -320,7 +339,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
recyclerViewRvtourlistTitle.setNestedScrollingEnabled(false);
recyclerViewRvtourlistTitle.setAdapter(mRvTourLabelAdapter);
getData();
getSelectedActivities();
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
......@@ -433,12 +452,13 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
}
}
private void getData() {
List<Integer> list = new ArrayList<>();
list.add(R.drawable.aaa1);
list.add(R.drawable.aaa2);
mActivityAdapter.setNewData(list);
// mRvEnthusiast.setNewData(list);
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);
}
@Override
......@@ -494,6 +514,13 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
break;
case 3:
bannerData((BeanHomeBanner) result);
break;
case 4:
SelectedActivitiesBean bean = (SelectedActivitiesBean) result;
if (bean != null && bean.getData() != null && bean.getData().size() > 0) {
mActivityAdapter.setNewData(bean.getData());
}
break;
}
......@@ -522,7 +549,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
R2.id.tv_out_city, R2.id.tv_get_address, R2.id.tv_out_address, R2.id.ll_item_select_data, R2.id.tv_select_car,
R2.id.ll_item_rv_city, R2.id.tv_book_now, R2.id.ll_item_rv_hot_label1, R2.id.ll_item_rv_hot_label2, R2.id.ll_item_rv_hot_label3,
R2.id.ll_item_hot_rvtour, R2.id.ll_item_hot_entertainment_camp, R2.id.ll_item_hot_car_rental, R2.id.tv_see_more_popular,
R2.id.ll_item_top, R2.id.travel_server_image, R2.id.tv_car_rental_guide, R2.id.ll_item_activity_all})
R2.id.ll_item_top, R2.id.travel_server_image, R2.id.tv_car_rental_guide, R2.id.ll_item_activity_all, R2.id.ll_rent, R2.id.ll_return})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.travel_city_layout) {
......@@ -554,37 +581,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
tvItemRentingACar.setSelected(true);
llLayoutRentingACar.setVisibility(View.GONE);
llLayoutRvTour.setVisibility(View.VISIBLE);
} else if (id == R.id.tv_get_city) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CITYLIST)
.withInt("mCityType", 1)
.withString("mNowCity", headTvGetCity.getText().toString())
.withInt("mCityId", getCityId)
.navigation(getActivity(), TYPE_REQUEST_CITY);
} else if (id == R.id.tv_out_city) {
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CITYLIST)
.withInt("mCityType", 2)
.withString("mNowCity", headTvOutCity.getText().toString())
.withInt("mCityId", outCityId)
.navigation(getActivity(), TYPE_REQUEST_CITY);
} else if (id == R.id.tv_get_address) {
String getCity = headTvGetCity.getText().toString().trim();
// if (getSwitchType == 0) {
// startActivityForResult(SelectShopActivity.getIntent(mActivity, 1,"",getCity.equals(nowCity) && mLatLng!=null?mLatLng.latitude:0,getCity.equals(nowCity)&& mLatLng!=null?mLatLng.longitude:0), TYPE_REQUEST_SHOP);
// } else {
startActivityForResult(SelectLocationActivity.getIntent(getContext(), 1, getCity, 0, latLatitude, lonLongitude, nowCity, 0), TYPE_REQUEST_ADDRESS);
} else if (id == R.id.tv_out_address) {
String outCity = headTvOutCity.getText().toString().trim();
// if (outSwitchType == 0) {
// startActivityForResult(SelectShopActivity.getIntent(mActivity, 2,"",outCity.equals(nowCity)&& mLatLng!=null?mLatLng.latitude:0,outCity.equals(nowCity)&& mLatLng!=null?mLatLng.longitude:0), TYPE_REQUEST_SHOP);
// } else {
startActivityForResult(SelectLocationActivity.getIntent(getContext(), 2, outCity, 0, outLatitude, outLongitude, nowCity, 0), TYPE_REQUEST_ADDRESS);
} else if (id == R.id.tv_get_city || id == R.id.tv_get_address || id == R.id.ll_rent) {
startActivityForResult(SelectShopActivity.getIntent(getActivity(), 1, "", TextUtils.isEmpty(getCityName) ? nowCity : getCityName, latLatitude, lonLongitude), TYPE_REQUEST_CITY);
} else if (id == R.id.tv_out_city || id == R.id.ll_return || id == R.id.tv_out_address) {
startActivityForResult(SelectShopActivity.getIntent(getActivity(), 2, "", TextUtils.isEmpty(outCityName) ? nowCity : outCityName, latLatitude, lonLongitude), TYPE_REQUEST_CITY);
} else if (id == R.id.ll_item_select_data) {
//选择日期
ARouter.getInstance()
......@@ -769,23 +769,33 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
switch (requestCode) {
case TYPE_REQUEST_CITY://城市列表
if (type == 1) {
headTvGetShop.setText("");
String companyName = data.getStringExtra("company");
getCityName = requestData;
headTvGetShop.setText(companyName);
getCityId = data.getIntExtra("id", 0);
double lat = data.getDoubleExtra("latitude", 0);
double lon = data.getDoubleExtra("longitude", 0);
setRequestData(type, requestData, headTvGetCity, headTvOutCity, lat, lon);
} else if (type == 2) {
headTvOutShop.setText("");
outCityName = requestData;
String companyName = data.getStringExtra("company");
headTvOutShop.setText(companyName);
outCityId = data.getIntExtra("id", 0);
double lat = data.getDoubleExtra("latitude", 0);
double lon = data.getDoubleExtra("longitude", 0);
setRequestData(type, requestData, headTvGetCity, headTvOutCity, lat, lon);
} else if (type == 3) {
tvRvCity.setText("");
vVTourCityId = data.getIntExtra("id", 0);
setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0);
} else if (type == 4) {
travelCityText.setText("");
mTravelCityId = data.getIntExtra("id", 0);
getCityId = mTravelCityId;
outCityId = mTravelCityId;
vVTourCityId = mTravelCityId;
setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0);
}
setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0);
break;
case TYPE_REQUEST_SHOP://门店
setRequestData(type, requestData, headTvGetShop, headTvOutShop, 0, 0);
......
package com.rv.home.rv.module.ui.main.home;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.home.R;
import com.rv.home.rv.module.basic.BaseStatusActivity;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
public class SalesroomActivity extends BaseStatusActivity<CommonPresenter> {
@Override
protected int setLayout() {
return R.layout.activity_salesroom;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
}
@Override
public void onShowResult(int requestType, BaseBean result) {
}
}
......@@ -3,13 +3,29 @@ 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.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
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.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.base.BaseBean;
import com.ruiwenliu.wrapper.inter.OnViewHolder;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.util.ViewHolder;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.basic.BaseStatusActivity;
......@@ -19,6 +35,8 @@ import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.main.home.adapter.SelectShopAdapter;
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 java.util.LinkedHashMap;
......@@ -31,25 +49,35 @@ import butterknife.BindView;
* Date: 2019/5/18.
* Desc:门店选择
*/
public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
private final int TYPE_REQUEST_CITY = 10001;
@BindView(R2.id.recyclerView)
RecyclerView recyclerView;
@BindView(R2.id.refresh)
SimpleRefreshLayout mSimpleRefreshLayout;
@BindView(R2.id.ll_search)
LinearLayout llSearch;
@BindView(R2.id.tv_current_city)
TextView tvCurrentCity;
private SelectShopAdapter mAdapter;
private int shopType;
private String mCityId;
private int mCityId;
private double mLat;
private double mLon;
private int mPage;
private int countPage;
private String cityName;
private GeoCoder geoCoder;
private double latLatitude;
private double lonLongitude;
public static Intent getIntent(Context context, int type, String id, double lat, double lon) {
public static Intent getIntent(Context context, int type, String id, String cityName, double lat, double lon) {
return new Intent(context, SelectShopActivity.class)
.putExtra("type", type)
.putExtra("city_id", id)
.putExtra("city_name", cityName)
.putExtra("lat", lat)
.putExtra("lon", lon);
}
......@@ -62,11 +90,16 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(mActivity.getString(R.string.rv_select_shop));
mCityId = intent.getStringExtra("city_id");
mLat = intent.getIntExtra("lat", 0);
mLon = intent.getIntExtra("lon", 0);
mLat = intent.getDoubleExtra("lat", 0d);
mLon = intent.getDoubleExtra("lon", 0d);
cityName = intent.getStringExtra("city_name");
if (!TextUtils.isEmpty(cityName)) {
tvCurrentCity.setText("当前选择城市: " + cityName);
}
getCityId();
mAdapter = new SelectShopAdapter();
mAdapter.setOnLoadMoreListener(this, recyclerView);
mAdapter.setPosition(mLat, mLon);
mSimpleRefreshLayout.setHeaderView(new SimpleRefreshView(this));
mSimpleRefreshLayout.setOnSimpleRefreshListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
......@@ -76,14 +109,57 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
getIntent().putExtra("location", mAdapter.getItem(position).getName());
getIntent().putExtra("type", shopType);
setResult(RESULT_OK, getIntent());
Intent intent = new Intent();
intent.putExtra("location", cityName);
intent.putExtra("type", shopType);
intent.putExtra("id", mCityId);
intent.putExtra("company", mAdapter.getData().get(position).getName());
intent.putExtra("latitude", latLatitude);
intent.putExtra("longitude", lonLongitude);
setResult(RESULT_OK, intent);
finish();
}
});
llSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 跳转到城市选择界面
ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CITYLIST)
.withInt("mCityType", 2)
.navigation(SelectShopActivity.this, TYPE_REQUEST_CITY);
}
});
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 {
latLatitude = result.getLocation().latitude;
lonLongitude = result.getLocation().longitude;
}
//获取地理编码结果
}
@Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
//没有找到检索结果
} else {
latLatitude = result.getLocation().latitude;
lonLongitude = result.getLocation().longitude;
}
}
});
}
@Override
protected void loadData(Bundle savedInstanceState, Intent intent) {
onRefresh();
......@@ -91,8 +167,46 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
@Override
public void onShowResult(int requestType, BaseBean result) {
if (requestType == 0) {
ShopListBean bean = (ShopListBean) result;
if (mPage == 1) {
mSimpleRefreshLayout.onRefreshComplete();
if (bean != null && bean.getData() != null && bean.getData().getData() != null && bean.getData().getData().size() > 0) {
processData((ShopListBean) result);
} else {
mAdapter.getData().clear();
mAdapter.setEmptyView(getEmptyView(recyclerView, -1, getString(R.string.rv_select_not_data)));
mAdapter.notifyDataSetChanged();
mAdapter.loadMoreComplete();
}
} else {
mAdapter.addData(bean.getData().getData());
mAdapter.loadMoreComplete();
}
processData((ShopListBean) result);
}
}
/**
* 获取通用空布局
*
* @param mRecyclerView
* @param imageId
* @param empty
* @return
*/
protected View getEmptyView(RecyclerView mRecyclerView, final int imageId, final String empty) {
return getHelperView(mRecyclerView, R.layout.select_shop_empty, new OnViewHolder() {
@Override
public void helper(ViewHolder helper) {
if (imageId != -1) {
helper.setImageResource(com.ruiwenliu.wrapper.R.id.iv_flag, imageId);
}
helper.setText(com.ruiwenliu.wrapper.R.id.tv_tip, empty);
}
});
}
@Override
......@@ -104,20 +218,14 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
@Override
public void onLoadMoreRequested() {
if(mPage>countPage){
if (mPage > countPage) {
mAdapter.loadMoreEnd();
}else {
} else {
mPage++;
getShopList(mPage);
}
}
/**
* 获取门店列表
*/
......@@ -125,26 +233,63 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
Map<String, Object> map = new LinkedHashMap<>();
map.put("page", page);
map.put("limit", 10);
map.put("addrCity", "441900");
if(mLat>0){
if (mCityId == 0) {
map.put("addrCity", 441900);
} else {
map.put("addrCity", mCityId);
}
if (mLat > 0) {
map.put("lat", mLat);
map.put("lon", mLon);
}
mPresenter.getData(RvFrameConfig.VEHICLE_POST,0, ApiConfig.HTTP_URL_SHOP_LIST, ShopListBean.class,map, page == 1 ? true : false);
mPresenter.getData(RvFrameConfig.VEHICLE_POST, 0, ApiConfig.HTTP_URL_SHOP_LIST, ShopListBean.class, map, page == 1 ? true : false);
}
private void processData(ShopListBean bean){
if(mPage==1){
countPage=bean.getData().getTotalPage();
mAdapter.setNewData(bean.getData().getData());
mSimpleRefreshLayout.onRefreshComplete();
}else {
mAdapter.addData(bean.getData().getData());
mAdapter.loadMoreComplete();
/******
* 获取城市id
*/
private void getCityId() {
if (TextUtils.isEmpty(cityName)) return;
String json = UtilsManager.getInstance().getJson(this, "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
for (ListsBean lsBean : cityBean.getLists()) {
if (cityName.equals(lsBean.getName())) {
mCityId = lsBean.getId();
return;
}
}
}
}
private void processData(ShopListBean bean) {
countPage = bean.getData().getTotalPage();
mAdapter.setNewData(bean.getData().getData());
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == TYPE_REQUEST_CITY && data != null) {
cityName = data.getStringExtra("location");
geoCoder.geocode(new GeoCodeOption()
.city(cityName)
.address(cityName));
mCityId = data.getIntExtra("id", 0);
if (!TextUtils.isEmpty(cityName)) {
tvCurrentCity.setText("当前选择城市: " + cityName);
}
// getIntent().putExtra("type", mCityType);
mPage = 1;
getShopList(mPage);
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (geoCoder != null) {
geoCoder.destroy();
}
}
}
package com.rv.home.rv.module.ui.main.home.adapter;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.basic.bean.MultiItemBean;
import com.rv.home.rv.module.ui.main.home.bean.CityHeadBean;
import com.rv.home.rv.module.ui.main.home.bean.HotCityBean;
import com.rv.home.rv.module.ui.main.home.bean.HotCityListBean;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import java.util.List;
......@@ -24,11 +27,14 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
public static final int TYPE_INDEX_HOT = 2;
public static final int TYPE_INDEX_CITY = 3;
private GridClickListener mListener;
public CityListAdapter(List<MultiItemBean> data) {
public CityListAdapter(List<MultiItemBean> data, GridClickListener listener) {
super(data);
this.mListener = listener;
addItemType(TYPE_INDEX_HEAD, R.layout.rv_item_head);
addItemType(TYPE_INDEX_HOT, R.layout.rv_item_hot_city);
addItemType(TYPE_INDEX_HOT, R.layout.rv_list_hot_city);
addItemType(TYPE_INDEX_CITY, R.layout.rv_item_city);
}
......@@ -40,8 +46,18 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
helper.setText(R.id.tv_head, cityHeadBean.headName);
break;
case TYPE_INDEX_HOT:
HotCityBean hotCityBean = (HotCityBean) item;
helper.setText(R.id.tv_hot_city, hotCityBean.hotCityName);
HotCityListBean hotCityListBean = (HotCityListBean) item;
final GridView gridView = helper.itemView.findViewById(R.id.gdv_hot_city);
final HotCityAdapter hotCityAdapter = new HotCityAdapter(mContext, hotCityListBean.getLists());
gridView.setAdapter(hotCityAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mListener != null) {
mListener.click((HotCityBean) hotCityAdapter.getItem(position));
}
}
});
break;
case TYPE_INDEX_CITY:
ListsBean cityBean = (ListsBean) item;
......@@ -50,23 +66,27 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
}
}
public int getSelectIndex(String an){
if(an.equals("定位")||an.equals("热门")){
public int getSelectIndex(String an) {
if (an.equals("定位") || an.equals("热门")) {
return 0;
}
if(TextUtils.isEmpty(an)){
if (TextUtils.isEmpty(an)) {
return -1;
}
for(MultiItemBean bean:getData()){
if(bean.getItemType()==TYPE_INDEX_HEAD){
CityHeadBean headBean= (CityHeadBean) bean;
if(headBean.headName.equals(an)){
return getData().indexOf(bean);
}
for (MultiItemBean bean : getData()) {
if (bean.getItemType() == TYPE_INDEX_HEAD) {
CityHeadBean headBean = (CityHeadBean) bean;
if (headBean.headName.equals(an)) {
return getData().indexOf(bean);
}
}
}
return -1;
}
public interface GridClickListener {
void click(HotCityBean hotCityBean);
}
}
package com.rv.home.rv.module.ui.main.home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.rv.home.R;
import com.rv.home.rv.module.ui.main.home.bean.HotCityBean;
import java.util.List;
public class HotCityAdapter extends BaseAdapter {
private Context mContext;
private List<HotCityBean> mLists;
public HotCityAdapter(Context context, List<HotCityBean> lists) {
this.mContext = context;
this.mLists = lists;
}
@Override
public int getCount() {
return mLists.size();
}
@Override
public Object getItem(int position) {
return mLists.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.rv_item_hot_city, null);
holder = new ViewHolder();
holder.tvHotCity = convertView.findViewById(R.id.tv_hot_city);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tvHotCity.setText(mLists.get(position).hotCityName);
return convertView;
}
private class ViewHolder {
TextView tvHotCity;
}
}
package com.rv.home.rv.module.ui.main.home.adapter;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.rv.component.utils.LocationUtils;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
......@@ -12,20 +18,41 @@ import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
* Desc:选择门店适配器
*/
public class SelectShopAdapter extends BaseQuickAdapter<ShopListBean.DataBeanX.DataBean,BaseViewHolder>{
public class SelectShopAdapter extends BaseQuickAdapter<ShopListBean.DataBeanX.DataBean, BaseViewHolder> {
private double latitude;
private double longitude;
public SelectShopAdapter() {
super(R.layout.rv_item_select_shop);
}
public void setPosition(Double lat, Double lon) {
this.latitude = lat;
this.longitude = lon;
}
@Override
protected void convert(BaseViewHolder helper, ShopListBean.DataBeanX.DataBean item) {
helper.setText(R.id.tv_name,item.getName());
helper.setText(R.id.tv_km,item.getDistance()!=null?String.format("%1$s%2$s%3$s"
,mContext.getString(R.string.rv_distance_you)
,item.getDistance()
,mContext.getString(R.string.rv_km)):"");
helper.setText(R.id.tv_address,String.format("%1$s%2$s",mContext.getString(R.string.rv_shop_location),item.getAddrDetail()));
protected void convert(BaseViewHolder helper, final ShopListBean.DataBeanX.DataBean item) {
helper.setText(R.id.tv_name, item.getName());
helper.setText(R.id.tv_position, "地址:" + item.getAddrDetail());
helper.setText(R.id.tv_contacts, "联系人: " + item.getLeader() + " " + item.getLeaderContactInfo());
helper.setOnClickListener(R.id.tv_call, new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!TextUtils.isEmpty(item.getLeaderContactInfo())) {
Intent t = new Intent();
t.setAction(Intent.ACTION_DIAL);
t.setData(Uri.parse("tel:" + item.getLeaderContactInfo()));
// 通知系统你去帮我干活吧
mContext.startActivity(t);
}
}
});
double distance = LocationUtils.getDistance(latitude, longitude, item.getLatitude(), item.getLongitude());
int distanceKm = (int)(distance / 1000);
helper.setText(R.id.tv_distance, "距您" + distanceKm + "km");
}
}
package com.rv.home.rv.module.ui.main.home.adapter;
import android.text.TextUtils;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ruiwenliu.wrapper.util.BaseGlideHolder;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.rv.home.R;
import com.rv.home.rv.module.ui.main.home.bean.SelectedActivitiesBean;
public class SelectedEventsAdapter extends BaseQuickAdapter<Integer, BaseGlideHolder> {
public class SelectedEventsAdapter extends BaseQuickAdapter<SelectedActivitiesBean.SelectedActivityItem, BaseGlideHolder> {
public SelectedEventsAdapter() {
super(R.layout.rv_item_selected_events);
}
@Override
protected void convert(BaseGlideHolder helper, Integer integer) {
protected void convert(BaseGlideHolder helper, SelectedActivitiesBean.SelectedActivityItem item) {
// GlideManager.getInstance(mContext).loadRoundImage(string, (ImageView)helper.getView(R.id.iv_activity),6);
// helper.setImageDrawable(R.id.iv_activity,mContext.getResources().getDrawable(integer));
GlideManager.getInstance(mContext).loadRoundImage2(integer, (ImageView)helper.getView(R.id.iv_activity),6);
if(!TextUtils.isEmpty(item.getPicture())) {
GlideManager.getInstance(mContext).loadRoundImage2(item.getPicture(), (ImageView) helper.getView(R.id.iv_activity), 6);
}
}
}
......@@ -9,7 +9,7 @@ import com.rv.home.rv.module.ui.main.home.adapter.CityListAdapter;
* Desc:热门城市
*/
public class HotCityBean implements MultiItemBean {
public class HotCityBean {
public String hotCityName;
public int hotCityId;
......@@ -18,16 +18,4 @@ public class HotCityBean implements MultiItemBean {
this.hotCityName = hotCityName;
this.hotCityId = hotCityId;
}
@Override
public int getSpanSize() {
return 2;
}
@Override
public int getItemType() {
return CityListAdapter.TYPE_INDEX_HOT;
}
}
package com.rv.home.rv.module.ui.main.home.bean;
import com.rv.home.rv.module.basic.bean.MultiItemBean;
import com.rv.home.rv.module.ui.main.home.adapter.CityListAdapter;
import java.util.List;
public class HotCityListBean implements MultiItemBean {
private List<HotCityBean> lists ;
public List<HotCityBean> getLists() {
return lists;
}
public void setLists(List<HotCityBean> lists) {
this.lists = lists;
}
public HotCityListBean(List<HotCityBean> lists) {
this.lists = lists;
}
@Override
public int getSpanSize() {
return 6;
}
@Override
public int getItemType() {
return CityListAdapter.TYPE_INDEX_HOT;
}
}
package com.rv.home.rv.module.ui.main.home.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
import java.util.List;
/*****
* 精选活动
*/
public class SelectedActivitiesBean extends BaseBean {
private boolean rel;
private List<SelectedActivityItem> data;
public boolean isRel() {
return rel;
}
public void setRel(boolean rel) {
this.rel = rel;
}
public List<SelectedActivityItem> getData() {
return data;
}
public void setData(List<SelectedActivityItem> data) {
this.data = data;
}
public static class SelectedActivityItem {
private int id;
private long crtTime;
private long updTime;
private String name;
private long startTime;
private long endTime;
private int numLimit;
private int hasJoinNum;
private int status;
private int sort;
private String picture;
private int type;
private String url;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getCrtTime() {
return crtTime;
}
public void setCrtTime(long crtTime) {
this.crtTime = crtTime;
}
public long getUpdTime() {
return updTime;
}
public void setUpdTime(long updTime) {
this.updTime = updTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getStartTime() {
return startTime;
}
public void setStartTime(long startTime) {
this.startTime = startTime;
}
public long getEndTime() {
return endTime;
}
public void setEndTime(long endTime) {
this.endTime = endTime;
}
public int getNumLimit() {
return numLimit;
}
public void setNumLimit(int numLimit) {
this.numLimit = numLimit;
}
public int getHasJoinNum() {
return hasJoinNum;
}
public void setHasJoinNum(int hasJoinNum) {
this.hasJoinNum = hasJoinNum;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
}
<?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="#ffffff" />
<stroke
android:width="1dp"
android:color="#6DB186" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_5" />
<solid android:color="@color/colorWrite" />
<stroke android:color="@color/gray_707070" android:width="1px" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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.SalesroomActivity">
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
......@@ -6,8 +6,7 @@
android:background="@color/colorLine"
android:orientation="vertical">
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -35,471 +34,447 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/size_230">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/size_230">
android:layout_marginLeft="@dimen/size_15"
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">
<android.support.v7.widget.CardView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_marginTop="@dimen/size_15"
android:layout_marginBottom="@dimen/size_25"
app:cardBackgroundColor="@color/colorWrite"
app:cardCornerRadius="10dp"
app:cardElevation="15dp">
android:orientation="vertical">
<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:layout_height="@dimen/size_50"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_item_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:orientation="horizontal">
android:text="租房车"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_item_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>
<TextView
android:id="@+id/tv_item_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" />
<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">
<TextView
android:id="@+id/tv_item_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:id="@+id/ll_layout_renting_a_car"
android:layout_width="match_parent"
android:layout_height="@dimen/size_245"
android:orientation="vertical"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_layout_renting_a_car"
android:id="@+id/ll_rent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10"
android:orientation="horizontal">
android:orientation="vertical">
<LinearLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:text="@string/rv_get_car_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" />
<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_14" />
<TextView
android:id="@+id/tv_get_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawableRight="@drawable/rv_common_icon_up_arrow"
android:drawablePadding="@dimen/size_3"
android:gravity="center"
android:hint="@string/rv_city_list"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<TextView
android:id="@+id/tv_get_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawableRight="@drawable/rv_common_icon_up_arrow"
android:drawablePadding="@dimen/size_3"
android:gravity="center"
android:hint="@string/rv_city_list"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<TextView
android:id="@+id/tv_get_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1"
android:gravity="center"
android:hint="@string/rv_get_car_hint"
android:textSize="@dimen/text_14" />
</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="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_get_address"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1"
android:gravity="center"
android:hint="@string/rv_get_car_hint"
android:text="@string/rv_get_out_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" />
<Switch
android:id="@+id/switch_get"
<TextView
android:id="@+id/tv_out_city"
android:layout_width="wrap_content"
android:layout_height="@dimen/size_20"
android:layout_gravity="center_vertical"
android:showText="true"
android:switchTextAppearance="@style/SwitchTheme"
android:textOff="@string/rv_to_shop"
android:textOn="@string/rv_to_door"
android:thumb="@drawable/switch_custom_thumb_selector"
android:track="@drawable/switch_custom_track_selector"
android:visibility="gone" />
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawableRight="@drawable/rv_common_icon_up_arrow"
android:drawablePadding="@dimen/size_3"
android:gravity="center"
android:hint="@string/rv_city_list"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
<TextView
android:id="@+id/tv_out_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginBottom="@dimen/size_10"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1"
android:gravity="center"
android:hint="@string/rv_get_out_hint"
android:textSize="@dimen/text_14" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:id="@+id/ll_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_get_time"
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_14" />
android:gravity="center_vertical"
android:text="2019-22"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_out_city"
android:id="@+id/tv_get_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawableRight="@drawable/rv_common_icon_up_arrow"
android:drawablePadding="@dimen/size_3"
android:gravity="center"
android:hint="@string/rv_city_list"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
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_out_address"
android:layout_width="match_parent"
android:id="@+id/tv_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1"
android:layout_centerHorizontal="true"
android:drawableBottom="@color/colorLine"
android:gravity="center"
android:hint="@string/rv_get_out_hint"
android:text="3天"
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">
<Switch
android:id="@+id/switch_out"
<TextView
android:layout_width="wrap_content"
android:layout_height="@dimen/size_20"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:showText="true"
android:switchTextAppearance="@style/SwitchTheme"
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:textOff="@string/rv_to_shop"
android:textOn="@string/rv_to_door"
android:thumb="@drawable/switch_custom_thumb_selector"
android:track="@drawable/switch_custom_track_selector"
android:visibility="gone" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:id="@+id/ll_item_select_data"
android:layout_width="match_parent"
android:layout_height="@dimen/size_60"
android:gravity="center_vertical"
android:orientation="horizontal">
android:textSize="@dimen/text_10" />
<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:paddingTop="@dimen/size_1"
android:paddingBottom="@dimen/size_1"
android:paddingLeft="@dimen/size_3"
android:paddingRight="@dimen/size_3"
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_get_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="2019-22"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_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">
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_day"
android:id="@+id/tv_out_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:drawableBottom="@color/colorLine"
android:gravity="center"
android:text="3天"
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">
android:gravity="center_vertical"
android:text="2019-22"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_out_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/shape_rv_main_small"
android:paddingTop="@dimen/size_1"
android:paddingBottom="@dimen/size_1"
android:paddingLeft="@dimen/size_3"
android:paddingRight="@dimen/size_3"
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_out_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="2019-22"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_out_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="周五"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
android:text="周五"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_select_car"
android:layout_width="0dp"
android:layout_height="@dimen/size_40"
android:layout_weight="1"
android:background="@drawable/home_button_select_car"
android:gravity="center"
android:text="立即选车"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_select_car"
android:layout_width="0dp"
android:layout_height="@dimen/size_40"
android:layout_weight="1"
android:background="@drawable/home_button_select_car"
android:gravity="center"
android:text="立即选车"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_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" />
<TextView
android:id="@+id/tv_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>
<LinearLayout
android:id="@+id/ll_layout_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_layout_rv_tour"
android:id="@+id/ll_item_rv_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone">
android:layout_height="@dimen/size_60"
android:layout_marginTop="@dimen/size_10"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_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_rv_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请选择目的地城市"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_15" />
<TextView
android:id="@+id/tv_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>
<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" />
<include layout="@layout/common_line" />
<TextView
android:id="@+id/tv_book_now"
android:layout_width="match_parent"
android:layout_height="@dimen/size_40"
android:layout_marginTop="@dimen/size_20"
android:background="@drawable/home_button_select_car"
android:gravity="center"
android:text="立即预订"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_book_now"
android:layout_width="match_parent"
android:layout_height="@dimen/size_40"
android:layout_marginTop="@dimen/size_20"
android:background="@drawable/home_button_select_car"
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="match_parent"
android:layout_width="0dp"
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">
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>
<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_item_rv_hot_label1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:id="@+id/ll_item_rv_hot_label1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/tv_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>
<TextView
android:id="@+id/tv_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_item_rv_hot_label2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:id="@+id/ll_item_rv_hot_label2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/tv_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>
<TextView
android:id="@+id/tv_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_item_rv_hot_label3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:id="@+id/ll_item_rv_hot_label3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/tv_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>
<TextView
android:id="@+id/tv_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>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".rv.module.ui.main.home.CityListActivity">
<android.support.v7.widget.RecyclerView
<EditText
android:id="@+id/edt_search"
android:layout_width="match_parent"
android:id="@+id/recyclerView"
android:layout_height="match_parent"/>
<TextView
android:id="@+id/tv_letter_overlay"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerInParent="true"
android:background="@drawable/shape_rv_button"
android:layout_height="@dimen/size_30"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/size_20"
android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/size_20"
android:layout_marginBottom="5dp"
android:background="@drawable/shape_rv_textview_home_search"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="48sp"
android:textStyle="bold"
android:visibility="gone" />
<com.ruiwenliu.wrapper.weight.SideLetterBar
android:id="@+id/side_letter_bar"
android:layout_width="36dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
android:hint="上海"
android:orientation="horizontal"
android:textSize="@dimen/sp_12" />
<include layout="@layout/common_line" />
<!--<ScrollView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical">-->
<!--</LinearLayout>-->
<!--</ScrollView>-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="@dimen/size_50"-->
<!--android:background="@color/gray_f5f5f5"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="horizontal">-->
<!--<TextView-->
<!--android:id="@+id/tv_current_city"-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_weight="1"-->
<!--android:text="当前定位城市"-->
<!--android:textSize="@dimen/sp_14" />-->
<!--<TextView-->
<!--android:id="@+id/tv_relocation"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginRight="@dimen/size_20"-->
<!--android:drawableLeft="@drawable/icon_location"-->
<!--android:drawablePadding="@dimen/size_5"-->
<!--android:text="重新定位"-->
<!--android:textColor="#fdb51c"-->
<!--android:textSize="@dimen/sp_12" />-->
<!--</LinearLayout>-->
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".rv.module.ui.main.home.SelectShopActivity">
<include layout="@layout/common_refresh"/>
</FrameLayout>
<LinearLayout
android:id="@+id/ll_search"
android:layout_width="match_parent"
android:layout_height="@dimen/size_30"
android:layout_marginLeft="@dimen/size_20"
android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/size_20"
android:background="@drawable/shape_rv_textview_home_search"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/size_20"
android:layout_height="@dimen/size_20"
android:src="@drawable/rv_common_icon_search" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5"
android:text="输入城市名称,查找对应城市的门店"
android:textColor="@color/text_Gray"
android:textSize="@dimen/sp_12" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginTop="5dp"
android:background="@color/gray_f5f5f5">
<TextView
android:id="@+id/tv_current_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/size_20"
android:text="当前定位城市"
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/tv_relocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/size_20"
android:drawableLeft="@drawable/icon_location"
android:drawablePadding="@dimen/size_5"
android:text="重新定位"
android:textColor="#fdb51c"
android:textSize="@dimen/sp_12" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_f5f5f5">
<include layout="@layout/common_refresh" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:background="@color/colorWrite"
android:layout_height="wrap_content">
android:orientation="vertical">
<TextView
android:id="@+id/tv_city"
android:layout_width="match_parent"
android:textSize="@dimen/text_16"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginRight="@dimen/size_10"
android:id="@+id/tv_city"
android:textColor="@color/textGray"
android:background="@color/colorWrite"
android:padding="@dimen/size_10"
/>
android:textColor="@color/textGray"
android:textSize="@dimen/text_16" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/size_half"
android:layout_marginLeft="@dimen/size_20"
android:layout_marginRight="@dimen/size_20"
android:background="@color/colorLine"
android:layout_height="@dimen/size_half"/>
android:background="@color/colorLine" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_head"
android:layout_width="match_parent"
android:textSize="@dimen/text_16"
android:layout_height="wrap_content"
android:id="@+id/tv_head"
android:textColor="@color/textMain"
android:background="@color/colorLine"
android:layout_marginTop="@dimen/size_10"
android:padding="@dimen/size_10"
/>
android:background="@color/colorGray"
android:paddingLeft="@dimen/size_20"
android:paddingTop="@dimen/size_3"
android:paddingBottom="3dp"
android:textColor="@color/text_Gray"
android:textSize="@dimen/text_12" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_marginLeft="@dimen/size_15"
android:id="@+id/tv_hot_city"
android:layout_width="match_parent"
android:layout_marginRight="@dimen/size_15"
android:textSize="@dimen/text_16"
android:layout_height="wrap_content"
android:id="@+id/tv_hot_city"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="5dp"
android:layout_marginRight="@dimen/size_10"
android:layout_marginBottom="5dp"
android:background="@drawable/shape_rv_bg_hot_city"
android:gravity="center"
android:paddingLeft="@dimen/size_10"
android:paddingTop="5dp"
android:paddingRight="@dimen/size_10"
android:paddingBottom="5dp"
android:textColor="@color/textMain"
android:layout_marginTop="@dimen/size_10"
android:background="@drawable/shape_rv_bg_write"
android:padding="@dimen/size_10"
/>
android:textSize="@dimen/text_16" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginRight="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10"
android:background="@color/colorWrite"
android:layout_height="wrap_content">
app:cardCornerRadius="@dimen/size_5">
<LinearLayout
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingRight="@dimen/size_15"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_loction"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_10"
android:layout_width="@dimen/size_45"
android:src="@drawable/my_set_location"
android:layout_height="@dimen/size_45" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/textMain"
android:layout_weight="1"
android:textStyle="bold"
android:id="@+id/tv_name"
android:textSize="@dimen/text_18"
android:text=""
/>
<TextView
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="@dimen/size_15">
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="欣信房车控股集团"
android:textColor="@color/textMain"
android:textSize="@dimen/text_18"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_5"
android:text="地址:东莞市松山湖欣新房车总部"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_12" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:orientation="horizontal">
<TextView
android:textSize="@dimen/text_12"
android:id="@+id/tv_contacts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="联系人" />
<TextView
android:id="@+id/tv_call"
android:layout_width="@dimen/size_70"
android:layout_height="@dimen/size_25"
android:layout_marginLeft="@dimen/size_5"
android:background="@drawable/shape_rv_button_green"
android:gravity="center"
android:text="拨打电话"
android:textColor="#6DB186"
android:textSize="@dimen/sp_12"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_12"
android:text=""
android:id="@+id/tv_km"
/>
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:id="@+id/tv_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/icon_rentingcar_gps"
android:drawablePadding="@dimen/size_10"
android:text="距您58km"
android:textColor="#000000"
android:textSize="@dimen/text_12" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_45"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14"
android:text=""
android:id="@+id/tv_address"
/>
<View
android:background="@color/colorLine"
android:layout_marginTop="@dimen/size_15"
android:layout_width="match_parent"
android:layout_height="@dimen/size_half"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/size_140"
android:background="#ffffff"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/size_10"
android:text="热门城市:"
android:textColor="@color/text_Gray"
android:textSize="@dimen/text_12" />
<GridView
android:listSelector="@android:color/transparent"
android:id="@+id/gdv_hot_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_10"
android:numColumns="4" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWrite"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_flag"
android:layout_width="345px"
android:layout_height="345px"
android:layout_centerInParent="true"
android:src="@drawable/bg_select_shop_empty" />
<TextView
android:id="@+id/tv_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/iv_flag"
android:layout_centerHorizontal="true"
android:text="当前城市暂无门店"
android:textColor="@color/colorGray"
android:textSize="@dimen/sp_14"
android:textStyle="bold" />
</RelativeLayout>
\ No newline at end of file
......@@ -47,17 +47,17 @@
<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>
<string name="rv_immediately_car">立即选车</string>
<string name="rv_hot_car_type">热门车型</string>
<string name="rv_get"></string>
<string name="rv_out"></string>
<string name="rv_get"></string>
<string name="rv_out"></string>
<string name="rv_forget_pwd">忘记密码</string>
<string name="rv_reset_pwd">重置密码</string>
<string name="rv_to_shop">到店</string>
......
package com.rv.tourism;
import android.Manifest;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
......@@ -65,7 +66,7 @@ import io.reactivex.functions.Consumer;
* 旅游
*/
public class TourismFragment extends BaseFragment<TourismPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
public class TourismFragment extends BaseFragment<TourismPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
@BindView(R2.id.travel_city_text)
TextView travelCityText;
......@@ -89,6 +90,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
private ArrayList<String> images = new ArrayList<>(); //图片(默认采用网络地址)
private List<String> titles = new ArrayList<>(); //图片标题
private List<BeanTourismBanner.DataBean> banners = new ArrayList<>();
private final int TYPE_REQUEST_CITY = 106;//城市列表
private PopularBrigadeAdapter mPopularBrigadeAdapter;
......@@ -170,7 +172,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
.withString("name", dataBean.getName())
.withString("content", dataBean.getContent())
.withString("url", dataBean.getCover())
.withDouble("price",Double.valueOf(dataBean.getPrice()))
.withDouble("price", Double.valueOf(dataBean.getPrice()))
.navigation();
}
});
......@@ -314,11 +316,12 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
mPopularBrigadeAdapter.addData(result.getData());
}
private void bannerData(BeanTourismBanner data) {
if (data != null) {
titles.clear();
images.clear();
banners.clear();
banners.addAll(data.getData());
for (int i = 0; i < data.getData().size(); i++) {
images.add(data.getData().get(i).getCover());
titles.add("");
......@@ -346,10 +349,22 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
.setOnBannerListener(new OnBannerListener() {
@Override
public void OnBannerClick(int position) {
Bundle bundle = new Bundle();
bundle.putInt(ActivityImageBrowseUrl.KEY_BACKGROUND, R.color.colorPrimary);
bundle.putStringArrayList(ActivityImageBrowseUrl.KEY_IMAGE, (ArrayList<String>) images);
IntentUtil.startActivity(_mActivity, ActivityImageBrowseUrl.class, bundle);
BeanTourismBanner.DataBean dataBean = banners.get(position);
ComponentName componentName = new ComponentName(getActivity(), "com.rv.share.WebViewActivity");
Intent intent = new Intent();
intent.setComponent(componentName);
intent.putExtra("url", dataBean.getUrl());
intent.putExtra("title", dataBean.getTitle());
startActivity(intent);
// BeanTourismBanner.DataBean dataBean = banners.get(position);
// ARouter.getInstance()
// .build(Constance.ACTIVITY_URL_TRAVELDETAILS)
// .withString("id", dataBean.getId())
// .withString("name", dataBean.getTitle())
// .withString("content", dataBean.getContent())
// .withString("url", dataBean.getCover())
// .withDouble("price", Double.valueOf(dataBean.getPrice()))
// .navigation();
}
})
......
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