Commit 47c597c8 by wjg

init

parent d264e5f1
......@@ -24,6 +24,13 @@ public class HLApplication extends Application {
public void onCreate() {
super.onCreate();
// Log.d("TEST", String.valueOf(Utils.pxTodp(this, 2340)));
// Log.d("TEST", String.valueOf(Utils.pxTodp(this, 1920)));
// Log.d("TEST", String.valueOf(this.getResources().getDisplayMetrics().density));
// Log.d("TEST", String.valueOf(Utils.pxTodp(this, 1920)));
// Log.d("TEST", String.valueOf(Utils.pxTodp(this, 1080)));
AppConfig.MACHINE_CODE = HttpUtil.getMacAddress();
AppConfig.MACHINE_CODE = "Code001"; // TODO 获取机器编码
......
......@@ -73,7 +73,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
Glide.with(mContext).load(goods.getPics().getThumbnail()).apply(options).into(imgThumbnail);
}
Sku sku = getSku(goods.getSkus());
Sku sku = getDefaultSku(goods.getSkus());
if (sku == null) {
helper.setText(R.id.txt_price, String.valueOf(goods.getPrice()));
helper.setText(R.id.txt_discount, String.valueOf(goods.getDiscount()));
......@@ -94,16 +94,25 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
butnAdd.setOnClickListener(v -> Utils.sendAddGoodsBroadcast(mContext, goods, sku, 1));
ViewGroup layoutItem = helper.getView(R.id.layout_item);
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd), 15);
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd));
}
}
View layoutItem = helper.getView(R.id.layout_item);
layoutItem.setOnClickListener(v -> Utils.showGoodsDetail(mContext, goods));
int padding = Utils.getDimens(mContext, R.dimen.padding10);
layoutItem.setPadding(padding, padding, padding, padding);
// 最后一个商品 并且购物条已经显示
if (getData().indexOf(item) == getItemCount() - 1 && trolleyState) {
int bottomPadding = Utils.getDimens(mContext, R.dimen.trolley_bar_height);
layoutItem.setPadding(padding, padding, padding, bottomPadding);
}
}
/** 获取SKU,优选获取默认的SKU */
private Sku getSku(List<Sku> skus) {
private Sku getDefaultSku(List<Sku> skus) {
if (CollectionUtils.isEmpty(skus)) {
return null;
}
......@@ -117,4 +126,14 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
}
return skus.get(0);
}
private boolean trolleyState = false;
public boolean isTrolleyState() {
return trolleyState;
}
public void setTrolleyState(boolean trolleyState) {
this.trolleyState = trolleyState;
}
}
......@@ -73,7 +73,7 @@ public class TrolleyAdapter extends BaseAdapter {
Glide.with(mContext).load(goods.getPics().getThumbnail()).into(imgThumbnail);
ViewGroup layoutItem = convertView.findViewById(R.id.layout_item);
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd, butnSubtract), 15);
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd, butnSubtract));
return convertView;
}
......
......@@ -4,11 +4,15 @@ public class Base {
public static final Integer TRUE = 1;
public static final Integer FALSE = 0;
public static final String NOTIFY_ACTION_ORDER_STATE_CHANGED = "ORDER_STATE_CHANGED";
public static final String NOTIFY_ACTION_SKU_STATE_CHANGED = "SKU_STATE_CHANGED";
public static final String NOTIFY_ACTION_QRCODE_VISITED = "QRCODE_VISITED";
public static final String PUSH_ACTION_ORDER_STATE_CHANGED = "ORDER_STATE_CHANGED";
public static final String PUSH_ACTION_SKU_STATE_CHANGED = "SKU_STATE_CHANGED";
public static final String PUSH_ACTION_QRCODE_VISITED = "QRCODE_VISITED";
public static final String BROADCAST_ACTION_ADD_GOODS = "ACTION_ADD_GOODS";
public static final String BROADCAST_ACTION_GOODS_CHANGED = "ACTION_GOODS_CHANGED";
public static final String BROADCAST_ACTION_CLEAR_GOODS = "ACTION_CLEAR_GOODS";
public static final String BROADCAST_ACTION_TROLLEY_SHOW = "ACTION_TROLLEY_SHOW";
public static final String BROADCAST_ACTION_TROLLEY_HIDE = "ACTION_TROLLEY_HIDE";
public static final String ADD_GOODS_ACTION = "ADD_GOODS_ACTION";
public static final String GOODS_CHANGED_ACTION = "GOODS_CHANGED_ACTION";
public static final String CLEAR_GOODS_ACTION = "CLEAR_GOODS_ACTION";
}
......@@ -17,7 +17,6 @@ public class Sku implements Serializable {
/** 原价 */
private BigDecimal price;
/** 折扣价 */
@JsonProperty("disCount")
private BigDecimal discount;
/** SKU规格 */
private List<SkuRule> rules;
......
......@@ -11,6 +11,7 @@ import android.view.ViewGroup;
import androidx.coordinatorlayout.widget.ViewGroupUtils;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.component.TouchDelegateComposite;
import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.TrolleyGoods;
......@@ -25,24 +26,18 @@ import java.util.List;
public class Utils {
public static void sendAddGoodsBroadcast(Context context, Goods goods, Sku sku, Integer count) {
Intent intent = new Intent();
intent.setAction(Base.ADD_GOODS_ACTION);
intent.putExtra("goods", goods);
intent.putExtra("sku", sku);
intent.putExtra("count", count);
context.sendBroadcast(intent);
}
public static void sendGoodsChnagedBroadcast(Context context) {
public static void fastBroadcast(Context context, String action) {
Intent intent = new Intent();
intent.setAction(Base.GOODS_CHANGED_ACTION);
intent.setAction(action);
context.sendBroadcast(intent);
}
public static void sendClearGoodsBroadcast(Context context) {
public static void sendAddGoodsBroadcast(Context context, Goods goods, Sku sku, Integer count) {
Intent intent = new Intent();
intent.setAction(Base.CLEAR_GOODS_ACTION);
intent.setAction(Base.BROADCAST_ACTION_ADD_GOODS);
intent.putExtra("goods", goods);
intent.putExtra("sku", sku);
intent.putExtra("count", count);
context.sendBroadcast(intent);
}
......@@ -79,34 +74,43 @@ public class Utils {
context.startActivity(intent);
}
// /**
// * 获得资源 dimens (dp)
// *
// * @param context
// * @param id 资源id
// * @return
// */
// public static float getDimens(Context context, int id) {
// DisplayMetrics dm = context.getResources().getDisplayMetrics();
// float px = context.getResources().getDimension(id);
// return px / dm.density;
// }
/**
* 获得资源 dimens (dp)
* 获得资源 dimens (px)
*
* @param context
* @param id 资源id
* @return
*/
public static float getDimens(Context context, int id) {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
float px = context.getResources().getDimension(id);
return px / dm.density;
public static int getDimens(Context context, Integer id) {
return (int) context.getResources().getDimension(id);
}
/**
* dp转px
*
* @param context
* @param dp
* @return
*/
public static int dpToPx(Context context, float dp) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return (int) ((dp * displayMetrics.density) + 0.5f);
}
public static int pxTodp(Context context, float pxValue) {
float density = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / density + 0.5f);
}
@SuppressLint("RestrictedApi")
public static void setTouchDelegate(ViewGroup group, List<View> views, Integer dp) {
Integer px = Utils.dpToPx(group.getContext(), dp);
public static void setTouchDelegate(ViewGroup group, List<View> views) {
Integer px = Utils.getDimens(group.getContext(), R.dimen.padding15);
TouchDelegateComposite composite = new TouchDelegateComposite(group);
views.forEach(view -> view.post(() -> {
Rect bounds = new Rect();
......
......@@ -171,7 +171,7 @@ public class ConfirmOrderDialog extends Dialog {
OnDismissListener dismissListener = new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
Utils.sendClearGoodsBroadcast(getContext());
Utils.fastBroadcast(getContext(), Base.BROADCAST_ACTION_CLEAR_GOODS);
if (expireThread != null) {
expireThread.interrupt();
}
......@@ -286,8 +286,8 @@ public class ConfirmOrderDialog extends Dialog {
private Bitmap genQRCode(String saveCode) throws WriterException {
String url = String.format(AppConfig.WX_URL, saveCode);
int width = Utils.dpToPx(getContext(), 100); // 图像宽度
int height = Utils.dpToPx(getContext(), 100); // 图像高度
int width = Utils.dpToPx(getContext(), 200); // 图像宽度
int height = Utils.dpToPx(getContext(), 200); // 图像高度
Map<EncodeHintType, Object> hints = new HashMap();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, width, height, hints);// 生成矩阵
......@@ -325,11 +325,11 @@ public class ConfirmOrderDialog extends Dialog {
private void regsitQRCodeVisitedListener() {
qrCodeVisitedHandler = new QRCodeVisitedHandler();
PushMessageReceiver.subscribe(Base.NOTIFY_ACTION_QRCODE_VISITED, qrCodeVisitedHandler);
PushMessageReceiver.subscribe(Base.PUSH_ACTION_QRCODE_VISITED, qrCodeVisitedHandler);
}
private void unregsitQRCodeVisitedListener() {
PushMessageReceiver.unsubscribe(Base.NOTIFY_ACTION_QRCODE_VISITED);
PushMessageReceiver.unsubscribe(Base.PUSH_ACTION_QRCODE_VISITED);
}
/** 将购物车列表按商品id分组保存 */
......
......@@ -101,7 +101,7 @@ public class GoodsDetailDialog extends Dialog {
butnTrolley.setOnClickListener(v -> addTrolley());
ViewGroup layoutItem = findViewById(R.id.layout_item);
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd, butnSubtract), 15);
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd, butnSubtract));
// 处理售罄的SKU和规格选项
processSpecRules();
......@@ -160,14 +160,14 @@ public class GoodsDetailDialog extends Dialog {
txtName.setText(spec.getSpecName());
spec.getRules().forEach(rule -> {
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
layoutParams.rightMargin = Utils.dpToPx(getContext(), 5);
layoutParams.rightMargin = Utils.getDimens(getContext(), R.dimen.padding5);
RadioButton button = (RadioButton) getLayoutInflater().inflate(R.layout.item_spec_rule, null);
button.setId(rule.getRuleId());
button.setText(rule.getRuleName());
button.setTag(rule);
if (!Base.TRUE.equals(rule.getState())) {
button.setEnabled(false);
} else if (!Base.TRUE.equals(rule.getIsDefault())) {
} else if (Base.TRUE.equals(rule.getIsDefault())) {
button.setChecked(true);
}
specGroup.addView(button, layoutParams);
......@@ -229,7 +229,7 @@ public class GoodsDetailDialog extends Dialog {
ImageView imageView = new ImageView(getContext());
imageView.setAdjustViewBounds(true);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.bottomMargin = Utils.dpToPx(getContext(), 5);
layoutParams.bottomMargin = Utils.getDimens(getContext(), R.dimen.padding5);
Glide.with(getContext()).load(url).into(imageView);
layoutImages.addView(imageView, layoutParams);
});
......@@ -240,18 +240,20 @@ public class GoodsDetailDialog extends Dialog {
showSelloutViews();
return;
}
// 将售罄和未售罄的SKU分组
// 将商品所有SKU列表按售罄和未售罄分组
Map<Integer, List<Sku>> map = goods.getSkus().stream().collect(Collectors.groupingBy(Sku::getState));
if (CollectionUtils.isEmpty(map)) {
return;
}
// 售罄SKU列表
List<Sku> sellOuts = map.get(Base.FALSE);
// 未售罄SKU列表
List<Sku> sellIns = map.get(Base.TRUE);
if (CollectionUtils.isEmpty(sellIns)) {
showSelloutViews();
return;
}
// 售罄SKU列表为空不需要处理
if (CollectionUtils.isEmpty(sellOuts)) {
return;
}
......@@ -267,22 +269,37 @@ public class GoodsDetailDialog extends Dialog {
});
}
private void showSelloutViews() {
layoutOperate.setVisibility(View.GONE);
layoutButns.setVisibility(View.GONE);
txtSellout.setVisibility(View.VISIBLE);
setAllRuleSellouts(); // 所有规格设置为售罄
/** 检查未售罄的sku里是否有此规格选项,如果有则此选项可选 */
private Integer checkRuleState(SkuRule skuRule, List<Sku> sellIns) {
if (CollectionUtils.isEmpty(sellIns)) {
return Base.FALSE;
}
for (Sku sku : sellIns) {
if (CollectionUtils.isEmpty(sku.getRules())) {
continue;
}
for (SkuRule rule : sku.getRules()) {
if (rule.getRuleId().equals(skuRule.getRuleId())) {
return Base.TRUE;
}
}
}
return Base.FALSE;
}
/** 设备商品规格 选项状态 */
private void setRuleState(SkuRule skuRule, Integer ruleState) {
if (goods == null || CollectionUtils.isEmpty(goods.getSpecs())) {
return;
}
goods.getSpecs().forEach(spec -> {
// 选项为空的规格不处理
if (CollectionUtils.isEmpty(spec.getRules())) {
return;
}
spec.getRules().forEach(rule -> {
// 设置匹配的选项
if (rule.getRuleId().equals(skuRule.getRuleId())) {
rule.setState(ruleState);
}
......@@ -290,6 +307,13 @@ public class GoodsDetailDialog extends Dialog {
});
}
private void showSelloutViews() {
layoutOperate.setVisibility(View.GONE);
layoutButns.setVisibility(View.GONE);
txtSellout.setVisibility(View.VISIBLE);
setAllRuleSellouts(); // 所有规格设置为售罄
}
private void setAllRuleSellouts() {
if (goods == null || CollectionUtils.isEmpty(goods.getSpecs())) {
return;
......@@ -301,22 +325,4 @@ public class GoodsDetailDialog extends Dialog {
spec.getRules().forEach(rule -> rule.setState(Base.FALSE));
});
}
private Integer checkRuleState(SkuRule skuRule, List<Sku> sellIns) {
if (CollectionUtils.isEmpty(sellIns)) {
return Base.FALSE;
}
for (Sku sku : sellIns) {
if (CollectionUtils.isEmpty(sku.getRules())) {
continue;
}
for (SkuRule rule : sku.getRules()) {
if (rule.getRuleId().equals(skuRule.getRuleId())) {
return Base.TRUE;
}
}
}
return Base.FALSE;
}
}
......@@ -39,6 +39,7 @@ import com.ihaoin.hooloo.device.data.vo.Sku;
import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.JsonUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
import java.util.ArrayList;
......@@ -90,7 +91,8 @@ public class LauncherActivity extends Activity {
initGoods();
setGoodsData();
registTrolleyReceiver();
registTrolleyGoodsChangedReceiver();
registTrolleyStateChangedReceiver();
showMenuView();
startLoadDataThread();
......@@ -102,8 +104,8 @@ public class LauncherActivity extends Activity {
recRecommends.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.left = Utils.dpToPx(LauncherActivity.this, 10);
outRect.bottom = Utils.dpToPx(LauncherActivity.this, 10);
outRect.left = Utils.getDimens(LauncherActivity.this, R.dimen.padding10);
outRect.bottom = Utils.getDimens(LauncherActivity.this, R.dimen.padding10);
}
});
......@@ -118,12 +120,13 @@ public class LauncherActivity extends Activity {
}
private void setRecommendsData() {
if (CollectionUtils.isEmpty(HLApplication.getMainData().getRecommends())) {
return;
}
scrollRecommends = new ArrayList<>();
ScrollBean header = new ScrollBean(true, null);
scrollRecommends.add(header);
recommendAdapter.setNewData(scrollRecommends);
if (CollectionUtils.isEmpty(HLApplication.getMainData().getRecommends())) {
return;
}
HLApplication.getMainData().getRecommends().forEach(x -> scrollRecommends.add(new ScrollBean(new ScrollBean.ScrollItemBean(x, null))));
recommendAdapter.setNewData(scrollRecommends);
}
......@@ -205,6 +208,9 @@ public class LauncherActivity extends Activity {
return;
}
HLApplication.getMainData().getCategorys().forEach(category -> {
if (CollectionUtils.isEmpty(category.getGoods())) {
return;
}
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT, RadioGroup.LayoutParams.WRAP_CONTENT);
RadioButton view = (RadioButton) this.getLayoutInflater().inflate(R.layout.item_category, null);
view.setText(category.getName());
......@@ -250,6 +256,9 @@ public class LauncherActivity extends Activity {
scrollGoods = new ArrayList<>();
HLApplication.getMainData().getCategorys().forEach(category -> {
if (CollectionUtils.isEmpty(category.getGoods())) {
return;
}
scrollGoods.add(new ScrollBean(true, category.getName()));
category.getGoods().forEach(goods -> {
scrollGoods.add(new ScrollBean(new ScrollBean.ScrollItemBean(goods, category.getName())));
......@@ -318,42 +327,44 @@ public class LauncherActivity extends Activity {
@Override
protected void onDestroy() {
super.onDestroy();
this.unregistTrolleyReceiver();
this.unregistTrolleyGoodsChangedReceiver();
this.unregistTrolleyStateChangedReceiver();
}
private TrolleyReceiver trolleyReceiver = null;
private TrolleyGoodsChangedReceiver trolleyGoodsChangedReceiver = null;
private TrolleyStateChangedReceiver trolleyStateChangedReceiver = null;
/** 注册购物车广播 */
private void registTrolleyReceiver() {
if (trolleyReceiver == null) {
trolleyReceiver = new TrolleyReceiver();
private void registTrolleyGoodsChangedReceiver() {
if (trolleyGoodsChangedReceiver == null) {
trolleyGoodsChangedReceiver = new TrolleyGoodsChangedReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Base.ADD_GOODS_ACTION);
intentFilter.addAction(Base.GOODS_CHANGED_ACTION);
intentFilter.addAction(Base.CLEAR_GOODS_ACTION);
this.registerReceiver(trolleyReceiver, intentFilter);
intentFilter.addAction(Base.BROADCAST_ACTION_ADD_GOODS);
intentFilter.addAction(Base.BROADCAST_ACTION_GOODS_CHANGED);
intentFilter.addAction(Base.BROADCAST_ACTION_CLEAR_GOODS);
this.registerReceiver(trolleyGoodsChangedReceiver, intentFilter);
}
}
private void unregistTrolleyReceiver() {
if (trolleyReceiver != null) {
this.unregisterReceiver(trolleyReceiver);
trolleyReceiver = null;
private void unregistTrolleyGoodsChangedReceiver() {
if (trolleyGoodsChangedReceiver != null) {
this.unregisterReceiver(trolleyGoodsChangedReceiver);
trolleyGoodsChangedReceiver = null;
}
}
/** 购物车操作广播接收器 */
class TrolleyReceiver extends BroadcastReceiver {
class TrolleyGoodsChangedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Base.ADD_GOODS_ACTION)) {
if (intent.getAction().equals(Base.BROADCAST_ACTION_ADD_GOODS)) {
Goods goods = (Goods) intent.getSerializableExtra("goods");
Sku sku = (Sku) intent.getSerializableExtra("sku");
Integer count = intent.getIntExtra("count", 1);
trolleyView.prepareAddGoods(goods, sku, count);
} else if (intent.getAction().equals(Base.GOODS_CHANGED_ACTION)) {
} else if (intent.getAction().equals(Base.BROADCAST_ACTION_GOODS_CHANGED)) {
trolleyView.goodsChanged();
} else if (intent.getAction().equals(Base.CLEAR_GOODS_ACTION)) {
} else if (intent.getAction().equals(Base.BROADCAST_ACTION_CLEAR_GOODS)) {
trolleyView.clearTrolley();
}
}
......@@ -365,6 +376,22 @@ public class LauncherActivity extends Activity {
}
}
private void registTrolleyStateChangedReceiver() {
trolleyStateChangedReceiver = new TrolleyStateChangedReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(Base.BROADCAST_ACTION_TROLLEY_SHOW);
filter.addAction(Base.BROADCAST_ACTION_TROLLEY_HIDE);
this.registerReceiver(trolleyStateChangedReceiver, filter);
}
private void unregistTrolleyStateChangedReceiver() {
if (trolleyStateChangedReceiver != null) {
mContext.unregisterReceiver(trolleyStateChangedReceiver);
trolleyStateChangedReceiver = null;
}
}
/** 显示菜单屏KDS */
private void showMenuView() {
DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
......@@ -375,4 +402,22 @@ public class LauncherActivity extends Activity {
menu = new MenuPresentation(this, displays[1]);
menu.show();
}
class TrolleyStateChangedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (StringUtils.isEmpty(intent.getAction())) {
return;
}
if (goodsAdapter == null) {
return;
}
if (intent.getAction().equals(Base.BROADCAST_ACTION_TROLLEY_SHOW)) {
goodsAdapter.setTrolleyState(true);
} else {
goodsAdapter.setTrolleyState(false);
}
goodsAdapter.notifyDataSetChanged();
}
}
}
......@@ -150,7 +150,7 @@ public class MenuPresentation extends Presentation {
private void regsitOrderChangeListener() {
orderStateChangeHandler = new OrderStateChangeHandler();
PushMessageReceiver.subscribe(Base.NOTIFY_ACTION_ORDER_STATE_CHANGED, orderStateChangeHandler);
PushMessageReceiver.subscribe(Base.PUSH_ACTION_ORDER_STATE_CHANGED, orderStateChangeHandler);
}
private List<Order> getOrders(Integer state) {
......
......@@ -20,6 +20,7 @@ import com.ihaoin.hooloo.device.HLApplication;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.adapter.TrolleyAdapter;
import com.ihaoin.hooloo.device.component.NetworkHandler;
import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.TrolleyGoods;
import com.ihaoin.hooloo.device.data.vo.Goods;
import com.ihaoin.hooloo.device.data.vo.Sku;
......@@ -100,7 +101,7 @@ public class TrolleyView extends RelativeLayout {
// 判断是否在购物车里存在同样规格的产品
if (optional.isPresent()) {
TrolleyGoods g = optional.get();
g.setCount(g.getCount() + 1);
g.setCount(g.getCount() + count);
} else {
TrolleyGoods g = new TrolleyGoods();
g.setId(RandomUtils.nextLong(trolleyGoods.stream().map(TrolleyGoods::getId).collect(Collectors.toList())));
......@@ -187,14 +188,16 @@ public class TrolleyView extends RelativeLayout {
viewBackground.setVisibility(View.INVISIBLE);
layoutTrolley.setVisibility(View.INVISIBLE);
state = false;
Utils.fastBroadcast(getContext(), Base.BROADCAST_ACTION_TROLLEY_HIDE);
} else {
this.setVisibility(View.VISIBLE);
Utils.fastBroadcast(getContext(), Base.BROADCAST_ACTION_TROLLEY_SHOW);
}
}
private void measureListHeight() {
int count = this.trolleyGoods.size() > 2 ? 2 : this.trolleyGoods.size();
int height = Utils.dpToPx(this.getContext(), 100 * count);
int height = Utils.getDimens(this.getContext(), R.dimen.trolley_item_height) * count;
ViewGroup.LayoutParams layoutParams = listTrolley.getLayoutParams();
layoutParams.height = height;
listTrolley.setLayoutParams(layoutParams);
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="@color/line"
android:fillColor="@color/black"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/black"
android:fillColor="@color/black"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12 19,6.41z" />
</vector>
......@@ -30,8 +30,9 @@
android:id="@+id/group_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/category_margin"
android:divider="@color/line"
android:dividerPadding="20dp"
android:dividerPadding="@dimen/category_divider_padding"
android:gravity="center"
android:orientation="vertical"
android:showDividers="middle" />
......
......@@ -22,20 +22,20 @@
android:layout_weight="1"
android:background="@color/colorPrimary"
android:orientation="vertical"
android:padding="20dp">
android:padding="@dimen/padding20">
<TextView
android:id="@+id/txt_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_margin="@dimen/padding10"
android:text="自主取餐"
android:textColor="@color/white"
android:textSize="24sp" />
android:textSize="@dimen/ts_menu_title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/txt_title"
android:layout_margin="10dp"
android:layout_margin="@dimen/padding10"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
......@@ -47,7 +47,7 @@
android:layout_height="wrap_content"
android:text="制作中"
android:textColor="@color/white"
android:textSize="18sp" />
android:textSize="@dimen/ts_menu_subtitle" />
<GridView
android:id="@+id/grid_cooking"
android:layout_width="match_parent"
......@@ -58,10 +58,10 @@
<ImageView
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="40dp"
android:layout_marginStart="@dimen/menu_divider_padding_hor"
android:layout_marginTop="@dimen/menu_divider_padding_ver"
android:layout_marginEnd="@dimen/menu_divider_padding_hor"
android:layout_marginBottom="@dimen/menu_divider_padding_ver"
android:background="@color/white"
tools:ignore="Suspicious0dp" />
<RelativeLayout
......@@ -74,7 +74,7 @@
android:layout_height="wrap_content"
android:text="待制作"
android:textColor="@color/white"
android:textSize="18sp" />
android:textSize="@dimen/ts_menu_subtitle" />
<GridView
android:id="@+id/grid_waiting"
android:layout_width="match_parent"
......@@ -85,10 +85,10 @@
<ImageView
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="40dp"
android:layout_marginStart="@dimen/menu_divider_padding_hor"
android:layout_marginTop="@dimen/menu_divider_padding_ver"
android:layout_marginEnd="@dimen/menu_divider_padding_hor"
android:layout_marginBottom="@dimen/menu_divider_padding_ver"
android:background="@color/white"
tools:ignore="Suspicious0dp" />
<RelativeLayout
......@@ -101,7 +101,7 @@
android:layout_height="wrap_content"
android:text="可取餐(扫码取餐)"
android:textColor="@color/white"
android:textSize="18sp" />
android:textSize="@dimen/ts_menu_subtitle" />
<GridView
android:id="@+id/grid_completed"
android:layout_width="match_parent"
......
......@@ -23,14 +23,14 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="打开系统设置"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_setting_name" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginEnd="@dimen/padding10"
android:src="@drawable/ic_baseline_chevron_right_24_grey" />
</LinearLayout>
<include layout="@layout/view_line" />
......@@ -44,18 +44,18 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="App版本号"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_setting_name" />
<TextView
android:id="@+id/txt_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginEnd="@dimen/padding10"
android:text="1.0.0"
android:textColor="@color/textDisable"
android:textSize="14sp" />
android:textSize="@dimen/ts_setting_desc" />
</LinearLayout>
<include layout="@layout/view_line" />
<LinearLayout
......@@ -68,18 +68,18 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="机器编码"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_setting_name" />
<TextView
android:id="@+id/txt_machine_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginEnd="@dimen/padding10"
android:text="机器编码"
android:textColor="@color/textDisable"
android:textSize="14sp" />
android:textSize="@dimen/ts_setting_desc" />
</LinearLayout>
<include layout="@layout/view_line" />
<LinearLayout
......@@ -92,18 +92,18 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="点单屏编码"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_setting_name" />
<TextView
android:id="@+id/txt_screen_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginEnd="@dimen/padding10"
android:text="A"
android:textColor="@color/textDisable"
android:textSize="14sp" />
android:textSize="@dimen/ts_setting_desc" />
</LinearLayout>
<include layout="@layout/view_line" />
<LinearLayout
......@@ -116,14 +116,15 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="显示菜单屏"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_setting_name" />
<ToggleButton
android:id="@+id/butn_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10" />
</LinearLayout>
<include layout="@layout/view_line" />
<LinearLayout
......@@ -136,14 +137,15 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="logcat日志"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_setting_name" />
<ToggleButton
android:id="@+id/butn_logcat"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10" />
</LinearLayout>
</LinearLayout>
</ScrollView>
......
......@@ -5,8 +5,8 @@
android:background="@drawable/sel_category_label"
android:button="@null"
android:gravity="center"
android:paddingTop="30dp"
android:paddingBottom="30dp"
android:paddingTop="@dimen/category_padding"
android:paddingBottom="@dimen/category_padding"
android:textColor="@drawable/sel_category_color"
android:textSize="12sp" />
android:textSize="@dimen/ts_category_radio" />
......@@ -5,12 +5,12 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
android:padding="@dimen/padding10">
<ImageView
android:id="@+id/img_thumbnail"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginEnd="10dp"
android:layout_width="@dimen/goods_thum_size"
android:layout_height="@dimen/goods_thum_size"
android:layout_marginEnd="@dimen/padding10"
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/layout_right"
......@@ -25,35 +25,35 @@
android:layout_height="wrap_content"
android:text="冰茶咖啡"
android:textColor="@color/textPrimary"
android:textSize="14sp"
android:textSize="@dimen/ts_goods_item_name"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/layout_tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginTop="@dimen/padding3"
android:gravity="center_vertical"
android:orientation="horizontal" />
<TextView
android:id="@+id/txt_intro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginTop="@dimen/padding3"
android:ellipsize="end"
android:lines="1"
android:text="茶叶与咖啡完美的碰撞"
android:textColor="@color/textSecondPrimary"
android:textSize="12sp" />
android:textSize="@dimen/ts_goods_item_intro" />
<LinearLayout
android:id="@+id/layout_butns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginTop="@dimen/padding3"
android:gravity="bottom"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_width="@dimen/ic_price"
android:layout_height="@dimen/ic_price"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_price"
......@@ -62,13 +62,13 @@
android:gravity="center_vertical"
android:text="19.9"
android:textColor="@color/textRed"
android:textSize="12sp"
android:textSize="@dimen/ts_goods_item_price"
android:textStyle="bold" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="5dp"
android:layout_width="@dimen/ic_discount"
android:layout_height="@dimen/ic_discount"
android:layout_marginStart="@dimen/padding5"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_discount"
......@@ -78,7 +78,7 @@
android:gravity="center_vertical"
android:text="29.9"
android:textColor="@color/textSecondPrimary"
android:textSize="9sp" />
android:textSize="@dimen/ts_goods_item_discount" />
<TextView
android:id="@+id/txt_sellout"
......@@ -87,13 +87,13 @@
android:gravity="center_vertical"
android:text="已售罄"
android:textColor="@color/textRed"
android:textSize="9sp"
android:textSize="@dimen/ts_goods_item_sellout"
android:visibility="gone" />
<Button
android:id="@+id/butn_add"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="@dimen/ic_add_size"
android:layout_height="@dimen/ic_add_size"
android:background="@drawable/ic_add" />
</LinearLayout>
</LinearLayout>
......
......@@ -3,15 +3,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
android:padding="@dimen/padding10">
<TextView
android:id="@+id/txt_category"
android:layout_width="match_parent"
android:paddingTop="@dimen/padding5"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:singleLine="true"
android:textColor="@color/textPrimary"
android:textSize="20sp"
android:textSize="@dimen/ts_category_item"
android:textStyle="bold" />
</LinearLayout>
\ No newline at end of file
......@@ -5,7 +5,7 @@
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_width="@dimen/logo_width"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@mipmap/logo" />
......
......@@ -4,4 +4,4 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp" />
android:textSize="@dimen/ts_order_number" />
......@@ -13,20 +13,20 @@
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:layout_margin="@dimen/padding20"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="20sp"
android:textSize="@dimen/ts_recommend_name"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_intro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_name"
android:layout_marginStart="30dp"
android:layout_marginTop="10dp"
android:layout_marginStart="@dimen/padding20"
android:layout_marginTop="@dimen/padding10"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp"
android:textSize="@dimen/ts_recommend_desc"
android:textStyle="bold" />
</RelativeLayout>
\ No newline at end of file
......@@ -7,15 +7,15 @@
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginTop="@dimen/padding10"
android:text="温度"
android:textColor="@color/textPrimary"
android:textSize="14sp"
android:textSize="@dimen/ts_detail_spec"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/group_spec"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginTop="@dimen/padding5"
android:orientation="horizontal" />
</LinearLayout>
......@@ -3,13 +3,13 @@
android:id="@+id/butn_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginEnd="@dimen/padding10"
android:background="@drawable/sel_spec_bg"
android:button="@null"
android:paddingStart="15dp"
android:paddingTop="5dp"
android:paddingEnd="15dp"
android:paddingBottom="5dp"
android:paddingStart="@dimen/padding10"
android:paddingTop="@dimen/padding3"
android:paddingEnd="@dimen/padding10"
android:paddingBottom="@dimen/padding3"
android:singleLine="true"
android:textColor="@drawable/sel_spec_color"
android:textSize="12sp" />
android:textSize="@dimen/ts_detail_rule" />
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dp">
android:paddingRight="@dimen/padding5">
<TextView
android:id="@+id/txt_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_tag"
android:padding="3dp"
android:padding="@dimen/padding3"
android:singleLine="true"
android:textColor="@color/colorPrimary"
android:textSize="9sp"
tools:ignore="SmallSp" />
android:textSize="@dimen/ts_goods_item_tag" />
</FrameLayout>
\ No newline at end of file
......@@ -5,8 +5,8 @@
android:button="@null"
android:drawableEnd="@drawable/ic_baseline_chevron_right_24"
android:gravity="center"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="温馨提示"
android:textColor="@color/colorPrimary"
android:textSize="9sp" />
android:textSize="@dimen/ts_tips" />
......@@ -5,22 +5,22 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
android:padding="@dimen/padding10">
<ToggleButton
android:id="@+id/butn_state"
style="@style/button_style"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_width="@dimen/ic_checkbox"
android:layout_height="@dimen/ic_checkbox"
android:background="@drawable/sel_butn_check"
android:checked="true"
android:textOff=""
android:textOn="" />
<ImageView
android:id="@+id/img_thumbnail"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="@dimen/goods_thum_size"
android:layout_height="@dimen/goods_thum_size"
android:layout_marginLeft="@dimen/padding10"
android:layout_marginRight="@dimen/padding10"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="0dp"
......@@ -33,25 +33,25 @@
android:layout_height="wrap_content"
android:text="冰茶咖啡"
android:textColor="@color/textPrimary"
android:textSize="14sp"
android:textSize="@dimen/ts_goods_item_name"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_options"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginTop="@dimen/padding5"
android:text="冰/无糖"
android:textColor="@color/textSecondPrimary"
android:textSize="12sp" />
android:textSize="@dimen/ts_goods_item_intro" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginTop="@dimen/padding5"
android:gravity="bottom"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_width="@dimen/ic_price"
android:layout_height="@dimen/ic_price"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_price"
......@@ -60,13 +60,13 @@
android:gravity="center_vertical"
android:text="19.9"
android:textColor="@color/textRed"
android:textSize="12sp"
android:textSize="@dimen/ts_goods_item_price"
android:textStyle="bold" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="5dp"
android:layout_width="@dimen/ic_discount"
android:layout_height="@dimen/ic_discount"
android:layout_marginStart="@dimen/padding5"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_discount"
......@@ -76,35 +76,35 @@
android:gravity="center_vertical"
android:text="29.9"
android:textColor="@color/textSecondPrimary"
android:textSize="9sp" />
android:textSize="@dimen/ts_goods_item_discount" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginStart="@dimen/padding10"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/butn_subtract"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="@dimen/ic_subtract_size"
android:layout_height="@dimen/ic_subtract_size"
android:background="@drawable/ic_sub" />
<TextView
android:id="@+id/txt_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="@dimen/padding10"
android:layout_marginRight="@dimen/padding10"
android:text="1"
android:textColor="@color/textPrimary"
android:textSize="12sp" />
android:textSize="@dimen/ts_goods_item_count" />
<Button
android:id="@+id/butn_add"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="@dimen/ic_add_size"
android:layout_height="@dimen/ic_add_size"
android:background="@drawable/ic_add" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -3,7 +3,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="15dp">
android:padding="@dimen/padding15">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
......@@ -11,20 +11,20 @@
android:layout_centerHorizontal="true"
android:text="确认订单"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:textSize="@dimen/ts_dialog_title"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/layout_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_marginTop="10dp"
android:layout_marginTop="@dimen/padding10"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/img_qrcode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/qrcode_size"
android:layout_height="@dimen/qrcode_size"
android:adjustViewBounds="true"
android:src="@mipmap/qrcode" />
<LinearLayout
......@@ -37,20 +37,20 @@
android:id="@+id/txt_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginTop="@dimen/padding20"
android:drawableStart="@mipmap/wx"
android:gravity="center"
android:text="使用微信扫一扫,确认订单并付款"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_scan" />
<TextView
android:id="@+id/txt_expire"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginTop="@dimen/padding5"
android:text="60秒后失效"
android:textColor="@color/textPrimary"
android:textSize="12sp" />
android:textSize="@dimen/ts_expire" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_succeed"
......@@ -60,13 +60,13 @@
android:visibility="gone">
<ImageView
android:id="@+id/img_succeed"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_width="@dimen/ic_scan_succ"
android:layout_height="@dimen/ic_scan_succ"
android:src="@mipmap/succ" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginStart="@dimen/padding10"
android:orientation="vertical">
<TextView
android:id="@+id/txt_return"
......@@ -74,14 +74,14 @@
android:layout_height="wrap_content"
android:text="扫码成功(1秒后转到首页)"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:textSize="@dimen/ts_scan" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginTop="@dimen/padding5"
android:text="在微信小程序上确认订单并付款"
android:textColor="@color/textPrimary"
android:textSize="12sp" />
android:textSize="@dimen/ts_expire" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
......@@ -94,8 +94,8 @@
android:visibility="invisible" />
<ImageView
android:id="@+id/butn_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/ic_dialog_close"
android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_outline_close_24" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="600dp"
android:layout_width="@dimen/dialog_detail_width"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
......@@ -14,18 +14,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
android:padding="@dimen/padding10">
<ImageView
android:id="@+id/img_intro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_margin="@dimen/padding10"
android:layout_weight="1"
android:adjustViewBounds="true" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_margin="@dimen/padding10"
android:layout_weight="1"
android:orientation="vertical">
<TextView
......@@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:text="冰茶咖啡"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:textSize="@dimen/ts_detail_name"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/layout_specs"
......@@ -45,7 +45,7 @@
android:id="@+id/layout_images"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginTop="@dimen/padding10"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
......@@ -62,7 +62,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
android:padding="@dimen/padding10">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
......@@ -70,8 +70,8 @@
android:gravity="bottom"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_width="@dimen/ic_detail_price"
android:layout_height="@dimen/ic_detail_price"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_price"
......@@ -80,13 +80,13 @@
android:gravity="center_vertical"
android:text="19.9"
android:textColor="@color/textRed"
android:textSize="18sp"
android:textSize="@dimen/ts_detail_price"
android:textStyle="bold" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="5dp"
android:layout_width="@dimen/ic_detail_discount"
android:layout_height="@dimen/ic_detail_discount"
android:layout_marginStart="@dimen/padding5"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_discount"
......@@ -95,35 +95,35 @@
android:gravity="center_vertical"
android:text="29.9"
android:textColor="@color/textSecondPrimary"
android:textSize="12sp" />
android:textSize="@dimen/ts_detail_discount" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_operate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginStart="@dimen/padding10"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/butn_subtract"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="@dimen/ic_detail_add_size"
android:layout_height="@dimen/ic_detail_add_size"
android:background="@drawable/ic_sub" />
<TextView
android:id="@+id/txt_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="@dimen/padding10"
android:layout_marginEnd="@dimen/padding10"
android:text="1"
android:textColor="@color/textPrimary"
android:textSize="12sp" />
android:textSize="@dimen/ts_detail_count" />
<Button
android:id="@+id/butn_add"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="@dimen/ic_detail_add_size"
android:layout_height="@dimen/ic_detail_add_size"
android:background="@drawable/ic_add" />
</LinearLayout>
<TextView
......@@ -133,7 +133,7 @@
android:gravity="center_vertical"
android:text="已售罄"
android:textColor="@color/textRed"
android:textSize="12sp"
android:textSize="@dimen/ts_detail_sellout"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
......@@ -150,6 +150,7 @@
android:background="@drawable/bg_button"
android:text="加入购物袋"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/ts_detail_add_trolley"
android:textStyle="bold" />
<Button
android:id="@+id/butn_buy"
......@@ -159,6 +160,7 @@
android:background="@color/colorPrimary"
android:text="立即购买"
android:textColor="@color/white"
android:textSize="@dimen/ts_detail_buynow"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
......@@ -166,9 +168,9 @@
<ImageView
android:id="@+id/butn_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/ic_dialog_close"
android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true"
android:layout_margin="15dp"
android:layout_margin="@dimen/padding15"
android:src="@drawable/ic_outline_close_24" />
</RelativeLayout>
\ No newline at end of file
......@@ -12,17 +12,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:padding="10dp"
android:padding="@dimen/padding10"
android:src="@drawable/ic_baseline_chevron_left_24" />
<TextView
android:id="@+id/txt_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:padding="10dp"
android:padding="@dimen/padding10"
android:text="设置"
android:textColor="@color/textSecondPrimary"
android:textSize="20sp"
android:textSize="@dimen/ts_header_text"
android:textStyle="bold" />
</RelativeLayout>
<include
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="600dp"
android:layout_width="@dimen/dialog_tip_width"
android:layout_height="match_parent">
<WebView
android:id="@+id/web_view"
......@@ -9,9 +9,9 @@
<ImageView
android:id="@+id/butn_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/ic_dialog_close"
android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true"
android:layout_margin="20dp"
android:layout_margin="@dimen/padding15"
android:src="@drawable/ic_outline_close_24" />
</RelativeLayout>
\ No newline at end of file
<?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="wrap_content">
<RelativeLayout
......@@ -11,10 +10,10 @@
android:visibility="invisible">
<LinearLayout
android:id="@+id/layout_trolley"
android:layout_width="400dp"
android:layout_width="@dimen/trolley_width"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60dp"
android:layout_marginBottom="@dimen/trolley_bar_height"
android:background="@android:color/white"
android:orientation="vertical"
android:visibility="invisible">
......@@ -26,24 +25,26 @@
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginStart="@dimen/padding10"
android:layout_weight="1"
android:text="购物袋"
android:textColor="@android:color/black"
android:textSize="20sp"
android:textSize="@dimen/ts_trolley_name"
android:textStyle="bold" />
<ImageView
android:layout_width="@dimen/ic_clear_size"
android:layout_height="@dimen/ic_clear_size"
android:layout_marginStart="@dimen/padding5"
android:src="@drawable/ic_baseline_delete_outline_24" />
<Button
android:id="@+id/butn_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginEnd="@dimen/padding10"
android:background="@null"
android:drawableStart="@drawable/ic_baseline_delete_outline_24"
android:drawablePadding="5dp"
android:gravity="end|center_vertical"
android:text="清空购物袋"
android:textColor="@android:color/darker_gray"
android:textSize="12sp" />
android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_trolley_clear" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
......@@ -52,7 +53,7 @@
<ListView
android:id="@+id/list_trolley"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_height="@dimen/trolley_item_height"
android:divider="@null" />
<ImageView
android:layout_width="match_parent"
......@@ -63,58 +64,58 @@
<LinearLayout
android:id="@+id/layout_settle_bar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="@dimen/trolley_bar_height"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="60dp"
android:layout_width="@dimen/trolley_ic_border_size"
android:layout_height="match_parent">
<ImageView
android:id="@+id/img_trolley"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_width="@dimen/trolley_ic_size"
android:layout_height="@dimen/trolley_ic_size"
android:layout_centerInParent="true"
android:src="@color/colorPrimaryDark" />
<TextView
android:id="@+id/txt_count"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="@dimen/trolley_count_size"
android:layout_height="@dimen/trolley_count_size"
android:layout_alignParentEnd="true"
android:background="@drawable/ic_dot"
android:gravity="center"
android:textColor="@color/white"
android:textSize="12sp"
android:textSize="@dimen/ts_trolley_count"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginStart="@dimen/padding10"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="@dimen/ic_trolley_price"
android:layout_height="@dimen/ic_trolley_price"
android:src="@drawable/ms__menu_down" />
<TextView
android:id="@+id/txt_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:textSize="@dimen/ts_trolley_total"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="@+id/butn_pay"
android:layout_width="100dp"
android:layout_width="@dimen/trolley_pay_width"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:text="付款"
android:textColor="@color/white"
android:textSize="16sp"
android:textSize="@dimen/ts_trolley_pay"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<resources>
<dimen name="padding20">20dp</dimen>
<dimen name="padding15">15dp</dimen>
<dimen name="padding10">10dp</dimen>
<dimen name="padding5">5dp</dimen>
<dimen name="padding3">3dp</dimen>
<dimen name="logo_width">200dp</dimen>
<dimen name="goods_thum_size">80dp</dimen>
<dimen name="category_padding">20dp</dimen>
<dimen name="category_margin">50dp</dimen>
<dimen name="category_divider_padding">20dp</dimen>
<dimen name="menu_divider_padding_hor">10dp</dimen>
<dimen name="menu_divider_padding_ver">40dp</dimen>
<dimen name="qrcode_size">150dp</dimen>
<dimen name="dialog_detail_width">600dp</dimen>
<dimen name="dialog_tip_width">600dp</dimen>
<dimen name="trolley_width">400dp</dimen>
<dimen name="trolley_item_height">100dp</dimen>
<dimen name="trolley_bar_height">60dp</dimen>
<dimen name="trolley_pay_width">150dp</dimen>
<dimen name="trolley_ic_size">40dp</dimen>
<dimen name="trolley_ic_border_size">50dp</dimen>
<dimen name="trolley_count_size">20dp</dimen>
<dimen name="ic_clear_size">15dp</dimen>
<dimen name="ic_add_size">20dp</dimen>
<dimen name="ic_subtract_size">20dp</dimen>
<dimen name="ic_price">15dp</dimen>
<dimen name="ic_discount">10dp</dimen>
<dimen name="ic_checkbox">25dp</dimen>
<dimen name="ic_corners">10dp</dimen>
<dimen name="ic_detail_add_size">20dp</dimen>
<dimen name="ic_detail_subtract_size">20dp</dimen>
<dimen name="ic_detail_price">15dp</dimen>
<dimen name="ic_detail_discount">10dp</dimen>
<dimen name="ic_dialog_close">30dp</dimen>
<dimen name="ic_trolley_price">30dp</dimen>
<dimen name="ic_scan_succ">40dp</dimen>
<dimen name="ts_recommend_name">20sp</dimen>
<dimen name="ts_recommend_desc">20sp</dimen>
<dimen name="ts_category_radio">12sp</dimen>
<dimen name="ts_category_item">18sp</dimen>
<dimen name="ts_goods_item_name">14sp</dimen>
<dimen name="ts_goods_item_intro">12sp</dimen>
<dimen name="ts_goods_item_price">12sp</dimen>
<dimen name="ts_goods_item_discount">9sp</dimen>
<dimen name="ts_goods_item_sellout">12sp</dimen>
<dimen name="ts_goods_item_tag">9sp</dimen>
<dimen name="ts_goods_item_count">12sp</dimen>
<dimen name="ts_trolley_name">18sp</dimen>
<dimen name="ts_trolley_clear">12sp</dimen>
<dimen name="ts_trolley_total">16sp</dimen>
<dimen name="ts_trolley_count">12sp</dimen>
<dimen name="ts_trolley_pay">16sp</dimen>
<dimen name="ts_tips">9sp</dimen>
<dimen name="ts_detail_name">20sp</dimen>
<dimen name="ts_detail_spec">14sp</dimen>
<dimen name="ts_detail_rule">12sp</dimen>
<dimen name="ts_detail_count">14sp</dimen>
<dimen name="ts_detail_price">14sp</dimen>
<dimen name="ts_detail_discount">12sp</dimen>
<dimen name="ts_detail_sellout">12sp</dimen>
<dimen name="ts_detail_add_trolley">14sp</dimen>
<dimen name="ts_detail_buynow">14sp</dimen>
<dimen name="ts_header_text">14sp</dimen>
<dimen name="ts_dialog_title">18sp</dimen>
<dimen name="ts_scan">14sp</dimen>
<dimen name="ts_expire">12sp</dimen>
<dimen name="ts_order_number">12sp</dimen>
<dimen name="ts_menu_title">22sp</dimen>
<dimen name="ts_menu_subtitle">18sp</dimen>
<dimen name="ts_setting_name">16sp</dimen>
<dimen name="ts_setting_desc">14sp</dimen>
</resources>
......@@ -7,7 +7,8 @@
<color name="textDisable">#FF999999</color>
<color name="line">#FF979797</color>
<color name="textRed">#FFFF001D</color>
<color name="white">#FFFFFF</color>
<color name="white">#FFFFFFFF</color>
<color name="black">#FF000000</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>
<resources>
<dimen name="fab_margin">16dp</dimen>
<dimen name="padding20">20dp</dimen>
<dimen name="padding15">15dp</dimen>
<dimen name="padding10">10dp</dimen>
<dimen name="padding5">5dp</dimen>
<dimen name="padding3">3dp</dimen>
<dimen name="logo_width">200dp</dimen>
<dimen name="goods_thum_size">80dp</dimen>
<dimen name="category_padding">20dp</dimen>
<dimen name="category_margin">50dp</dimen>
<dimen name="category_divider_padding">20dp</dimen>
<dimen name="menu_divider_padding_hor">10dp</dimen>
<dimen name="menu_divider_padding_ver">40dp</dimen>
<dimen name="qrcode_size">150dp</dimen>
<dimen name="dialog_detail_width">600dp</dimen>
<dimen name="dialog_tip_width">600dp</dimen>
<dimen name="trolley_width">400dp</dimen>
<dimen name="trolley_item_height">100dp</dimen>
<dimen name="trolley_bar_height">60dp</dimen>
<dimen name="trolley_pay_width">150dp</dimen>
<dimen name="trolley_ic_size">40dp</dimen>
<dimen name="trolley_ic_border_size">50dp</dimen>
<dimen name="trolley_count_size">20dp</dimen>
<dimen name="ic_clear_size">15dp</dimen>
<dimen name="ic_add_size">20dp</dimen>
<dimen name="ic_subtract_size">20dp</dimen>
<dimen name="ic_price">15dp</dimen>
<dimen name="ic_discount">10dp</dimen>
<dimen name="ic_checkbox">25dp</dimen>
<dimen name="ic_corners">10dp</dimen>
<dimen name="ic_detail_add_size">20dp</dimen>
<dimen name="ic_detail_subtract_size">20dp</dimen>
<dimen name="ic_detail_price">15dp</dimen>
<dimen name="ic_detail_discount">10dp</dimen>
<dimen name="ic_dialog_close">30dp</dimen>
<dimen name="ic_trolley_price">30dp</dimen>
<dimen name="ic_scan_succ">40dp</dimen>
<dimen name="ts_recommend_name">20sp</dimen>
<dimen name="ts_recommend_desc">20sp</dimen>
<dimen name="ts_category_radio">12sp</dimen>
<dimen name="ts_category_item">18sp</dimen>
<dimen name="ts_goods_item_name">14sp</dimen>
<dimen name="ts_goods_item_intro">12sp</dimen>
<dimen name="ts_goods_item_price">12sp</dimen>
<dimen name="ts_goods_item_discount">9sp</dimen>
<dimen name="ts_goods_item_sellout">12sp</dimen>
<dimen name="ts_goods_item_tag">9sp</dimen>
<dimen name="ts_goods_item_count">12sp</dimen>
<dimen name="ts_trolley_name">18sp</dimen>
<dimen name="ts_trolley_clear">12sp</dimen>
<dimen name="ts_trolley_total">16sp</dimen>
<dimen name="ts_trolley_count">12sp</dimen>
<dimen name="ts_trolley_pay">16sp</dimen>
<dimen name="ts_tips">9sp</dimen>
<dimen name="ts_detail_name">20sp</dimen>
<dimen name="ts_detail_spec">14sp</dimen>
<dimen name="ts_detail_rule">12sp</dimen>
<dimen name="ts_detail_count">14sp</dimen>
<dimen name="ts_detail_price">14sp</dimen>
<dimen name="ts_detail_discount">12sp</dimen>
<dimen name="ts_detail_sellout">12sp</dimen>
<dimen name="ts_detail_add_trolley">14sp</dimen>
<dimen name="ts_detail_buynow">14sp</dimen>
<dimen name="ts_header_text">14sp</dimen>
<dimen name="ts_dialog_title">18sp</dimen>
<dimen name="ts_scan">14sp</dimen>
<dimen name="ts_expire">12sp</dimen>
<dimen name="ts_order_number">12sp</dimen>
<dimen name="ts_menu_title">22sp</dimen>
<dimen name="ts_menu_subtitle">18sp</dimen>
<dimen name="ts_setting_name">16sp</dimen>
<dimen name="ts_setting_desc">14sp</dimen>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment