Commit 23614c30 authored by linfeng's avatar linfeng

bug修复

parents 26abe468 436c2c63
...@@ -188,15 +188,6 @@ ...@@ -188,15 +188,6 @@
<activity <activity
android:name="com.rv.home.rv.module.ui.login.LoginRvActivity" android:name="com.rv.home.rv.module.ui.login.LoginRvActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="pdfd6612" />
</intent-filter>
</activity> </activity>
<activity <activity
......
...@@ -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
...@@ -97,4 +97,6 @@ public class ApiConfig { ...@@ -97,4 +97,6 @@ public class ApiConfig {
* 用户收益 * 用户收益
*/ */
public static String HTTP_URL_USER_PROFIT = RvFrameConfig.HOST + "/api/admin/app/user/profit"; public static String HTTP_URL_USER_PROFIT = RvFrameConfig.HOST + "/api/admin/app/user/profit";
public static String HTTP_URL_SELECTED_ACTIVITIES = RvFrameConfig.HOST + "/api/activity/homeActivities/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);
} }
......
...@@ -8,6 +8,7 @@ import android.support.v4.content.ContextCompat; ...@@ -8,6 +8,7 @@ import android.support.v4.content.ContextCompat;
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.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -206,12 +207,16 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i ...@@ -206,12 +207,16 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
.navigation(mActivity, 109); .navigation(mActivity, 109);
} else if (id == R.id.ll_item_get_address) { } else if (id == R.id.ll_item_get_address) {
//取车地址
startActivityForResult(SelectLocationActivity.getIntent(mActivity, 1, dataBean.getStartCityName(), dataBean.getStartCity(),mLat, mLon, "", 1), 110); startActivityForResult(SelectShopActivity.getIntent(mActivity, 1, "", dataBean.getStartCityName(), mLat, mLon), 110);
// //取车地址
// startActivityForResult(SelectLocationActivity.getIntent(mActivity, 1, dataBean.getStartCityName(), dataBean.getStartCity(),mLat, mLon, "", 1), 110);
} else if (id == R.id.ll_item_out_address) { } else if (id == R.id.ll_item_out_address) {
//还车地址 //还车地址
startActivityForResult(SelectLocationActivity.getIntent(mActivity, 2, dataBean.getStartCityName(),dataBean.getEndCity(), outLatitude, outLongitude, "", 1), 110); startActivityForResult(SelectShopActivity.getIntent(mActivity, 2, "", dataBean.getEndCityName(), outLatitude, outLongitude), 110);
// startActivityForResult(SelectLocationActivity.getIntent(mActivity, 2, dataBean.getStartCityName(),dataBean.getEndCity(), outLatitude, outLongitude, "", 1), 110);
} else if (id == R.id.ll_item_filter) { } else if (id == R.id.ll_item_filter) {
if (attributeListBean == null) { if (attributeListBean == null) {
return; return;
...@@ -423,30 +428,31 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i ...@@ -423,30 +428,31 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
onFresh(); onFresh();
} else if (requestCode == 110 && resultCode == RESULT_OK) { } else if (requestCode == 110 && resultCode == RESULT_OK) {
double lat = data.getDoubleExtra("latitude", 0); double lat = data.getDoubleExtra("latitude", 0);
double lon = data.getDoubleExtra("longitude", 0); double lon = data.getDoubleExtra("longitude", 0);
int type = data.getIntExtra("type", 1); int type = data.getIntExtra("type", 1);
String requestData = data.getStringExtra("location"); String requestData = data.getStringExtra("location");
String city = data.getStringExtra("city"); String company = data.getStringExtra("company");
int cityId = data.getIntExtra("cityId", 0); int cityId = data.getIntExtra("id", 0);
setRequestData(type, requestData, lat, lon, city, cityId); setRequestData(type, requestData, lat, lon, company, cityId);
} }
} }
private void setRequestData(int type, String requestData, double lat, double lon, String city, int cityId) { private void setRequestData(int type, String requestData, double lat, double lon, String compangy, int cityId) {
if (type == 1) { if (type == 1) {
tvGetAddress.setText(requestData); tvGetAddress.setText(compangy);
dataBean.setStartAddr(requestData); dataBean.setStartAddr(requestData);
dataBean.setStartCity(cityId); dataBean.setStartCity(cityId);
dataBean.setStartCityName(city); dataBean.setStartCityName(compangy);
mLat = lat; mLat = lat;
mLon = lon; mLon = lon;
} else if (type == 2) { } else if (type == 2) {
tvOutAddress.setText(requestData); tvOutAddress.setText(compangy);
dataBean.setEndAddr(requestData); dataBean.setEndAddr(requestData);
dataBean.setEndCity(cityId); dataBean.setEndCity(cityId);
dataBean.setEndCityName(city); dataBean.setEndCityName(compangy);
outLatitude = lat; outLatitude = lat;
outLongitude = lon; outLongitude = lon;
} }
......
...@@ -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,52 +131,41 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -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<>(); List<MultiItemBean> list = new ArrayList<>();
if (!TextUtils.isEmpty(now_city)) { list.add(new HotCityListBean(getHotCitys()));
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));
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()) {
list.add(new CityHeadBean(cityBean.getTitle())); if (TextUtils.isEmpty(searchCity)) {
list.add(new CityHeadBean(cityBean.getTitle()));
}
for (ListsBean lsBean : cityBean.getLists()) { 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; 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> { ...@@ -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);
}
};
} }
......
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) {
}
}
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,23 +66,27 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -50,23 +66,27 @@ 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);
} }
} }
} }
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
<?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"-->
</RelativeLayout> <!--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"?> <?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_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
<ImageView android:layout_marginLeft="@dimen/size_10"
android:id="@+id/iv_loction" android:layout_marginTop="10dp"
android:paddingLeft="@dimen/size_15" android:layout_marginRight="@dimen/size_10"
android:paddingRight="@dimen/size_10" android:layout_marginBottom="@dimen/size_10"
android:layout_width="@dimen/size_45" android:orientation="horizontal">
android:src="@drawable/my_set_location"
android:layout_height="@dimen/size_45" /> <LinearLayout
<TextView android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/textMain"
android:layout_weight="1" android:layout_weight="1"
android:textStyle="bold" android:gravity="center_vertical"
android:id="@+id/tv_name" android:orientation="vertical"
android:textSize="@dimen/text_18" android:paddingRight="@dimen/size_15">
android:text=""
/> <TextView
<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_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:textColor="@color/textLightGrey" android:gravity="center">
android:textSize="@dimen/text_12"
android:text="" <TextView
android:id="@+id/tv_km" 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> </LinearLayout>
<TextView </android.support.v7.widget.CardView>
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>
<?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;
...@@ -65,7 +66,7 @@ import io.reactivex.functions.Consumer; ...@@ -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) @BindView(R2.id.travel_city_text)
TextView travelCityText; TextView travelCityText;
...@@ -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;
...@@ -169,7 +171,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B ...@@ -169,7 +171,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();
} }
}); });
...@@ -313,11 +315,12 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B ...@@ -313,11 +315,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("");
...@@ -345,10 +348,22 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B ...@@ -345,10 +348,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();
} }
}) })
......
...@@ -129,7 +129,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol ...@@ -129,7 +129,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
} }
}); });
viewHolder.img_agree.setImageResource(hasAgree ? R.drawable.common_icon_like_selected : R.drawable.common_icon_radio_unche); viewHolder.img_agree.setImageResource(hasAgree ? R.drawable.common_icon_selected : R.drawable.common_icon_radio_unche);
viewHolder.btn_buy.setBackgroundResource(hasAgree ? R.drawable.shape_rv_bg_dark_yellow : R.drawable.shape_rv_bg_btn_grap_yellow); viewHolder.btn_buy.setBackgroundResource(hasAgree ? R.drawable.shape_rv_bg_dark_yellow : R.drawable.shape_rv_bg_btn_grap_yellow);
viewHolder.img_agree.setOnClickListener(new View.OnClickListener() { viewHolder.img_agree.setOnClickListener(new View.OnClickListener() {
@Override @Override
...@@ -141,7 +141,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol ...@@ -141,7 +141,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
viewHolder.btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_btn_grap_yellow); viewHolder.btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_btn_grap_yellow);
} else { } else {
hasAgree = true; hasAgree = true;
viewHolder.img_agree.setImageResource(R.drawable.common_icon_like_selected); viewHolder.img_agree.setImageResource(R.drawable.common_icon_selected);
viewHolder.btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_dark_yellow); viewHolder.btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_dark_yellow);
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<string name="tv_title_member_center">会员中心</string> <string name="tv_title_member_center">会员中心</string>
<string name="tv_outdoors_act">户外活动</string> <string name="tv_outdoors_act">户外活动</string>
<string name="tv_agreement">同意欣新房车 《会员服务协议会员规则》 </string> <string name="tv_agreement">同意房车 《会员服务协议会员规则》 </string>
<string name="tv_use_now">马上使用</string> <string name="tv_use_now">马上使用</string>
......
...@@ -46,11 +46,7 @@ public class PointAdapter extends BaseQuickAdapter<PointBean.RvPointItem, BaseVi ...@@ -46,11 +46,7 @@ public class PointAdapter extends BaseQuickAdapter<PointBean.RvPointItem, BaseVi
helper.setText(R.id.btn_state, item.getBtnWord()); helper.setText(R.id.btn_state, item.getBtnWord());
} }
helper.setBackgroundRes(R.id.btn_state, item.isIntegralStatus() ? R.drawable.shape_rv_bg_member_top_grap : R.drawable.shape_rv_bg_dark_yellow); helper.setBackgroundRes(R.id.btn_state, item.isIntegralStatus() ? R.drawable.shape_rv_bg_member_top_grap : R.drawable.shape_rv_bg_dark_yellow);
if (item.isIntegralStatus()) { helper.itemView.findViewById(R.id.btn_state).setEnabled(!item.isIntegralStatus());
helper.itemView.findViewById(R.id.btn_state).setEnabled(false);
} else {
helper.itemView.findViewById(R.id.btn_state).setEnabled(true);
}
helper.addOnClickListener(R.id.btn_state); helper.addOnClickListener(R.id.btn_state);
} }
} }
...@@ -5,7 +5,25 @@ ...@@ -5,7 +5,25 @@
<application> <application>
<activity android:name=".ShareActivity" /> <activity android:name=".ShareActivity" />
<activity android:name=".BillActivity" /> <activity android:name=".BillActivity" />
<activity android:name=".WebViewActivity" /> <activity android:name=".WebViewActivity" >
<!--<intent-filter>-->
<!--<data android:scheme="rv" android:host="xxfc" android:path="/activity" />-->
<!--&lt;!&ndash;下面这几行也必须得设置&ndash;&gt;-->
<!--<category android:name="android.intent.category.DEFAULT"/>-->
<!--<action android:name="android.intent.action.VIEW"/>-->
<!--<category android:name="android.intent.category.BROWSABLE"/>-->
<!--</intent-filter>-->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="pdfd6612" />
</intent-filter>
</activity>
<activity android:name=".ReativeBillActivity" /> <activity android:name=".ReativeBillActivity" />
<activity android:name=".PopularizeActivity"></activity> <activity android:name=".PopularizeActivity"></activity>
</application> </application>
......
...@@ -49,6 +49,8 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> { ...@@ -49,6 +49,8 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
ImageView imgParent; ImageView imgParent;
@BindView(R2.id.tv_parent_phone) @BindView(R2.id.tv_parent_phone)
TextView tvParentPhone; TextView tvParentPhone;
@BindView(R2.id.tv_ruler)
TextView tvRuler;
@BindView(R2.id.tv_more_detail) @BindView(R2.id.tv_more_detail)
TextView tvMoreDetail; TextView tvMoreDetail;
...@@ -108,7 +110,7 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> { ...@@ -108,7 +110,7 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
} }
@OnClick({R2.id.tv_weixin, R2.id.tv_weixin_circle, R2.id.tv_bill, R2.id.tv_more, R2.id.tv_more_detail, R2.id.ll_activation, R2.id.ll_comein, R2.id.ll_invite}) @OnClick({R2.id.tv_weixin, R2.id.tv_weixin_circle, R2.id.tv_bill, R2.id.tv_more, R2.id.tv_more_detail, R2.id.ll_activation, R2.id.ll_comein, R2.id.ll_invite,R2.id.tv_ruler})
public void onViewClicked(View view) { public void onViewClicked(View view) {
int id = view.getId(); int id = view.getId();
if (TextUtils.isEmpty(shareUrl)) { if (TextUtils.isEmpty(shareUrl)) {
......
...@@ -5,15 +5,22 @@ import android.content.Intent; ...@@ -5,15 +5,22 @@ import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import com.base.utils.tools.android.NetworkUtil; import com.base.utils.tools.android.NetworkUtil;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.Cooker;
import com.rv.home.rv.module.basic.BaseStatusActivity; import com.rv.home.rv.module.basic.BaseStatusActivity;
import com.rv.share.presenter.WebViewPresenter; import com.rv.share.presenter.WebViewPresenter;
import com.rv.share.view.RvWebView; import com.rv.share.view.RvWebView;
import com.sh.sdk.shareinstall.ShareInstall;
import com.sh.sdk.shareinstall.listener.AppGetInfoListener;
import org.json.JSONException;
import org.json.JSONObject;
import butterknife.BindView; import butterknife.BindView;
...@@ -38,6 +45,8 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> { ...@@ -38,6 +45,8 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
@Override @Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
// 获取唤醒参数
ShareInstall.getInstance().getInfo(intent, openListener);
url = intent.getStringExtra("url"); url = intent.getStringExtra("url");
title = intent.getStringExtra("title"); title = intent.getStringExtra("title");
if (!TextUtils.isEmpty(title)) { if (!TextUtils.isEmpty(title)) {
...@@ -67,9 +76,16 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> { ...@@ -67,9 +76,16 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
} }
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// 此处要调用,否则app在后台运行时,会无法截获
ShareInstall.getInstance().getInfo(intent, openListener);
}
@Override @Override
public void onDestroy() { public void onDestroy() {
if(rvWebView != null) { if (rvWebView != null) {
llContent.removeAllViews(); llContent.removeAllViews();
rvWebView.stopLoading();// 停止当前加载 rvWebView.stopLoading();// 停止当前加载
rvWebView.clearMatches();// 清除网页查找的高亮匹配字符。 rvWebView.clearMatches();// 清除网页查找的高亮匹配字符。
...@@ -97,4 +113,23 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> { ...@@ -97,4 +113,23 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
} }
}; };
private AppGetInfoListener openListener = new AppGetInfoListener() {
@Override
public void onGetInfoFinish(String info) {
// 客户端获取到的参数是json字符串格式
Log.d("ShareInstall", "info = " + info);
if (info.contains("code"))
try {
JSONObject object = new JSONObject(info);
String inviteCode = object.optString("code");
if (!TextUtils.isEmpty(inviteCode)) {
Cooker.save(getApplicationContext(), "code", inviteCode);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
};
} }
package com.rv.share.adapter; package com.rv.share.adapter;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.base.utils.ui.image.round.RoundImageView; import com.base.utils.ui.image.round.RoundImageView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
...@@ -20,9 +21,18 @@ public class ActivationListAdapter extends BaseQuickAdapter<InviteListBean.invit ...@@ -20,9 +21,18 @@ public class ActivationListAdapter extends BaseQuickAdapter<InviteListBean.invit
@Override @Override
protected void convert(BaseViewHolder helper, InviteListBean.inviteMember item) { protected void convert(BaseViewHolder helper, InviteListBean.inviteMember item) {
helper.setText(R.id.tv_name, item.getUsername()); helper.setText(R.id.tv_name, dealName(item.getUsername()));
helper.setText(R.id.tv_ac_time, DateUtils.timestampToString1(item.getBindTime())); helper.setText(R.id.tv_ac_time, DateUtils.timestampToString1(item.getBindTime()));
GlideManager.getInstance(mContext).loadImage(item.getHeadUrl(), (RoundImageView) helper.itemView.findViewById(R.id.rimg_header)); GlideManager.getInstance(mContext).loadImage(item.getHeadUrl(), (RoundImageView) helper.itemView.findViewById(R.id.rimg_header));
} }
private String dealName(String name) {
if (!TextUtils.isEmpty(name)) {
if (name.length() == 11) {
return name.substring(0, 3) + "****" + name.substring(7, name.length());
}
}
return name;
}
} }
package com.rv.share.adapter; package com.rv.share.adapter;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.TextView; import android.widget.TextView;
import com.base.utils.ui.image.round.RoundImageView; import com.base.utils.ui.image.round.RoundImageView;
...@@ -24,15 +25,35 @@ public class IncomeListAdapter extends BaseQuickAdapter<IncomeRecordsBean.Income ...@@ -24,15 +25,35 @@ public class IncomeListAdapter extends BaseQuickAdapter<IncomeRecordsBean.Income
@Override @Override
protected void convert(BaseViewHolder helper, IncomeRecordsBean.IncomeItem item) { protected void convert(BaseViewHolder helper, IncomeRecordsBean.IncomeItem item) {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append(item.getUsername()).append("成交").append(item.getPrice()).append("元");
helper.setText(R.id.tv_income_record, buffer.toString());
if (item.getStatus() == 0) {
buffer.append(dealName(item.getUsername())).append("成交").append(item.getPrice()).append("元");
} else if (item.getStatus() == 1) {
buffer.append(dealName(item.getUsername())).append("退款").append(item.getPrice()).append("元");
}
helper.setText(R.id.tv_income_record, buffer.toString());
helper.setText(R.id.tv_income_time, DateUtils.timestampToString1(item.getCrtTime())); helper.setText(R.id.tv_income_time, DateUtils.timestampToString1(item.getCrtTime()));
StringBuilder builder = new StringBuilder(); if (item.getWaiting() == 1 && item.getStatus() == 0) {
builder.append("+").append(item.getCommission()).append("元"); StringBuilder builder = new StringBuilder();
helper.setText(R.id.tv_income_price, builder.toString()); builder.append("+").append(item.getCommission()).append("元");
helper.setText(R.id.tv_income_price, builder.toString());
} else if (item.getWaiting() == 1 && item.getStatus() == 1) {
StringBuilder builder = new StringBuilder();
builder.append("-").append(item.getCommission()).append("元");
helper.setText(R.id.tv_income_price, builder.toString());
} else {
helper.setText(R.id.tv_income_price, "进行中");
}
GlideManager.getInstance(mContext).loadImage(item.getHeadUrl(), (RoundImageView) helper.itemView.findViewById(R.id.rimg_header)); GlideManager.getInstance(mContext).loadImage(item.getHeadUrl(), (RoundImageView) helper.itemView.findViewById(R.id.rimg_header));
} }
private String dealName(String name) {
if (!TextUtils.isEmpty(name)) {
if (name.length() == 11) {
return name.substring(0, 3) + "****" + name.substring(7, name.length());
}
}
return name;
}
} }
package com.rv.share.adapter; package com.rv.share.adapter;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.base.utils.ui.image.round.RoundImageView; import com.base.utils.ui.image.round.RoundImageView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
...@@ -27,7 +28,7 @@ public class InviteListAdapter extends BaseQuickAdapter<InviteListBean.inviteMem ...@@ -27,7 +28,7 @@ public class InviteListAdapter extends BaseQuickAdapter<InviteListBean.inviteMem
@Override @Override
protected void convert(BaseViewHolder helper, InviteListBean.inviteMember item) { protected void convert(BaseViewHolder helper, InviteListBean.inviteMember item) {
helper.setText(R.id.tv_income_record, item.getUsername()); helper.setText(R.id.tv_income_record, dealName(item.getUsername()));
helper.setText(R.id.tv_income_time, DateUtils.timestampToString1(item.getJoinTime())); helper.setText(R.id.tv_income_time, DateUtils.timestampToString1(item.getJoinTime()));
setTimes(effTime, helper, item); setTimes(effTime, helper, item);
...@@ -54,4 +55,13 @@ public class InviteListAdapter extends BaseQuickAdapter<InviteListBean.inviteMem ...@@ -54,4 +55,13 @@ public class InviteListAdapter extends BaseQuickAdapter<InviteListBean.inviteMem
notifyDataSetChanged(); notifyDataSetChanged();
} }
}; };
private String dealName(String name) {
if (!TextUtils.isEmpty(name)) {
if (name.length() == 11) {
return name.substring(0, 3) + "****" + name.substring(7, name.length());
}
}
return name;
}
} }
...@@ -13,10 +13,8 @@ import android.widget.TextView; ...@@ -13,10 +13,8 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.base.utils.ui.datetime.selector.util.TextUtil; import com.base.utils.ui.datetime.selector.util.TextUtil;
import com.frame.rv.config.RvFrameConfig;
import com.rv.component.utils.DisplayUtil; import com.rv.component.utils.DisplayUtil;
import com.rv.home.rv.module.basic.presenter.CommonPresenter; import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.BillActivity;
import com.rv.share.R; import com.rv.share.R;
import com.rv.share.ReativeBillActivity; import com.rv.share.ReativeBillActivity;
import com.rv.share.view.ShareChoiceDialog; import com.rv.share.view.ShareChoiceDialog;
...@@ -35,17 +33,17 @@ public class SharePresenter extends CommonPresenter { ...@@ -35,17 +33,17 @@ public class SharePresenter extends CommonPresenter {
private ShareChoiceDialog dialog = null; private ShareChoiceDialog dialog = null;
public void setShareImage(Context context, TextView tvWeixin, TextView tvWxCircle, TextView tvBill, TextView tvMore) { public void setShareImage(Context context, TextView tvWeixin, TextView tvWxCircle, TextView tvBill, TextView tvMore) {
Drawable drawable = context.getResources().getDrawable(R.drawable.icon_share_wx); Drawable drawable = context.getResources().getDrawable(R.drawable.icon_share_weixin);
drawable.setBounds(0, 0, DisplayUtil.dip2px(context, drawableSize), DisplayUtil.dip2px(context, drawableSize)); drawable.setBounds(0, 0, DisplayUtil.dip2px(context, drawableSize), DisplayUtil.dip2px(context, drawableSize));
tvWeixin.setCompoundDrawables(null, drawable, null, null); tvWeixin.setCompoundDrawables(null, drawable, null, null);
tvWeixin.setVisibility(View.VISIBLE); tvWeixin.setVisibility(View.VISIBLE);
Drawable drawable1 = context.getResources().getDrawable(R.drawable.icon_share_cir); Drawable drawable1 = context.getResources().getDrawable(R.drawable.icon_share_wx_circle);
drawable1.setBounds(0, 0, DisplayUtil.dip2px(context, drawableSize), DisplayUtil.dip2px(context, drawableSize)); drawable1.setBounds(0, 0, DisplayUtil.dip2px(context, drawableSize), DisplayUtil.dip2px(context, drawableSize));
tvWxCircle.setCompoundDrawables(null, drawable1, null, null); tvWxCircle.setCompoundDrawables(null, drawable1, null, null);
tvWxCircle.setVisibility(View.VISIBLE); tvWxCircle.setVisibility(View.VISIBLE);
Drawable drawable2 = context.getResources().getDrawable(R.drawable.icon_share_bill); Drawable drawable2 = context.getResources().getDrawable(R.drawable.icon_share_code);
drawable2.setBounds(0, 0, DisplayUtil.dip2px(context, drawableSize), DisplayUtil.dip2px(context, drawableSize)); drawable2.setBounds(0, 0, DisplayUtil.dip2px(context, drawableSize), DisplayUtil.dip2px(context, drawableSize));
tvBill.setCompoundDrawables(null, drawable2, null, null); tvBill.setCompoundDrawables(null, drawable2, null, null);
tvBill.setVisibility(View.VISIBLE); tvBill.setVisibility(View.VISIBLE);
...@@ -61,7 +59,7 @@ public class SharePresenter extends CommonPresenter { ...@@ -61,7 +59,7 @@ public class SharePresenter extends CommonPresenter {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image = new UMImage(getPresenterContext(), R.drawable.logo); UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo);
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题 web.setTitle(mTitle);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
...@@ -80,7 +78,7 @@ public class SharePresenter extends CommonPresenter { ...@@ -80,7 +78,7 @@ public class SharePresenter extends CommonPresenter {
if (shareAction == null) { if (shareAction == null) {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image = new UMImage(getPresenterContext(), R.drawable.logo); UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo);
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle + " " + mDescript);//标题 web.setTitle(mTitle + " " + mDescript);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
......
...@@ -63,7 +63,7 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -63,7 +63,7 @@ public class WebViewPresenter extends CommonPresenter {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image = new UMImage(getPresenterContext(), R.drawable.logo); UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo);
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题 web.setTitle(mTitle);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
...@@ -82,7 +82,7 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -82,7 +82,7 @@ public class WebViewPresenter extends CommonPresenter {
if (shareAction == null) { if (shareAction == null) {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image = new UMImage(getPresenterContext(), R.drawable.logo); UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo);
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题 web.setTitle(mTitle);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="30dp" />
<solid android:color="#FE6E2F" />
</shape>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<string-array name="popularize_list"> <string-array name="popularize_list">
<item>收益记录</item> <item>收益记录</item>
<item>已邀请</item> <item>待激活</item>
<item>已激活</item> <item>已激活</item>
</string-array> </string-array>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment