Commit 73547d0b authored by linfeng's avatar linfeng

租车下单优化

parent 3c2de633
...@@ -28,7 +28,7 @@ public abstract class BasePopupWindow extends PopupWindow implements OnViewHolde ...@@ -28,7 +28,7 @@ public abstract class BasePopupWindow extends PopupWindow implements OnViewHolde
private WeakReference<Activity> viewReference; //MvpView的子类的弱引用 private WeakReference<Activity> viewReference; //MvpView的子类的弱引用
protected ViewHolder helper; protected ViewHolder helper;
// public boolean canDismiss=false; // public boolean canDismiss=false;
WindowManager.LayoutParams params; public WindowManager.LayoutParams params;
public BasePopupWindow(@NonNull Activity activity) { public BasePopupWindow(@NonNull Activity activity) {
viewReference = new WeakReference<>(activity); viewReference = new WeakReference<>(activity);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<dimen name="size_130">130dp</dimen> <dimen name="size_130">130dp</dimen>
<dimen name="size_140">140dp</dimen> <dimen name="size_140">140dp</dimen>
<dimen name="size_150">150dp</dimen> <dimen name="size_150">150dp</dimen>
<dimen name="size_160">160dp</dimen>
<dimen name="size_170">170dp</dimen> <dimen name="size_170">170dp</dimen>
<dimen name="size_180">180dp</dimen> <dimen name="size_180">180dp</dimen>
<dimen name="size_190">190dp</dimen> <dimen name="size_190">190dp</dimen>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:gravity="bottom" android:gravity="bottom"
android:maxHeight="@dimen/size_580"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
......
...@@ -95,6 +95,12 @@ public class DateUtils { ...@@ -95,6 +95,12 @@ public class DateUtils {
*/ */
private static SimpleDateFormat sdf16 = new SimpleDateFormat("dd"); private static SimpleDateFormat sdf16 = new SimpleDateFormat("dd");
/**
* MM月dd日
*/
private static SimpleDateFormat sdf17 = new SimpleDateFormat("MM月dd日");
/** /**
* 将yyyy-MM-dd HH:mm:ss转换 Date * 将yyyy-MM-dd HH:mm:ss转换 Date
* *
...@@ -515,6 +521,23 @@ public class DateUtils { ...@@ -515,6 +521,23 @@ public class DateUtils {
return day; return day;
} }
/**
* 将MM-dd格式成MM月dd日
*
* @param dateStr MM-dd
* @return MM月dd日
*/
public static String formatDate14(String dateStr) {
String day = "";
try {
Date date = sdf5.parse(dateStr);
day = sdf17.format(date);
} catch (Exception e) {
e.printStackTrace();
}
return day;
}
/** /**
* 将yyyy-MM-dd格式成yy-MM-dd * 将yyyy-MM-dd格式成yy-MM-dd
* *
...@@ -731,7 +754,7 @@ public class DateUtils { ...@@ -731,7 +754,7 @@ public class DateUtils {
} }
/** /**
*将yyyy-MM-dd HH:mm:ss格式成dd * 将yyyy-MM-dd HH:mm:ss格式成dd
* *
* @param dateStr yyyy-MM-dd HH:mm:ss * @param dateStr yyyy-MM-dd HH:mm:ss
* @return dd * @return dd
......
package com.rv.home.rv.module.ui.main.home.adapter;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.rv.home.R;
import com.rv.home.rv.module.ui.main.home.bean.OrderCarPriceBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderCarPriceDetailBean;
import java.util.List;
/**
* 租车订单价格明细
*/
public class OrderCarPriceDetailAdapter extends BaseQuickAdapter<OrderCarPriceDetailBean.ChildrenBean, BaseViewHolder> {
private OrderDayCarPriceDetailAdapter adapter;
private boolean type;
public OrderCarPriceDetailAdapter() {
super(R.layout.rv_item_order_car_price_detail);
}
@Override
protected void convert(BaseViewHolder helper, OrderCarPriceDetailBean.ChildrenBean item) {
helper.setText(R.id.tv_name, item.getKey());
helper.setText(R.id.tv_price, item.getVal());
if ("优惠券".equals(item.getKey())) {
helper.setTextColor(R.id.tv_name, helper.itemView.getContext().getResources().getColor(R.color.colorAuxiliaryRed));
helper.setTextColor(R.id.tv_price, helper.itemView.getContext().getResources().getColor(R.color.colorAuxiliaryRed));
} else {
helper.setTextColor(R.id.tv_name, helper.itemView.getContext().getResources().getColor(R.color.textMain));
helper.setTextColor(R.id.tv_price, helper.itemView.getContext().getResources().getColor(R.color.textMain));
}
RecyclerView rvDayPrice = helper.getView(R.id.rv_dayprice);
rvDayPrice.setLayoutManager(new LinearLayoutManager(helper.itemView.getContext()));
adapter = new OrderDayCarPriceDetailAdapter();
rvDayPrice.setAdapter(adapter);
List<OrderCarPriceBean> dataBean = item.getDataBean();
if (dataBean != null && dataBean.size() > 0) {
if (item.isDayPrice()) {
helper.setText(R.id.tv_attr, item.getDetail());
helper.setGone(R.id.iv_hint, true);
adapter.setNewData(dataBean);
helper.setOnClickListener(R.id.ll_item_isshow_dayprice, new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!type) {
rvDayPrice.setVisibility(View.VISIBLE);
} else {
rvDayPrice.setVisibility(View.GONE);
}
type = !type;
}
});
} else {
helper.setGone(R.id.iv_hint, false);
double price = dataBean.get(0).getPrice();
helper.setText(R.id.tv_attr, price + "/天*" + item.getDetail());
}
} else {
helper.setGone(R.id.iv_hint, false);
helper.setText(R.id.tv_attr, item.getDetail());
}
if (!type){
rvDayPrice.setVisibility(View.GONE);
}
}
public void setType(boolean b) {
type = b;
}
}
package com.rv.home.rv.module.ui.main.home.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.rv.component.utils.DateUtils;
import com.rv.home.R;
import com.rv.home.rv.module.ui.main.home.bean.OrderCarPriceBean;
/**
* 租车订单价格明细
*/
public class OrderDayCarPriceDetailAdapter extends BaseQuickAdapter<OrderCarPriceBean, BaseViewHolder> {
public OrderDayCarPriceDetailAdapter() {
super(R.layout.rv_item_order_day_car_price_detail);
}
@Override
protected void convert(BaseViewHolder helper, OrderCarPriceBean item) {
helper.setText(R.id.tv_date, DateUtils.formatDate14(DateUtils.formatDate11(item.getDate())));
helper.setText(R.id.tv_price, "¥" + item.getPrice());
}
}
...@@ -12,14 +12,14 @@ import java.util.List; ...@@ -12,14 +12,14 @@ import java.util.List;
public class OrderCalendarPriceBean extends BaseBean implements Serializable { public class OrderCalendarPriceBean extends BaseBean implements Serializable {
private List<DataBean> data; private List<OrderCarPriceBean> data;
private boolean rel; private boolean rel;
public List<DataBean> getData() { public List<OrderCarPriceBean> getData() {
return data; return data;
} }
public void setData(List<DataBean> data) { public void setData(List<OrderCarPriceBean> data) {
this.data = data; this.data = data;
} }
...@@ -30,44 +30,4 @@ public class OrderCalendarPriceBean extends BaseBean implements Serializable { ...@@ -30,44 +30,4 @@ public class OrderCalendarPriceBean extends BaseBean implements Serializable {
public void setRel(boolean rel) { public void setRel(boolean rel) {
this.rel = rel; this.rel = rel;
} }
public static class DataBean implements Serializable {
private String date;
private double price;
private double no_discount_price;
private double freeDays;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getNo_discount_price() {
return no_discount_price;
}
public void setNo_discount_price(double no_discount_price) {
this.no_discount_price = no_discount_price;
}
public double getFreeDays() {
return freeDays;
}
public void setFreeDays(double freeDays) {
this.freeDays = freeDays;
}
}
} }
package com.rv.home.rv.module.ui.main.home.bean;
public class OrderCarPriceBean {
private String date;
private double price;
private double no_discount_price;
private double freeDays;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getNo_discount_price() {
return no_discount_price;
}
public void setNo_discount_price(double no_discount_price) {
this.no_discount_price = no_discount_price;
}
public double getFreeDays() {
return freeDays;
}
public void setFreeDays(double freeDays) {
this.freeDays = freeDays;
}
}
package com.rv.home.rv.module.ui.main.home.bean;
import java.util.List;
/**
* Desc:租车订单价格明细
*/
public class OrderCarPriceDetailBean {
/**
* key : 费用明细
* val :
* children : [{"key":"车辆租赁费","detail":"¥35000.01/天×2天","val":"¥70000.02"},{"key":"专职司机服务费","detail":"¥600.00×1人×2天","val":"¥1200.00"},{"key":"租房车押金","detail":"","val":"¥20000.00"}]
*/
private String key;
private String val;
private List<ChildrenBean> children;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getVal() {
return val;
}
public void setVal(String val) {
this.val = val;
}
public List<ChildrenBean> getChildren() {
return children;
}
public void setChildren(List<ChildrenBean> children) {
this.children = children;
}
public static class ChildrenBean {
/**
* key : 车辆租赁费
* detail : ¥35000.01/天×2天
* val : ¥70000.02
*/
private String key;
private String detail;
private String val;
private boolean isDayPrice;
private List<OrderCarPriceBean> dataBean;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getVal() {
return val;
}
public void setVal(String val) {
this.val = val;
}
public boolean isDayPrice() {
return isDayPrice;
}
public void setDayPrice(boolean dayPrice) {
isDayPrice = dayPrice;
}
public List<OrderCarPriceBean> getDataBean() {
return dataBean;
}
public void setDataBean(List<OrderCarPriceBean> dataBean) {
this.dataBean = dataBean;
}
}
}
package com.rv.home.rv.module.ui.main.home.dialog;
import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import android.widget.TextView;
import com.ruiwenliu.wrapper.dialog.BasePopupWindow;
import com.ruiwenliu.wrapper.util.ViewHolder;
import com.rv.home.R;
import com.rv.home.rv.module.ui.main.home.adapter.OrderCarPriceDetailAdapter;
import com.rv.home.rv.module.ui.main.home.bean.OrderCarPriceDetailBean;
/**
* Desc:租车订单价格明细
*/
public class OrderCarPriceDetailPw extends BasePopupWindow {
private OrderCarPriceDetailAdapter detailAdapter;
private TextView tvTitle;
public OrderCarPriceDetailPw(@NonNull Activity activity) {
super(activity);
setClippingEnabled(true);
setOutsideTouchable(true);
setFocusable(true);
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public int getViewLayout() {
return R.layout.rv_pw_order_price_detail;
}
@Override
public void helper(ViewHolder helper) {
super.helper(helper);
tvTitle = helper.getView(R.id.tv_title);
RecyclerView recyclerView = helper.getView(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(getDialogContext()));
detailAdapter = new OrderCarPriceDetailAdapter();
recyclerView.setAdapter(detailAdapter);
}
public void setNewData(OrderCarPriceDetailBean bean) {
if (detailAdapter != null && bean != null) {
tvTitle.setText(bean.getKey());
detailAdapter.setNewData(bean.getChildren());
}
}
@Override
public void dismiss() {
detailAdapter.setType(false);
super.dismiss();
}
// @Override
// public void showAsDropDown(View parent, int xoff, int yoff, int gravity) {
// if (Build.VERSION.SDK_INT >= 24) {
// Rect visibleFrame = new Rect();
// parent.getGlobalVisibleRect(visibleFrame);
// int height = parent.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom;
//// int height = anchor.getResources().getDisplayMetrics().heightPixels;
// setHeight(height);
// }
// super.showAsDropDown(parent, xoff, yoff, gravity);
// }
}
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorWrite" android:background="@color/colorWrite"
android:padding="@dimen/size_15" android:paddingLeft="@dimen/size_15"
android:paddingTop="@dimen/size_15"> android:paddingTop="@dimen/size_15"
android:paddingRight="@dimen/size_15">
<ImageView <ImageView
android:id="@+id/iv_goods" android:id="@+id/iv_goods"
...@@ -105,12 +106,57 @@ ...@@ -105,12 +106,57 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWrite"
android:paddingLeft="@dimen/size_160"
android:paddingRight="@dimen/size_15">
<include layout="@layout/common_line" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorWrite" android:background="@color/colorWrite"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:layout_marginLeft="@dimen/size_15"
android:layout_marginRight="@dimen/size_15"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_day_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="@color/colorAuxiliaryRed"
android:textSize="@dimen/text_14"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_item_loook_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/rv_common_icon_up_arrow"
android:drawablePadding="@dimen/size_5"
android:paddingLeft="@dimen/size_30"
android:paddingTop="@dimen/size_10"
android:paddingBottom="@dimen/size_10"
android:text="每日价格"
android:textColor="@color/text_Main"
android:textSize="@dimen/text_12" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
...@@ -513,7 +559,7 @@ ...@@ -513,7 +559,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="(剩余1天)" android:text=""
android:textColor="@color/textGray" android:textColor="@color/textGray"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
...@@ -549,9 +595,9 @@ ...@@ -549,9 +595,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="暂无优惠券"
android:drawableRight="@drawable/common_icon_rig_gray" android:drawableRight="@drawable/common_icon_rig_gray"
android:drawablePadding="@dimen/size_5" android:drawablePadding="@dimen/size_5"
android:text="暂无优惠券"
android:textColor="@color/gray_FFB74B" android:textColor="@color/gray_FFB74B"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
</RelativeLayout> </RelativeLayout>
...@@ -808,8 +854,6 @@ ...@@ -808,8 +854,6 @@
android:textSize="@dimen/text_16" /> android:textSize="@dimen/text_16" />
<EditText <EditText
android:inputType="phone"
android:maxLength="11"
android:id="@+id/edt_inviter_phone" android:id="@+id/edt_inviter_phone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -818,6 +862,8 @@ ...@@ -818,6 +862,8 @@
android:background="@color/colorWrite" android:background="@color/colorWrite"
android:gravity="center_vertical" android:gravity="center_vertical"
android:hint="请输入邀请人手机号" android:hint="请输入邀请人手机号"
android:inputType="phone"
android:maxLength="11"
android:textColor="@color/text_Gray" android:textColor="@color/text_Gray"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
</RelativeLayout> </RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWrite"
android:orientation="vertical"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/size_8"
android:paddingBottom="@dimen/size_8">
<LinearLayout
android:id="@+id/ll_item_isshow_dayprice"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="222222222222"
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
<ImageView
android:id="@+id/iv_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginLeft="@dimen/size_5"
android:src="@drawable/rv_common_icon_notice" />
</LinearLayout>
<TextView
android:id="@+id/tv_attr"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="222222222"
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="55555555555"
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_dayprice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWrite"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/size_3"
android:paddingBottom="@dimen/size_3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text=""
android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" />
<TextView
android:id="@+id/tv_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_half"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="@dimen/size_half"
android:layout_weight="1" />
<View
android:layout_width="0dp"
android:layout_height="@dimen/size_half"
android:layout_weight="2"
android:background="@color/colorLine" />
</LinearLayout>
</LinearLayout>
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