Commit 51a60406 authored by jianglx's avatar jianglx

Merge branch 'master-video' of http://113.105.137.151:22280/lify/rvapp into dev-member-john

parents 4da4982c 59406bfb
...@@ -41,20 +41,22 @@ public class OkGoUtil { ...@@ -41,20 +41,22 @@ public class OkGoUtil {
public static String TOKEN_KEY = "Authorization"; public static String TOKEN_KEY = "Authorization";
//把Token保存到SP文件中的Key //把Token保存到SP文件中的Key
final private static String SP_KEY_TOKEN = "sp_key_token"; final private static String SP_KEY_TOKEN = "sp_key_token";
final private static String SP_KEY_TOKEN_TIME = "sp_key_token_time";
final private static String SP_KEY_USERINFO ="userinfo"; final private static String SP_KEY_USERINFO = "userinfo";
public static String getYkId(){ public static String getYkId() {
String ykid = "uk_"+ (int)((Math.random()*9+1)*100000); String ykid = "uk_" + (int) ((Math.random() * 9 + 1) * 100000);
return ykid; return ykid;
} }
//保存Token //保存Token
public static void setToken(String token) { public static void setToken(String token, String time) {
if (application == null) return; if (application == null) return;
SharedPreferences sp = application.getSharedPreferences(OkGoUtil.class.getSimpleName(), Context.MODE_PRIVATE); SharedPreferences sp = application.getSharedPreferences(OkGoUtil.class.getSimpleName(), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit(); SharedPreferences.Editor editor = sp.edit();
editor.putString(SP_KEY_TOKEN, token); editor.putString(SP_KEY_TOKEN, token);
editor.putString(SP_KEY_TOKEN_TIME, time);
editor.apply(); editor.apply();
editor.commit(); editor.commit();
} }
...@@ -68,11 +70,20 @@ public class OkGoUtil { ...@@ -68,11 +70,20 @@ public class OkGoUtil {
return null; return null;
} }
//获取Token登录时间
public static String getTime() {
if (application != null) {
SharedPreferences sp = application.getSharedPreferences(OkGoUtil.class.getSimpleName(), Context.MODE_PRIVATE);
return sp.getString(SP_KEY_TOKEN_TIME, null);
}
return null;
}
/** /**
* 清空Token * 清空Token
*/ */
public static void clearToken(){ public static void clearToken() {
if (application ==null) if (application == null)
return; return;
SharedPreferences sp = application.getSharedPreferences(OkGoUtil.class.getSimpleName(), Context.MODE_PRIVATE); SharedPreferences sp = application.getSharedPreferences(OkGoUtil.class.getSimpleName(), Context.MODE_PRIVATE);
sp.edit().clear().commit(); sp.edit().clear().commit();
...@@ -269,7 +280,7 @@ public class OkGoUtil { ...@@ -269,7 +280,7 @@ public class OkGoUtil {
getUrl = getUrl(url, param); getUrl = getUrl(url, param);
} else { } else {
getUrl = url; getUrl = url;
Log.d(OkGoUtil.class.getSimpleName(), "getJson():\n url:" + url ); Log.d(OkGoUtil.class.getSimpleName(), "getJson():\n url:" + url);
} }
GetRequest<String> request; GetRequest<String> request;
request = OkGo.<String>get(getUrl) request = OkGo.<String>get(getUrl)
...@@ -327,7 +338,7 @@ public class OkGoUtil { ...@@ -327,7 +338,7 @@ public class OkGoUtil {
sb.append(key); sb.append(key);
sb.append("="); sb.append("=");
sb.append(value); sb.append(value);
}catch (Exception e){ } catch (Exception e) {
//忽略 //忽略
} }
} }
......
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
flavorDimensions "default" flavorDimensions "default"
versionCode 143 versionCode 144
versionName "1.4.3" versionName "1.4.4"
multiDexEnabled true multiDexEnabled true
ndk { ndk {
......
...@@ -25,11 +25,13 @@ import android.widget.Toast; ...@@ -25,11 +25,13 @@ import android.widget.Toast;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.frame.base.url.Constance; import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.SPConstance;
import com.ruiwenliu.wrapper.adapter.TabAdapter; import com.ruiwenliu.wrapper.adapter.TabAdapter;
import com.ruiwenliu.wrapper.base.BaseActivity; import com.ruiwenliu.wrapper.base.BaseActivity;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseWrapperFragment; import com.ruiwenliu.wrapper.base.BaseWrapperFragment;
import com.ruiwenliu.wrapper.bean.ActBean; import com.ruiwenliu.wrapper.bean.ActBean;
import com.ruiwenliu.wrapper.bean.UpdateTokenBean;
import com.ruiwenliu.wrapper.receiver.NetWorkReceiver; import com.ruiwenliu.wrapper.receiver.NetWorkReceiver;
import com.ruiwenliu.wrapper.statusbar.StatusBarUtil; import com.ruiwenliu.wrapper.statusbar.StatusBarUtil;
import com.ruiwenliu.wrapper.util.listener.SwitchFragment; import com.ruiwenliu.wrapper.util.listener.SwitchFragment;
...@@ -37,6 +39,7 @@ import com.ruiwenliu.wrapper.weight.CustomScrollViewPager; ...@@ -37,6 +39,7 @@ import com.ruiwenliu.wrapper.weight.CustomScrollViewPager;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.camp.CampFragment; import com.rv.camp.CampFragment;
import com.rv.component.utils.Cookie; import com.rv.component.utils.Cookie;
import com.rv.component.utils.DateUtils;
import com.rv.home.rv.module.ApiConfig; import com.rv.home.rv.module.ApiConfig;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter; import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.main.home.HomeFragment; import com.rv.home.rv.module.ui.main.home.HomeFragment;
...@@ -49,7 +52,6 @@ import com.rv.tourism.TourismFragment; ...@@ -49,7 +52,6 @@ import com.rv.tourism.TourismFragment;
import com.rv.version.bean.VersionCheckBean; import com.rv.version.bean.VersionCheckBean;
import com.rv.version.util.DownloadAppUtils; import com.rv.version.util.DownloadAppUtils;
import com.rv.version.util.UpdateAppUtils; import com.rv.version.util.UpdateAppUtils;
import com.squareup.haha.perflib.Main;
import com.xxfc.discovery.DiscoveryFragment; import com.xxfc.discovery.DiscoveryFragment;
import com.yuyife.okgo.OkGoUtil; import com.yuyife.okgo.OkGoUtil;
...@@ -231,25 +233,44 @@ public class MainActivity extends BaseActivity<CommonPresenter> { ...@@ -231,25 +233,44 @@ public class MainActivity extends BaseActivity<CommonPresenter> {
promotionDialog.show(); promotionDialog.show();
} }
break; break;
case 3: case 4:
UpdateTokenBean updateTokenBean = (UpdateTokenBean) result;
if (updateTokenBean != null && !TextUtils.isEmpty(updateTokenBean.getData())) {
OkGoUtil.setToken(updateTokenBean.getData(), DateUtils.getCurDate());
Cookie.save(getApplicationContext(), SPConstance.USER_JSON_TOKEN, updateTokenBean.getData());
Cookie.save(getApplicationContext(), SPConstance.USER_JSON_TOKE_TIME, DateUtils.getCurDate());
}
break; break;
default: default:
break; break;
} }
} }
/** /**
* 检查token是否过期 * 设置token时间检测
*/ */
private void checkToken() { private void checkToken() {
String time = OkGoUtil.getTime();
if (!TextUtils.isEmpty(time)) {
if (DateUtils.compareDateDay(DateUtils.getCurDate(), time) > 6) {
getToken();
}
} else {
getToken();
}
}
/**
* 获取新token
*/
private void getToken() {
Map<String, Object> heapmap = new HashMap<>(); Map<String, Object> heapmap = new HashMap<>();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (!TextUtils.isEmpty(OkGoUtil.getToken())) { if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
map.put("Authorization", OkGoUtil.getToken()); heapmap.put("Authorization", OkGoUtil.getToken());
map.put("token", OkGoUtil.getToken()); map.put("token", OkGoUtil.getToken());
mPresenter.getData(RvFrameConfig.HOST, 3, ApiConfig.HTTP_URL_GET_TOKEN, BaseBean.class, map, heapmap, false); mPresenter.getData(RvFrameConfig.HOST, 4, ApiConfig.HTTP_URL_GET_TOKEN, UpdateTokenBean.class, map, heapmap, false);
} }
} }
...@@ -284,6 +305,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> { ...@@ -284,6 +305,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> {
setCurrent(TYPE_FOUND); setCurrent(TYPE_FOUND);
} else if (id == R.id.rl_mine) { } else if (id == R.id.rl_mine) {
setCurrent(TYPE_MINE); setCurrent(TYPE_MINE);
checkToken();
} }
} }
......
...@@ -7,14 +7,20 @@ import android.os.Bundle; ...@@ -7,14 +7,20 @@ import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import com.ruiwenliu.wrapper.SPConstance;
import com.ruiwenliu.wrapper.base.BaseActivity; import com.ruiwenliu.wrapper.base.BaseActivity;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.util.UtilsManager; import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.Cookie;
import com.rv.component.utils.DateUtils;
import com.rv.component.utils.LogUtil; import com.rv.component.utils.LogUtil;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter; import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.yuyife.okgo.OkGoUtil; import com.yuyife.okgo.OkGoUtil;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import io.reactivex.Flowable; import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull; import io.reactivex.annotations.NonNull;
...@@ -68,11 +74,10 @@ public class WelcomeActivity extends BaseActivity<CommonPresenter> { ...@@ -68,11 +74,10 @@ public class WelcomeActivity extends BaseActivity<CommonPresenter> {
@Override @Override
public void accept(@NonNull Long aLong) { public void accept(@NonNull Long aLong) {
try { try {
if (!TextUtils.isEmpty(UtilsManager.getInstance(mActivity).getSPInstance("city_json").getString("token", ""))) { String token = Cookie.getStringValue(getApplicationContext(), SPConstance.USER_JSON_TOKEN, "");
OkGoUtil.setToken( String tokenTime = Cookie.getStringValue(getApplicationContext(), SPConstance.USER_JSON_TOKE_TIME, "");
UtilsManager.getInstance(mActivity) if (!TextUtils.isEmpty(token)) {
.getSPInstance("city_json") OkGoUtil.setToken(token, tokenTime);
.getString("token", ""));
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -106,7 +111,7 @@ public class WelcomeActivity extends BaseActivity<CommonPresenter> { ...@@ -106,7 +111,7 @@ public class WelcomeActivity extends BaseActivity<CommonPresenter> {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// this.getWindow().getDecorView().setBackground(null); // this.getWindow().getDecorView().setBackground(null);
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |View.SYSTEM_UI_FLAG_FULLSCREEN); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN);
} }
// if (Build.VERSION.SDK_INT >= 21) { // if (Build.VERSION.SDK_INT >= 21) {
// View decorView = getWindow().getDecorView(); // View decorView = getWindow().getDecorView();
......
...@@ -62,25 +62,26 @@ public class MyReceiver extends BroadcastReceiver { ...@@ -62,25 +62,26 @@ public class MyReceiver extends BroadcastReceiver {
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
switch (onclickType) { switch (onclickType) {
case "1": case "1":
intent2.setClass(context, OrderListActivity.class);
context.startActivity(intent2);
break; break;
case "2": case "2":
intent2.setClass(context, CollectionActivity.class);
context.startActivity(intent2);
break; break;
case "3": case "3":
intent2.setClass(context, ShareActivity.class); break;
case "4":
break;
case "5":
break;
default:
intent2.setClass(context, MainActivity.class);
context.startActivity(intent2); context.startActivity(intent2);
break; break;
} }
} else { } else {
Intent intent3 = new Intent(); Intent intent3 = new Intent();
intent3.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent3.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent intent4 = new Intent();
intent4.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent4.setClass(context, MainActivity.class);
switch (onclickType) { switch (onclickType) {
case "1": case "1":
intent3.setClass(context, OrderListActivity.class); intent3.setClass(context, OrderListActivity.class);
...@@ -94,6 +95,14 @@ public class MyReceiver extends BroadcastReceiver { ...@@ -94,6 +95,14 @@ public class MyReceiver extends BroadcastReceiver {
intent3.setClass(context, ShareActivity.class); intent3.setClass(context, ShareActivity.class);
context.startActivity(intent3); context.startActivity(intent3);
break; break;
case "4":
break;
case "5":
break;
default:
intent3.setClass(context, MainActivity.class);
context.startActivity(intent3);
break;
} }
} }
......
...@@ -15,6 +15,9 @@ public interface RvFrameConstant { ...@@ -15,6 +15,9 @@ public interface RvFrameConstant {
int HTTP_STATE_DATA_ALREADY_EXISTS = 1009; int HTTP_STATE_DATA_ALREADY_EXISTS = 1009;
int HTTP_STATE_NOT_CHECKTOKEN = 10003; //参数不能为空", int HTTP_STATE_NOT_CHECKTOKEN = 10003; //参数不能为空",
int HTTP_STATE_DATA_NOT_CHECKTOKEN =10009; //"token无效", int HTTP_STATE_DATA_NOT_CHECKTOKEN =10009; //"token无效",
int HTTP_STATE_TOKEN_EXPIRED =40101; //用户token异常
int HTTP_STATE_TOKEN_EXPIRED_PASS =40001; //用户token异常
int HTTP_STATE_TOKEN_EXPIRED_PASS2 =40301; //用户token异常
/** /**
* 请求错误类型 * 请求错误类型
*/ */
......
...@@ -11,4 +11,5 @@ public final class SPConstance { ...@@ -11,4 +11,5 @@ public final class SPConstance {
public static final String USER_JSON_ISCERTIFICATIONSTATUS ="CertificationStatus"; public static final String USER_JSON_ISCERTIFICATIONSTATUS ="CertificationStatus";
public static final String USER_JSON_USERINFO ="userinfo"; public static final String USER_JSON_USERINFO ="userinfo";
public static final String USER_JSON_CODE = "userCode"; public static final String USER_JSON_CODE = "userCode";
public static final String USER_JSON_TOKE_TIME = "tokentime";
} }
...@@ -10,6 +10,7 @@ import android.view.Window; ...@@ -10,6 +10,7 @@ import android.view.Window;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.base.utils.tools.android.NetworkUtil; import com.base.utils.tools.android.NetworkUtil;
import com.frame.base.url.Constance;
import com.ruiwenliu.wrapper.R; import com.ruiwenliu.wrapper.R;
import com.ruiwenliu.wrapper.dialog.LoadingDialog; import com.ruiwenliu.wrapper.dialog.LoadingDialog;
import com.ruiwenliu.wrapper.presenter.MvpPresenter; import com.ruiwenliu.wrapper.presenter.MvpPresenter;
...@@ -97,6 +98,10 @@ public abstract class BaseActivity<P extends MvpPresenter> extends BaseWrapperAc ...@@ -97,6 +98,10 @@ public abstract class BaseActivity<P extends MvpPresenter> extends BaseWrapperAc
} }
} }
@Override
public void onErrorToken() {
ARouter.getInstance().build(Constance.ACTIVITY_URL_LOGINRV).navigation();
}
protected LoadingDialog createLoadingDialog() { protected LoadingDialog createLoadingDialog() {
if (mLoadingDialog == null) { if (mLoadingDialog == null) {
......
...@@ -36,4 +36,9 @@ public interface BaseView<T extends BaseBean> { ...@@ -36,4 +36,9 @@ public interface BaseView<T extends BaseBean> {
* @param errorMsg * @param errorMsg
*/ */
void onShowError(String errorMsg, int errorType); void onShowError(String errorMsg, int errorType);
/**
* token过期或者异常
*/
void onErrorToken();
} }
...@@ -12,6 +12,7 @@ import android.widget.Toast; ...@@ -12,6 +12,7 @@ import android.widget.Toast;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.base.utils.tools.android.NetworkUtil; import com.base.utils.tools.android.NetworkUtil;
import com.frame.base.url.Constance;
import com.ruiwenliu.wrapper.R; import com.ruiwenliu.wrapper.R;
import com.ruiwenliu.wrapper.dialog.LoadingDialog; import com.ruiwenliu.wrapper.dialog.LoadingDialog;
import com.ruiwenliu.wrapper.presenter.MvpPresenter; import com.ruiwenliu.wrapper.presenter.MvpPresenter;
...@@ -140,6 +141,10 @@ public abstract class BaseWrapperFragment<P extends MvpPresenter> extends Suppor ...@@ -140,6 +141,10 @@ public abstract class BaseWrapperFragment<P extends MvpPresenter> extends Suppor
} }
} }
@Override
public void onErrorToken() {
ARouter.getInstance().build(Constance.ACTIVITY_URL_LOGINRV).navigation();
}
/** /**
* @return 布局resourceId * @return 布局resourceId
......
package com.ruiwenliu.wrapper.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
public class UpdateTokenBean extends BaseBean {
private String data;
private int code;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
...@@ -63,6 +63,12 @@ public class RxRequestResult<T extends BaseBean, V extends BaseView<T>> extends ...@@ -63,6 +63,12 @@ public class RxRequestResult<T extends BaseBean, V extends BaseView<T>> extends
case RvFrameConstant.HTTP_STATE_DATA_NOT_CHECKTOKEN: case RvFrameConstant.HTTP_STATE_DATA_NOT_CHECKTOKEN:
RxBus.post(new SignOutEvent()); RxBus.post(new SignOutEvent());
break; break;
case RvFrameConstant.HTTP_STATE_TOKEN_EXPIRED:
case RvFrameConstant.HTTP_STATE_TOKEN_EXPIRED_PASS:
case RvFrameConstant.HTTP_STATE_TOKEN_EXPIRED_PASS2:
RxBus.post(new SignOutEvent());
baseView.onErrorToken();
break;
default: default:
baseView.onShowError(bean.message, bean.status); baseView.onShowError(bean.message, bean.status);
break; break;
...@@ -92,36 +98,27 @@ public class RxRequestResult<T extends BaseBean, V extends BaseView<T>> extends ...@@ -92,36 +98,27 @@ public class RxRequestResult<T extends BaseBean, V extends BaseView<T>> extends
baseView.onHideLoading(); baseView.onHideLoading();
if (e instanceof SocketTimeoutException) {//请求超时 if (e instanceof SocketTimeoutException) {//请求超时
} else if (e instanceof ConnectException) {//网络连接超时 } else if (e instanceof ConnectException) {//网络连接超时
// ToastManager.showShortToast("网络连接超时");
baseView.onShowError("网络连接超时", position); baseView.onShowError("网络连接超时", position);
} else if (e instanceof SSLHandshakeException) {//安全证书异常 } else if (e instanceof SSLHandshakeException) {//安全证书异常
// ToastManager.showShortToast("安全证书异常");
baseView.onShowError("安全证书异常", position); baseView.onShowError("安全证书异常", position);
} else if (e instanceof HttpException) {//请求的地址不存在 } else if (e instanceof HttpException) {//请求的地址不存在
int code = ((HttpException) e).code(); int code = ((HttpException) e).code();
if (code == 504) { if (code == 504) {
// ToastManager.showShortToast("网络异常,请检查您的网络状态");
baseView.onShowError("网络异常,请检查您的网络状态", position); baseView.onShowError("网络异常,请检查您的网络状态", position);
} else if (code == 404) { } else if (code == 404) {
// ToastManager.showShortToast("请求的地址不存在");
baseView.onShowError("请求的地址不存在", position); baseView.onShowError("请求的地址不存在", position);
} else { } else {
// ToastManager.showShortToast("请求失败");
baseView.onShowError("请求失败", position); baseView.onShowError("请求失败", position);
} }
} else if (e instanceof UnknownHostException) {//域名解析失败 } else if (e instanceof UnknownHostException) {//域名解析失败
// ToastManager.showShortToast("域名解析失败");
baseView.onShowError("域名解析失败", position); baseView.onShowError("域名解析失败", position);
} else { } else {
// ToastManager.showShortToast("error:" + e.getMessage());
baseView.onShowError("error:" + e.getMessage(), position); baseView.onShowError("error:" + e.getMessage(), position);
} }
} catch (Exception e2) { } catch (Exception e2) {
e2.printStackTrace(); e2.printStackTrace();
} finally { } finally {
Log.e("OnSuccessAndFaultSub", "error:" + e.getMessage()); Log.e("OnSuccessAndFaultSub", "error:" + e.getMessage());
// mOnSuccessAndFaultListener.onFault("error:" + e.getMessage());
// dismissProgressDialog();
} }
} }
......
...@@ -532,6 +532,24 @@ public class DateUtils { ...@@ -532,6 +532,24 @@ public class DateUtils {
} }
/**
* 将yyyy-MM-dd HH:mm:ss格式成yyyy-MM-dd
*
* @param dateStr yyyy-MM-dd HH:mm:ss
* @return yyyy-MM-dd
*/
public static String formatDate166(String dateStr) {
String day = "";
try {
Date date = sdf.parse(dateStr);
day = sdf4.format(date);
} catch (Exception e) {
e.printStackTrace();
}
return day;
}
/** /**
* 将yyyy-MM-dd HH:mm格式成HH:mm * 将yyyy-MM-dd HH:mm格式成HH:mm
* *
......
...@@ -63,6 +63,7 @@ public class CampDetailActivity extends BaseStatusActivity<CampPresenter> { ...@@ -63,6 +63,7 @@ public class CampDetailActivity extends BaseStatusActivity<CampPresenter> {
@BindView(R2.id.webView) @BindView(R2.id.webView)
WebView mWebView; WebView mWebView;
private String webUrl; private String webUrl;
@Autowired() @Autowired()
......
...@@ -30,7 +30,6 @@ public class DiscoveryShortVideoAdapter extends BaseQuickAdapter<DiscoveryRecomm ...@@ -30,7 +30,6 @@ public class DiscoveryShortVideoAdapter extends BaseQuickAdapter<DiscoveryRecomm
return; return;
} }
DiscoveryRecommendBean.DataBeanX.DataBean.Body body = item.getBody(); DiscoveryRecommendBean.DataBeanX.DataBean.Body body = item.getBody();
if (body != null) { if (body != null) {
if (body.getVideos() != null && body.getVideos().size() > 0) { if (body.getVideos() != null && body.getVideos().size() > 0) {
...@@ -40,6 +39,11 @@ public class DiscoveryShortVideoAdapter extends BaseQuickAdapter<DiscoveryRecomm ...@@ -40,6 +39,11 @@ public class DiscoveryShortVideoAdapter extends BaseQuickAdapter<DiscoveryRecomm
error(com.ruiwenliu.wrapper.R.drawable.glide_icon_error); error(com.ruiwenliu.wrapper.R.drawable.glide_icon_error);
TransformationUtil utils = new TransformationUtil(image); TransformationUtil utils = new TransformationUtil(image);
Glide.with(mContext) Glide.with(mContext)
.setDefaultRequestOptions(
new RequestOptions()
.frame(1000000)
.centerCrop()
)
.asBitmap() .asBitmap()
.load(body.getVideos().get(0).getOurl()) .load(body.getVideos().get(0).getOurl())
.apply(options) .apply(options)
......
package com.xxfc.discovery.other; package com.xxfc.discovery.other;
import android.app.DownloadManager; import android.app.DownloadManager;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
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.text.TextUtils;
...@@ -27,22 +21,23 @@ import android.widget.ImageView; ...@@ -27,22 +21,23 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.dueeeke.videoplayer.player.VideoView; import com.dueeeke.videoplayer.player.VideoView;
import com.frame.base.url.Constance; import com.dueeeke.videoplayer.widget.RotateVideoView;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.SPConstance;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.statusbar.StatusBarUtil; import com.ruiwenliu.wrapper.statusbar.StatusBarUtil;
import com.ruiwenliu.wrapper.util.TransformationUtil;
import com.ruiwenliu.wrapper.util.glide.GlideApp; import com.ruiwenliu.wrapper.util.glide.GlideApp;
import com.ruiwenliu.wrapper.util.glide.GlideManager; import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.ruiwenliu.wrapper.util.glide.GlideOptions;
import com.ruiwenliu.wrapper.util.um.CustomShareListener; import com.ruiwenliu.wrapper.util.um.CustomShareListener;
import com.ruiwenliu.wrapper.util.um.ShareManager; import com.ruiwenliu.wrapper.util.um.ShareManager;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.AlbumNotifyHelper;
import com.rv.component.utils.Cookie;
import com.rv.component.utils.IsAppInstall; import com.rv.component.utils.IsAppInstall;
import com.rv.component.utils.StorageUtils; import com.rv.component.utils.StorageUtils;
import com.umeng.socialize.bean.SHARE_MEDIA; import com.umeng.socialize.bean.SHARE_MEDIA;
...@@ -60,12 +55,6 @@ import com.xxfc.discovery.presenter.DiscoveryPresenter; ...@@ -60,12 +55,6 @@ import com.xxfc.discovery.presenter.DiscoveryPresenter;
import com.xxfc.discovery.widget.TikTokController; import com.xxfc.discovery.widget.TikTokController;
import com.yuyife.okgo.OkGoUtil; import com.yuyife.okgo.OkGoUtil;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
...@@ -113,6 +102,8 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i ...@@ -113,6 +102,8 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i
TextView tvVideoAddressName; TextView tvVideoAddressName;
@BindView(R2.id.tv_video_address) @BindView(R2.id.tv_video_address)
TextView tvVideoAddress; TextView tvVideoAddress;
// @BindView(R2.id.video_play)
// RotateVideoView mVideoView;
private VideoView mVideoView; private VideoView mVideoView;
...@@ -154,6 +145,7 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i ...@@ -154,6 +145,7 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i
dataBeanList = new ArrayList(); dataBeanList = new ArrayList();
mVideoView = new VideoView(this); mVideoView = new VideoView(this);
mVideoView.setLooping(true); mVideoView.setLooping(true);
mTikTokController = new TikTokController(this); mTikTokController = new TikTokController(this);
mVideoView.setVideoController(mTikTokController); mVideoView.setVideoController(mTikTokController);
...@@ -172,10 +164,22 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i ...@@ -172,10 +164,22 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i
tvVideoCommentAll.setText("全部评论" + dataBean.getCount().getComment() + "条"); tvVideoCommentAll.setText("全部评论" + dataBean.getCount().getComment() + "条");
if (dataBean.getBody() != null && dataBean.getBody().getImages() != null && dataBean.getBody().getImages().size() > 0) { if (dataBean.getBody() != null && dataBean.getBody().getImages() != null && dataBean.getBody().getImages().size() > 0) {
GlideOptions options = GlideOptions.placeholderOf(com.ruiwenliu.wrapper.R.drawable.glide_icon_placeholder).
error(com.ruiwenliu.wrapper.R.drawable.glide_icon_error);
TransformationUtil utils = new TransformationUtil(thumb);
GlideApp.with(mActivity) GlideApp.with(mActivity)
.setDefaultRequestOptions(
new RequestOptions()
.frame(1000000)
.centerCrop()
)
.asBitmap()
.load(dataBean.getBody().getImages().get(0).getOurl()) .load(dataBean.getBody().getImages().get(0).getOurl())
.apply(options)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(12)).override(thumb.getWidth(), thumb.getHeight()))
.placeholder(android.R.color.white) .placeholder(android.R.color.white)
.into(thumb); .into(utils);
} }
GlideManager.getInstance(mActivity).loadCircleImage(dataBean.getPicUrl(), ivVideoAvatar); GlideManager.getInstance(mActivity).loadCircleImage(dataBean.getPicUrl(), ivVideoAvatar);
...@@ -203,10 +207,22 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i ...@@ -203,10 +207,22 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i
private void startPlay() { private void startPlay() {
if (dataBean != null && dataBean.getBody() != null) { if (dataBean != null && dataBean.getBody() != null) {
if (dataBean.getBody().getVideos() != null && dataBean.getBody().getVideos().size() > 0) { if (dataBean.getBody().getVideos() != null && dataBean.getBody().getVideos().size() > 0) {
GlideApp.with(this)
GlideOptions options = GlideOptions.placeholderOf(com.ruiwenliu.wrapper.R.drawable.glide_icon_placeholder).
error(com.ruiwenliu.wrapper.R.drawable.glide_icon_error);
TransformationUtil utils = new TransformationUtil(mTikTokController.getThumb());
GlideApp.with(mActivity)
.setDefaultRequestOptions(
new RequestOptions()
.frame(1000000)
.centerCrop()
)
.asBitmap()
.load(dataBean.getBody().getVideos().get(0).getOurl()) .load(dataBean.getBody().getVideos().get(0).getOurl())
.apply(options)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(12)).override(mTikTokController.getThumb().getWidth(), mTikTokController.getThumb().getHeight()))
.placeholder(android.R.color.white) .placeholder(android.R.color.white)
.into(mTikTokController.getThumb()); .into(utils);
} }
ViewParent parent = mVideoView.getParent(); ViewParent parent = mVideoView.getParent();
...@@ -216,7 +232,7 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i ...@@ -216,7 +232,7 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i
container.addView(mVideoView); container.addView(mVideoView);
if (dataBean.getBody().getVideos() != null && dataBean.getBody().getVideos().size() > 0) { if (dataBean.getBody().getVideos() != null && dataBean.getBody().getVideos().size() > 0) {
mVideoView.setUrl(dataBean.getBody().getVideos().get(0).getOurl()); mVideoView.setUrl(dataBean.getBody().getVideos().get(0).getOurl());
mVideoView.setScreenScale(VideoView.SCREEN_SCALE_CENTER_CROP); mVideoView.setScreenScale(VideoView.SCREEN_SCALE_DEFAULT);
mVideoView.start(); mVideoView.start();
} }
} }
...@@ -327,12 +343,6 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i ...@@ -327,12 +343,6 @@ public class ShortVideoActivity extends BaseStatusActivity<DiscoveryPresenter> i
mVideoView.pause(); mVideoView.pause();
} }
@Override
public void onResume() {
super.onResume();
mVideoView.resume();
}
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
......
...@@ -18,10 +18,16 @@ ...@@ -18,10 +18,16 @@
<ImageView <ImageView
android:id="@+id/thumb" android:id="@+id/thumb"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:scaleType="centerCrop" /> android:scaleType="centerCrop"
android:layout_gravity="center_vertical" />
</FrameLayout> </FrameLayout>
<!--<com.dueeeke.videoplayer.widget.RotateVideoView-->
<!--android:id="@+id/video_play"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent" />-->
<RelativeLayout <RelativeLayout
android:id="@+id/rl_item_video" android:id="@+id/rl_item_video"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -151,7 +157,6 @@ ...@@ -151,7 +157,6 @@
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
<TextView <TextView
android:visibility="gone"
android:id="@+id/tv_video_address" android:id="@+id/tv_video_address"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -161,7 +166,8 @@ ...@@ -161,7 +166,8 @@
android:drawablePadding="@dimen/size_5" android:drawablePadding="@dimen/size_5"
android:text="" android:text=""
android:textColor="@color/colorWrite" android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" /> android:textSize="@dimen/text_10"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
......
<?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:orientation="vertical" android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/iv_thumb" android:id="@+id/iv_thumb"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:scaleType="centerCrop"/> android:scaleType="centerCrop" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -145,4 +145,9 @@ public class ApiConfig { ...@@ -145,4 +145,9 @@ public class ApiConfig {
* 检查token是否有效 * 检查token是否有效
*/ */
public static String HTTP_URL_GET_TOKEN = RvFrameConfig.HOST + "/api/auth/jwt/checkToken"; public static String HTTP_URL_GET_TOKEN = RvFrameConfig.HOST + "/api/auth/jwt/checkToken";
/**
* 获取新的token
*/
public static String HTTP_URL_GET_TOKEN_REFRESH = RvFrameConfig.HOST + "/api/auth/jwt/refresh";
} }
...@@ -17,6 +17,7 @@ import com.ruiwenliu.wrapper.presenter.MvpPresenter; ...@@ -17,6 +17,7 @@ import com.ruiwenliu.wrapper.presenter.MvpPresenter;
import com.ruiwenliu.wrapper.util.UtilsManager; import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.Cookie; import com.rv.component.utils.Cookie;
import com.rv.component.utils.DateUtils;
import com.rv.component.utils.LogUtil; import com.rv.component.utils.LogUtil;
import com.rv.home.R; import com.rv.home.R;
import com.rv.home.rv.module.ApiConfig; import com.rv.home.rv.module.ApiConfig;
...@@ -128,6 +129,8 @@ public abstract class BaseLoginActivity<P extends MvpPresenter> extends BaseStat ...@@ -128,6 +129,8 @@ public abstract class BaseLoginActivity<P extends MvpPresenter> extends BaseStat
Cookie.save(getApplicationContext(), SPConstance.USER_JSON_NAME, registeredBean.getData().getUsername()); Cookie.save(getApplicationContext(), SPConstance.USER_JSON_NAME, registeredBean.getData().getUsername());
Cookie.save(getApplicationContext(), SPConstance.USER_JSON_HEADERURL, registeredBean.getData().getHeaderurl()); Cookie.save(getApplicationContext(), SPConstance.USER_JSON_HEADERURL, registeredBean.getData().getHeaderurl());
Cookie.save(getApplicationContext(), SPConstance.USER_JSON_TOKEN, registeredBean.getToken()); Cookie.save(getApplicationContext(), SPConstance.USER_JSON_TOKEN, registeredBean.getToken());
Cookie.save(getApplicationContext(), SPConstance.USER_JSON_TOKE_TIME, DateUtils.getCurDate());
UtilsManager.getInstance(OkGoUtil.application).setSharePreferencesSave(SPConstance.USER_JSON).putString(SPConstance.USER_JSON_CODE, registeredBean.getData().getCode()).commit(); UtilsManager.getInstance(OkGoUtil.application).setSharePreferencesSave(SPConstance.USER_JSON).putString(SPConstance.USER_JSON_CODE, registeredBean.getData().getCode()).commit();
UtilsManager.getInstance(OkGoUtil.application).setSharePreferencesSave(SPConstance.USER_JSON).putString(SPConstance.USER_JSON_NAME, registeredBean.getData().getUsername()).commit(); UtilsManager.getInstance(OkGoUtil.application).setSharePreferencesSave(SPConstance.USER_JSON).putString(SPConstance.USER_JSON_NAME, registeredBean.getData().getUsername()).commit();
UtilsManager.getInstance(OkGoUtil.application).setSharePreferencesSave(SPConstance.USER_JSON).putString(SPConstance.USER_JSON_HEADERURL, registeredBean.getData().getHeaderurl()).commit(); UtilsManager.getInstance(OkGoUtil.application).setSharePreferencesSave(SPConstance.USER_JSON).putString(SPConstance.USER_JSON_HEADERURL, registeredBean.getData().getHeaderurl()).commit();
...@@ -142,7 +145,7 @@ public abstract class BaseLoginActivity<P extends MvpPresenter> extends BaseStat ...@@ -142,7 +145,7 @@ public abstract class BaseLoginActivity<P extends MvpPresenter> extends BaseStat
headMap.put("Authorization", registeredBean.getToken()); headMap.put("Authorization", registeredBean.getToken());
mPresenter.getDataHead(RvFrameConfig.ADMIN_POST, 10, ApiConfig.HTTP_URL_APP_USER_INFO, BeanUserInfo.class, headMap, false); mPresenter.getDataHead(RvFrameConfig.ADMIN_POST, 10, ApiConfig.HTTP_URL_APP_USER_INFO, BeanUserInfo.class, headMap, false);
} }
OkGoUtil.setToken(registeredBean.getToken()); OkGoUtil.setToken(registeredBean.getToken(), DateUtils.getCurDate());
// switch (RvFrameConfig.RvFrameInfo.TYPE_LOGIN) { // switch (RvFrameConfig.RvFrameInfo.TYPE_LOGIN) {
// case 1: // case 1:
// if ("0".equals(bean.getData().getCertificationStatus())) { //实名认证状态:0-未认证,1-已认证 // if ("0".equals(bean.getData().getCertificationStatus())) { //实名认证状态:0-未认证,1-已认证
......
...@@ -49,6 +49,7 @@ import com.ruiwenliu.wrapper.base.presenter.CommonPresenter; ...@@ -49,6 +49,7 @@ import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.login.LoginRvActivity; import com.rv.home.rv.module.ui.login.LoginRvActivity;
import com.rv.home.rv.module.ui.main.home.bean.CarTypeListBean; import com.rv.home.rv.module.ui.main.home.bean.CarTypeListBean;
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.OrderPriceBean;
import com.umeng.socialize.UMShareAPI; import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA; import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.shareboard.SnsPlatform; import com.umeng.socialize.shareboard.SnsPlatform;
...@@ -128,7 +129,7 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -128,7 +129,7 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> {
.subscribe(new Observer<IDCardCertificationEvent>(disposable) { .subscribe(new Observer<IDCardCertificationEvent>(disposable) {
@Override @Override
public void onNext(IDCardCertificationEvent event) { public void onNext(IDCardCertificationEvent event) {
startActivity(ConfirmOrderActivity.getIntent(mActivity, dataBean, mCarBean, getIntent().getStringExtra("startTime"), getIntent().getStringExtra("endTime"))); getOrderPrice();
} }
}); });
...@@ -174,6 +175,10 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -174,6 +175,10 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> {
case 0: case 0:
userInfoData((UserInfoBean) result); userInfoData((UserInfoBean) result);
break; break;
case 1:
OrderPriceBean priceBean = (OrderPriceBean) result;
startActivity(ConfirmOrderActivity.getIntent(mActivity, dataBean, mCarBean, getIntent().getStringExtra("startTime"), getIntent().getStringExtra("endTime"), priceBean));
break;
} }
} }
...@@ -224,7 +229,7 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -224,7 +229,7 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> {
super.onNewIntent(intent); super.onNewIntent(intent);
int type = intent.getIntExtra("type", 0); int type = intent.getIntExtra("type", 0);
if (type == 1) { if (type == 1) {
startActivity(ConfirmOrderActivity.getIntent(mActivity, dataBean, mCarBean, getIntent().getStringExtra("startTime"), getIntent().getStringExtra("endTime"))); getOrderPrice();
finish(); finish();
} }
} }
...@@ -263,17 +268,35 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -263,17 +268,35 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> {
startActivity(LoginRvActivity.getIntent(mActivity, 0)); startActivity(LoginRvActivity.getIntent(mActivity, 0));
return; return;
} }
// BeanUserInfo.UserInfo userInfo = getUserInfo(); BeanUserInfo.UserInfo userInfo = getUserInfo();
// if (userInfo != null) { if (userInfo != null) {
// if (userInfo.getCertificationStatus() == 0) { if (userInfo.getCertificationStatus() == 0) {
// ARouter.getInstance().build(Constance.ACTIVITY_URL_IDCARDCERTIFICATION).navigation(); ARouter.getInstance().build(Constance.ACTIVITY_URL_IDCARDCERTIFICATION).navigation();
// return; return;
// } }
// } }
startActivity(ConfirmOrderActivity.getIntent(mActivity, dataBean, mCarBean, getIntent().getStringExtra("startTime"), getIntent().getStringExtra("endTime")));
getOrderPrice();
} }
} }
/**
* 获得订单价格
*/
private void getOrderPrice() {
Map<String, Object> headMap = new LinkedHashMap<>();
if (OkGoUtil.getToken() != null)
headMap.put("Authorization", OkGoUtil.getToken());
Map<String, Object> map = new LinkedHashMap<>();
map.put("driverType", 1);
map.put("modelId", dataBean.getModelId());
map.put("startTime", dataBean.getStartTime());
map.put("endTime", dataBean.getEndTime());
map.put("dayNum", dataBean.getDayNum());
mPresenter.getData(RvFrameConfig.VEHICLE_ORDER, 1, ApiConfig.HTTP_URL_GET_ORDER_PRICE, OrderPriceBean.class, map, headMap, true);
}
//添加收藏 //添加收藏
private void addCollection() { private void addCollection() {
......
package com.rv.home.rv.module.ui.main.home;
import android.Manifest;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.TimePicker;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.mapapi.model.LatLng;
import com.frame.rv.config.RvFrameConfig;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.util.LocationManager;
import com.ruiwenliu.wrapper.util.TimeManager;
import com.rv.home.R;
import com.rv.home.R2;
import com.ruiwenliu.wrapper.inter.OnViewHolder;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.util.ViewHolder;
import com.ruiwenliu.wrapper.util.permission.RxPermission;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.home.rv.module.ApiConfig;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.main.home.adapter.HotCarTypeAdapter;
import com.rv.home.rv.module.ui.main.home.bean.CityPickerBean;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderDataBean;
import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.functions.Consumer;
/**
* Created :Auser
* Date: 2019/5/17.
* Desc:租车首页
*/
public class CarRentalActivity extends BaseStatusActivity<CommonPresenter> {
@BindView(R2.id.recyclerView)
RecyclerView recyclerView;
@BindView(R2.id.iv_top)
ImageView ivTop;
private HotCarTypeAdapter mAdapter;
private Map<String, Integer> mapGetTime;
private Map<String, Integer> mapOutTime;
private TextView headTvGetCity;//获取出发城市
private TextView headTvOutCity;//获取还车城市
private TextView headTvGetShop;//获取出发门店地址
private TextView headTvOutShop;//获取还车门店地址
private final int TYPE_REQUEST_CITY = 1;//城市列表
private final int TYPE_REQUEST_SHOP = 2;//门店列表
private final int TYPE_REQUEST_ADDRESS = 3;//地址选择
private LocationManager locationManager;
private String nowCity = "";
private int getSwitchType;//取车开关类型
private int outSwitchType;//还车开关类型
private double latLatitude = 0;
private double lonLongitude;
private LatLng mLatLng;//当前城市经纬度
private double outLatitude = 0;
private double outLongitude;
private int getCityId;//取车城市ID
private int outCityId;//还车城市ID
private OrderDataBean dataBean;
private int copyDay=2;//租车天数
public static Intent getIntent(Context context) {
return new Intent(context, CarRentalActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
};
@Override
protected int setLayout() {
return R.layout.rv_act_car_rental;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
showTitle(false);
permissionProcess();
mAdapter = new HotCarTypeAdapter();
recyclerView.setLayoutManager(new GridLayoutManager(mActivity, 2));
recyclerView.setAdapter(mAdapter);
recyclerView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE:
ivTop.setVisibility(View.GONE);
break;
case MotionEvent.ACTION_UP:
ivTop.setVisibility(View.VISIBLE);
break;
}
return false;
}
});
getData();
}
@Override
protected void loadData(Bundle savedInstanceState, Intent intent) {
}
@Override
public void onShowResult(int requestType, BaseBean result) {
processData((ShopListBean) result);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
int type = data.getIntExtra("type", 1);
String requestData = data.getStringExtra("location");
switch (requestCode) {
case TYPE_REQUEST_CITY://城市列表
if (type == 1) {
headTvGetShop.setText("");
getCityId = data.getIntExtra("id", 0);
} else {
headTvOutShop.setText("");
outCityId = data.getIntExtra("id", 0);
}
setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0);
break;
case TYPE_REQUEST_SHOP://门店
setRequestData(type, requestData, headTvGetShop, headTvOutShop, 0, 0);
break;
case TYPE_REQUEST_ADDRESS://地址
double lat = data.getDoubleExtra("latitude", 0);
double lon = data.getDoubleExtra("longitude", 0);
setRequestData(type, requestData, headTvGetShop, headTvOutShop, lat, lon);
break;
}
}
}
@OnClick(R2.id.iv_top)
public void onViewClicked() {
if (recyclerView != null && mAdapter != null) {
recyclerView.scrollToPosition(0);
}
}
/**
* 设置返回结果参数
* @param type
* @param data
* @param tvGet
* @param tvOut
* @param lat
* @param lon
*/
private void setRequestData(int type, String data, TextView tvGet, TextView tvOut, double lat, double lon) {
if (tvGet == null) {
return;
}
switch (type) {
case 1:
latLatitude = lat;
lonLongitude = lon;
tvGet.setText(data);
break;
case 2:
outLatitude = lat;
outLongitude = lon;
tvOut.setText(data);
break;
}
}
/**
* 获取门店列表
*/
private void getShopList(double lat, double lon) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("page", 1);
map.put("limit", 1);
map.put("lat", lat);
map.put("lon", lon);
mPresenter.getData(RvFrameConfig.VEHICLE_POST, 0, ApiConfig.HTTP_URL_SHOP_LIST, ShopListBean.class, map, true);
}
/**
* 处理最近门店请求结果
* @param bean
*/
private void processData(ShopListBean bean) {
if (bean.getData().getTotalCount() > 0) {
if (headTvGetShop != null && TextUtils.isEmpty(headTvGetShop.getText().toString().trim())) {
headTvGetShop.setText(bean.getData().getData().get(0).getName());
latLatitude = bean.getData().getData().get(0).getLatitude();
lonLongitude = bean.getData().getData().get(0).getLongitude();
}
if (headTvOutShop != null && TextUtils.isEmpty(headTvOutShop.getText().toString().trim())) {
headTvOutShop.setText(bean.getData().getData().get(0).getName());
outLatitude = bean.getData().getData().get(0).getLatitude();
outLongitude = bean.getData().getData().get(0).getLongitude();
}
}
}
private void getData() {
mAdapter.addHeaderView(getHeadView());
List<String> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
list.add("东莞松山湖欣新房车总店" + i);
}
// mAdapter.setNewData(list);
}
/**
* 获取头部View
*
* @return
*/
private View getHeadView() {
return getHelperView(recyclerView, R.layout.rv_head_car_rental, new OnViewHolder() {
@Override
public void helper(ViewHolder helper) {
headTvGetCity = helper.getView(R.id.tv_get_city);
headTvOutCity = helper.getView(R.id.tv_out_city);
headTvGetShop = helper.getView(R.id.tv_get_address);
headTvOutShop = helper.getView(R.id.tv_out_address);
final TextView tvGetTime = helper.getView(R.id.tv_get_time);
final TextView tvGetWeek = helper.getView(R.id.tv_get_week);
final TextView tvOutTime = helper.getView(R.id.tv_out_time);
final TextView tvOutWeek = helper.getView(R.id.tv_out_week);
final TextView tvGetDay = helper.getView(R.id.tv_day);
final CheckBox checkBox = helper.getView(R.id.check_driver);
Switch shGet = helper.getView(R.id.switch_get);
initTime(tvGetTime, tvOutTime);
tvGetDay.setText(String.format("%1$s%2$s", copyDay, mActivity.getString(R.string.rv_days)));
shGet.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
getSwitchType = 1;
} else {
getSwitchType = 0;
}
headTvGetShop.setText("");
}
});
Switch shOut = helper.getView(R.id.switch_out);
shOut.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
outSwitchType = 1;
} else {
outSwitchType = 0;
}
headTvOutShop.setText("");
}
});
helper.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(v.getId()==R.id.iv_back){
finish();
}else if(v.getId()==R.id.tv_get_city){
// startActivityForResult(CityListActivity.getIntent(mActivity, 1, headTvGetCity.getText().toString().trim(), getCityId), TYPE_REQUEST_CITY);
}else if(v.getId()==R.id.tv_out_city){
// startActivityForResult(CityListActivity.getIntent(mActivity, 2, headTvOutCity.getText().toString().trim(), outCityId), TYPE_REQUEST_CITY);
}else if(v.getId()==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(mActivity, 1, getCity, latLatitude, lonLongitude, nowCity,0), TYPE_REQUEST_ADDRESS);
// }
}else if(v.getId()==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(mActivity, 2, outCity, outLatitude, outLongitude, nowCity,0), TYPE_REQUEST_ADDRESS);
// }
}else if(v.getId()==R.id.tv_get_time){
if (mapGetTime == null) {
return;
}
showDatePicker(mapGetTime.get("year"), mapGetTime.get("month"), mapGetTime.get("day"), mapGetTime.get("hour"), mapGetTime.get("minute"), tvGetTime, tvGetWeek, mapGetTime, tvGetDay);
}else if(v.getId()==R.id.tv_out_time){
if (mapOutTime == null) {
return;
}
showDatePicker(mapOutTime.get("year"), mapOutTime.get("month"), mapOutTime.get("day"), mapOutTime.get("hour"), mapOutTime.get("minute"), tvOutTime, tvOutWeek, mapOutTime, tvGetDay);
}else if(v.getId()==R.id.tv_select){
if (mapGetTime.size() > 0 && mapOutTime.size() > 0) {
String getTime = String.format("%1$s-%2$s-%3$s", mapGetTime.get("year"), mapGetTime.get("month") < 10 ? "0" + mapGetTime.get("month") : mapGetTime.get("month"), mapGetTime.get("day") < 10 ? "0" + mapGetTime.get("day") : mapGetTime.get("day"));
String outTime = String.format("%1$s-%2$s-%3$s", mapOutTime.get("year"), mapOutTime.get("month") < 10 ? "0" + mapOutTime.get("month") : mapOutTime.get("month"), mapOutTime.get("day") < 10 ? "0" + mapOutTime.get("day") : mapOutTime.get("day"));
if (copyDay < 0) {
showToast(mActivity.getString(R.string.rv_day_toast));
return;
}
sendData(headTvGetCity.getText().toString().trim(),
headTvGetShop.getText().toString().trim(),
headTvOutCity.getText().toString().trim(),
headTvOutShop.getText().toString().trim(),
getTime, outTime, copyDay, checkBox.isChecked(),
tvGetTime.getText().toString().trim(),
tvOutTime.getText().toString().trim()
);
}
}
// switch (v.getId()) {
// case R.id.iv_back:
// finish();
// break;
// case R.id.tv_get_city://获取取车城市
// startActivityForResult(CityListActivity.getIntent(mActivity, 1, headTvGetCity.getText().toString().trim(), getCityId), TYPE_REQUEST_CITY);
// break;
// case R.id.tv_out_city://获取还车城市
// startActivityForResult(CityListActivity.getIntent(mActivity, 2, headTvOutCity.getText().toString().trim(), outCityId), TYPE_REQUEST_CITY);
// break;
// case 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(mActivity, 1, getCity, latLatitude, lonLongitude, nowCity), TYPE_REQUEST_ADDRESS);
//// }
//
// break;
// case 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(mActivity, 2, outCity, outLatitude, outLongitude, nowCity), TYPE_REQUEST_ADDRESS);
//// }
// break;
// case R.id.tv_get_time://获取取车时间
// if (mapGetTime == null) {
// return;
// }
// showDatePicker(mapGetTime.get("year"), mapGetTime.get("month"), mapGetTime.get("day"), mapGetTime.get("hour"), mapGetTime.get("minute"), tvGetTime, tvGetWeek, mapGetTime, tvGetDay);
// break;
// case R.id.tv_out_time://获取还车时间
// if (mapOutTime == null) {
// return;
// }
// showDatePicker(mapOutTime.get("year"), mapOutTime.get("month"), mapOutTime.get("day"), mapOutTime.get("hour"), mapOutTime.get("minute"), tvOutTime, tvOutWeek, mapOutTime, tvGetDay);
// break;
// case R.id.tv_select://选择车型
// if (mapGetTime.size() > 0 && mapOutTime.size() > 0) {
// String getTime = String.format("%1$s-%2$s-%3$s", mapGetTime.get("year"), mapGetTime.get("month") < 10 ? "0" + mapGetTime.get("month") : mapGetTime.get("month"), mapGetTime.get("day") < 10 ? "0" + mapGetTime.get("day") : mapGetTime.get("day"));
// String outTime = String.format("%1$s-%2$s-%3$s", mapOutTime.get("year"), mapOutTime.get("month") < 10 ? "0" + mapOutTime.get("month") : mapOutTime.get("month"), mapOutTime.get("day") < 10 ? "0" + mapOutTime.get("day") : mapOutTime.get("day"));
// if (copyDay < 0) {
// showToast(mActivity.getString(R.string.rv_day_toast));
// return;
// }
// sendData(headTvGetCity.getText().toString().trim(),
// headTvGetShop.getText().toString().trim(),
// headTvOutCity.getText().toString().trim(),
// headTvOutShop.getText().toString().trim(),
// getTime, outTime, copyDay, checkBox.isChecked(),
// tvGetTime.getText().toString().trim(),
// tvOutTime.getText().toString().trim()
// );
//
// }
// break;
//
// }
}
}, R.id.iv_back, R.id.tv_get_city, R.id.tv_out_city, R.id.tv_get_address, R.id.tv_out_address, R.id.tv_get_time, R.id.tv_out_time, R.id.tv_select);
}
});
}
/**
* 初始化定位
*/
public void initGps() {
locationManager = new LocationManager(this);
locationManager.getLocationDetail(new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation location) {
//此处的BDLocation为定位结果信息类,通过它的各种get方法可获取定位相关的全部结果
//以下只列举部分获取经纬度相关(常用)的结果信息
//更多结果信息获取说明,请参照类参考中BDLocation类中的说明
//获取定位精度,默认值为0.0f
float radius = location.getRadius();
//获取经纬度坐标类型,以LocationClientOption中设置过的坐标类型为准
String coorType = location.getCoorType();
//获取定位类型、定位错误返回码,具体信息可参照类参考中BDLocation类中的说明
int errorCode = location.getLocType();
// setGpsContent("count=:",String.valueOf(count));
// setGpsContent("latitude:",String.valueOf(location.getLatitude()));
// setGpsContent("longitude:",String.valueOf(location.getLongitude()));
// setGpsContent("城市:",location.getCity());
// setGpsContent("街道:",location.getAddrStr());
// setGpsContent("当前位置:",location.getLocationDescribe());
latLatitude=location.getLatitude();
lonLongitude=location.getLongitude();
mLatLng = new LatLng(location.getLatitude(), location.getLongitude());
getShopList(mLatLng.latitude, mLatLng.longitude);
headTvGetCity.setText(location.getCity());
headTvOutCity.setText(location.getCity());
nowCity = location.getCity();
locationManager.stopLocation();
}
});
}
/**
* 初始化时间进程
*/
private void initTime(TextView tvGetTime, TextView tvOutTime) {
Calendar cal = Calendar.getInstance();
if (mapGetTime == null) {
mapGetTime = new LinkedHashMap<>();
}
mapGetTime.put("year", cal.get(Calendar.YEAR));
mapGetTime.put("month", cal.get(Calendar.MONTH) + 1);
mapGetTime.put("day", cal.get(Calendar.DAY_OF_MONTH));
mapGetTime.put("hour", cal.get(Calendar.HOUR));
mapGetTime.put("minute", cal.get(Calendar.MINUTE));
if (mapOutTime == null) {
mapOutTime = new LinkedHashMap<>();
}
String[] timeGroup = TimeManager.getAfterDay(2).split("-");
mapOutTime.put("year", Integer.valueOf(timeGroup[0]));
mapOutTime.put("month", Integer.valueOf(timeGroup[1]));
mapOutTime.put("day", Integer.valueOf(timeGroup[2]));
mapOutTime.put("hour", cal.get(Calendar.HOUR));
mapOutTime.put("minute", cal.get(Calendar.MINUTE));
tvGetTime.setText(String.format("%1$s-%2$s-%3$s %4$s:%5$s", mapGetTime.get("year"), mapGetTime.get("month"), mapGetTime.get("day"), mapGetTime.get("hour"), mapGetTime.get("minute")));
tvOutTime.setText(String.format("%1$s-%2$s-%3$s %4$s:%5$s", mapOutTime.get("year"), mapOutTime.get("month"), mapOutTime.get("day"), mapOutTime.get("hour"), mapOutTime.get("minute")));
}
/**
* 获取进程天数
*
* @param tvDay
*/
private void getTimeDay(TextView tvDay) {
if (mapGetTime != null && mapOutTime != null) {
copyDay = TimeManager.getDays(String.format("%1$s-%2$s-%3$s", mapGetTime.get("year"), mapGetTime.get("month"), mapGetTime.get("day"))
, String.format("%1$s-%2$s-%3$s", mapOutTime.get("year"), mapOutTime.get("month"), mapOutTime.get("day")));
tvDay.setText(String.format("%1$s%2$s", copyDay, mActivity.getString(R.string.rv_days)));
}
}
/**
* 展示日历弹窗
*
* @param newYear
* @param newMonth
* @param newDay
* @param tvTime
*/
private void showDatePicker(int newYear, int newMonth, int newDay, final int newHour, final int newMinute, final TextView tvTime, final TextView tvWeek, final Map<String, Integer> map, final TextView tvDay) {
if (tvTime == null) {
return;
}
//实例化日期选择器悬浮窗
//参数1:上下文对象
//参数2:监听事件
//参数3:初始化年份
//参数4:初始化月份
//参数5:初始化日期
new DatePickerDialog(mActivity, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
map.clear();
map.put("year", year);
map.put("month", month + 1);
map.put("day", dayOfMonth);
tvTime.setText("");
tvWeek.setText("");
String tvMonth = month < 10 ? "0" + month : "" + month;
String tvDays = month < 10 ? "0" + dayOfMonth : "" + dayOfMonth;
tvTime.append("" + year + "-" + tvMonth + "-" + tvDays + " ");
showTimeDialog(newHour, newMinute, tvTime, map);
getTimeDay(tvDay);
}
}, newYear, newMonth - 1,
newDay).show();
}
/**
* 展示时间弹窗
* //实例化时间选择器
* //参数1:上下文对象
* //参数2:监听事件
* //参数3:初始化小时
* //参数4:初始化分钟
* //参数5:是否24小时制
*/
private void showTimeDialog(int hour, int minute, final TextView tvTime, final Map<String, Integer> map) {
new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {
//实现监听方法
@Override
public void onTimeSet(TimePicker timePicker, int i, int i1) {
map.put("hour", i);
map.put("minute", i1);
//设置文本显示内容
tvTime.append("" + i + ":" + i1);
}
}, hour, minute, true).show();//记得使用show才能显示!
}
/**
* 定位权限处理
*/
private void permissionProcess() {
/**
* 6.0以上手机做权限处理
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
new RxPermission(mActivity).request(
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
).subscribe(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
if (aBoolean == true) {
initGps();
}else {
finish();
}
}
});
} else {
initGps();
}
}
/**
* 传参
* @param starCity
* @param starAddress
* @param endCity
* @param endAddress
* @param getTime
* @param outTime
* @param day
* @param checkBox
* @param startTime
* @param endTime
*/
private void sendData(String starCity, String starAddress, String endCity, String endAddress, String getTime, String outTime, int day, boolean checkBox, String startTime, String endTime) {
if (dataBean == null) {
dataBean = new OrderDataBean();
}
if (getCityId > 0 && outCityId > 0) {
dataBean.setEndCity(outCityId);
dataBean.setStartCity(getCityId);
} else {
String json = UtilsManager.getInstance().getJson(this, "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
for (ListsBean lsBean : cityBean.getLists()) {
if (starCity.equals(lsBean.getName())) {
dataBean.setStartCity(lsBean.getId());
}
if (endCity.equals(lsBean.getName())) {
dataBean.setEndCity(lsBean.getId());
}
}
}
}
dataBean.setDayNum(day);
dataBean.setStartCityName(starCity);
dataBean.setStartAddr(starAddress);
try {
dataBean.setStartTime(TimeManager.dateToStamp(getTime));
dataBean.setEndTime(TimeManager.dateToStamp(outTime));
} catch (ParseException e) {
e.printStackTrace();
}
dataBean.setEndCityName(endCity);
dataBean.setEndAddr(endAddress);
dataBean.setDriverType(checkBox == true ? 1 : 2);
// startActivity(CarRentalListActivity.getIntent(mActivity, latLatitude, lonLongitude, checkBox, dataBean, startTime, endTime));
}
}
...@@ -72,6 +72,7 @@ import com.xxrv.coupon.api.CouponApi; ...@@ -72,6 +72,7 @@ import com.xxrv.coupon.api.CouponApi;
import com.xxrv.coupon.bean.CarCouponBean; import com.xxrv.coupon.bean.CarCouponBean;
import com.yuyife.okgo.OkGoUtil; import com.yuyife.okgo.OkGoUtil;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -190,12 +191,13 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -190,12 +191,13 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
private List<CarCouponBean.DataBean.CarCouponTypeDataBean.CarCouponDataBean> selectCouponList = null; private List<CarCouponBean.DataBean.CarCouponTypeDataBean.CarCouponDataBean> selectCouponList = null;
private OrderMemberBean.DataBean memberData; private OrderMemberBean.DataBean memberData;
public static Intent getIntent(Context context, OrderDataBean bean, CarTypeListBean.DataBeanX.DataBean carBean, String startTime, String endTime) { public static Intent getIntent(Context context, OrderDataBean bean, CarTypeListBean.DataBeanX.DataBean carBean, String startTime, String endTime, OrderPriceBean beanPrice) {
return new Intent(context, ConfirmOrderActivity.class) return new Intent(context, ConfirmOrderActivity.class)
.putExtra("bean", bean) .putExtra("bean", bean)
.putExtra("carBean", carBean) .putExtra("carBean", carBean)
.putExtra("startTime", startTime) .putExtra("startTime", startTime)
.putExtra("endTime", endTime); .putExtra("endTime", endTime)
.putExtra("priceBean", beanPrice);
} }
@Override @Override
...@@ -209,6 +211,7 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -209,6 +211,7 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
api = WXAPIFactory.createWXAPI(this, RvFrameConfig.APP_ID); api = WXAPIFactory.createWXAPI(this, RvFrameConfig.APP_ID);
dataBean = (OrderDataBean) intent.getSerializableExtra("bean"); dataBean = (OrderDataBean) intent.getSerializableExtra("bean");
mCarBean = (CarTypeListBean.DataBeanX.DataBean) intent.getSerializableExtra("carBean"); mCarBean = (CarTypeListBean.DataBeanX.DataBean) intent.getSerializableExtra("carBean");
priceBean = (OrderPriceBean) intent.getSerializableExtra("priceBean");
intiView(); intiView();
initRxBus(); initRxBus();
...@@ -285,14 +288,7 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -285,14 +288,7 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
public void onShowResult(int requestType, BaseBean result) { public void onShowResult(int requestType, BaseBean result) {
switch (requestType) { switch (requestType) {
case 0: case 0:
priceBean = (OrderPriceBean) result; // priceBean = (OrderPriceBean) result;
if (priceBean.getData() != null) {
tvXinDrivingPrice.setText(String.format("(¥%1$s%2$s", priceBean.getData().getDriverPrice(), "/天)"));
tvCarNotHurtMoney.setText(String.format("¥%1$s%2$s", priceBean.getData().getDamageSafePrice(), "/天"));
tvDeposit.setText(String.format("¥%1$s%2$s", priceBean.getData().getDeposit(), mActivity.getString(R.string.rv_rb)));
// orderPriceDetailBean = new Gson().fromJson(priceBean.getData().getCostDetail(), OrderPriceDetailBean.class);
getPayMoney();
}
break; break;
case 1: case 1:
ConfirmOrderBean orderBean = (ConfirmOrderBean) result; ConfirmOrderBean orderBean = (ConfirmOrderBean) result;
...@@ -316,7 +312,8 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -316,7 +312,8 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
mCarBean.getVehicleModel().setMember(orderMemberBean.getData()); mCarBean.getVehicleModel().setMember(orderMemberBean.getData());
} }
intiView(); intiView();
getOrderPrice(); getPayMoney();
// getOrderPrice();
break; break;
} }
} }
...@@ -667,6 +664,14 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -667,6 +664,14 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
tvFreeCarDays.setText("(剩余" + memberData.getRentFreeDays() + "天)"); tvFreeCarDays.setText("(剩余" + memberData.getRentFreeDays() + "天)");
} }
if (priceBean.getData() != null) {
tvXinDrivingPrice.setText(String.format("(¥%1$s%2$s", priceBean.getData().getDriverPrice(), "/天)"));
tvCarNotHurtMoney.setText(String.format("¥%1$s%2$s", priceBean.getData().getDamageSafePrice(), "/天"));
tvDeposit.setText(String.format("¥%1$s%2$s", priceBean.getData().getDeposit(), mActivity.getString(R.string.rv_rb)));
// orderPriceDetailBean = new Gson().fromJson(priceBean.getData().getCostDetail(), OrderPriceDetailBean.class);
}
swbtnMember.setOnTouchListener(new View.OnTouchListener() { swbtnMember.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
......
...@@ -8,6 +8,9 @@ import android.support.v7.widget.RecyclerView; ...@@ -8,6 +8,9 @@ import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer;
import com.frame.base.bus.RxBus;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
...@@ -25,6 +28,8 @@ import java.util.LinkedHashMap; ...@@ -25,6 +28,8 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
public class DrivingListActivity extends BaseStatusActivity<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener { public class DrivingListActivity extends BaseStatusActivity<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener {
@BindView(R2.id.recyclerView) @BindView(R2.id.recyclerView)
...@@ -93,6 +98,20 @@ public class DrivingListActivity extends BaseStatusActivity<CommonPresenter> imp ...@@ -93,6 +98,20 @@ public class DrivingListActivity extends BaseStatusActivity<CommonPresenter> imp
} }
} }
}); });
initRxBus();
}
private void initRxBus() {
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
onRefresh();
}
});
} }
......
...@@ -92,91 +92,91 @@ import io.reactivex.functions.Consumer; ...@@ -92,91 +92,91 @@ import io.reactivex.functions.Consumer;
*/ */
public class HomeFragment extends BaseFragment<HomePresenter> implements ObservableScrollView.ScrollViewListener, SimpleRefreshLayout.OnSimpleRefreshListener { public class HomeFragment extends BaseFragment<HomePresenter> implements ObservableScrollView.ScrollViewListener, SimpleRefreshLayout.OnSimpleRefreshListener {
Unbinder unbinder; Unbinder unbinder;
@BindView(R2.id.ll_layout_renting_a_car) @BindView(R2.id.ll_layout_home_renting_a_car)
LinearLayout llLayoutRentingACar; LinearLayout llLayoutRentingACar;
@BindView(R2.id.ll_layout_rv_tour) @BindView(R2.id.ll_layout_home_rv_tour)
LinearLayout llLayoutRvTour; LinearLayout llLayoutRvTour;
@BindView(R2.id.mine_banner) @BindView(R2.id.home_banner)
Banner mineBanner; Banner mineBanner;
@BindView(R2.id.tv_item_rv_tour) @BindView(R2.id.tv_item_home_rv_tour)
TextView tvItemRvTour; TextView tvItemRvTour;
@BindView(R2.id.tv_item_renting_a_car) @BindView(R2.id.tv_item_home_renting_a_car)
TextView tvItemRentingACar; TextView tvItemRentingACar;
@BindView(R2.id.tv_get_address) @BindView(R2.id.tv_home_get_address)
TextView headTvGetShop; TextView headTvGetShop;
@BindView(R2.id.tv_out_address) @BindView(R2.id.tv_home_out_address)
TextView headTvOutShop; TextView headTvOutShop;
@BindView(R2.id.tv_get_time) @BindView(R2.id.tv_home_get_time)
TextView tvGetTime; TextView tvGetTime;
@BindView(R2.id.tv_get_week) @BindView(R2.id.tv_home_get_week)
TextView tvGetWeek; TextView tvGetWeek;
@BindView(R2.id.tv_day) @BindView(R2.id.tv_home_day)
TextView tvDay; TextView tvDay;
@BindView(R2.id.tv_out_time) @BindView(R2.id.tv_home_out_time)
TextView tvOutTime; TextView tvOutTime;
@BindView(R2.id.tv_out_week) @BindView(R2.id.tv_home_out_week)
TextView tvOutWeek; TextView tvOutWeek;
@BindView(R2.id.recyclerView_content) @BindView(R2.id.recyclerView_home_content)
RecyclerView recyclerViewContent; RecyclerView recyclerViewContent;
@BindView(R2.id.recyclerView_activity) @BindView(R2.id.recyclerView_home_activity)
RecyclerView recyclerViewActivity; RecyclerView recyclerViewActivity;
@BindView(R2.id.recyclerView_rvtourlist) @BindView(R2.id.recyclerView_home_rvtourlist)
RecyclerView recyclerViewRvtourlist; RecyclerView recyclerViewRvtourlist;
@BindView(R2.id.recyclerView_rvtourlist_title) @BindView(R2.id.recyclerView_home_rvtourlist_title)
RecyclerView recyclerViewRvtourlistTitle; RecyclerView recyclerViewRvtourlistTitle;
@BindView(R2.id.recyclerView_rv_enthusiast) @BindView(R2.id.recyclerView_home_rv_enthusiast)
RecyclerView recyclerViewRvEnthusiast; RecyclerView recyclerViewRvEnthusiast;
@BindView(R2.id.travel_city_text) @BindView(R2.id.tv_home_travel_city_text)
TextView travelCityText; TextView travelCityText;
@BindView(R2.id.travel_city_layout) @BindView(R2.id.tv_home_travel_city_layout)
LinearLayout travelCityLayout; LinearLayout travelCityLayout;
@BindView(R2.id.search_input) @BindView(R2.id.tv_home_search_input)
TextView searchInput; TextView searchInput;
@BindView(R2.id.travel_server_image) @BindView(R2.id.iv_home_travel_server_image)
ImageView travelServerImage; ImageView travelServerImage;
@BindView(R2.id.tv_rv_city) @BindView(R2.id.tv_home_rv_city)
TextView tvRvCity; TextView tvRvCity;
@BindView(R2.id.tv_rv_hot_label1) @BindView(R2.id.tv_home_rv_hot_label1)
TextView tvRvHotLabel1; TextView tvRvHotLabel1;
@BindView(R2.id.tv_rv_hot_label2) @BindView(R2.id.tv_home_rv_hot_label2)
TextView tvRvHotLabel2; TextView tvRvHotLabel2;
@BindView(R2.id.tv_rv_hot_label3) @BindView(R2.id.tv_home_rv_hot_label3)
TextView tvRvHotLabel3; TextView tvRvHotLabel3;
@BindView(R2.id.tv_hot_rvtour) @BindView(R2.id.tv_home_hot_rvtour)
TextView tvHotRvtour; TextView tvHotRvtour;
@BindView(R2.id.tv_hot_entertainment_camp) @BindView(R2.id.tv_home_hot_entertainment_camp)
TextView tvHotEntertainmentCamp; TextView tvHotEntertainmentCamp;
@BindView(R2.id.tv_hot_car_rental) @BindView(R2.id.tv_home_hot_car_rental)
TextView tvHotCarRental; TextView tvHotCarRental;
@BindView(R2.id.tv_see_more_popular) @BindView(R2.id.tv_home_see_more_popular)
TextView tvSeeMorePopular; TextView tvSeeMorePopular;
@BindView(R2.id.rl_item_layout) @BindView(R2.id.rl_home_item_layout)
RelativeLayout rlItemLayout; RelativeLayout rlItemLayout;
@BindView(R2.id.os_scrollview) @BindView(R2.id.os_scrollview_home)
ObservableScrollView scrollview; ObservableScrollView scrollview;
@BindView(R2.id.ll_item_title) @BindView(R2.id.ll_home_item_title)
LinearLayout llItemTitle; LinearLayout llItemTitle;
@BindView(R2.id.ll_item_top) @BindView(R2.id.ll_home_item_top)
LinearLayout llItemTop; LinearLayout llItemTop;
@BindView(R2.id.ll_item_search) @BindView(R2.id.ll_home_item_search)
LinearLayout llItemSearch; LinearLayout llItemSearch;
@BindView(R2.id.refresh) @BindView(R2.id.refresh_home)
SimpleRefreshLayout mSimpleRefreshLayout; SimpleRefreshLayout mSimpleRefreshLayout;
@BindView(R2.id.ll_item_hot_rvtour) @BindView(R2.id.ll_home_item_hot_rvtour)
LinearLayout llItemHotRvtour; LinearLayout llItemHotRvtour;
@BindView(R2.id.ll_item_hot_entertainment_camp) @BindView(R2.id.ll_home_item_hot_entertainment_camp)
LinearLayout llItemHotEntertainmentCamp; LinearLayout llItemHotEntertainmentCamp;
@BindView(R2.id.ll_item_hot_car_rental) @BindView(R2.id.ll_home_item_hot_car_rental)
LinearLayout llItemHotCarRental; LinearLayout llItemHotCarRental;
@BindView(R2.id.tv_hot_rvtour_hint) @BindView(R2.id.tv_home_hot_rvtour_hint)
TextView tvHotRvtourHint; TextView tvHotRvtourHint;
@BindView(R2.id.tv_hot_entertainment_hint) @BindView(R2.id.tv_home_hot_entertainment_hint)
TextView tvHotEntertainmentHint; TextView tvHotEntertainmentHint;
@BindView(R2.id.tv_hot_car_rental_hint) @BindView(R2.id.tv_home_hot_car_rental_hint)
TextView tvHotCarRentalHint; TextView tvHotCarRentalHint;
@BindView(R2.id.iv_travel_city_text_hint) @BindView(R2.id.iv_home_travel_city_text_hint)
ImageView ivTravelCityTextHint; ImageView ivTravelCityTextHint;
@BindView(R2.id.iv_search_input_hint) @BindView(R2.id.iv_home_search_input_hint)
ImageView ivSearchInputHint; ImageView ivSearchInputHint;
...@@ -585,6 +585,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -585,6 +585,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
@Override @Override
public void onShowResult(int requestType, BaseBean result) { public void onShowResult(int requestType, BaseBean result) {
mSimpleRefreshLayout.onRefreshComplete(); mSimpleRefreshLayout.onRefreshComplete();
mSimpleRefreshLayout.setPullDownEnable(true);
switch (requestType) { switch (requestType) {
case 0: case 0:
processData((ShopListBean) result); processData((ShopListBean) result);
...@@ -648,14 +649,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -648,14 +649,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
} }
@OnClick({R2.id.travel_city_layout, R2.id.ll_item_search, R2.id.tv_item_rv_tour, R2.id.tv_item_renting_a_car, @OnClick({R2.id.tv_home_travel_city_layout, R2.id.ll_home_item_search, R2.id.tv_item_home_rv_tour, R2.id.tv_item_home_renting_a_car,
R2.id.tv_get_address, R2.id.tv_out_address, R2.id.ll_item_select_data, R2.id.tv_select_car, R2.id.tv_home_get_address, R2.id.tv_home_out_address, R2.id.ll_home_item_select_data, R2.id.tv_home_select_car,
R2.id.ll_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_home_item_rv_city, R2.id.tv_home_book_now, R2.id.ll_home_item_rv_hot_label1, R2.id.ll_home_item_rv_hot_label2, R2.id.ll_home_item_rv_hot_label3,
R2.id.ll_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_home_item_hot_rvtour, R2.id.ll_home_item_hot_entertainment_camp, R2.id.ll_home_item_hot_car_rental, R2.id.tv_home_see_more_popular,
R2.id.ll_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, R2.id.cardview}) R2.id.ll_home_item_top, R2.id.iv_home_travel_server_image, R2.id.tv_home_car_rental_guide, R2.id.ll_home_item_activity_all, R2.id.ll_rent, R2.id.ll_return, R2.id.cardview})
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.tv_home_travel_city_layout) {
//选择城市 //选择城市
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CITYLIST) .build(Constance.ACTIVITY_URL_CITYLIST)
...@@ -664,7 +665,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -664,7 +665,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withInt("mCityId", mTravelCityId) .withInt("mCityId", mTravelCityId)
.navigation(getActivity(), TYPE_REQUEST_CITY); .navigation(getActivity(), TYPE_REQUEST_CITY);
} else if (id == R.id.ll_item_search) { } else if (id == R.id.ll_home_item_search) {
//搜索 //搜索
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_TRAVELSEARCH) .build(Constance.ACTIVITY_URL_TRAVELSEARCH)
...@@ -672,19 +673,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -672,19 +673,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withDouble("lonLongitude", 0) .withDouble("lonLongitude", 0)
.navigation(); .navigation();
} else if (id == R.id.tv_item_rv_tour) { } else if (id == R.id.tv_item_home_rv_tour) {
tvItemRvTour.setSelected(true); tvItemRvTour.setSelected(true);
tvItemRentingACar.setSelected(false); tvItemRentingACar.setSelected(false);
llLayoutRentingACar.setVisibility(View.VISIBLE); llLayoutRentingACar.setVisibility(View.VISIBLE);
llLayoutRvTour.setVisibility(View.GONE); llLayoutRvTour.setVisibility(View.GONE);
} else if (id == R.id.tv_item_renting_a_car) { } else if (id == R.id.tv_item_home_renting_a_car) {
tvItemRvTour.setSelected(false); tvItemRvTour.setSelected(false);
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_address || id == R.id.ll_rent) { } else if (id == R.id.tv_home_get_address || id == R.id.ll_rent) {
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_SELECTSHOP) .build(Constance.ACTIVITY_URL_SELECTSHOP)
.withDouble("mLat", latLatitude) .withDouble("mLat", latLatitude)
...@@ -693,7 +694,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -693,7 +694,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withInt("shopType", 1) .withInt("shopType", 1)
.navigation(_mActivity, TYPE_REQUEST_CITY); .navigation(_mActivity, TYPE_REQUEST_CITY);
// startActivityForResult(SelectShopActivity.getIntent(getActivity(), 1, "", , latLatitude, lonLongitude), TYPE_REQUEST_CITY); // startActivityForResult(SelectShopActivity.getIntent(getActivity(), 1, "", , latLatitude, lonLongitude), TYPE_REQUEST_CITY);
} else if (id == R.id.ll_return || id == R.id.tv_out_address) { } else if (id == R.id.ll_return || id == R.id.tv_home_out_address) {
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_SELECTSHOP) .build(Constance.ACTIVITY_URL_SELECTSHOP)
.withDouble("mLat", latLatitude) .withDouble("mLat", latLatitude)
...@@ -702,7 +703,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -702,7 +703,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withInt("shopType", 2) .withInt("shopType", 2)
.navigation(_mActivity, TYPE_REQUEST_CITY); .navigation(_mActivity, TYPE_REQUEST_CITY);
// startActivityForResult(SelectShopActivity.getIntent(getActivity(), 2, "", TextUtils.isEmpty(outCityName) ? nowCity : outCityName, latLatitude, lonLongitude), TYPE_REQUEST_CITY); // startActivityForResult(SelectShopActivity.getIntent(getActivity(), 2, "", TextUtils.isEmpty(outCityName) ? nowCity : outCityName, latLatitude, lonLongitude), TYPE_REQUEST_CITY);
} else if (id == R.id.ll_item_select_data) { } else if (id == R.id.ll_home_item_select_data) {
//选择日期 //选择日期
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CALENDAR) .build(Constance.ACTIVITY_URL_CALENDAR)
...@@ -710,7 +711,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -710,7 +711,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withString("endDate", endDate) .withString("endDate", endDate)
.navigation(_mActivity, 108); .navigation(_mActivity, 108);
} else if (id == R.id.tv_select_car) { } else if (id == R.id.tv_home_select_car) {
//租房车 立即选车 //租房车 立即选车
if (copyDay < 1) { if (copyDay < 1) {
showToast(getContext().getString(R.string.rv_day_toast)); showToast(getContext().getString(R.string.rv_day_toast));
...@@ -730,7 +731,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -730,7 +731,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
begDate, begDate,
endDate endDate
); );
} else if (id == R.id.ll_item_rv_city) { } else if (id == R.id.ll_home_item_rv_city) {
//房车游选择城市 //房车游选择城市
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CITYLIST) .build(Constance.ACTIVITY_URL_CITYLIST)
...@@ -740,7 +741,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -740,7 +741,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.navigation(getActivity(), TYPE_REQUEST_CITY); .navigation(getActivity(), TYPE_REQUEST_CITY);
} else if (id == R.id.tv_book_now) { } else if (id == R.id.tv_home_book_now) {
//房车游 立即预定 //房车游 立即预定
geoCoder.geocode(new GeoCodeOption() geoCoder.geocode(new GeoCodeOption()
...@@ -754,7 +755,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -754,7 +755,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withString("city", tvRvCity.getText().toString()) .withString("city", tvRvCity.getText().toString())
.navigation(); .navigation();
} else if (id == R.id.ll_item_rv_hot_label1) { } else if (id == R.id.ll_home_item_rv_hot_label1) {
//热门标签1 //热门标签1
if (hotData != null && hotData.size() > 0) { if (hotData != null && hotData.size() > 0) {
ARouter.getInstance() ARouter.getInstance()
...@@ -764,7 +765,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -764,7 +765,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.navigation(); .navigation();
} }
} else if (id == R.id.ll_item_rv_hot_label2) { } else if (id == R.id.ll_home_item_rv_hot_label2) {
//热门标签2 //热门标签2
if (hotData != null && hotData.size() > 1) { if (hotData != null && hotData.size() > 1) {
ARouter.getInstance() ARouter.getInstance()
...@@ -774,7 +775,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -774,7 +775,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.navigation(); .navigation();
} }
} else if (id == R.id.ll_item_rv_hot_label3) { } else if (id == R.id.ll_home_item_rv_hot_label3) {
//热门标签3 //热门标签3
if (hotData != null && hotData.size() > 2) { if (hotData != null && hotData.size() > 2) {
ARouter.getInstance() ARouter.getInstance()
...@@ -784,7 +785,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -784,7 +785,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.navigation(); .navigation();
} }
} else if (id == R.id.ll_item_hot_rvtour) { } else if (id == R.id.ll_home_item_hot_rvtour) {
//热门旅行 //热门旅行
llItemHotRvtour.setSelected(true); llItemHotRvtour.setSelected(true);
...@@ -806,7 +807,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -806,7 +807,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
recommendGood("2"); recommendGood("2");
hotType = "2"; hotType = "2";
} else if (id == R.id.ll_item_hot_entertainment_camp) { } else if (id == R.id.ll_home_item_hot_entertainment_camp) {
//娱乐营地 //娱乐营地
llItemHotRvtour.setSelected(false); llItemHotRvtour.setSelected(false);
llItemHotEntertainmentCamp.setSelected(true); llItemHotEntertainmentCamp.setSelected(true);
...@@ -826,7 +827,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -826,7 +827,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
mAdapter.notifyDataSetChanged(); mAdapter.notifyDataSetChanged();
recommendGood("3"); recommendGood("3");
hotType = "3"; hotType = "3";
} else if (id == R.id.ll_item_hot_car_rental) { } else if (id == R.id.ll_home_item_hot_car_rental) {
//购房车 //购房车
llItemHotRvtour.setSelected(false); llItemHotRvtour.setSelected(false);
llItemHotEntertainmentCamp.setSelected(false); llItemHotEntertainmentCamp.setSelected(false);
...@@ -848,7 +849,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -848,7 +849,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
recommendGood("4"); recommendGood("4");
hotType = "4"; hotType = "4";
} else if (id == R.id.tv_see_more_popular) { } else if (id == R.id.tv_home_see_more_popular) {
//查看更多热门 //查看更多热门
if ("2".equals(hotType)) { if ("2".equals(hotType)) {
//热门旅行 //热门旅行
...@@ -864,14 +865,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -864,14 +865,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.build(Constance.ACTIVITY_URL_CARPURCHASELIST) .build(Constance.ACTIVITY_URL_CARPURCHASELIST)
.navigation(); .navigation();
} }
} else if (id == R.id.ll_item_top) { } else if (id == R.id.ll_home_item_top) {
scrollview.fullScroll(View.FOCUS_UP); scrollview.fullScroll(View.FOCUS_UP);
} else if (id == R.id.travel_server_image) { } else if (id == R.id.iv_home_travel_server_image) {
Intent intent = new Intent(Intent.ACTION_DIAL); Intent intent = new Intent(Intent.ACTION_DIAL);
Uri uri = Uri.parse("tel:" + "4000369369"); Uri uri = Uri.parse("tel:" + "4000369369");
intent.setData(uri); intent.setData(uri);
startActivity(intent); startActivity(intent);
} else if (id == R.id.tv_car_rental_guide) { } else if (id == R.id.tv_home_car_rental_guide) {
//租车指南 //租车指南
ARouter.getInstance().build(Constance.ACTIVITY_URL_WEBVIEW) ARouter.getInstance().build(Constance.ACTIVITY_URL_WEBVIEW)
.withString("title", "租车指南") .withString("title", "租车指南")
...@@ -879,7 +880,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -879,7 +880,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
.withInt("type", 1) .withInt("type", 1)
.navigation(); .navigation();
} else if (id == R.id.ll_item_activity_all) { } else if (id == R.id.ll_home_item_activity_all) {
showToast("亲,该功能还在开发中。。。"); showToast("亲,该功能还在开发中。。。");
} else if (id == R.id.cardview) { } else if (id == R.id.cardview) {
return; return;
......
package com.rv.home.rv.module.ui.main.home;
import android.Manifest;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.TimePicker;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.mapapi.model.LatLng;
import com.frame.rv.config.RvFrameConfig;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.inter.OnViewHolder;
import com.ruiwenliu.wrapper.util.LocationManager;
import com.ruiwenliu.wrapper.util.TimeManager;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.util.ViewHolder;
import com.ruiwenliu.wrapper.util.permission.RxPermission;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.ApiConfig;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.main.home.adapter.HotCarTypeAdapter;
import com.rv.home.rv.module.ui.main.home.bean.CityPickerBean;
import com.rv.home.rv.module.ui.main.home.bean.ListsBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderDataBean;
import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.functions.Consumer;
/**
* Created :Auser
* Date: 2019/5/15.
* Desc:首页
*/
public class HomePageFragment extends BaseFragment<CommonPresenter> {
@BindView(R2.id.recyclerView)
RecyclerView recyclerView;
@BindView(R2.id.iv_top)
ImageView ivTop;
private HotCarTypeAdapter mAdapter;
private Map<String, Integer> mapGetTime;
private Map<String, Integer> mapOutTime;
private TextView headTvGetCity;//获取出发城市
private TextView headTvOutCity;//获取还车城市
private TextView headTvGetShop;//获取出发门店地址
private TextView headTvOutShop;//获取还车门店地址
private final int TYPE_REQUEST_CITY = 1;//城市列表
private final int TYPE_REQUEST_SHOP = 2;//门店列表
private final int TYPE_REQUEST_ADDRESS = 3;//地址选择
private LocationManager locationManager;
private String nowCity = "";
private int getSwitchType;//取车开关类型
private int outSwitchType;//还车开关类型
private double latLatitude = 0;
private double lonLongitude;
private LatLng mLatLng;//当前城市经纬度
private double outLatitude = 0;
private double outLongitude;
private int getCityId;//取车城市ID
private int outCityId;//还车城市ID
private OrderDataBean dataBean;
private int copyDay=2;//租车天数
public static Intent getIntent(Context context) {
return new Intent(context, CarRentalActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
};
public static HomePageFragment getInstance(int type) {
Bundle bundl = new Bundle();
bundl.putInt("type", type);
HomePageFragment fragment = new HomePageFragment();
fragment.setArguments(bundl);
return fragment;
}
@Override
public int getViewLayout() {
return R.layout.rv_act_car_rental;
}
@Override
protected void initView(Bundle savedInstanceState) {
permissionProcess();
mAdapter = new HotCarTypeAdapter();
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
recyclerView.setAdapter(mAdapter);
recyclerView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE:
ivTop.setVisibility(View.GONE);
break;
case MotionEvent.ACTION_UP:
ivTop.setVisibility(View.VISIBLE);
break;
}
return false;
}
});
getData();
}
@Override
protected void loadData(Bundle savedInstanceState) {
}
@Override
public void onShowResult(int requestType, BaseBean result) {
processData((ShopListBean) result);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
int type = data.getIntExtra("type", 1);
String requestData = data.getStringExtra("location");
switch (requestCode) {
case TYPE_REQUEST_CITY://城市列表
if (type == 1) {
headTvGetShop.setText("");
getCityId = data.getIntExtra("id", 0);
} else {
headTvOutShop.setText("");
outCityId = data.getIntExtra("id", 0);
}
setRequestData(type, requestData, headTvGetCity, headTvOutCity, 0, 0);
break;
case TYPE_REQUEST_SHOP://门店
setRequestData(type, requestData, headTvGetShop, headTvOutShop, 0, 0);
break;
case TYPE_REQUEST_ADDRESS://地址
double lat = data.getDoubleExtra("latitude", 0);
double lon = data.getDoubleExtra("longitude", 0);
setRequestData(type, requestData, headTvGetShop, headTvOutShop, lat, lon);
break;
}
}
}
@OnClick(R2.id.iv_top)
public void onViewClicked() {
if (recyclerView != null && mAdapter != null) {
recyclerView.scrollToPosition(0);
}
}
/**
* 设置返回结果参数
* @param type
* @param data
* @param tvGet
* @param tvOut
* @param lat
* @param lon
*/
private void setRequestData(int type, String data, TextView tvGet, TextView tvOut, double lat, double lon) {
if (tvGet == null) {
return;
}
switch (type) {
case 1:
latLatitude = lat;
lonLongitude = lon;
tvGet.setText(data);
break;
case 2:
outLatitude = lat;
outLongitude = lon;
tvOut.setText(data);
break;
}
}
/**
* 获取门店列表
*/
private void getShopList(double lat, double lon) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("page", 1);
map.put("limit", 1);
map.put("lat", lat);
map.put("lon", lon);
mPresenter.getData(RvFrameConfig.VEHICLE_POST, 0, ApiConfig.HTTP_URL_SHOP_LIST, ShopListBean.class, map, true);
}
/**
* 处理最近门店请求结果
* @param bean
*/
private void processData(ShopListBean bean) {
if (bean.getData().getTotalCount() > 0) {
if (headTvGetShop != null && TextUtils.isEmpty(headTvGetShop.getText().toString().trim())) {
headTvGetShop.setText(bean.getData().getData().get(0).getName());
latLatitude = bean.getData().getData().get(0).getLatitude();
lonLongitude = bean.getData().getData().get(0).getLongitude();
}
if (headTvOutShop != null && TextUtils.isEmpty(headTvOutShop.getText().toString().trim())) {
headTvOutShop.setText(bean.getData().getData().get(0).getName());
outLatitude = bean.getData().getData().get(0).getLatitude();
outLongitude = bean.getData().getData().get(0).getLongitude();
}
}
}
private void getData() {
mAdapter.addHeaderView(getHeadView());
List<String> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
list.add("东莞松山湖欣新房车总店" + i);
}
// mAdapter.setNewData(list);
}
/**
* 获取头部View
*
* @return
*/
private View getHeadView() {
return getHelperView(recyclerView, R.layout.rv_head_car_rental, new OnViewHolder() {
@Override
public void helper(ViewHolder helper) {
headTvGetCity = helper.getView(R.id.tv_get_city);
headTvOutCity = helper.getView(R.id.tv_out_city);
headTvGetShop = helper.getView(R.id.tv_get_address);
headTvOutShop = helper.getView(R.id.tv_out_address);
final TextView tvGetTime = helper.getView(R.id.tv_get_time);
final TextView tvGetWeek = helper.getView(R.id.tv_get_week);
final TextView tvOutTime = helper.getView(R.id.tv_out_time);
final TextView tvOutWeek = helper.getView(R.id.tv_out_week);
final TextView tvGetDay = helper.getView(R.id.tv_day);
final CheckBox checkBox = helper.getView(R.id.check_driver);
Switch shGet = helper.getView(R.id.switch_get);
initTime(tvGetTime, tvOutTime);
tvGetDay.setText(String.format("%1$s%2$s", copyDay, getContext().getString(R.string.rv_days)));
shGet.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
getSwitchType = 1;
} else {
getSwitchType = 0;
}
headTvGetShop.setText("");
}
});
Switch shOut = helper.getView(R.id.switch_out);
shOut.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
outSwitchType = 1;
} else {
outSwitchType = 0;
}
headTvOutShop.setText("");
}
});
helper.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.iv_back) {
getActivity().finish();
} else if (i == R.id.tv_get_city) {
// startActivityForResult(CityListActivity.getIntent(getContext(), 1, headTvGetCity.getText().toString().trim(), getCityId), TYPE_REQUEST_CITY);
} else if (i == R.id.tv_out_city) {
// startActivityForResult(CityListActivity.getIntent(getContext(), 2, headTvOutCity.getText().toString().trim(), outCityId), TYPE_REQUEST_CITY);
} else if (i == 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, latLatitude, lonLongitude, nowCity,0), TYPE_REQUEST_ADDRESS);
// }
} else if (i == 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, outLatitude, outLongitude, nowCity,0), TYPE_REQUEST_ADDRESS);
// }
} else if (i == R.id.tv_get_time) {
if (mapGetTime == null) {
return;
}
showDatePicker(mapGetTime.get("year"), mapGetTime.get("month"), mapGetTime.get("day"), mapGetTime.get("hour"), mapGetTime.get("minute"), tvGetTime, tvGetWeek, mapGetTime, tvGetDay);
} else if (i == R.id.tv_out_time) {
if (mapOutTime == null) {
return;
}
showDatePicker(mapOutTime.get("year"), mapOutTime.get("month"), mapOutTime.get("day"), mapOutTime.get("hour"), mapOutTime.get("minute"), tvOutTime, tvOutWeek, mapOutTime, tvGetDay);
} else if (i == R.id.tv_select) {
if (mapGetTime.size() > 0 && mapOutTime.size() > 0) {
String getTime = String.format("%1$s-%2$s-%3$s", mapGetTime.get("year"), mapGetTime.get("month") < 10 ? "0" + mapGetTime.get("month") : mapGetTime.get("month"), mapGetTime.get("day") < 10 ? "0" + mapGetTime.get("day") : mapGetTime.get("day"));
String outTime = String.format("%1$s-%2$s-%3$s", mapOutTime.get("year"), mapOutTime.get("month") < 10 ? "0" + mapOutTime.get("month") : mapOutTime.get("month"), mapOutTime.get("day") < 10 ? "0" + mapOutTime.get("day") : mapOutTime.get("day"));
if (copyDay < 0) {
showToast(getContext().getString(R.string.rv_day_toast));
return;
}
sendData(headTvGetCity.getText().toString().trim(),
headTvGetShop.getText().toString().trim(),
headTvOutCity.getText().toString().trim(),
headTvOutShop.getText().toString().trim(),
getTime, outTime, copyDay, checkBox.isChecked(),
tvGetTime.getText().toString().trim(),
tvOutTime.getText().toString().trim()
);
}
}
}
}, R.id.iv_back, R.id.tv_get_city, R.id.tv_out_city, R.id.tv_get_address, R.id.tv_out_address, R.id.tv_get_time, R.id.tv_out_time, R.id.tv_select);
}
});
}
/**
* 初始化定位
*/
public void initGps() {
locationManager = new LocationManager(getContext());
locationManager.getLocationDetail(new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation location) {
//此处的BDLocation为定位结果信息类,通过它的各种get方法可获取定位相关的全部结果
//以下只列举部分获取经纬度相关(常用)的结果信息
//更多结果信息获取说明,请参照类参考中BDLocation类中的说明
//获取定位精度,默认值为0.0f
float radius = location.getRadius();
//获取经纬度坐标类型,以LocationClientOption中设置过的坐标类型为准
String coorType = location.getCoorType();
//获取定位类型、定位错误返回码,具体信息可参照类参考中BDLocation类中的说明
int errorCode = location.getLocType();
// setGpsContent("count=:",String.valueOf(count));
// setGpsContent("latitude:",String.valueOf(location.getLatitude()));
// setGpsContent("longitude:",String.valueOf(location.getLongitude()));
// setGpsContent("城市:",location.getCity());
// setGpsContent("街道:",location.getAddrStr());
// setGpsContent("当前位置:",location.getLocationDescribe());
latLatitude=location.getLatitude();
lonLongitude=location.getLongitude();
mLatLng = new LatLng(location.getLatitude(), location.getLongitude());
getShopList(mLatLng.latitude, mLatLng.longitude);
headTvGetCity.setText(location.getCity());
headTvOutCity.setText(location.getCity());
nowCity = location.getCity();
locationManager.stopLocation();
}
});
}
/**
* 初始化时间进程
*/
private void initTime(TextView tvGetTime, TextView tvOutTime) {
Calendar cal = Calendar.getInstance();
if (mapGetTime == null) {
mapGetTime = new LinkedHashMap<>();
}
mapGetTime.put("year", cal.get(Calendar.YEAR));
mapGetTime.put("month", cal.get(Calendar.MONTH) + 1);
mapGetTime.put("day", cal.get(Calendar.DAY_OF_MONTH));
mapGetTime.put("hour", cal.get(Calendar.HOUR));
mapGetTime.put("minute", cal.get(Calendar.MINUTE));
if (mapOutTime == null) {
mapOutTime = new LinkedHashMap<>();
}
String[] timeGroup = TimeManager.getAfterDay(2).split("-");
mapOutTime.put("year", Integer.valueOf(timeGroup[0]));
mapOutTime.put("month", Integer.valueOf(timeGroup[1]));
mapOutTime.put("day", Integer.valueOf(timeGroup[2]));
mapOutTime.put("hour", cal.get(Calendar.HOUR));
mapOutTime.put("minute", cal.get(Calendar.MINUTE));
tvGetTime.setText(String.format("%1$s-%2$s-%3$s %4$s:%5$s", mapGetTime.get("year"), mapGetTime.get("month"), mapGetTime.get("day"), mapGetTime.get("hour"), mapGetTime.get("minute")));
tvOutTime.setText(String.format("%1$s-%2$s-%3$s %4$s:%5$s", mapOutTime.get("year"), mapOutTime.get("month"), mapOutTime.get("day"), mapOutTime.get("hour"), mapOutTime.get("minute")));
}
/**
* 获取进程天数
*
* @param tvDay
*/
private void getTimeDay(TextView tvDay) {
if (mapGetTime != null && mapOutTime != null) {
copyDay = TimeManager.getDays(String.format("%1$s-%2$s-%3$s", mapGetTime.get("year"), mapGetTime.get("month"), mapGetTime.get("day"))
, String.format("%1$s-%2$s-%3$s", mapOutTime.get("year"), mapOutTime.get("month"), mapOutTime.get("day")));
tvDay.setText(String.format("%1$s%2$s", copyDay, getContext().getString(R.string.rv_days)));
}
}
/**
* 展示日历弹窗
*
* @param newYear
* @param newMonth
* @param newDay
* @param tvTime
*/
private void showDatePicker(int newYear, int newMonth, int newDay, final int newHour, final int newMinute, final TextView tvTime, final TextView tvWeek, final Map<String, Integer> map, final TextView tvDay) {
if (tvTime == null) {
return;
}
//实例化日期选择器悬浮窗
//参数1:上下文对象
//参数2:监听事件
//参数3:初始化年份
//参数4:初始化月份
//参数5:初始化日期
new DatePickerDialog(getContext(), new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
map.clear();
map.put("year", year);
map.put("month", month + 1);
map.put("day", dayOfMonth);
tvTime.setText("");
tvWeek.setText("");
String tvMonth = month < 10 ? "0" + month : "" + month;
String tvDays = month < 10 ? "0" + dayOfMonth : "" + dayOfMonth;
tvTime.append("" + year + "-" + tvMonth + "-" + tvDays + " ");
showTimeDialog(newHour, newMinute, tvTime, map);
getTimeDay(tvDay);
}
}, newYear, newMonth - 1,
newDay).show();
}
/**
* 展示时间弹窗
* //实例化时间选择器
* //参数1:上下文对象
* //参数2:监听事件
* //参数3:初始化小时
* //参数4:初始化分钟
* //参数5:是否24小时制
*/
private void showTimeDialog(int hour, int minute, final TextView tvTime, final Map<String, Integer> map) {
new TimePickerDialog(getContext(), new TimePickerDialog.OnTimeSetListener() {
//实现监听方法
@Override
public void onTimeSet(TimePicker timePicker, int i, int i1) {
map.put("hour", i);
map.put("minute", i1);
//设置文本显示内容
tvTime.append("" + i + ":" + i1);
}
}, hour, minute, true).show();//记得使用show才能显示!
}
/**
* 定位权限处理
*/
private void permissionProcess() {
/**
* 6.0以上手机做权限处理
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
new RxPermission(getActivity()).request(
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
).subscribe(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
if (aBoolean == true) {
initGps();
}else {
getActivity().finish();
}
}
});
} else {
initGps();
}
}
/**
* 传参
* @param starCity
* @param starAddress
* @param endCity
* @param endAddress
* @param getTime
* @param outTime
* @param day
* @param checkBox
* @param startTime
* @param endTime
*/
private void sendData(String starCity, String starAddress, String endCity, String endAddress, String getTime, String outTime, int day, boolean checkBox, String startTime, String endTime) {
if (dataBean == null) {
dataBean = new OrderDataBean();
}
if (getCityId > 0 && outCityId > 0) {
dataBean.setEndCity(outCityId);
dataBean.setStartCity(getCityId);
} else {
String json = UtilsManager.getInstance().getJson(getContext(), "city.json");
CityPickerBean bean = new Gson().fromJson(json, CityPickerBean.class);
for (CityPickerBean.CityBean cityBean : bean.getCity()) {
for (ListsBean lsBean : cityBean.getLists()) {
if (starCity.equals(lsBean.getName())) {
dataBean.setStartCity(lsBean.getId());
}
if (endCity.equals(lsBean.getName())) {
dataBean.setEndCity(lsBean.getId());
}
}
}
}
dataBean.setDayNum(day);
dataBean.setStartCityName(starCity);
dataBean.setStartAddr(starAddress);
try {
dataBean.setStartTime(TimeManager.dateToStamp(getTime));
dataBean.setEndTime(TimeManager.dateToStamp(outTime));
} catch (ParseException e) {
e.printStackTrace();
}
dataBean.setEndCityName(endCity);
dataBean.setEndAddr(endAddress);
dataBean.setDriverType(checkBox == true ? 1 : 2);
// startActivity(CarRentalListActivity.getIntent(getContext(), latLatitude, lonLongitude, checkBox, dataBean, startTime, endTime));
}
}
...@@ -2,13 +2,15 @@ package com.rv.home.rv.module.ui.main.home.bean; ...@@ -2,13 +2,15 @@ package com.rv.home.rv.module.ui.main.home.bean;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import java.io.Serializable;
/** /**
* Created :Auser * Created :Auser
* Date: 2019/5/28. * Date: 2019/5/28.
* Desc:获取订单价格 * Desc:获取订单价格
*/ */
public class OrderPriceBean extends BaseBean{ public class OrderPriceBean extends BaseBean implements Serializable {
/** /**
* data : {"orderAmount":90000.02,"goodsAmount":70000.02,"vehicleAmount":70000.02,"driverAmount":0,"deposit":20000} * data : {"orderAmount":90000.02,"goodsAmount":70000.02,"vehicleAmount":70000.02,"driverAmount":0,"deposit":20000}
...@@ -34,7 +36,7 @@ public class OrderPriceBean extends BaseBean{ ...@@ -34,7 +36,7 @@ public class OrderPriceBean extends BaseBean{
this.rel = rel; this.rel = rel;
} }
public static class DataBean { public static class DataBean implements Serializable {
/** /**
* orderAmount : 90000.02 * orderAmount : 90000.02
* goodsAmount : 70000.02 * goodsAmount : 70000.02
......
...@@ -14,6 +14,7 @@ import android.view.View; ...@@ -14,6 +14,7 @@ import android.view.View;
import com.alipay.sdk.app.PayTask; import com.alipay.sdk.app.PayTask;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity; import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.frame.base.bus.Observer;
import com.frame.base.bus.PaymentSuccessfulEvent; import com.frame.base.bus.PaymentSuccessfulEvent;
import com.frame.base.bus.RxBus; import com.frame.base.bus.RxBus;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
...@@ -42,6 +43,7 @@ import java.util.LinkedHashMap; ...@@ -42,6 +43,7 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
/** /**
* Created :Auser * Created :Auser
...@@ -136,6 +138,18 @@ public class AllOrderFragment extends BaseFragment<CommonPresenter> implements B ...@@ -136,6 +138,18 @@ public class AllOrderFragment extends BaseFragment<CommonPresenter> implements B
} }
}); });
initRxbus();
}
private void initRxbus() {
RxBus.tObservable(PaymentSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<PaymentSuccessfulEvent>(disposable) {
@Override
public void onNext(PaymentSuccessfulEvent event) {
onRefresh();
}
});
} }
@Override @Override
......
...@@ -16,6 +16,7 @@ import com.alipay.sdk.app.PayTask; ...@@ -16,6 +16,7 @@ import com.alipay.sdk.app.PayTask;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity; import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.frame.base.bus.CancelOrderEvent; import com.frame.base.bus.CancelOrderEvent;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer; import com.frame.base.bus.Observer;
import com.frame.base.bus.PaymentSuccessfulEvent; import com.frame.base.bus.PaymentSuccessfulEvent;
import com.frame.base.bus.RxBus; import com.frame.base.bus.RxBus;
...@@ -48,6 +49,7 @@ import butterknife.BindView; ...@@ -48,6 +49,7 @@ import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
/** /**
* Created :Auser * Created :Auser
...@@ -172,6 +174,16 @@ public class ForPaymentFragment extends BaseFragment<CommonPresenter> implements ...@@ -172,6 +174,16 @@ public class ForPaymentFragment extends BaseFragment<CommonPresenter> implements
} }
}); });
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
onRefresh();
}
});
} }
@Override @Override
......
...@@ -8,6 +8,9 @@ import android.view.View; ...@@ -8,6 +8,9 @@ import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity; import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer;
import com.frame.base.bus.RxBus;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment; import com.ruiwenliu.wrapper.base.BaseFragment;
...@@ -26,6 +29,8 @@ import java.util.LinkedHashMap; ...@@ -26,6 +29,8 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/** /**
* Created :Auser * Created :Auser
...@@ -86,8 +91,22 @@ public class HaveToTravelFragment extends BaseFragment<CommonPresenter>implement ...@@ -86,8 +91,22 @@ public class HaveToTravelFragment extends BaseFragment<CommonPresenter>implement
} }
} }
}); });
initRxbus();
}
private void initRxbus() {
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
onRefresh();
}
});
} }
@Override @Override
protected void loadData(Bundle savedInstanceState) { protected void loadData(Bundle savedInstanceState) {
......
...@@ -10,6 +10,7 @@ import android.view.View; ...@@ -10,6 +10,7 @@ import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity; import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.frame.base.bus.CancelOrderEvent; import com.frame.base.bus.CancelOrderEvent;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer; import com.frame.base.bus.Observer;
import com.frame.base.bus.PaymentSuccessfulEvent; import com.frame.base.bus.PaymentSuccessfulEvent;
import com.frame.base.bus.RxBus; import com.frame.base.bus.RxBus;
...@@ -32,6 +33,7 @@ import java.util.Map; ...@@ -32,6 +33,7 @@ import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/** /**
* Created :Auser * Created :Auser
...@@ -124,6 +126,14 @@ public class ToTravelFragment extends BaseFragment<CommonPresenter> implements B ...@@ -124,6 +126,14 @@ public class ToTravelFragment extends BaseFragment<CommonPresenter> implements B
} }
}); });
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
onRefresh();
}
});
} }
......
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
<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_home"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.rv.component.utils.ObservableScrollView <com.rv.component.utils.ObservableScrollView
android:id="@+id/os_scrollview" android:id="@+id/os_scrollview_home"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scrollbars="none"> android:scrollbars="none">
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
android:id="@+id/rl_item_layout" android:id="@+id/rl_home_item_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_580"> android:layout_height="@dimen/size_580">
<com.yuyife.banner.Banner <com.yuyife.banner.Banner
android:id="@+id/mine_banner" android:id="@+id/home_banner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_item_rv_tour" android:id="@+id/tv_item_home_rv_tour"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16" />
<TextView <TextView
android:id="@+id/tv_item_renting_a_car" android:id="@+id/tv_item_home_renting_a_car"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<LinearLayout <LinearLayout
android:id="@+id/ll_layout_renting_a_car" android:id="@+id/ll_layout_home_renting_a_car"
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">
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
<TextView <TextView
android:id="@+id/tv_get_address" android:id="@+id/tv_home_get_address"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
<TextView <TextView
android:id="@+id/tv_out_address" android:id="@+id/tv_home_out_address"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
<LinearLayout <LinearLayout
android:id="@+id/ll_item_select_data" android:id="@+id/ll_home_item_select_data"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_60" android:layout_height="@dimen/size_60"
android:gravity="center_vertical" android:gravity="center_vertical"
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/tv_get_time" android:id="@+id/tv_home_get_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
<TextView <TextView
android:id="@+id/tv_get_week" android:id="@+id/tv_home_get_week"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="周三" android:text="周三"
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/tv_day" android:id="@+id/tv_home_day"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/tv_out_time" android:id="@+id/tv_home_out_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
<TextView <TextView
android:id="@+id/tv_out_week" android:id="@+id/tv_home_out_week"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="周五" android:text="周五"
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<Button <Button
android:id="@+id/tv_select_car" android:id="@+id/tv_home_select_car"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/size_40" android:layout_height="@dimen/size_40"
android:layout_weight="1" android:layout_weight="1"
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16" />
<TextView <TextView
android:id="@+id/tv_car_rental_guide" android:id="@+id/tv_home_car_rental_guide"
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_20" android:layout_marginLeft="@dimen/size_20"
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_layout_rv_tour" android:id="@+id/ll_layout_home_rv_tour"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
...@@ -319,7 +319,7 @@ ...@@ -319,7 +319,7 @@
android:visibility="gone"> android:visibility="gone">
<LinearLayout <LinearLayout
android:id="@+id/ll_item_rv_city" android:id="@+id/ll_home_item_rv_city"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_60" android:layout_height="@dimen/size_60"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
...@@ -327,7 +327,7 @@ ...@@ -327,7 +327,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_rv_city" android:id="@+id/tv_home_rv_city"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="请选择目的地城市" android:text="请选择目的地城市"
...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
<Button <Button
android:id="@+id/tv_book_now" android:id="@+id/tv_home_book_now"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_40" android:layout_height="@dimen/size_40"
android:layout_marginTop="@dimen/size_20" android:layout_marginTop="@dimen/size_20"
...@@ -377,13 +377,13 @@ ...@@ -377,13 +377,13 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_item_rv_hot_label1" android:id="@+id/ll_home_item_rv_hot_label1"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1">
<TextView <TextView
android:id="@+id/tv_rv_hot_label1" android:id="@+id/tv_home_rv_hot_label1"
android:layout_width="@dimen/size_60" android:layout_width="@dimen/size_60"
android:layout_height="@dimen/size_35" android:layout_height="@dimen/size_35"
android:background="@drawable/shape_rv_dark_gray_circle" android:background="@drawable/shape_rv_dark_gray_circle"
...@@ -396,13 +396,13 @@ ...@@ -396,13 +396,13 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_item_rv_hot_label2" android:id="@+id/ll_home_item_rv_hot_label2"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1">
<TextView <TextView
android:id="@+id/tv_rv_hot_label2" android:id="@+id/tv_home_rv_hot_label2"
android:layout_width="@dimen/size_60" android:layout_width="@dimen/size_60"
android:layout_height="@dimen/size_35" android:layout_height="@dimen/size_35"
android:background="@drawable/shape_rv_dark_gray_circle" android:background="@drawable/shape_rv_dark_gray_circle"
...@@ -415,13 +415,13 @@ ...@@ -415,13 +415,13 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_item_rv_hot_label3" android:id="@+id/ll_home_item_rv_hot_label3"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1">
<TextView <TextView
android:id="@+id/tv_rv_hot_label3" android:id="@+id/tv_home_rv_hot_label3"
android:layout_width="@dimen/size_60" android:layout_width="@dimen/size_60"
android:layout_height="@dimen/size_35" android:layout_height="@dimen/size_35"
android:background="@drawable/shape_rv_dark_gray_circle" android:background="@drawable/shape_rv_dark_gray_circle"
...@@ -463,7 +463,7 @@ ...@@ -463,7 +463,7 @@
app:cardMaxElevation="@dimen/size_10"> app:cardMaxElevation="@dimen/size_10">
<LinearLayout <LinearLayout
android:id="@+id/ll_item_hot_rvtour" android:id="@+id/ll_home_item_hot_rvtour"
android:layout_width="@dimen/size_100" android:layout_width="@dimen/size_100"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:background="@drawable/selector_home_item_hot_button" android:background="@drawable/selector_home_item_hot_button"
...@@ -471,7 +471,7 @@ ...@@ -471,7 +471,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/tv_hot_rvtour" android:id="@+id/tv_home_hot_rvtour"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="热门旅行" android:text="热门旅行"
...@@ -479,7 +479,7 @@ ...@@ -479,7 +479,7 @@
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
<TextView <TextView
android:id="@+id/tv_hot_rvtour_hint" android:id="@+id/tv_home_hot_rvtour_hint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="精选房车游路线" android:text="精选房车游路线"
...@@ -496,7 +496,7 @@ ...@@ -496,7 +496,7 @@
app:cardMaxElevation="@dimen/size_10"> app:cardMaxElevation="@dimen/size_10">
<LinearLayout <LinearLayout
android:id="@+id/ll_item_hot_entertainment_camp" android:id="@+id/ll_home_item_hot_entertainment_camp"
android:layout_width="@dimen/size_100" android:layout_width="@dimen/size_100"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:layout_centerInParent="true" android:layout_centerInParent="true"
...@@ -505,7 +505,7 @@ ...@@ -505,7 +505,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/tv_hot_entertainment_camp" android:id="@+id/tv_home_hot_entertainment_camp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="娱乐营地" android:text="娱乐营地"
...@@ -513,7 +513,7 @@ ...@@ -513,7 +513,7 @@
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
<TextView <TextView
android:id="@+id/tv_hot_entertainment_hint" android:id="@+id/tv_home_hot_entertainment_hint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="娱乐休息两不误" android:text="娱乐休息两不误"
...@@ -530,7 +530,7 @@ ...@@ -530,7 +530,7 @@
app:cardMaxElevation="@dimen/size_10"> app:cardMaxElevation="@dimen/size_10">
<LinearLayout <LinearLayout
android:id="@+id/ll_item_hot_car_rental" android:id="@+id/ll_home_item_hot_car_rental"
android:layout_width="@dimen/size_100" android:layout_width="@dimen/size_100"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
...@@ -539,7 +539,7 @@ ...@@ -539,7 +539,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/tv_hot_car_rental" android:id="@+id/tv_home_hot_car_rental"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="购房车" android:text="购房车"
...@@ -547,7 +547,7 @@ ...@@ -547,7 +547,7 @@
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
<TextView <TextView
android:id="@+id/tv_hot_car_rental_hint" android:id="@+id/tv_home_hot_car_rental_hint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="精心打造你的房车" android:text="精心打造你的房车"
...@@ -558,7 +558,7 @@ ...@@ -558,7 +558,7 @@
</RelativeLayout> </RelativeLayout>
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView_content" android:id="@+id/recyclerView_home_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_420" android:layout_height="@dimen/size_420"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
...@@ -566,7 +566,7 @@ ...@@ -566,7 +566,7 @@
android:paddingRight="@dimen/size_10" /> android:paddingRight="@dimen/size_10" />
<TextView <TextView
android:id="@+id/tv_see_more_popular" android:id="@+id/tv_home_see_more_popular"
android:layout_width="@dimen/size_240" android:layout_width="@dimen/size_240"
android:layout_height="@dimen/size_40" android:layout_height="@dimen/size_40"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
...@@ -585,7 +585,7 @@ ...@@ -585,7 +585,7 @@
android:textSize="@dimen/text_18" /> android:textSize="@dimen/text_18" />
<LinearLayout <LinearLayout
android:id="@+id/ll_item_activity_all" android:id="@+id/ll_home_item_activity_all"
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"
...@@ -613,7 +613,7 @@ ...@@ -613,7 +613,7 @@
</LinearLayout> </LinearLayout>
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView_activity" android:id="@+id/recyclerView_home_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="@dimen/size_15" android:paddingLeft="@dimen/size_15"
...@@ -647,12 +647,12 @@ ...@@ -647,12 +647,12 @@
android:paddingRight="@dimen/size_15"> android:paddingRight="@dimen/size_15">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView_rvtourlist" android:id="@+id/recyclerView_home_rvtourlist"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView_rvtourlist_title" android:id="@+id/recyclerView_home_rvtourlist_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_100" android:layout_height="@dimen/size_100"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
...@@ -686,7 +686,7 @@ ...@@ -686,7 +686,7 @@
android:textSize="@dimen/text_10" /> android:textSize="@dimen/text_10" />
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView_rv_enthusiast" android:id="@+id/recyclerView_home_rv_enthusiast"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" /> android:layout_alignParentBottom="true" />
...@@ -698,7 +698,7 @@ ...@@ -698,7 +698,7 @@
</com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout> </com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout>
<com.ruiwenliu.wrapper.statusbar.StatusBarHeightView <com.ruiwenliu.wrapper.statusbar.StatusBarHeightView
android:id="@+id/ll_item_title" android:id="@+id/ll_home_item_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
...@@ -711,7 +711,7 @@ ...@@ -711,7 +711,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/travel_city_layout" android:id="@+id/tv_home_travel_city_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_5" android:layout_marginLeft="@dimen/size_5"
...@@ -720,7 +720,7 @@ ...@@ -720,7 +720,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/travel_city_text" android:id="@+id/tv_home_travel_city_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/ui_dimen_common_small" android:layout_marginRight="@dimen/ui_dimen_common_small"
...@@ -728,14 +728,14 @@ ...@@ -728,14 +728,14 @@
android:textSize="@dimen/_ui_text_size_h6" /> android:textSize="@dimen/_ui_text_size_h6" />
<ImageView <ImageView
android:id="@+id/iv_travel_city_text_hint" android:id="@+id/iv_home_travel_city_text_hint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/rv_common_icon_up_arrow2" /> android:src="@drawable/rv_common_icon_up_arrow2" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_item_search" android:id="@+id/ll_home_item_search"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="@dimen/ui_dimen_common" android:layout_margin="@dimen/ui_dimen_common"
...@@ -746,7 +746,7 @@ ...@@ -746,7 +746,7 @@
<ImageView <ImageView
android:id="@+id/iv_search_input_hint" android:id="@+id/iv_home_search_input_hint"
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginLeft="@dimen/ui_dimen_margin_h1" android:layout_marginLeft="@dimen/ui_dimen_margin_h1"
...@@ -754,7 +754,7 @@ ...@@ -754,7 +754,7 @@
android:src="@drawable/rv_common_icon_search2" /> android:src="@drawable/rv_common_icon_search2" />
<TextView <TextView
android:id="@+id/search_input" android:id="@+id/tv_home_search_input"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
...@@ -769,7 +769,7 @@ ...@@ -769,7 +769,7 @@
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/travel_server_image" android:id="@+id/iv_home_travel_server_image"
android:layout_width="@dimen/size_30" android:layout_width="@dimen/size_30"
android:layout_height="@dimen/size_30" android:layout_height="@dimen/size_30"
android:layout_marginRight="@dimen/size_5" android:layout_marginRight="@dimen/size_5"
...@@ -779,7 +779,7 @@ ...@@ -779,7 +779,7 @@
android:src="@drawable/rv_rentingcar_icon_service_white" /> android:src="@drawable/rv_rentingcar_icon_service_white" />
<LinearLayout <LinearLayout
android:id="@+id/ll_item_top" android:id="@+id/ll_home_item_top"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" android:gravity="center_horizontal"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorLine"
tools:context=".rv.module.ui.main.home.CarRentalActivity">
<include layout="@layout/common_rv" />
<ImageView
android:id="@+id/iv_top"
android:layout_width="@dimen/size_50"
android:layout_height="@dimen/size_50"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/size_30"
android:layout_marginRight="@dimen/size_30"
android:gravity="center"
android:src="@drawable/rv_top"
android:textColor="@color/colorWrite" />
</RelativeLayout>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="大通自行式C型房车(旅居版)" android:text=""
android:textColor="@color/textMain" android:textColor="@color/textMain"
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16" />
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
android:layout_marginTop="@dimen/size_3" android:layout_marginTop="@dimen/size_3"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="大通自行式C型房车(旅居版)" android:text=""
android:textColor="@color/textGray" android:textColor="@color/textGray"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
android:layout_marginTop="@dimen/size_3" android:layout_marginTop="@dimen/size_3"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="¥3500天" android:text="¥0天"
android:textColor="@color/colorAuxiliaryRed" android:textColor="@color/colorAuxiliaryRed"
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16" />
</LinearLayout> </LinearLayout>
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="2019-06-12 10:00~2019-06-15 18:00" android:text=""
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shape_rv_bg_shallow_yellow_small_circle" android:background="@drawable/shape_rv_bg_shallow_yellow_small_circle"
android:padding="@dimen/size_5" android:padding="@dimen/size_5"
android:text="3天" android:text="0天"
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
...@@ -441,7 +441,7 @@ ...@@ -441,7 +441,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10" android:layout_marginLeft="@dimen/size_10"
android:gravity="right" android:gravity="right"
android:text=20000元" android:text="¥0元"
android:textColor="@color/colorAuxiliaryRed" android:textColor="@color/colorAuxiliaryRed"
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16" />
</LinearLayout> </LinearLayout>
...@@ -637,7 +637,7 @@ ...@@ -637,7 +637,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_weight="1" android:layout_weight="1"
android:text="¥100/日" android:text="¥0/日"
android:textColor="@color/colorBg" android:textColor="@color/colorBg"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
</RelativeLayout> </RelativeLayout>
...@@ -876,7 +876,7 @@ ...@@ -876,7 +876,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="¥22555" android:text="¥0"
android:textColor="@color/colorAuxiliaryRed" android:textColor="@color/colorAuxiliaryRed"
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorLine"
android:orientation="vertical"
tools:context=".rv.module.ui.main.home.CarRentalActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/size_200"
android:background="@color/colorAuxiliaryYellow" />
<RelativeLayout
android:id="@+id/rl_back"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_back"
android:layout_width="@dimen/size_32"
android:layout_height="@dimen/size_32"
android:layout_marginLeft="@dimen/size_5"
android:layout_marginTop="@dimen/size_10"
android:padding="@dimen/size_8"
android:src="@drawable/rv_common_icon_back_dark" />
<ImageView
android:layout_width="@dimen/size_32"
android:layout_height="@dimen/size_32"
android:layout_marginLeft="@dimen/size_5"
android:layout_marginTop="@dimen/size_10"
android:padding="@dimen/size_8"
android:layout_marginRight="@dimen/size_10"
android:layout_alignParentRight="true"
android:src="@drawable/rv_rentingcar_icon_service_white" />
</RelativeLayout>
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/rl_back"
android:layout_marginLeft="@dimen/size_40"
android:text="@string/rv_rental_car"
android:textColor="@color/textMain"
android:textSize="@dimen/text_18"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_title"
android:layout_marginLeft="@dimen/size_40"
android:layout_marginTop="@dimen/size_10"
android:text="@string/rv_rental_car_content"
android:textColor="@color/textMain"
android:textSize="@dimen/text_16" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_marginTop="@dimen/size_150"
android:background="@drawable/shape_rv_bg_write"
android:orientation="vertical"
android:paddingRight="@dimen/size_15"
android:paddingLeft="@dimen/size_15"
android:paddingTop="@dimen/size_15"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_10"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rv_get_car_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_get_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawablePadding="@dimen/size_3"
android:hint="@string/rv_city_list"
android:drawableRight="@drawable/rv_common_icon_up_arrow"
android:gravity="center"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<TextView
android:id="@+id/tv_get_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1"
android:textSize="@dimen/text_14"
android:gravity="center"
android:hint="@string/rv_get_car_hint" />
<Switch
android:id="@+id/switch_get"
android:layout_width="wrap_content"
android:layout_height="@dimen/size_20"
android:layout_gravity="center_vertical"
android:visibility="gone"
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" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_10"
android:layout_marginTop="@dimen/size_15"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rv_get_out_address"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_out_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawablePadding="@dimen/size_3"
android:hint="@string/rv_city_list"
android:drawableRight="@drawable/rv_common_icon_up_arrow"
android:gravity="center"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<TextView
android:id="@+id/tv_out_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1"
android:textSize="@dimen/text_14"
android:gravity="center"
android:hint="@string/rv_get_out_hint" />
<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:visibility="gone"
android:textOn="@string/rv_to_door"
android:thumb="@drawable/switch_custom_thumb_selector"
android:track="@drawable/switch_custom_track_selector" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_rv_bg_yellow"
android:paddingBottom="@dimen/size_3"
android:paddingLeft="@dimen/size_5"
android:paddingRight="@dimen/size_5"
android:paddingTop="@dimen/size_3"
android:text="@string/rv_get"
android:layout_gravity="center_vertical"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_get_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_5"
android:text="2019-22"
android:gravity="center_vertical"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_get_week"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_get_time"
android:layout_marginLeft="@dimen/size_5"
android:text=""
android:textColor="@color/textGray"
android:textSize="@dimen/text_16" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="match_parent">
<TextView
android:layout_marginTop="@dimen/size_10"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_day"
android:drawableBottom="@color/colorLine"
android:text="3"
android:gravity="center"
android:textSize="@dimen/text_14" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_rv_main"
android:paddingBottom="@dimen/size_3"
android:paddingLeft="@dimen/size_5"
android:paddingRight="@dimen/size_5"
android:paddingTop="@dimen/size_3"
android:layout_gravity="center_vertical"
android:text="@string/rv_out"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_10" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_out_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_5"
android:gravity="center_vertical"
android:text="2019-22"
android:textColor="@color/textGray"
android:textSize="@dimen/text_12" />
<TextView
android:visibility="gone"
android:id="@+id/tv_out_week"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_out_time"
android:layout_marginLeft="@dimen/size_5"
android:text=""
android:textColor="@color/textGray"
android:textSize="@dimen/text_16" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<CheckBox
android:id="@+id/check_driver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_18"
android:layout_marginTop="@dimen/size_10"
android:text="@string/rv_full_time_driver"
android:paddingLeft="@dimen/size_10"
android:button="@drawable/selector_rv_check"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_select"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:layout_margin="@dimen/size_15"
android:background="@drawable/shape_rv_bg_yellow"
android:gravity="center"
android:text="@string/rv_immediately_car"
android:textColor="@color/colorWrite"
android:textSize="@dimen/text_18" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_20"
android:text="@string/rv_hot_car_type"
android:textColor="@color/textMain"
android:textSize="@dimen/text_18"
android:textStyle="bold" />
</LinearLayout>
...@@ -11,6 +11,9 @@ import android.widget.TextView; ...@@ -11,6 +11,9 @@ import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer;
import com.frame.base.bus.RxBus;
import com.frame.base.url.Constance; import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
...@@ -37,6 +40,8 @@ import java.util.Map; ...@@ -37,6 +40,8 @@ import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/** /**
* 选择出游人 / 选择出游人 * 选择出游人 / 选择出游人
...@@ -76,6 +81,7 @@ public class ChooseAVisitorActivity extends BaseStatusActivity<CommonPresenter> ...@@ -76,6 +81,7 @@ public class ChooseAVisitorActivity extends BaseStatusActivity<CommonPresenter>
@Override @Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
openType = intent.getIntExtra("openType", 0); openType = intent.getIntExtra("openType", 0);
initRxBus();
if (openType != 0) { if (openType != 0) {
adultNumber = intent.getIntExtra("adult_number", 0); adultNumber = intent.getIntExtra("adult_number", 0);
childBumber = intent.getIntExtra("child_number", 0); childBumber = intent.getIntExtra("child_number", 0);
...@@ -225,6 +231,18 @@ public class ChooseAVisitorActivity extends BaseStatusActivity<CommonPresenter> ...@@ -225,6 +231,18 @@ public class ChooseAVisitorActivity extends BaseStatusActivity<CommonPresenter>
super.finish(); super.finish();
} }
private void initRxBus() {
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
getDrivingList();
}
});
}
@Override @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent); super.loadData(savedInstanceState, intent);
......
...@@ -10,6 +10,9 @@ import android.view.View; ...@@ -10,6 +10,9 @@ import android.view.View;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity; import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer;
import com.frame.base.bus.RxBus;
import com.frame.base.url.Constance; import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
...@@ -28,8 +31,10 @@ import java.util.LinkedHashMap; ...@@ -28,8 +31,10 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
public class CollectionActivity extends BaseStatusActivity<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener { public class CollectionActivity extends BaseStatusActivity<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener {
@BindView(R2.id.recyclerView) @BindView(R2.id.recyclerView)
RecyclerView recyclerView; RecyclerView recyclerView;
private int mPage; private int mPage;
...@@ -50,8 +55,8 @@ public class CollectionActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -50,8 +55,8 @@ public class CollectionActivity 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("收藏"); titleView.setTitle("收藏");
initRxBus();
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity)); recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
collectionAdapter = new CollectionAdapter(new ArrayList<MultiItemEntity>()); collectionAdapter = new CollectionAdapter(new ArrayList<MultiItemEntity>());
collectionAdapter.setOnLoadMoreListener(this, recyclerView); collectionAdapter.setOnLoadMoreListener(this, recyclerView);
...@@ -61,22 +66,34 @@ public class CollectionActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -61,22 +66,34 @@ public class CollectionActivity extends BaseStatusActivity<CommonPresenter> impl
@Override @Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) { public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
CollectionListBean.DataBeanX.DataBean dataBean = (CollectionListBean.DataBeanX.DataBean) adapter.getItem(position); CollectionListBean.DataBeanX.DataBean dataBean = (CollectionListBean.DataBeanX.DataBean) adapter.getItem(position);
if ( 2 == dataBean.getType()) { if (2 == dataBean.getType()) {
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_TRAVELDETAILS) .build(Constance.ACTIVITY_URL_TRAVELDETAILS)
.withString("id", dataBean.getTypeId()) .withString("id", dataBean.getTypeId())
.withString("name", dataBean.getName()) .withString("name", dataBean.getName())
.withString("content", dataBean.getUnit()) .withString("content", dataBean.getUnit())
.withString("url", dataBean.getCover()) .withString("url", dataBean.getCover())
.withDouble("price",dataBean.getPrice()) .withDouble("price", dataBean.getPrice())
.navigation(); .navigation();
}else if (1 == dataBean.getType()){ } else if (1 == dataBean.getType()) {
} }
} }
}); });
} }
private void initRxBus() {
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
onRefresh();
}
});
}
@Override @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent); super.loadData(savedInstanceState, intent);
...@@ -118,7 +135,7 @@ public class CollectionActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -118,7 +135,7 @@ public class CollectionActivity extends BaseStatusActivity<CommonPresenter> impl
headMap.put("Authorization", OkGoUtil.getToken()); headMap.put("Authorization", OkGoUtil.getToken());
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("page", page); map.put("page", page);
mPresenter.getData(RvFrameConfig.ADMIN_POST, 0, ApiConfig.HTTP_URL_COLLECTONLIST, CollectionListBean.class, map,headMap, page == 1 ? true : false); mPresenter.getData(RvFrameConfig.ADMIN_POST, 0, ApiConfig.HTTP_URL_COLLECTONLIST, CollectionListBean.class, map, headMap, page == 1 ? true : false);
} }
......
...@@ -10,6 +10,9 @@ import android.view.View; ...@@ -10,6 +10,9 @@ import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer;
import com.frame.base.bus.RxBus;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.other.TagAliasOperatorHelper; import com.ruiwenliu.wrapper.other.TagAliasOperatorHelper;
...@@ -32,6 +35,7 @@ import java.util.Map; ...@@ -32,6 +35,7 @@ import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import io.reactivex.schedulers.Schedulers;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_DELETE; import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_DELETE;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_SET; import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_SET;
...@@ -64,6 +68,7 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -64,6 +68,7 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
isShowLoadingError = false; isShowLoadingError = false;
} }
@Override @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent); super.loadData(savedInstanceState, intent);
......
...@@ -22,7 +22,6 @@ public class TravelBookingDeparturetimeAdapter extends BaseQuickAdapter<BeanTour ...@@ -22,7 +22,6 @@ public class TravelBookingDeparturetimeAdapter extends BaseQuickAdapter<BeanTour
protected void convert(BaseViewHolder helper, BeanTourDetailData.DataBeanX.TourDepartTimeVo item) { protected void convert(BaseViewHolder helper, BeanTourDetailData.DataBeanX.TourDepartTimeVo item) {
String time = item.getStartTime() + getWeek(item.getStartWeek()) + "~" + item.getEndTime() + getWeek(item.getEndWeek()); String time = item.getStartTime() + getWeek(item.getStartWeek()) + "~" + item.getEndTime() + getWeek(item.getEndWeek());
helper.setText(R.id.tv_time, time); helper.setText(R.id.tv_time, time);
if ("0".equals(item.getOverdue())) { if ("0".equals(item.getOverdue())) {
if (selectPosition == mData.indexOf(item)) { if (selectPosition == mData.indexOf(item)) {
...@@ -33,6 +32,7 @@ public class TravelBookingDeparturetimeAdapter extends BaseQuickAdapter<BeanTour ...@@ -33,6 +32,7 @@ public class TravelBookingDeparturetimeAdapter extends BaseQuickAdapter<BeanTour
helper.setTextColor(R.id.tv_time, ContextCompat.getColor(mContext, R.color.colorMain)); helper.setTextColor(R.id.tv_time, ContextCompat.getColor(mContext, R.color.colorMain));
} else { } else {
helper.setTextColor(R.id.tv_time, ContextCompat.getColor(mContext, R.color.textGray)); helper.setTextColor(R.id.tv_time, ContextCompat.getColor(mContext, R.color.textGray));
helper.getView(R.id.iv_time_select).setSelected(false);
} }
} }
......
...@@ -506,7 +506,12 @@ public class TravelDetailsActivity extends BaseStatusActivity<TourismPresenter> ...@@ -506,7 +506,12 @@ public class TravelDetailsActivity extends BaseStatusActivity<TourismPresenter>
@JavascriptInterface @JavascriptInterface
public void showDialog() { public void showDialog() {
travelBooking(); mWebView.post(new Runnable() {
@Override
public void run() {
travelBooking();
}
});
} }
@JavascriptInterface @JavascriptInterface
......
...@@ -17,6 +17,8 @@ import android.widget.TextView; ...@@ -17,6 +17,8 @@ import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.alipay.sdk.app.EnvUtils; import com.alipay.sdk.app.EnvUtils;
import com.base.utils.ui.image.round.RoundImageView; import com.base.utils.ui.image.round.RoundImageView;
import com.frame.base.bus.LoginSuccessfulEvent;
import com.frame.base.bus.Observer;
import com.frame.base.bus.PaymentFailedEvent; import com.frame.base.bus.PaymentFailedEvent;
import com.frame.base.bus.PaymentSuccessfulEvent; import com.frame.base.bus.PaymentSuccessfulEvent;
import com.frame.base.bus.RxBus; import com.frame.base.bus.RxBus;
...@@ -50,6 +52,7 @@ import java.util.Map; ...@@ -50,6 +52,7 @@ import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
...@@ -157,6 +160,16 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -157,6 +160,16 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
} }
}); });
Log.e("xxxxxxxxxxxxxx", disposableSuc == disposableFail ? "true" : "false"); Log.e("xxxxxxxxxxxxxx", disposableSuc == disposableFail ? "true" : "false");
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
getUserData();
getMemberData();
}
});
} }
@Override @Override
...@@ -238,7 +251,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -238,7 +251,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
*/ */
private boolean isLogin() { private boolean isLogin() {
if (TextUtils.isEmpty(OkGoUtil.getToken())) { if (TextUtils.isEmpty(OkGoUtil.getToken())) {
startActivityForResult(LoginRvActivity.getIntent(MemberCenterActivity.this,0), REQUEST_LOGIN); startActivityForResult(LoginRvActivity.getIntent(MemberCenterActivity.this, 0), REQUEST_LOGIN);
return false; return false;
} }
return true; return true;
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
android:id="@+id/ll_webview" android:id="@+id/ll_webview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/ll_item_title"
android:layout_marginLeft="@dimen/size_15" android:layout_marginLeft="@dimen/size_15"
android:layout_marginTop="@dimen/size_15" android:layout_marginTop="@dimen/size_15"
android:layout_marginRight="@dimen/size_15" android:layout_marginRight="@dimen/size_15"
......
package com.dueeeke.videoplayer.widget;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import com.dueeeke.videoplayer.player.VideoView;
public class RotateVideoView extends VideoView {
public RotateVideoView(@NonNull Context context) {
super(context);
}
public RotateVideoView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public RotateVideoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void startFullScreen() {
super.startFullScreen();
mOrientationEventListener.disable();
}
@Override
public void stopFullScreen() {
super.stopFullScreen();
mOrientationEventListener.disable();
}
}
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