Commit 391c1631 authored by jianglx's avatar jianglx

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

parent 23feca33
...@@ -37,9 +37,9 @@ public class UtilsManager { ...@@ -37,9 +37,9 @@ public class UtilsManager {
private Context mContext = null; private Context mContext = null;
public static UtilsManager getInstance(Context context) { public static UtilsManager getInstance(Context context) {
if (instance ==null){ if (instance == null) {
synchronized (UtilsManager.class){ synchronized (UtilsManager.class) {
if (instance ==null){ if (instance == null) {
instance = new UtilsManager(context); instance = new UtilsManager(context);
} }
} }
...@@ -48,9 +48,9 @@ public class UtilsManager { ...@@ -48,9 +48,9 @@ public class UtilsManager {
} }
public static UtilsManager getInstance() { public static UtilsManager getInstance() {
if (instance ==null){ if (instance == null) {
synchronized (UtilsManager.class){ synchronized (UtilsManager.class) {
if (instance ==null){ if (instance == null) {
instance = new UtilsManager(); instance = new UtilsManager();
} }
} }
...@@ -198,7 +198,7 @@ public class UtilsManager { ...@@ -198,7 +198,7 @@ public class UtilsManager {
/** /**
* 读取本地文件的方法 * 读取本地文件的方法
* * 恐有内存泄漏
* @param context * @param context
* @param fileName * @param fileName
* @return * @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 @@ ...@@ -3,7 +3,8 @@
package="com.rv.home"> package="com.rv.home">
<application> <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> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -92,4 +92,6 @@ public class ApiConfig { ...@@ -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_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_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> { ...@@ -206,6 +206,7 @@ public class LoginRvActivity extends BaseLoginActivity<CommonPresenter> {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("username", getPhone()); map.put("username", getPhone());
map.put("type", 4); map.put("type", 4);
map.put("code", Cooker.getStringValue(getApplicationContext(), "code"));
mPresenter.postData(0, ApiConfig.HTTP_URL_SEND_CODE, SendCodeBean.class, map, true); mPresenter.postData(0, ApiConfig.HTTP_URL_SEND_CODE, SendCodeBean.class, map, true);
} }
...@@ -216,6 +217,7 @@ public class LoginRvActivity extends BaseLoginActivity<CommonPresenter> { ...@@ -216,6 +217,7 @@ public class LoginRvActivity extends BaseLoginActivity<CommonPresenter> {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("openid", openid); map.put("openid", openid);
map.put("isQQ", isQQ); map.put("isQQ", isQQ);
map.put("code", Cooker.getStringValue(getApplicationContext(), "code"));
mPresenter.postData(1, ApiConfig.HTTP_URL_OTHER_LOGIN, RegisteredBean.class, map, true); mPresenter.postData(1, ApiConfig.HTTP_URL_OTHER_LOGIN, RegisteredBean.class, map, true);
} }
......
...@@ -7,9 +7,11 @@ import android.os.Bundle; ...@@ -7,9 +7,11 @@ import android.os.Bundle;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View; 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.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
...@@ -17,17 +19,19 @@ import com.chad.library.adapter.base.BaseQuickAdapter; ...@@ -17,17 +19,19 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.url.Constance; import com.frame.base.url.Constance;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean; 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.R;
import com.rv.home.R2; import com.rv.home.R2;
import com.rv.home.rv.module.basic.BaseStatusActivity; 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.bean.MultiItemBean;
import com.rv.home.rv.module.basic.presenter.CommonPresenter; 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.adapter.CityListAdapter;
import com.rv.home.rv.module.ui.main.home.bean.CityHeadBean; 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.CityPickerBean;
import com.rv.home.rv.module.ui.main.home.bean.HotCityBean; 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 com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import java.io.BufferedReader; import java.io.BufferedReader;
...@@ -48,11 +52,8 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -48,11 +52,8 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
@BindView(R2.id.recyclerView) @BindView(R2.id.recyclerView)
RecyclerView recyclerView; RecyclerView recyclerView;
@BindView(R2.id.tv_letter_overlay) @BindView(R2.id.edt_search)
TextView tvLetterOverlay; EditText edtSearch;
@BindView(R2.id.side_letter_bar)
SideLetterBar sideLetterBar;
@Autowired @Autowired
int mCityType; int mCityType;
@Autowired @Autowired
...@@ -61,6 +62,7 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -61,6 +62,7 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
int mCityId; int mCityId;
// private Map<String,String> mapSave; // private Map<String,String> mapSave;
private Disposable mDisposable = null; private Disposable mDisposable = null;
private CityListAdapter cityListAdapter;
// public static Intent getIntent(Context context, int type, String city, int id) { // 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); // 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> { ...@@ -81,35 +83,18 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
// mCityType = intent.getIntExtra("type", 1); // mCityType = intent.getIntExtra("type", 1);
// mNowCity = intent.getStringExtra("location"); // mNowCity = intent.getStringExtra("location");
// mCityId = intent.getIntExtra("id", 1); // mCityId = intent.getIntExtra("id", 1);
final List<MultiItemBean> list = getListData(mNowCity); // hotCityAdapter = new HotCityAdapter(this, getHotCitys());
List<MultiItemBean> lists = new ArrayList<>(); // gridView.setAdapter(hotCityAdapter);
final CityListAdapter cityListAdapter = new CityListAdapter(lists); cityListAdapter = new CityListAdapter(new ArrayList<MultiItemBean>(), listener);
recyclerView.setLayoutManager(new GridLayoutManager(this, 6)); recyclerView.setLayoutManager(new GridLayoutManager(this, 6));
recyclerView.setAdapter(cityListAdapter); recyclerView.setAdapter(cityListAdapter);
recyclerView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorLine));
/**
* 设置每个Item的横排显示数量
* 注意:======对应GridLayoutManager设置
*/
cityListAdapter.setSpanSizeLookup(new BaseQuickAdapter.SpanSizeLookup() { cityListAdapter.setSpanSizeLookup(new BaseQuickAdapter.SpanSizeLookup() {
@Override @Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int position) { public int getSpanSize(GridLayoutManager gridLayoutManager, int position) {
return list.get(position).getSpanSize(); return cityListAdapter.getData().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);
} }
}); });
recyclerView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorLine));
cityListAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { cityListAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override @Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) { public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
...@@ -128,11 +113,17 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -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 @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
} }
@Override @Override
...@@ -140,50 +131,39 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -140,50 +131,39 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
} }
private List<MultiItemBean> getListData(String now_city) { private List<HotCityBean> getHotCitys() {
List<MultiItemBean> list = new ArrayList<>(); List<HotCityBean> lists = new ArrayList<>();
if (!TextUtils.isEmpty(now_city)) { lists.add(new HotCityBean("北京", 110100));
list.add(new HotCityBean(now_city, mCityId)); lists.add(new HotCityBean("上海", 310100));
list.add(new CityHeadBean("当前城市/已访问城市")); 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;
} }
list.add(new CityHeadBean("热门城市"));
list.add(new HotCityBean("北京市", 110100)); private List<MultiItemBean> getListData(String searchCity) {
list.add(new HotCityBean("上海市", 310100)); List<MultiItemBean> list = new ArrayList<>();
list.add(new HotCityBean("东莞市", 441900)); list.add(new HotCityListBean(getHotCitys()));
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));
String json = getJson(this, "city.json"); String json = getJson(this, "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class); CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) { for (CityPickerBean.CityBean cityBean : bean.getCity()) {
if (TextUtils.isEmpty(searchCity)) {
list.add(new CityHeadBean(cityBean.getTitle())); list.add(new CityHeadBean(cityBean.getTitle()));
}
for (ListsBean lsBean : cityBean.getLists()) { for (ListsBean lsBean : cityBean.getLists()) {
if (!TextUtils.isEmpty(searchCity)) {
if (lsBean.getName().contains(searchCity)) {
list.add(lsBean); 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 ""; return list;
} }
/** /**
...@@ -193,7 +173,7 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -193,7 +173,7 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
* @param fileName * @param fileName
* @return * @return
*/ */
public String getJson(Context context, String fileName) { private String getJson(Context context, String fileName) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
try { try {
AssetManager assetManager = context.getAssets(); AssetManager assetManager = context.getAssets();
...@@ -257,6 +237,31 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -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; ...@@ -13,6 +13,7 @@ import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -68,11 +69,13 @@ import com.rv.home.rv.module.ui.main.home.bean.HomeHotGoodListBean; ...@@ -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.HomePopularBrigade;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean; 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.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.bean.ShopListBean;
import com.yuyife.banner.Banner; import com.yuyife.banner.Banner;
import com.yuyife.banner.BannerConfig; import com.yuyife.banner.BannerConfig;
import com.yuyife.banner.listener.OnBannerListener; import com.yuyife.banner.listener.OnBannerListener;
import com.yuyife.banner.loader.ImageLoader; import com.yuyife.banner.loader.ImageLoader;
import com.yuyife.okgo.OkGoUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -105,14 +108,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -105,14 +108,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
TextView headTvGetCity; TextView headTvGetCity;
@BindView(R2.id.tv_get_address) @BindView(R2.id.tv_get_address)
TextView headTvGetShop; TextView headTvGetShop;
@BindView(R2.id.switch_get)
Switch switchGet;
@BindView(R2.id.tv_out_city) @BindView(R2.id.tv_out_city)
TextView headTvOutCity; TextView headTvOutCity;
@BindView(R2.id.tv_out_address) @BindView(R2.id.tv_out_address)
TextView headTvOutShop; TextView headTvOutShop;
@BindView(R2.id.switch_out)
Switch switchOut;
@BindView(R2.id.tv_get_time) @BindView(R2.id.tv_get_time)
TextView tvGetTime; TextView tvGetTime;
@BindView(R2.id.tv_get_week) @BindView(R2.id.tv_get_week)
...@@ -195,6 +194,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -195,6 +194,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
private final int TYPE_REQUEST_CITY = 1;//城市列表 private final int TYPE_REQUEST_CITY = 1;//城市列表
private final int TYPE_REQUEST_SHOP = 2;//门店列表 private final int TYPE_REQUEST_SHOP = 2;//门店列表
private final int TYPE_REQUEST_ADDRESS = 3;//地址选择 private final int TYPE_REQUEST_ADDRESS = 3;//地址选择
private final int REQUEST_GET_CODE = 10001; // 取车地址选择请求码
private final int REQUEST_RETURN_CODE = 10002; // 换车地址选择请求码
Unbinder unbinder2; Unbinder unbinder2;
Unbinder unbinder3; Unbinder unbinder3;
...@@ -210,6 +213,8 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -210,6 +213,8 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
private double outLongitude; private double outLongitude;
private int getCityId;//取车城市ID private int getCityId;//取车城市ID
private int outCityId;//还车城市ID private int outCityId;//还车城市ID
private String getCityName;
private String outCityName;
private int vVTourCityId;// 房车游城市ID private int vVTourCityId;// 房车游城市ID
private int mTravelCityId;// 头城市ID private int mTravelCityId;// 头城市ID
private OrderDataBean dataBean; private OrderDataBean dataBean;
...@@ -231,7 +236,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -231,7 +236,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
private HotCarTypeAdapter mAdapter; private HotCarTypeAdapter mAdapter;
private SelectedEventsAdapter mActivityAdapter; private SelectedEventsAdapter mActivityAdapter;
// private RVEnthusiastAdapter mRvEnthusiast; // private RVEnthusiastAdapter mRvEnthusiast;
private RVTourListAdapter mRvTourAdapter; private RVTourListAdapter mRvTourAdapter;
private RVTourListLabelAdapter mRvTourLabelAdapter; private RVTourListLabelAdapter mRvTourLabelAdapter;
...@@ -297,6 +302,20 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -297,6 +302,20 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
recyclerViewActivity.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。 recyclerViewActivity.addItemDecoration(new AbSpacesItemDecoration(10));// 分割线。
recyclerViewActivity.setNestedScrollingEnabled(false); recyclerViewActivity.setNestedScrollingEnabled(false);
recyclerViewActivity.setAdapter(mActivityAdapter); 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(); // mRvEnthusiast = new RVEnthusiastAdapter();
...@@ -320,7 +339,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -320,7 +339,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
recyclerViewRvtourlistTitle.setNestedScrollingEnabled(false); recyclerViewRvtourlistTitle.setNestedScrollingEnabled(false);
recyclerViewRvtourlistTitle.setAdapter(mRvTourLabelAdapter); recyclerViewRvtourlistTitle.setAdapter(mRvTourLabelAdapter);
getData(); getSelectedActivities();
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override @Override
...@@ -433,12 +452,13 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -433,12 +452,13 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
} }
} }
private void getData() { private void getSelectedActivities() {
List<Integer> list = new ArrayList<>();
list.add(R.drawable.aaa1); Map<String, Object> header = new HashMap<>();
list.add(R.drawable.aaa2); if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
mActivityAdapter.setNewData(list); header.put("Authorization", OkGoUtil.getToken());
// mRvEnthusiast.setNewData(list); }
mPresenter.getDataHead(RvFrameConfig.HOST, 4, ApiConfig.HTTP_URL_SELECTED_ACTIVITIES, SelectedActivitiesBean.class, header, false);
} }
@Override @Override
...@@ -494,6 +514,13 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -494,6 +514,13 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
break; break;
case 3: case 3:
bannerData((BeanHomeBanner) result); 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; break;
} }
...@@ -522,7 +549,7 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -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.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_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_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) { public void onViewClicked(View view) {
int id = view.getId(); int id = view.getId();
if (id == R.id.travel_city_layout) { if (id == R.id.travel_city_layout) {
...@@ -554,37 +581,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -554,37 +581,10 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
tvItemRentingACar.setSelected(true); tvItemRentingACar.setSelected(true);
llLayoutRentingACar.setVisibility(View.GONE); llLayoutRentingACar.setVisibility(View.GONE);
llLayoutRvTour.setVisibility(View.VISIBLE); llLayoutRvTour.setVisibility(View.VISIBLE);
} else if (id == R.id.tv_get_city) { } 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);
ARouter.getInstance() } else if (id == R.id.tv_out_city || id == R.id.ll_return || id == R.id.tv_out_address) {
.build(Constance.ACTIVITY_URL_CITYLIST) startActivityForResult(SelectShopActivity.getIntent(getActivity(), 2, "", TextUtils.isEmpty(outCityName) ? nowCity : outCityName, latLatitude, lonLongitude), TYPE_REQUEST_CITY);
.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.ll_item_select_data) { } else if (id == R.id.ll_item_select_data) {
//选择日期 //选择日期
ARouter.getInstance() ARouter.getInstance()
...@@ -769,23 +769,33 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser ...@@ -769,23 +769,33 @@ public class HomeFragment extends BaseFragment<CommonPresenter> implements Obser
switch (requestCode) { switch (requestCode) {
case TYPE_REQUEST_CITY://城市列表 case TYPE_REQUEST_CITY://城市列表
if (type == 1) { if (type == 1) {
headTvGetShop.setText(""); String companyName = data.getStringExtra("company");
getCityName = requestData;
headTvGetShop.setText(companyName);
getCityId = data.getIntExtra("id", 0); 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) { } else if (type == 2) {
headTvOutShop.setText(""); outCityName = requestData;
String companyName = data.getStringExtra("company");
headTvOutShop.setText(companyName);
outCityId = data.getIntExtra("id", 0); 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) { } else if (type == 3) {
tvRvCity.setText(""); tvRvCity.setText("");
vVTourCityId = data.getIntExtra("id", 0); vVTourCityId = data.getIntExtra("id", 0);
setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0);
} else if (type == 4) { } else if (type == 4) {
travelCityText.setText(""); travelCityText.setText("");
mTravelCityId = data.getIntExtra("id", 0); mTravelCityId = data.getIntExtra("id", 0);
getCityId = mTravelCityId; getCityId = mTravelCityId;
outCityId = mTravelCityId; outCityId = mTravelCityId;
vVTourCityId = mTravelCityId; vVTourCityId = mTravelCityId;
}
setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0); setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0);
}
break; break;
case TYPE_REQUEST_SHOP://门店 case TYPE_REQUEST_SHOP://门店
setRequestData(type, requestData, headTvGetShop, headTvOutShop, 0, 0); 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; ...@@ -3,13 +3,29 @@ package com.rv.home.rv.module.ui.main.home;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View; 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.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean; 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.R;
import com.rv.home.R2; import com.rv.home.R2;
import com.rv.home.rv.module.basic.BaseStatusActivity; import com.rv.home.rv.module.basic.BaseStatusActivity;
...@@ -19,6 +35,8 @@ import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView; ...@@ -19,6 +35,8 @@ import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.home.rv.module.ApiConfig; import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.basic.presenter.CommonPresenter; 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.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 com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -33,23 +51,33 @@ import butterknife.BindView; ...@@ -33,23 +51,33 @@ import butterknife.BindView;
*/ */
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) @BindView(R2.id.recyclerView)
RecyclerView recyclerView; RecyclerView recyclerView;
@BindView(R2.id.refresh) @BindView(R2.id.refresh)
SimpleRefreshLayout mSimpleRefreshLayout; SimpleRefreshLayout mSimpleRefreshLayout;
@BindView(R2.id.ll_search)
LinearLayout llSearch;
@BindView(R2.id.tv_current_city)
TextView tvCurrentCity;
private SelectShopAdapter mAdapter; private SelectShopAdapter mAdapter;
private int shopType; private int shopType;
private String mCityId; private int mCityId;
private double mLat; private double mLat;
private double mLon; private double mLon;
private int mPage; private int mPage;
private int countPage; 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) return new Intent(context, SelectShopActivity.class)
.putExtra("type", type) .putExtra("type", type)
.putExtra("city_id", id) .putExtra("city_id", id)
.putExtra("city_name", cityName)
.putExtra("lat", lat) .putExtra("lat", lat)
.putExtra("lon", lon); .putExtra("lon", lon);
} }
...@@ -62,11 +90,16 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -62,11 +90,16 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
@Override @Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(mActivity.getString(R.string.rv_select_shop)); titleView.setTitle(mActivity.getString(R.string.rv_select_shop));
mCityId = intent.getStringExtra("city_id"); mLat = intent.getDoubleExtra("lat", 0d);
mLat = intent.getIntExtra("lat", 0); mLon = intent.getDoubleExtra("lon", 0d);
mLon = intent.getIntExtra("lon", 0); cityName = intent.getStringExtra("city_name");
if (!TextUtils.isEmpty(cityName)) {
tvCurrentCity.setText("当前选择城市: " + cityName);
}
getCityId();
mAdapter = new SelectShopAdapter(); mAdapter = new SelectShopAdapter();
mAdapter.setOnLoadMoreListener(this, recyclerView); mAdapter.setOnLoadMoreListener(this, recyclerView);
mAdapter.setPosition(mLat, mLon);
mSimpleRefreshLayout.setHeaderView(new SimpleRefreshView(this)); mSimpleRefreshLayout.setHeaderView(new SimpleRefreshView(this));
mSimpleRefreshLayout.setOnSimpleRefreshListener(this); mSimpleRefreshLayout.setOnSimpleRefreshListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity)); recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
...@@ -76,14 +109,57 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -76,14 +109,57 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override @Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) { public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
getIntent().putExtra("location", mAdapter.getItem(position).getName()); Intent intent = new Intent();
getIntent().putExtra("type", shopType); intent.putExtra("location", cityName);
setResult(RESULT_OK, getIntent()); 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(); 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 @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
onRefresh(); onRefresh();
...@@ -91,8 +167,46 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -91,8 +167,46 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
@Override @Override
public void onShowResult(int requestType, BaseBean result) { 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); 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();
}
}
}
/**
* 获取通用空布局
*
* @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 @Override
...@@ -104,20 +218,14 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -104,20 +218,14 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
@Override @Override
public void onLoadMoreRequested() { public void onLoadMoreRequested() {
if(mPage>countPage){ if (mPage > countPage) {
mAdapter.loadMoreEnd(); mAdapter.loadMoreEnd();
} else {
}else {
mPage++; mPage++;
getShopList(mPage); getShopList(mPage);
} }
} }
/** /**
* 获取门店列表 * 获取门店列表
*/ */
...@@ -125,26 +233,63 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -125,26 +233,63 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("page", page); map.put("page", page);
map.put("limit", 10); map.put("limit", 10);
map.put("addrCity", "441900"); if (mCityId == 0) {
if(mLat>0){ map.put("addrCity", 441900);
} else {
map.put("addrCity", mCityId);
}
if (mLat > 0) {
map.put("lat", mLat); map.put("lat", mLat);
map.put("lon", mLon); 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){ * 获取城市id
if(mPage==1){ */
countPage=bean.getData().getTotalPage(); private void getCityId() {
mAdapter.setNewData(bean.getData().getData()); if (TextUtils.isEmpty(cityName)) return;
mSimpleRefreshLayout.onRefreshComplete(); String json = UtilsManager.getInstance().getJson(this, "city.json");
}else { CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
mAdapter.addData(bean.getData().getData()); for (CityPickerBean.CityBean cityBean : bean.getCity()) {
mAdapter.loadMoreComplete(); 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; package com.rv.home.rv.module.ui.main.home.adapter;
import android.text.TextUtils; 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.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.rv.home.R; 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.basic.bean.MultiItemBean;
import com.rv.home.rv.module.ui.main.home.bean.CityHeadBean; 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.HotCityBean;
import com.rv.home.rv.module.ui.main.home.bean.HotCityListBean;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean; import com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import java.util.List; import java.util.List;
...@@ -24,11 +27,14 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -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_HOT = 2;
public static final int TYPE_INDEX_CITY = 3; 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); super(data);
this.mListener = listener;
addItemType(TYPE_INDEX_HEAD, R.layout.rv_item_head); 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); addItemType(TYPE_INDEX_CITY, R.layout.rv_item_city);
} }
...@@ -40,8 +46,18 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -40,8 +46,18 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
helper.setText(R.id.tv_head, cityHeadBean.headName); helper.setText(R.id.tv_head, cityHeadBean.headName);
break; break;
case TYPE_INDEX_HOT: case TYPE_INDEX_HOT:
HotCityBean hotCityBean = (HotCityBean) item; HotCityListBean hotCityListBean = (HotCityListBean) item;
helper.setText(R.id.tv_hot_city, hotCityBean.hotCityName); 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; break;
case TYPE_INDEX_CITY: case TYPE_INDEX_CITY:
ListsBean cityBean = (ListsBean) item; ListsBean cityBean = (ListsBean) item;
...@@ -50,18 +66,18 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -50,18 +66,18 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
} }
} }
public int getSelectIndex(String an){ public int getSelectIndex(String an) {
if(an.equals("定位")||an.equals("热门")){ if (an.equals("定位") || an.equals("热门")) {
return 0; return 0;
} }
if(TextUtils.isEmpty(an)){ if (TextUtils.isEmpty(an)) {
return -1; return -1;
} }
for(MultiItemBean bean:getData()){ for (MultiItemBean bean : getData()) {
if(bean.getItemType()==TYPE_INDEX_HEAD){ if (bean.getItemType() == TYPE_INDEX_HEAD) {
CityHeadBean headBean= (CityHeadBean) bean; CityHeadBean headBean = (CityHeadBean) bean;
if(headBean.headName.equals(an)){ if (headBean.headName.equals(an)) {
return getData().indexOf(bean); return getData().indexOf(bean);
} }
} }
...@@ -69,4 +85,8 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -69,4 +85,8 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
return -1; 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; 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.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.rv.component.utils.LocationUtils;
import com.rv.home.R; import com.rv.home.R;
import com.rv.home.R2; import com.rv.home.R2;
import com.rv.home.rv.module.ui.main.home.bean.ShopListBean; 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; ...@@ -12,20 +18,41 @@ import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
* Desc:选择门店适配器 * 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() { public SelectShopAdapter() {
super(R.layout.rv_item_select_shop); super(R.layout.rv_item_select_shop);
} }
public void setPosition(Double lat, Double lon) {
this.latitude = lat;
this.longitude = lon;
}
@Override @Override
protected void convert(BaseViewHolder helper, ShopListBean.DataBeanX.DataBean item) { protected void convert(BaseViewHolder helper, final ShopListBean.DataBeanX.DataBean item) {
helper.setText(R.id.tv_name,item.getName()); 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" helper.setText(R.id.tv_position, "地址:" + item.getAddrDetail());
,mContext.getString(R.string.rv_distance_you) helper.setText(R.id.tv_contacts, "联系人: " + item.getLeader() + " " + item.getLeaderContactInfo());
,item.getDistance()
,mContext.getString(R.string.rv_km)):""); helper.setOnClickListener(R.id.tv_call, new View.OnClickListener() {
helper.setText(R.id.tv_address,String.format("%1$s%2$s",mContext.getString(R.string.rv_shop_location),item.getAddrDetail())); @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; package com.rv.home.rv.module.ui.main.home.adapter;
import android.text.TextUtils;
import android.widget.ImageView; import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ruiwenliu.wrapper.util.BaseGlideHolder; import com.ruiwenliu.wrapper.util.BaseGlideHolder;
import com.ruiwenliu.wrapper.util.glide.GlideManager; import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.rv.home.R; 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() { public SelectedEventsAdapter() {
super(R.layout.rv_item_selected_events); super(R.layout.rv_item_selected_events);
} }
@Override @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); // GlideManager.getInstance(mContext).loadRoundImage(string, (ImageView)helper.getView(R.id.iv_activity),6);
// helper.setImageDrawable(R.id.iv_activity,mContext.getResources().getDrawable(integer)); // 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; ...@@ -9,7 +9,7 @@ import com.rv.home.rv.module.ui.main.home.adapter.CityListAdapter;
* Desc:热门城市 * Desc:热门城市
*/ */
public class HotCityBean implements MultiItemBean { public class HotCityBean {
public String hotCityName; public String hotCityName;
public int hotCityId; public int hotCityId;
...@@ -18,16 +18,4 @@ public class HotCityBean implements MultiItemBean { ...@@ -18,16 +18,4 @@ public class HotCityBean implements MultiItemBean {
this.hotCityName = hotCityName; this.hotCityName = hotCityName;
this.hotCityId = hotCityId; 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 @@ ...@@ -6,8 +6,7 @@
android:background="@color/colorLine" android:background="@color/colorLine"
android:orientation="vertical"> android:orientation="vertical">
<com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout <com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/refresh" android:id="@+id/refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
...@@ -45,8 +44,8 @@ ...@@ -45,8 +44,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15" android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_marginTop="@dimen/size_15" android:layout_marginTop="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_marginBottom="@dimen/size_25" android:layout_marginBottom="@dimen/size_25"
app:cardBackgroundColor="@color/colorWrite" app:cardBackgroundColor="@color/colorWrite"
app:cardCornerRadius="10dp" app:cardCornerRadius="10dp"
...@@ -101,6 +100,7 @@ ...@@ -101,6 +100,7 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/ll_rent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
...@@ -145,23 +145,12 @@ ...@@ -145,23 +145,12 @@
android:hint="@string/rv_get_car_hint" android:hint="@string/rv_get_car_hint"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
<Switch
android:id="@+id/switch_get"
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" />
</LinearLayout> </LinearLayout>
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
<LinearLayout <LinearLayout
android:id="@+id/ll_return"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15" android:layout_marginTop="@dimen/size_15"
...@@ -206,20 +195,6 @@ ...@@ -206,20 +195,6 @@
android:hint="@string/rv_get_out_hint" android:hint="@string/rv_get_out_hint"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
<Switch
android:id="@+id/switch_out"
android:layout_width="wrap_content"
android:layout_height="@dimen/size_20"
android:layout_gravity="center_vertical"
android:showText="true"
android:switchTextAppearance="@style/SwitchTheme"
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> </LinearLayout>
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
...@@ -244,10 +219,10 @@ ...@@ -244,10 +219,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@drawable/shape_rv_bg_yellow_small" android:background="@drawable/shape_rv_bg_yellow_small"
android:paddingTop="@dimen/size_1"
android:paddingBottom="@dimen/size_1"
android:paddingLeft="@dimen/size_3" android:paddingLeft="@dimen/size_3"
android:paddingTop="@dimen/size_1"
android:paddingRight="@dimen/size_3" android:paddingRight="@dimen/size_3"
android:paddingBottom="@dimen/size_1"
android:text="@string/rv_get" android:text="@string/rv_get"
android:textColor="@color/colorWrite" android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" /> android:textSize="@dimen/text_10" />
...@@ -306,10 +281,10 @@ ...@@ -306,10 +281,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@drawable/shape_rv_main_small" android:background="@drawable/shape_rv_main_small"
android:paddingTop="@dimen/size_1"
android:paddingBottom="@dimen/size_1"
android:paddingLeft="@dimen/size_3" android:paddingLeft="@dimen/size_3"
android:paddingTop="@dimen/size_1"
android:paddingRight="@dimen/size_3" android:paddingRight="@dimen/size_3"
android:paddingBottom="@dimen/size_1"
android:text="@string/rv_out" android:text="@string/rv_out"
android:textColor="@color/colorWrite" android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" /> android:textSize="@dimen/text_10" />
......
<?xml version="1.0" encoding="utf-8"?> <?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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".rv.module.ui.main.home.CityListActivity"> 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:layout_width="match_parent"
android:id="@+id/recyclerView" android:layout_height="@dimen/size_30"
android:layout_height="match_parent"/> android:layout_gravity="center"
android:layout_marginLeft="@dimen/size_20"
<TextView android:layout_marginTop="@dimen/size_10"
android:id="@+id/tv_letter_overlay" android:layout_marginRight="@dimen/size_20"
android:layout_width="120dp" android:layout_marginBottom="5dp"
android:layout_height="120dp" android:background="@drawable/shape_rv_textview_home_search"
android:layout_centerInParent="true"
android:background="@drawable/shape_rv_button"
android:gravity="center" android:gravity="center"
android:textColor="@android:color/white" android:hint="上海"
android:textSize="48sp" android:orientation="horizontal"
android:textStyle="bold" android:textSize="@dimen/sp_12" />
android:visibility="gone" />
<include layout="@layout/common_line" />
<com.ruiwenliu.wrapper.weight.SideLetterBar
android:id="@+id/side_letter_bar" <!--<ScrollView-->
android:layout_width="36dp" <!--android:layout_width="match_parent"-->
android:layout_height="match_parent" <!--android:layout_height="wrap_content">-->
android:layout_alignParentRight="true"
tools:ignore="RtlHardcoded" /> <!--<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" />
</RelativeLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <?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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".rv.module.ui.main.home.SelectShopActivity"> 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"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:layout_height="wrap_content"
android:background="@color/colorWrite" android:background="@color/colorWrite"
android:layout_height="wrap_content"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/tv_city"
android:layout_width="match_parent" android:layout_width="match_parent"
android:textSize="@dimen/text_16"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10" android:layout_marginLeft="@dimen/size_10"
android:layout_marginRight="@dimen/size_10" android:layout_marginRight="@dimen/size_10"
android:id="@+id/tv_city"
android:textColor="@color/textGray"
android:background="@color/colorWrite" android:background="@color/colorWrite"
android:padding="@dimen/size_10" android:padding="@dimen/size_10"
/> android:textColor="@color/textGray"
android:textSize="@dimen/text_16" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_half"
android:layout_marginLeft="@dimen/size_20" android:layout_marginLeft="@dimen/size_20"
android:layout_marginRight="@dimen/size_20" android:layout_marginRight="@dimen/size_20"
android:background="@color/colorLine" android:background="@color/colorLine" />
android:layout_height="@dimen/size_half"/>
</LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:layout_height="wrap_content"
android:layout_height="wrap_content"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/tv_head"
android:layout_width="match_parent" android:layout_width="match_parent"
android:textSize="@dimen/text_16"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/tv_head" android:background="@color/colorGray"
android:textColor="@color/textMain" android:paddingLeft="@dimen/size_20"
android:background="@color/colorLine" android:paddingTop="@dimen/size_3"
android:layout_marginTop="@dimen/size_10" android:paddingBottom="3dp"
android:padding="@dimen/size_10" android:textColor="@color/text_Gray"
/> android:textSize="@dimen/text_12" />
</LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_marginLeft="@dimen/size_15" android:id="@+id/tv_hot_city"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginRight="@dimen/size_15"
android:textSize="@dimen/text_16"
android:layout_height="wrap_content" 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:gravity="center"
android:paddingLeft="@dimen/size_10"
android:paddingTop="5dp"
android:paddingRight="@dimen/size_10"
android:paddingBottom="5dp"
android:textColor="@color/textMain" android:textColor="@color/textMain"
android:layout_marginTop="@dimen/size_10" android:textSize="@dimen/text_16" />
android:background="@drawable/shape_rv_bg_write"
android:padding="@dimen/size_10"
/>
</LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <?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: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:background="@color/colorWrite"
android:layout_height="wrap_content"> app:cardCornerRadius="@dimen/size_5">
<LinearLayout <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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/textMain" 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:layout_weight="1" android:layout_weight="1"
android:textStyle="bold" android:gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="@dimen/size_15">
<TextView
android:id="@+id/tv_name" 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:textSize="@dimen/text_18"
android:text="" android:textStyle="bold" />
/>
<TextView <TextView
android:id="@+id/tv_position"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_5"
android:text="地址:东莞市松山湖欣新房车总部"
android:textColor="@color/textLightGrey" 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:textSize="@dimen/text_12"
android:text="" android:id="@+id/tv_contacts"
android:id="@+id/tv_km" 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>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center">
<TextView <TextView
android:id="@+id/tv_distance"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_45" android:drawableTop="@drawable/icon_rentingcar_gps"
android:textColor="@color/textLightGrey" android:drawablePadding="@dimen/size_10"
android:textSize="@dimen/text_14" android:text="距您58km"
android:text="" android:textColor="#000000"
android:id="@+id/tv_address" android:textSize="@dimen/text_12" />
/>
<View </LinearLayout>
android:background="@color/colorLine"
android:layout_marginTop="@dimen/size_15" </LinearLayout>
android:layout_width="match_parent" </android.support.v7.widget.CardView>
android:layout_height="@dimen/size_half"/>
</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="@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 @@ ...@@ -47,17 +47,17 @@
<string name="rv_ok">确定</string> <string name="rv_ok">确定</string>
<string name="rv_rental_car">租房车</string> <string name="rv_rental_car">租房车</string>
<string name="rv_rental_car_content">开启生活新旅程</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_address_">取车地址:</string>
<string name="rv_get_car_hint">请输入取车地址</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_address_">还车地址:</string>
<string name="rv_get_out_hint">请输入还车地址</string> <string name="rv_get_out_hint">请输入还车地址</string>
<string name="rv_full_time_driver">欣新专职司机(600/天)</string> <string name="rv_full_time_driver">欣新专职司机(600/天)</string>
<string name="rv_immediately_car">立即选车</string> <string name="rv_immediately_car">立即选车</string>
<string name="rv_hot_car_type">热门车型</string> <string name="rv_hot_car_type">热门车型</string>
<string name="rv_get"></string> <string name="rv_get"></string>
<string name="rv_out"></string> <string name="rv_out"></string>
<string name="rv_forget_pwd">忘记密码</string> <string name="rv_forget_pwd">忘记密码</string>
<string name="rv_reset_pwd">重置密码</string> <string name="rv_reset_pwd">重置密码</string>
<string name="rv_to_shop">到店</string> <string name="rv_to_shop">到店</string>
......
package com.rv.tourism; package com.rv.tourism;
import android.Manifest; import android.Manifest;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Rect; import android.graphics.Rect;
...@@ -89,6 +90,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B ...@@ -89,6 +90,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
private ArrayList<String> images = new ArrayList<>(); //图片(默认采用网络地址) private ArrayList<String> images = new ArrayList<>(); //图片(默认采用网络地址)
private List<String> titles = new ArrayList<>(); //图片标题 private List<String> titles = new ArrayList<>(); //图片标题
private List<BeanTourismBanner.DataBean> banners = new ArrayList<>();
private final int TYPE_REQUEST_CITY = 106;//城市列表 private final int TYPE_REQUEST_CITY = 106;//城市列表
private PopularBrigadeAdapter mPopularBrigadeAdapter; private PopularBrigadeAdapter mPopularBrigadeAdapter;
...@@ -170,7 +172,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B ...@@ -170,7 +172,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
.withString("name", dataBean.getName()) .withString("name", dataBean.getName())
.withString("content", dataBean.getContent()) .withString("content", dataBean.getContent())
.withString("url", dataBean.getCover()) .withString("url", dataBean.getCover())
.withDouble("price",Double.valueOf(dataBean.getPrice())) .withDouble("price", Double.valueOf(dataBean.getPrice()))
.navigation(); .navigation();
} }
}); });
...@@ -314,11 +316,12 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B ...@@ -314,11 +316,12 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
mPopularBrigadeAdapter.addData(result.getData()); mPopularBrigadeAdapter.addData(result.getData());
} }
private void bannerData(BeanTourismBanner data) { private void bannerData(BeanTourismBanner data) {
if (data != null) { if (data != null) {
titles.clear(); titles.clear();
images.clear(); images.clear();
banners.clear();
banners.addAll(data.getData());
for (int i = 0; i < data.getData().size(); i++) { for (int i = 0; i < data.getData().size(); i++) {
images.add(data.getData().get(i).getCover()); images.add(data.getData().get(i).getCover());
titles.add(""); titles.add("");
...@@ -346,10 +349,22 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B ...@@ -346,10 +349,22 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
.setOnBannerListener(new OnBannerListener() { .setOnBannerListener(new OnBannerListener() {
@Override @Override
public void OnBannerClick(int position) { public void OnBannerClick(int position) {
Bundle bundle = new Bundle(); BeanTourismBanner.DataBean dataBean = banners.get(position);
bundle.putInt(ActivityImageBrowseUrl.KEY_BACKGROUND, R.color.colorPrimary); ComponentName componentName = new ComponentName(getActivity(), "com.rv.share.WebViewActivity");
bundle.putStringArrayList(ActivityImageBrowseUrl.KEY_IMAGE, (ArrayList<String>) images); Intent intent = new Intent();
IntentUtil.startActivity(_mActivity, ActivityImageBrowseUrl.class, bundle); 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