Commit 4b8660af by wjg

init

parent 47c597c8
...@@ -6,6 +6,8 @@ import android.util.Log; ...@@ -6,6 +6,8 @@ import android.util.Log;
import com.ihaoin.hooloo.device.config.AppConfig; import com.ihaoin.hooloo.device.config.AppConfig;
import com.ihaoin.hooloo.device.data.MainData; import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.network.HttpUtil; import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.util.SharedPreferencesUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import cn.jpush.android.api.JPushInterface; import cn.jpush.android.api.JPushInterface;
...@@ -24,20 +26,16 @@ public class HLApplication extends Application { ...@@ -24,20 +26,16 @@ public class HLApplication extends Application {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
// Log.d("TEST", String.valueOf(Utils.pxTodp(this, 2340))); AppConfig.MACHINE_CODE = SharedPreferencesUtils.getMachineCode(this);
// 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 获取机器编码
JPushInterface.setDebugMode(true); JPushInterface.setDebugMode(true);
JPushInterface.init(this); JPushInterface.init(this);
Log.d("PushMessageReceiver", JPushInterface.getRegistrationID(this));
// HttpUtil.postRegistrationId(JPushInterface.getRegistrationID(this), null); String registrationId = JPushInterface.getRegistrationID(this);
Log.d("PushMessageReceiver", registrationId);
if (!StringUtils.isEmpty(registrationId)) {
HttpUtil.postRegistrationId(registrationId, null);
}
} }
@Override @Override
......
...@@ -26,8 +26,8 @@ public class RecommendAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseVi ...@@ -26,8 +26,8 @@ public class RecommendAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseVi
@Override @Override
protected void convertHead(BaseViewHolder helper, ScrollBean item) { protected void convertHead(BaseViewHolder helper, ScrollBean item) {
View layoutItem = helper.getView(R.id.layout_item); View layoutItem = helper.getView(R.id.layout_item);
View imgLogo = helper.getView(R.id.img_logo); View logo = helper.getView(R.id.logo);
SettingsQueue settingsQueue = new SettingsQueue(mContext, imgLogo, layoutItem); SettingsQueue settingsQueue = new SettingsQueue(mContext, logo, layoutItem);
} }
@Override @Override
......
...@@ -58,7 +58,7 @@ public class TrolleyAdapter extends BaseAdapter { ...@@ -58,7 +58,7 @@ public class TrolleyAdapter extends BaseAdapter {
txtName.setText(goods.getName()); txtName.setText(goods.getName());
if (!CollectionUtils.isEmpty(goods.getRules())) { if (!CollectionUtils.isEmpty(goods.getRules())) {
StringAppend stringAppend = new StringAppend("/"); StringAppend stringAppend = new StringAppend("/");
goods.getRules().forEach(x -> stringAppend.append(x.getSpecName())); goods.getRules().forEach(x -> stringAppend.append(x.getRuleName()));
txtOptions.setText(stringAppend.toString()); txtOptions.setText(stringAppend.toString());
txtOptions.setVisibility(View.VISIBLE); txtOptions.setVisibility(View.VISIBLE);
} else { } else {
......
...@@ -12,7 +12,7 @@ import com.ihaoin.hooloo.device.config.AppConfig; ...@@ -12,7 +12,7 @@ import com.ihaoin.hooloo.device.config.AppConfig;
* 所有网络请求处理父类 * 所有网络请求处理父类
*/ */
public abstract class NetworkHandler extends Handler { public abstract class NetworkHandler extends Handler {
private static final String TAG = "Network"; private static final String TAG = "HL_Network";
@Override @Override
public void handleMessage(@NonNull Message msg) { public void handleMessage(@NonNull Message msg) {
......
...@@ -9,7 +9,7 @@ import android.util.Log; ...@@ -9,7 +9,7 @@ import android.util.Log;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ihaoin.hooloo.device.network.HttpUtil; import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.util.CollectionUtils; import com.ihaoin.hooloo.device.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -40,12 +40,16 @@ public class PushMessageReceiver extends JPushMessageReceiver { ...@@ -40,12 +40,16 @@ public class PushMessageReceiver extends JPushMessageReceiver {
} }
private void dispatchMsg(CustomMessage customMessage) { private void dispatchMsg(CustomMessage customMessage) {
if (CollectionUtils.isEmpty(subscribers)) { // if (CollectionUtils.isEmpty(subscribers)) {
Log.e(TAG, "msg subscribers is empty"); // Log.e(TAG, "msg subscribers is empty");
return; // return;
} // }
JSONObject jsonObject = JSON.parseObject(customMessage.message); JSONObject jsonObject = JSON.parseObject(customMessage.message);
String action = jsonObject.getString("action"); String action = jsonObject.getString("action");
if (StringUtils.isEmpty(action)) {
Log.e(TAG, "msg action is empty");
return;
}
Handler handler = subscribers.get(action); Handler handler = subscribers.get(action);
if (handler == null) { if (handler == null) {
Log.e(TAG, String.format("msg action[%s] subscribers is empty", action)); Log.e(TAG, String.format("msg action[%s] subscribers is empty", action));
......
...@@ -2,10 +2,11 @@ package com.ihaoin.hooloo.device.config; ...@@ -2,10 +2,11 @@ package com.ihaoin.hooloo.device.config;
public class AppConfig { public class AppConfig {
public static Boolean DEBUG = true; public static Boolean DEBUG = true; // TODO false
public static String DEBUG_TAG = "HL_TEST";
/** 机器编码 */ /** 机器编码 */
public static String MACHINE_CODE = ""; public static String MACHINE_CODE = "";
/** 打开微信网址 */ /** 打开微信网址 */
public static String WX_URL = "https://www.bjjsycloud.com/?id=%s"; public static String WX_URL = "https://hooloo.gdatac.com/order/create/?id=%s";
} }
...@@ -14,5 +14,8 @@ public class Base { ...@@ -14,5 +14,8 @@ public class Base {
public static final String BROADCAST_ACTION_TROLLEY_SHOW = "ACTION_TROLLEY_SHOW"; 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 BROADCAST_ACTION_TROLLEY_HIDE = "ACTION_TROLLEY_HIDE";
public static final String BROADCAST_ACTION_MACHINE_CODE_CHANGED = "ACTION_MACHINE_CODE_CHANGED";
public static final String BROADCAST_ACTION_MENU_STATE_CHANGED = "ACTION_MENU_STATE_CHANGED";
public static final String BROADCAST_ACTION_LOGCAT_STATE_CHANGED = "ACTION_LOGCAT_STATE_CHANGED";
} }
package com.ihaoin.hooloo.device.data.enums; package com.ihaoin.hooloo.device.data.enums;
public enum OrderState { public enum OrderState {
COOKING(1, "制作中"),
WAITING(2, "待制作"), WAITING(2, "待制作"),
COMPLETED(3, "可取餐"); COOKING(3, "制作中"),
COMPLETED(4, "可取餐");
private Integer code; private Integer code;
private String name; private String name;
......
...@@ -25,6 +25,16 @@ public class Goods implements Serializable { ...@@ -25,6 +25,16 @@ public class Goods implements Serializable {
private List<String> tags; private List<String> tags;
/** SKU */ /** SKU */
private List<Sku> skus; private List<Sku> skus;
/** 是否是推荐商品 */
private Integer isRecommend;
public Integer getIsRecommend() {
return isRecommend;
}
public void setIsRecommend(Integer isRecommend) {
this.isRecommend = isRecommend;
}
public Integer getGoodsId() { public Integer getGoodsId() {
return goodsId; return goodsId;
......
...@@ -3,6 +3,7 @@ package com.ihaoin.hooloo.device.network; ...@@ -3,6 +3,7 @@ package com.ihaoin.hooloo.device.network;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.util.Log;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.ihaoin.hooloo.device.config.AppConfig; import com.ihaoin.hooloo.device.config.AppConfig;
...@@ -22,7 +23,7 @@ import okhttp3.RequestBody; ...@@ -22,7 +23,7 @@ import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
public class HttpUtil { public class HttpUtil {
private static final String TAG = "Network"; private static final String TAG = "HL_Network";
public static void post(String url, String body, Handler handler) { public static void post(String url, String body, Handler handler) {
if (body == null) { if (body == null) {
...@@ -62,11 +63,9 @@ public class HttpUtil { ...@@ -62,11 +63,9 @@ public class HttpUtil {
private static void onFailure(Handler handler, Call call, Exception e) { private static void onFailure(Handler handler, Call call, Exception e) {
try { try {
// if (AppConfig.DEBUG) {
// String msgText = String.format("返回状态:%s, 请求:%s, 返回内容:%s", 0, call.request().url(), e.getMessage());
// Log.e(TAG, msgText);
// }
if (handler == null) { if (handler == null) {
String msgText = String.format("请求:%s, 返回状态:%s, 返回内容:%s", call.request().url(), 0, e.getMessage());
Log.e(TAG, msgText);
return; return;
} }
sendHandlerMessage(0, handler, call, e); sendHandlerMessage(0, handler, call, e);
...@@ -75,26 +74,8 @@ public class HttpUtil { ...@@ -75,26 +74,8 @@ public class HttpUtil {
} }
} }
private static void sendHandlerMessage(Integer what, Handler handler, Call call, Object o) {
Message msg = handler.obtainMessage(what, o);
Bundle bundle = new Bundle();
bundle.putString("url", call.request().url().toString());
msg.setData(bundle);
handler.sendMessage(msg);
}
private static void onResponse(Handler handler, Call call, Response response) { private static void onResponse(Handler handler, Call call, Response response) {
try { try {
// if (AppConfig.DEBUG) {
// String msgText = String.format("返回状态:%s, 请求:%s, 返回内容:%s", 1, call.request().url(), responseBody);
// Log.i(TAG, msgText);
// }
if (handler == null) {
return;
}
// if (call.request().url().toString().contains("checkSku")) {
// responseBody = "{\"msg\":\"该产品已经不存在\",\"code\":500}";
// }
String responseBody = response.body().string(); String responseBody = response.body().string();
JsonNode jsonObject = JsonUtils.getMapper().readValue(responseBody, JsonNode.class); JsonNode jsonObject = JsonUtils.getMapper().readValue(responseBody, JsonNode.class);
if (jsonObject == null) { if (jsonObject == null) {
...@@ -105,18 +86,25 @@ public class HttpUtil { ...@@ -105,18 +86,25 @@ public class HttpUtil {
onFailure(handler, call, new BizException(jsonObject.get("msg").asText())); onFailure(handler, call, new BizException(jsonObject.get("msg").asText()));
return; return;
} }
if (handler == null) {
String msgText = String.format("请求:%s, 返回状态:%s, 返回内容:%s", call.request().url(), 1, responseBody);
Log.i(TAG, msgText);
return;
}
sendHandlerMessage(1, handler, call, jsonObject.get("data") == null ? "" : jsonObject.get("data").toString()); sendHandlerMessage(1, handler, call, jsonObject.get("data") == null ? "" : jsonObject.get("data").toString());
// Message msg = handler.obtainMessage(1, );
// Bundle bundle = new Bundle();
// bundle.putString("url", call.request().url().toString());
// msg.setData(bundle);
// handler.sendMessage(msg);
} catch (Exception e) { } catch (Exception e) {
onFailure(handler, call, e); onFailure(handler, call, e);
} }
} }
private static void sendHandlerMessage(Integer what, Handler handler, Call call, Object o) {
Message msg = handler.obtainMessage(what, o);
Bundle bundle = new Bundle();
bundle.putString("url", call.request().url().toString());
msg.setData(bundle);
handler.sendMessage(msg);
}
public static void getMainDatas(Handler handler) { public static void getMainDatas(Handler handler) {
String url = String.format(HttpParams.GET_MAIN_DATA, AppConfig.MACHINE_CODE); String url = String.format(HttpParams.GET_MAIN_DATA, AppConfig.MACHINE_CODE);
get(url, handler); get(url, handler);
...@@ -144,6 +132,9 @@ public class HttpUtil { ...@@ -144,6 +132,9 @@ public class HttpUtil {
public static String getMacAddress() { public static String getMacAddress() {
try { try {
if (AppConfig.DEBUG) {
return "SN0091290001";
}
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces()); List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) { for (NetworkInterface nif : all) {
if (!nif.getName().equalsIgnoreCase("wlan0")) continue; if (!nif.getName().equalsIgnoreCase("wlan0")) continue;
......
...@@ -3,11 +3,14 @@ package com.ihaoin.hooloo.device.util; ...@@ -3,11 +3,14 @@ package com.ihaoin.hooloo.device.util;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import com.ihaoin.hooloo.device.network.HttpUtil;
public class SharedPreferencesUtils { public class SharedPreferencesUtils {
private final static String KEY_SEETINGS = "settings"; private final static String KEY_SEETINGS = "settings";
private final static String KEY_SCREEN_NO = "SCREEN_NO"; private final static String KEY_SCREEN_NO = "SCREEN_NO";
private final static String KEY_SHOW_MENU = "SHOW_MENU"; private final static String KEY_SHOW_MENU = "SHOW_MENU";
private final static String KEY_SHOW_LOGCAT = "SHOW_LOGCAT"; private final static String KEY_SHOW_LOGCAT = "SHOW_LOGCAT";
private final static String KEY_MACHINE_CODE = "MACHINE_CODE";
public static String getScreenNo(Context context) { public static String getScreenNo(Context context) {
SharedPreferences sp = getSharedPreferences(context); SharedPreferences sp = getSharedPreferences(context);
...@@ -19,6 +22,16 @@ public class SharedPreferencesUtils { ...@@ -19,6 +22,16 @@ public class SharedPreferencesUtils {
sp.edit().putString(KEY_SCREEN_NO, val).commit(); sp.edit().putString(KEY_SCREEN_NO, val).commit();
} }
public static String getMachineCode(Context context) {
SharedPreferences sp = getSharedPreferences(context);
return sp.getString(KEY_MACHINE_CODE, HttpUtil.getMacAddress());
}
public static void setMachineCode(Context context, String val) {
SharedPreferences sp = getSharedPreferences(context);
sp.edit().putString(KEY_MACHINE_CODE, val).commit();
}
public static Boolean getShowMenu(Context context) { public static Boolean getShowMenu(Context context) {
SharedPreferences sp = getSharedPreferences(context); SharedPreferences sp = getSharedPreferences(context);
return sp.getBoolean(KEY_SHOW_MENU, false); return sp.getBoolean(KEY_SHOW_MENU, false);
...@@ -26,7 +39,7 @@ public class SharedPreferencesUtils { ...@@ -26,7 +39,7 @@ public class SharedPreferencesUtils {
public static void setShowMenu(Context context, Boolean val) { public static void setShowMenu(Context context, Boolean val) {
SharedPreferences sp = getSharedPreferences(context); SharedPreferences sp = getSharedPreferences(context);
sp.edit().putBoolean(KEY_SCREEN_NO, val).commit(); sp.edit().putBoolean(KEY_SHOW_MENU, val).commit();
} }
public static Boolean getShowLogcat(Context context) { public static Boolean getShowLogcat(Context context) {
......
...@@ -107,6 +107,7 @@ public class ConfirmOrderDialog extends Dialog { ...@@ -107,6 +107,7 @@ public class ConfirmOrderDialog extends Dialog {
setOnDismissListener(dismissListener); setOnDismissListener(dismissListener);
postConfirmOrder(); postConfirmOrder();
Utils.setTouchDelegate(findViewById(R.id.layout_root), Arrays.asList(butnClose));
} }
private void showConfirmViews() { private void showConfirmViews() {
...@@ -264,6 +265,7 @@ public class ConfirmOrderDialog extends Dialog { ...@@ -264,6 +265,7 @@ public class ConfirmOrderDialog extends Dialog {
class ConfirmOrderHandler extends NetworkHandler { class ConfirmOrderHandler extends NetworkHandler {
@Override @Override
public void handleMessage(@NonNull Message msg) { public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
try { try {
stopLoading(); stopLoading();
Object obj = msg.obj; Object obj = msg.obj;
...@@ -286,8 +288,8 @@ public class ConfirmOrderDialog extends Dialog { ...@@ -286,8 +288,8 @@ public class ConfirmOrderDialog extends Dialog {
private Bitmap genQRCode(String saveCode) throws WriterException { private Bitmap genQRCode(String saveCode) throws WriterException {
String url = String.format(AppConfig.WX_URL, saveCode); String url = String.format(AppConfig.WX_URL, saveCode);
int width = Utils.dpToPx(getContext(), 200); // 图像宽度 int width = Utils.dpToPx(getContext(), 800); // 图像宽度
int height = Utils.dpToPx(getContext(), 200); // 图像高度 int height = Utils.dpToPx(getContext(), 800); // 图像高度
Map<EncodeHintType, Object> hints = new HashMap(); Map<EncodeHintType, Object> hints = new HashMap();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, width, height, hints);// 生成矩阵 BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, width, height, hints);// 生成矩阵
......
...@@ -108,6 +108,8 @@ public class GoodsDetailDialog extends Dialog { ...@@ -108,6 +108,8 @@ public class GoodsDetailDialog extends Dialog {
buildSpecs(); buildSpecs();
buildDetails(); buildDetails();
Utils.setTouchDelegate(findViewById(R.id.layout_root), Arrays.asList(butnClose));
} }
private void buyNow() { private void buyNow() {
......
...@@ -30,15 +30,18 @@ import com.ihaoin.hooloo.device.R; ...@@ -30,15 +30,18 @@ import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.adapter.GoodsAdapter; import com.ihaoin.hooloo.device.adapter.GoodsAdapter;
import com.ihaoin.hooloo.device.adapter.RecommendAdapter; import com.ihaoin.hooloo.device.adapter.RecommendAdapter;
import com.ihaoin.hooloo.device.component.NetworkHandler; import com.ihaoin.hooloo.device.component.NetworkHandler;
import com.ihaoin.hooloo.device.config.AppConfig;
import com.ihaoin.hooloo.device.config.Base; import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.MainData; import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.data.ScrollBean; import com.ihaoin.hooloo.device.data.ScrollBean;
import com.ihaoin.hooloo.device.data.vo.Category; import com.ihaoin.hooloo.device.data.vo.Category;
import com.ihaoin.hooloo.device.data.vo.Goods; import com.ihaoin.hooloo.device.data.vo.Goods;
import com.ihaoin.hooloo.device.data.vo.Recommend;
import com.ihaoin.hooloo.device.data.vo.Sku; import com.ihaoin.hooloo.device.data.vo.Sku;
import com.ihaoin.hooloo.device.network.HttpUtil; import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.util.CollectionUtils; import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.JsonUtils; import com.ihaoin.hooloo.device.util.JsonUtils;
import com.ihaoin.hooloo.device.util.SharedPreferencesUtils;
import com.ihaoin.hooloo.device.util.StringUtils; import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils; import com.ihaoin.hooloo.device.util.Utils;
...@@ -75,6 +78,8 @@ public class LauncherActivity extends Activity { ...@@ -75,6 +78,8 @@ public class LauncherActivity extends Activity {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
mContext = this; mContext = this;
setMachineCode();
requestPermissions(); requestPermissions();
trolleyView = findViewById(R.id.view_trolley); trolleyView = findViewById(R.id.view_trolley);
...@@ -93,11 +98,20 @@ public class LauncherActivity extends Activity { ...@@ -93,11 +98,20 @@ public class LauncherActivity extends Activity {
registTrolleyGoodsChangedReceiver(); registTrolleyGoodsChangedReceiver();
registTrolleyStateChangedReceiver(); registTrolleyStateChangedReceiver();
registSettingChangedReceiver();
showMenuView(); showMenuView();
startLoadDataThread(); startLoadDataThread();
} }
private void setMachineCode() {
AppConfig.MACHINE_CODE = SharedPreferencesUtils.getMachineCode(this);
if (AppConfig.DEBUG) {
Log.i(AppConfig.DEBUG_TAG, "machine code: " + AppConfig.MACHINE_CODE);
}
startLoadDataThread();
}
private void initRecommends() { private void initRecommends() {
recommendManager = new GridLayoutManager(mContext, 2); recommendManager = new GridLayoutManager(mContext, 2);
recommendManager.setSpanSizeLookup(new MySpanSizeLookup()); recommendManager.setSpanSizeLookup(new MySpanSizeLookup());
...@@ -120,14 +134,15 @@ public class LauncherActivity extends Activity { ...@@ -120,14 +134,15 @@ public class LauncherActivity extends Activity {
} }
private void setRecommendsData() { private void setRecommendsData() {
List<Recommend> recommends = HLApplication.getMainData().getRecommends();
scrollRecommends = new ArrayList<>(); scrollRecommends = new ArrayList<>();
ScrollBean header = new ScrollBean(true, null); ScrollBean header = new ScrollBean(true, null);
scrollRecommends.add(header); scrollRecommends.add(header);
recommendAdapter.setNewData(scrollRecommends); recommendAdapter.setNewData(scrollRecommends);
if (CollectionUtils.isEmpty(HLApplication.getMainData().getRecommends())) { if (CollectionUtils.isEmpty(recommends)) {
return; return;
} }
HLApplication.getMainData().getRecommends().forEach(x -> scrollRecommends.add(new ScrollBean(new ScrollBean.ScrollItemBean(x, null)))); recommends.forEach(x -> scrollRecommends.add(new ScrollBean(new ScrollBean.ScrollItemBean(x, null))));
recommendAdapter.setNewData(scrollRecommends); recommendAdapter.setNewData(scrollRecommends);
} }
...@@ -174,7 +189,8 @@ public class LauncherActivity extends Activity { ...@@ -174,7 +189,8 @@ public class LauncherActivity extends Activity {
} }
// 遍历分类列表,设置选中分类 // 遍历分类列表,设置选中分类
for (Category category : HLApplication.getMainData().getCategorys()) { List<Category> categorys = HLApplication.getMainData().getCategorys();
for (Category category : categorys) {
if (category.getName().equals(title)) { if (category.getName().equals(title)) {
if (groupCategory.getCheckedRadioButtonId() == category.getId()) { if (groupCategory.getCheckedRadioButtonId() == category.getId()) {
break; break;
...@@ -185,7 +201,7 @@ public class LauncherActivity extends Activity { ...@@ -185,7 +201,7 @@ public class LauncherActivity extends Activity {
if (isSlideToBottom(recGoods)) { if (isSlideToBottom(recGoods)) {
// 滚动到最下,选中最后一个分类 // 滚动到最下,选中最后一个分类
groupCategory.check(CollectionUtils.lastItem(HLApplication.getMainData().getCategorys()).getId()); groupCategory.check(CollectionUtils.lastItem(categorys).getId());
} }
} }
}); });
...@@ -204,10 +220,12 @@ public class LauncherActivity extends Activity { ...@@ -204,10 +220,12 @@ public class LauncherActivity extends Activity {
private void initCategorys() { private void initCategorys() {
groupCategory.removeAllViews(); groupCategory.removeAllViews();
if (CollectionUtils.isEmpty(HLApplication.getMainData().getCategorys())) { List<Category> categorys = HLApplication.getMainData().getCategorys();
if (CollectionUtils.isEmpty(categorys)) {
return; return;
} }
HLApplication.getMainData().getCategorys().forEach(category -> { for (int i = 0; i < categorys.size(); i++) {
Category category = categorys.get(i);
if (CollectionUtils.isEmpty(category.getGoods())) { if (CollectionUtils.isEmpty(category.getGoods())) {
return; return;
} }
...@@ -216,15 +234,19 @@ public class LauncherActivity extends Activity { ...@@ -216,15 +234,19 @@ public class LauncherActivity extends Activity {
view.setText(category.getName()); view.setText(category.getName());
view.setId(category.getId()); view.setId(category.getId());
view.setTag(category); view.setTag(category);
if (i == 0) {
view.setChecked(true);
view.getPaint().setFakeBoldText(true);
}
groupCategory.addView(view, layoutParams); groupCategory.addView(view, layoutParams);
view.setOnClickListener(v -> { view.setOnClickListener(v -> {
Integer checkedId = v.getId(); Integer checkedId = v.getId();
Category category1 = (Category) groupCategory.findViewById(checkedId).getTag(); Category category1 = (Category) groupCategory.findViewById(checkedId).getTag();
int position = HLApplication.getMainData().getCategorys().indexOf(category1); int position = categorys.indexOf(category1);
goodsLayoutManager.scrollToPositionWithOffset(tPosition.get(position), 0); goodsLayoutManager.scrollToPositionWithOffset(tPosition.get(position), 0);
}); });
}); }
groupCategory.setOnCheckedChangeListener((group, checkedId) -> { groupCategory.setOnCheckedChangeListener((group, checkedId) -> {
for (int i = 0; i < groupCategory.getChildCount(); i++) { for (int i = 0; i < groupCategory.getChildCount(); i++) {
View child = groupCategory.getChildAt(i); View child = groupCategory.getChildAt(i);
...@@ -245,17 +267,16 @@ public class LauncherActivity extends Activity { ...@@ -245,17 +267,16 @@ public class LauncherActivity extends Activity {
TextView view = (TextView) this.getLayoutInflater().inflate(R.layout.item_tips, null); TextView view = (TextView) this.getLayoutInflater().inflate(R.layout.item_tips, null);
groupCategory.addView(view, layoutParams); groupCategory.addView(view, layoutParams);
view.setOnClickListener(v -> Utils.showTips(LauncherActivity.this)); view.setOnClickListener(v -> Utils.showTips(LauncherActivity.this));
groupCategory.check(HLApplication.getMainData().getCategorys().get(0).getId());
} }
private void setGoodsData() { private void setGoodsData() {
if (CollectionUtils.isEmpty(HLApplication.getMainData().getCategorys())) { List<Category> categorys = HLApplication.getMainData().getCategorys();
if (CollectionUtils.isEmpty(categorys)) {
return; return;
} }
scrollGoods = new ArrayList<>(); scrollGoods = new ArrayList<>();
HLApplication.getMainData().getCategorys().forEach(category -> { categorys.forEach(category -> {
if (CollectionUtils.isEmpty(category.getGoods())) { if (CollectionUtils.isEmpty(category.getGoods())) {
return; return;
} }
...@@ -329,6 +350,8 @@ public class LauncherActivity extends Activity { ...@@ -329,6 +350,8 @@ public class LauncherActivity extends Activity {
super.onDestroy(); super.onDestroy();
this.unregistTrolleyGoodsChangedReceiver(); this.unregistTrolleyGoodsChangedReceiver();
this.unregistTrolleyStateChangedReceiver(); this.unregistTrolleyStateChangedReceiver();
this.unregistSettingChangedReceiver();
System.exit(0);
} }
private TrolleyGoodsChangedReceiver trolleyGoodsChangedReceiver = null; private TrolleyGoodsChangedReceiver trolleyGoodsChangedReceiver = null;
...@@ -370,13 +393,6 @@ public class LauncherActivity extends Activity { ...@@ -370,13 +393,6 @@ public class LauncherActivity extends Activity {
} }
} }
private void requestPermissions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
}
}
private void registTrolleyStateChangedReceiver() { private void registTrolleyStateChangedReceiver() {
trolleyStateChangedReceiver = new TrolleyStateChangedReceiver(); trolleyStateChangedReceiver = new TrolleyStateChangedReceiver();
IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter();
...@@ -392,17 +408,6 @@ public class LauncherActivity extends Activity { ...@@ -392,17 +408,6 @@ public class LauncherActivity extends Activity {
} }
} }
/** 显示菜单屏KDS */
private void showMenuView() {
DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
Display[] displays = displayManager.getDisplays();
if (CollectionUtils.isEmpty(displays) || displays.length < 2) {
return;
}
menu = new MenuPresentation(this, displays[1]);
menu.show();
}
class TrolleyStateChangedReceiver extends BroadcastReceiver { class TrolleyStateChangedReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
...@@ -420,4 +425,79 @@ public class LauncherActivity extends Activity { ...@@ -420,4 +425,79 @@ public class LauncherActivity extends Activity {
goodsAdapter.notifyDataSetChanged(); goodsAdapter.notifyDataSetChanged();
} }
} }
private SettingChangedReceiver settingChangedReceiver;
private void registSettingChangedReceiver() {
settingChangedReceiver = new SettingChangedReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(Base.BROADCAST_ACTION_MACHINE_CODE_CHANGED);
filter.addAction(Base.BROADCAST_ACTION_MENU_STATE_CHANGED);
filter.addAction(Base.BROADCAST_ACTION_LOGCAT_STATE_CHANGED);
this.registerReceiver(settingChangedReceiver, filter);
}
private void unregistSettingChangedReceiver() {
if (settingChangedReceiver != null) {
mContext.unregisterReceiver(settingChangedReceiver);
settingChangedReceiver = null;
}
}
private class SettingChangedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Base.BROADCAST_ACTION_MACHINE_CODE_CHANGED)) {
setMachineCode();
} else if (intent.getAction().equals(Base.BROADCAST_ACTION_MENU_STATE_CHANGED)) {
if (SharedPreferencesUtils.getShowMenu(LauncherActivity.this)) {
showMenuView();
} else {
hideMenuView();
}
} else if (intent.getAction().equals(Base.BROADCAST_ACTION_LOGCAT_STATE_CHANGED)) {
if (SharedPreferencesUtils.getShowMenu(LauncherActivity.this)) {
Toast.makeText(LauncherActivity.this, "展示Logcat", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(LauncherActivity.this, "隐藏Logcat", Toast.LENGTH_SHORT).show();
}
}
}
}
/** 显示菜单屏KDS */
private void showMenuView() {
if (AppConfig.DEBUG) {
Toast.makeText(this, "展示菜单屏", Toast.LENGTH_SHORT).show();
}
if (menu != null) {
return;
}
DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
Display[] displays = displayManager.getDisplays();
if (CollectionUtils.isEmpty(displays) || displays.length < 2) {
Toast.makeText(this, "未获取到菜单屏硬件", Toast.LENGTH_SHORT).show();
return;
}
menu = new MenuPresentation(this, displays[1]);
menu.show();
}
private void hideMenuView() {
if (AppConfig.DEBUG) {
Toast.makeText(this, "隐藏菜单屏", Toast.LENGTH_SHORT).show();
}
if (menu == null) {
return;
}
menu.dismiss();
menu = null;
}
private void requestPermissions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
}
}
} }
...@@ -19,6 +19,7 @@ import com.ihaoin.hooloo.device.adapter.OrderAdapter; ...@@ -19,6 +19,7 @@ import com.ihaoin.hooloo.device.adapter.OrderAdapter;
import com.ihaoin.hooloo.device.component.NetworkHandler; import com.ihaoin.hooloo.device.component.NetworkHandler;
import com.ihaoin.hooloo.device.component.PushMessageReceiver; import com.ihaoin.hooloo.device.component.PushMessageReceiver;
import com.ihaoin.hooloo.device.config.Base; import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.data.enums.ImageState; import com.ihaoin.hooloo.device.data.enums.ImageState;
import com.ihaoin.hooloo.device.data.enums.OrderState; import com.ihaoin.hooloo.device.data.enums.OrderState;
import com.ihaoin.hooloo.device.data.vo.Order; import com.ihaoin.hooloo.device.data.vo.Order;
...@@ -84,24 +85,26 @@ public class MenuPresentation extends Presentation { ...@@ -84,24 +85,26 @@ public class MenuPresentation extends Presentation {
} }
private String getRightImage(String state) { private String getRightImage(String state) {
if (HLApplication.getMainData() == null || HLApplication.getMainData().getImages() == null) { MainData mainData = HLApplication.getMainData();
if (mainData == null || mainData.getImages() == null) {
return null; return null;
} }
if (CollectionUtils.isEmpty(HLApplication.getMainData().getImages().getRight())) { if (CollectionUtils.isEmpty(mainData.getImages().getRight())) {
return null; return null;
} }
return HLApplication.getMainData().getImages().getRight().get(state); return mainData.getImages().getRight().get(state);
} }
private void showImages() { private void showImages() {
if (HLApplication.getMainData() == null || HLApplication.getMainData().getImages() == null) { MainData mainData = HLApplication.getMainData();
if (mainData == null || mainData.getImages() == null) {
return; return;
} }
if (!StringUtils.isEmpty(HLApplication.getMainData().getImages().getLeft())) { if (!StringUtils.isEmpty(mainData.getImages().getLeft())) {
Glide.with(getContext()).load(HLApplication.getMainData().getImages().getLeft()).into(imgLeft); Glide.with(getContext()).load(mainData.getImages().getLeft()).into(imgLeft);
} }
if (HLApplication.getMainData().getShopState().equals(0)) { if (mainData.getShopState().equals(0)) {
Glide.with(getContext()).load(getRightImage(ImageState.CLOSED.getCode())).into(imgRight); Glide.with(getContext()).load(getRightImage(ImageState.CLOSED.getCode())).into(imgRight);
} else if (!CollectionUtils.isEmpty(cookingOrders)) { } else if (!CollectionUtils.isEmpty(cookingOrders)) {
Glide.with(getContext()).load(getRightImage(ImageState.COOKING.getCode())).into(imgRight); Glide.with(getContext()).load(getRightImage(ImageState.COOKING.getCode())).into(imgRight);
...@@ -201,6 +204,10 @@ public class MenuPresentation extends Presentation { ...@@ -201,6 +204,10 @@ public class MenuPresentation extends Presentation {
} }
if (CollectionUtils.isEmpty(pkgs)) { if (CollectionUtils.isEmpty(pkgs)) {
OrderState state = OrderState.get(order.getState());
if (state == null) {
return;
}
pkgs = new ArrayList<>(); pkgs = new ArrayList<>();
List<Order> orders = new ArrayList<>(); List<Order> orders = new ArrayList<>();
...@@ -218,6 +225,10 @@ public class MenuPresentation extends Presentation { ...@@ -218,6 +225,10 @@ public class MenuPresentation extends Presentation {
pkg.getOrders().remove(order); pkg.getOrders().remove(order);
}); });
OrderState state = OrderState.get(order.getState());
if (state == null) {
return;
}
// 添加新订单状态 // 添加新订单状态
pkgs.forEach(pkg -> { pkgs.forEach(pkg -> {
if (!pkg.getState().equals(order.getState())) { if (!pkg.getState().equals(order.getState())) {
......
...@@ -6,11 +6,12 @@ import android.content.pm.PackageInfo; ...@@ -6,11 +6,12 @@ import android.content.pm.PackageInfo;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import com.ihaoin.hooloo.device.R; import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.config.AppConfig; import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.util.SharedPreferencesUtils; import com.ihaoin.hooloo.device.util.SharedPreferencesUtils;
import com.ihaoin.hooloo.device.util.StringUtils; import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils; import com.ihaoin.hooloo.device.util.Utils;
...@@ -20,6 +21,7 @@ public class SettingsActivity extends Activity { ...@@ -20,6 +21,7 @@ public class SettingsActivity extends Activity {
private View layoutSysSettings; private View layoutSysSettings;
private TextView txtVersion; private TextView txtVersion;
private TextView txtMachineCode; private TextView txtMachineCode;
private View layoutMachineCode;
private View layoutScreen; private View layoutScreen;
private TextView txtScreenNo; private TextView txtScreenNo;
...@@ -39,19 +41,31 @@ public class SettingsActivity extends Activity { ...@@ -39,19 +41,31 @@ public class SettingsActivity extends Activity {
layoutSysSettings = findViewById(R.id.layout_sys_settings); layoutSysSettings = findViewById(R.id.layout_sys_settings);
txtVersion = findViewById(R.id.txt_version); txtVersion = findViewById(R.id.txt_version);
txtMachineCode = findViewById(R.id.txt_machine_code); txtMachineCode = findViewById(R.id.txt_machine_code);
layoutMachineCode = findViewById(R.id.layout_machine_code);
layoutScreen = findViewById(R.id.layout_screen); layoutScreen = findViewById(R.id.layout_screen);
txtScreenNo = findViewById(R.id.txt_screen_no); txtScreenNo = findViewById(R.id.txt_screen_no);
butnMenu = findViewById(R.id.butn_menu); butnMenu = findViewById(R.id.butn_menu);
butnLogcat = findViewById(R.id.butn_logcat); butnLogcat = findViewById(R.id.butn_logcat);
butnClose = findViewById(R.id.butn_close); butnClose = findViewById(R.id.butn_close);
txtVersion.setText(getAppVersionName()); txtVersion.setText(getAppVersionName());
txtMachineCode.setText(AppConfig.MACHINE_CODE); txtMachineCode.setText(SharedPreferencesUtils.getMachineCode(this));
txtScreenNo.setText(SharedPreferencesUtils.getScreenNo(this)); txtScreenNo.setText(SharedPreferencesUtils.getScreenNo(this));
butnMenu.setChecked(SharedPreferencesUtils.getShowMenu(this));
butnLogcat.setChecked(SharedPreferencesUtils.getShowLogcat(this));
butnMenu.setOnCheckedChangeListener((v, checked) -> {
SharedPreferencesUtils.setShowMenu(SettingsActivity.this, checked);
Utils.fastBroadcast(SettingsActivity.this, Base.BROADCAST_ACTION_MENU_STATE_CHANGED);
});
butnLogcat.setOnCheckedChangeListener((v, checked) -> {
SharedPreferencesUtils.setShowLogcat(SettingsActivity.this, checked);
Utils.fastBroadcast(SettingsActivity.this, Base.BROADCAST_ACTION_LOGCAT_STATE_CHANGED);
});
butnClose.setOnClickListener(v -> finish()); butnClose.setOnClickListener(v -> finish());
layoutScreen.setOnClickListener(v -> showEditScreen()); layoutScreen.setOnClickListener(v -> showEditScreen());
layoutMachineCode.setOnClickListener(v -> showMachineCode());
layoutSysSettings.setOnClickListener(v -> Utils.openSystemSettings(getApplicationContext())); layoutSysSettings.setOnClickListener(v -> Utils.openSystemSettings(getApplicationContext()));
} }
...@@ -67,6 +81,21 @@ public class SettingsActivity extends Activity { ...@@ -67,6 +81,21 @@ public class SettingsActivity extends Activity {
builder.create().show(); builder.create().show();
} }
private void showMachineCode() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("修改点机器编码");
EditText editText = new EditText(getApplicationContext());
editText.setText(SharedPreferencesUtils.getMachineCode(SettingsActivity.this));
builder.setView(editText);
builder.setPositiveButton("确定", (dialog, which) -> {
SharedPreferencesUtils.setMachineCode(SettingsActivity.this, editText.getText().toString());
txtMachineCode.setText(SharedPreferencesUtils.getMachineCode(SettingsActivity.this));
Utils.fastBroadcast(SettingsActivity.this, Base.BROADCAST_ACTION_MACHINE_CODE_CHANGED);
});
builder.setNegativeButton("取消", null);
builder.create().show();
}
public String getAppVersionName() { public String getAppVersionName() {
try { try {
PackageInfo packageInfo = getApplicationContext().getPackageManager().getPackageInfo(getPackageName(), 0); PackageInfo packageInfo = getApplicationContext().getPackageManager().getPackageInfo(getPackageName(), 0);
......
...@@ -13,6 +13,9 @@ import androidx.annotation.NonNull; ...@@ -13,6 +13,9 @@ import androidx.annotation.NonNull;
import com.ihaoin.hooloo.device.HLApplication; import com.ihaoin.hooloo.device.HLApplication;
import com.ihaoin.hooloo.device.R; import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.util.StringUtils; import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
import java.util.Arrays;
public class TipsDialog extends Dialog { public class TipsDialog extends Dialog {
private View butnClose; private View butnClose;
...@@ -45,5 +48,7 @@ public class TipsDialog extends Dialog { ...@@ -45,5 +48,7 @@ public class TipsDialog extends Dialog {
}); });
webView.loadUrl(HLApplication.getMainData().getTips()); webView.loadUrl(HLApplication.getMainData().getTips());
butnClose.setOnClickListener(x -> dismiss()); butnClose.setOnClickListener(x -> dismiss());
Utils.setTouchDelegate(findViewById(R.id.layout_root), Arrays.asList(butnClose));
} }
} }
...@@ -74,17 +74,38 @@ public class TrolleyView extends RelativeLayout { ...@@ -74,17 +74,38 @@ public class TrolleyView extends RelativeLayout {
} }
public void prepareAddGoods(Goods goods, Sku sku, Integer count) { public void prepareAddGoods(Goods goods, Sku sku, Integer count) {
NetworkHandler handler = new NetworkHandler() { CheckGoodsHandler handler = new CheckGoodsHandler(goods, sku, count);
HttpUtil.checkSku(sku.getSkuId(), handler);
}
class CheckGoodsHandler extends NetworkHandler {
private Goods goods;
private Sku sku;
private Integer count;
public CheckGoodsHandler(Goods goods, Sku sku, Integer count) {
super();
this.goods = goods;
this.sku = sku;
this.count = count;
}
@Override @Override
public void handleMessage(@NonNull Message msg) { public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if (msg.what != 1) { if (msg.what != 1) {
Toast.makeText(getContext(), ((Exception) msg.obj).getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), ((Exception) msg.obj).getMessage(), Toast.LENGTH_SHORT).show();
return; return;
} }
addGoods(goods, sku, count); addGoods(goods, sku, count);
} }
}; }
HttpUtil.checkSku(sku.getSkuId(), handler);
private Integer getCountOfOrder() {
if (HLApplication.getMainData() == null || HLApplication.getMainData().getCountOfOrder() == null) {
return 9;
}
return HLApplication.getMainData().getCountOfOrder();
} }
/** 添加商品到购物车 - 商品详情、商品列表 */ /** 添加商品到购物车 - 商品详情、商品列表 */
...@@ -93,8 +114,8 @@ public class TrolleyView extends RelativeLayout { ...@@ -93,8 +114,8 @@ public class TrolleyView extends RelativeLayout {
// Toast.makeText(this.getContext(), R.string.error_sku_state, Toast.LENGTH_SHORT).show(); // Toast.makeText(this.getContext(), R.string.error_sku_state, Toast.LENGTH_SHORT).show();
// return; // return;
// } // }
if (getCount() >= HLApplication.getMainData().getCountOfOrder()) { if (getCount() >= getCountOfOrder()) {
Toast.makeText(this.getContext(), getContext().getString(R.string.count_limit, HLApplication.getMainData().getCountOfOrder().toString()), Toast.LENGTH_SHORT).show(); Toast.makeText(this.getContext(), getContext().getString(R.string.count_limit, getCountOfOrder().toString()), Toast.LENGTH_SHORT).show();
return; return;
} }
Optional<TrolleyGoods> optional = this.trolleyGoods.stream().filter(x -> x.getGoodId().equals(goods.getGoodsId()) && x.getSkuId().equals(sku.getSkuId())).findAny(); Optional<TrolleyGoods> optional = this.trolleyGoods.stream().filter(x -> x.getGoodId().equals(goods.getGoodsId()) && x.getSkuId().equals(sku.getSkuId())).findAny();
...@@ -130,8 +151,8 @@ public class TrolleyView extends RelativeLayout { ...@@ -130,8 +151,8 @@ public class TrolleyView extends RelativeLayout {
// Toast.makeText(this.getContext(), R.string.error_sku_state, Toast.LENGTH_SHORT).show(); // Toast.makeText(this.getContext(), R.string.error_sku_state, Toast.LENGTH_SHORT).show();
// return; // return;
// } // }
if (getCount() >= HLApplication.getMainData().getCountOfOrder()) { if (getCount() >= getCountOfOrder()) {
Toast.makeText(this.getContext(), getContext().getString(R.string.count_limit, HLApplication.getMainData().getCountOfOrder().toString()), Toast.LENGTH_SHORT).show(); Toast.makeText(this.getContext(), getContext().getString(R.string.count_limit, getCountOfOrder().toString()), Toast.LENGTH_SHORT).show();
return; return;
} }
TrolleyGoods goods = this.trolleyGoods.get(position); TrolleyGoods goods = this.trolleyGoods.get(position);
...@@ -159,8 +180,8 @@ public class TrolleyView extends RelativeLayout { ...@@ -159,8 +180,8 @@ public class TrolleyView extends RelativeLayout {
} }
public Boolean checkGoodsCount() { public Boolean checkGoodsCount() {
if (getCount() > HLApplication.getMainData().getCountOfOrder()) { if (getCount() > getCountOfOrder()) {
Toast.makeText(this.getContext(), getContext().getString(R.string.count_limit, HLApplication.getMainData().getCountOfOrder().toString()), Toast.LENGTH_SHORT).show(); Toast.makeText(this.getContext(), getContext().getString(R.string.count_limit, getCountOfOrder().toString()), Toast.LENGTH_SHORT).show();
return false; return false;
} }
return true; return true;
...@@ -196,7 +217,7 @@ public class TrolleyView extends RelativeLayout { ...@@ -196,7 +217,7 @@ public class TrolleyView extends RelativeLayout {
} }
private void measureListHeight() { private void measureListHeight() {
int count = this.trolleyGoods.size() > 2 ? 2 : this.trolleyGoods.size(); int count = this.trolleyGoods.size() > 3 ? 3 : this.trolleyGoods.size();
int height = Utils.getDimens(this.getContext(), R.dimen.trolley_item_height) * count; int height = Utils.getDimens(this.getContext(), R.dimen.trolley_item_height) * count;
ViewGroup.LayoutParams layoutParams = listTrolley.getLayoutParams(); ViewGroup.LayoutParams layoutParams = listTrolley.getLayoutParams();
layoutParams.height = height; layoutParams.height = height;
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
<item>
<vector
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M15,5L15,25"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
<path
android:pathData="M5,15H25,15"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
</vector>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
<item>
<vector
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M5,15L13,22"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
<path
android:pathData="M12.4,21.9L23,9"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
</vector>
</item>
</layer-list>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:fillColor="@color/black"
android:viewportWidth="24"
android:viewportHeight="24">
<path
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>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<stroke
android:width="1dp"
android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
<item>
<vector
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M5,15H25,15"
android:strokeWidth="1"
android:strokeColor="@color/colorPrimary" />
</vector>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<stroke
android:width="1dp"
android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<item android:drawable="@drawable/ic_checked" android:state_checked="true" /> <item android:drawable="@mipmap/duigou_2x" android:state_checked="true" />
<item android:drawable="@drawable/ic_checked" android:state_selected="true" /> <item android:drawable="@mipmap/duigou_2x" android:state_selected="true" />
<item android:drawable="@drawable/ic_uncheck" /> <item android:drawable="@mipmap/duigou_2x" />
</selector> </selector>
...@@ -15,16 +15,17 @@ ...@@ -15,16 +15,17 @@
<FrameLayout <FrameLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="4"> android:layout_marginLeft="@dimen/padding10"
android:layout_weight="4.5">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:paddingTop="@dimen/padding20"
android:id="@+id/rec_right" android:id="@+id/rec_right"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</FrameLayout> </FrameLayout>
<ScrollView <ScrollView
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1.3"
android:scrollbars="none"> android:scrollbars="none">
<RadioGroup <RadioGroup
android:id="@+id/group_category" android:id="@+id/group_category"
......
...@@ -80,6 +80,11 @@ ...@@ -80,6 +80,11 @@
android:text="机器编码" android:text="机器编码"
android:textColor="@color/textDisable" android:textColor="@color/textDisable"
android:textSize="@dimen/ts_setting_desc" /> android:textSize="@dimen/ts_setting_desc" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10"
android:src="@drawable/ic_baseline_chevron_right_24_grey" />
</LinearLayout> </LinearLayout>
<include layout="@layout/view_line" /> <include layout="@layout/view_line" />
<LinearLayout <LinearLayout
...@@ -104,6 +109,11 @@ ...@@ -104,6 +109,11 @@
android:text="A" android:text="A"
android:textColor="@color/textDisable" android:textColor="@color/textDisable"
android:textSize="@dimen/ts_setting_desc" /> android:textSize="@dimen/ts_setting_desc" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10"
android:src="@drawable/ic_baseline_chevron_right_24_grey" />
</LinearLayout> </LinearLayout>
<include layout="@layout/view_line" /> <include layout="@layout/view_line" />
<LinearLayout <LinearLayout
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
android:gravity="center" android:gravity="center"
android:paddingTop="@dimen/category_padding" android:paddingTop="@dimen/category_padding"
android:paddingBottom="@dimen/category_padding" android:paddingBottom="@dimen/category_padding"
android:paddingStart="@dimen/padding10"
android:paddingEnd="@dimen/padding10"
android:textColor="@drawable/sel_category_color" android:textColor="@drawable/sel_category_color"
android:textSize="@dimen/ts_category_radio" /> android:textSize="@dimen/ts_category_radio" />
...@@ -3,15 +3,27 @@ ...@@ -3,15 +3,27 @@
android:id="@+id/layout_item" android:id="@+id/layout_item"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/padding10"> android:padding="@dimen/padding10">
<ImageView <RelativeLayout
android:id="@+id/img_thumbnail"
android:layout_width="@dimen/goods_thum_size" android:layout_width="@dimen/goods_thum_size"
android:layout_height="@dimen/goods_thum_size" android:layout_height="@dimen/goods_thum_size"
android:layout_marginEnd="@dimen/padding10" android:layout_marginEnd="@dimen/padding10">
<ImageView
android:id="@+id/img_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<ImageView
android:id="@+id/img_recommend"
android:layout_width="@dimen/ic_recommend"
android:layout_height="@dimen/ic_recommend"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/padding5"
android:src="@mipmap/aixin_2x" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/layout_right" android:id="@+id/layout_right"
android:layout_width="0dp" android:layout_width="0dp"
...@@ -44,38 +56,42 @@ ...@@ -44,38 +56,42 @@
android:text="茶叶与咖啡完美的碰撞" android:text="茶叶与咖啡完美的碰撞"
android:textColor="@color/textSecondPrimary" android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_goods_item_intro" /> android:textSize="@dimen/ts_goods_item_intro" />
<LinearLayout <RelativeLayout
android:id="@+id/layout_butns" android:id="@+id/layout_butns"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding3" android:layout_marginTop="@dimen/padding3">
android:gravity="bottom"
android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/img_price"
android:layout_width="@dimen/ic_price" android:layout_width="@dimen/ic_price"
android:layout_height="@dimen/ic_price" android:layout_height="@dimen/ic_price"
android:layout_alignParentBottom="true"
android:src="@drawable/ms__arrow" /> android:src="@drawable/ms__arrow" />
<TextView <TextView
android:id="@+id/txt_price" android:id="@+id/txt_price"
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:layout_alignParentBottom="true"
android:layout_toRightOf="@id/img_price"
android:text="19.9" android:text="19.9"
android:textColor="@color/textRed" android:textColor="@color/textRed"
android:textSize="@dimen/ts_goods_item_price" android:textSize="@dimen/ts_goods_item_price"
android:textStyle="bold" /> android:textStyle="bold" />
<ImageView <ImageView
android:id="@+id/img_discount"
android:layout_width="@dimen/ic_discount" android:layout_width="@dimen/ic_discount"
android:layout_height="@dimen/ic_discount" android:layout_height="@dimen/ic_discount"
android:layout_alignParentBottom="true"
android:layout_marginStart="@dimen/padding5" android:layout_marginStart="@dimen/padding5"
android:layout_toEndOf="@id/txt_price"
android:src="@drawable/ms__arrow" /> android:src="@drawable/ms__arrow" />
<TextView <TextView
android:id="@+id/txt_discount" android:id="@+id/txt_discount"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_alignParentBottom="true"
android:gravity="center_vertical" android:layout_toEndOf="@id/img_discount"
android:text="29.9" android:text="29.9"
android:textColor="@color/textSecondPrimary" android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_goods_item_discount" /> android:textSize="@dimen/ts_goods_item_discount" />
...@@ -84,7 +100,8 @@ ...@@ -84,7 +100,8 @@
android:id="@+id/txt_sellout" android:id="@+id/txt_sellout"
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:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:text="已售罄" android:text="已售罄"
android:textColor="@color/textRed" android:textColor="@color/textRed"
android:textSize="@dimen/ts_goods_item_sellout" android:textSize="@dimen/ts_goods_item_sellout"
...@@ -94,7 +111,8 @@ ...@@ -94,7 +111,8 @@
style="@style/button_style" style="@style/button_style"
android:layout_width="@dimen/ic_add_size" android:layout_width="@dimen/ic_add_size"
android:layout_height="@dimen/ic_add_size" android:layout_height="@dimen/ic_add_size"
android:background="@drawable/ic_add" /> android:layout_alignParentEnd="true"
</LinearLayout> android:background="@mipmap/jiahao_2x" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -3,10 +3,17 @@ ...@@ -3,10 +3,17 @@
android:id="@+id/layout_item" android:id="@+id/layout_item"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorLogo"
android:paddingHorizontal="@dimen/padding20"
android:paddingVertical="@dimen/padding15">
<ImageView <ImageView
android:id="@+id/img_logo"
android:layout_width="@dimen/logo_width" android:layout_width="@dimen/logo_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:src="@mipmap/logo" /> android:src="@mipmap/logo_2x" />
</FrameLayout>
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -16,6 +16,6 @@ ...@@ -16,6 +16,6 @@
android:id="@+id/group_spec" android:id="@+id/group_spec"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding5" android:layout_marginTop="@dimen/spec_rule_margin"
android:orientation="horizontal" /> android:orientation="horizontal" />
</LinearLayout> </LinearLayout>
...@@ -6,10 +6,8 @@ ...@@ -6,10 +6,8 @@
android:layout_marginEnd="@dimen/padding10" android:layout_marginEnd="@dimen/padding10"
android:background="@drawable/sel_spec_bg" android:background="@drawable/sel_spec_bg"
android:button="@null" android:button="@null"
android:paddingStart="@dimen/padding10" android:paddingHorizontal="@dimen/padding10"
android:paddingTop="@dimen/padding3" android:paddingVertical="@dimen/rule_vertical_padding"
android:paddingEnd="@dimen/padding10"
android:paddingBottom="@dimen/padding3"
android:singleLine="true" android:singleLine="true"
android:textColor="@drawable/sel_spec_color" android:textColor="@drawable/sel_spec_color"
android:textSize="@dimen/ts_detail_rule" /> android:textSize="@dimen/ts_detail_rule" />
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
android:id="@+id/txt_price" android:id="@+id/txt_price"
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:text="19.9" android:text="19.9"
android:textColor="@color/textRed" android:textColor="@color/textRed"
android:textSize="@dimen/ts_goods_item_price" android:textSize="@dimen/ts_goods_item_price"
...@@ -73,7 +72,6 @@ ...@@ -73,7 +72,6 @@
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:gravity="center_vertical"
android:text="29.9" android:text="29.9"
android:textColor="@color/textSecondPrimary" android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_goods_item_discount" /> android:textSize="@dimen/ts_goods_item_discount" />
...@@ -90,7 +88,7 @@ ...@@ -90,7 +88,7 @@
style="@style/button_style" style="@style/button_style"
android:layout_width="@dimen/ic_subtract_size" android:layout_width="@dimen/ic_subtract_size"
android:layout_height="@dimen/ic_subtract_size" android:layout_height="@dimen/ic_subtract_size"
android:background="@drawable/ic_sub" /> android:background="@mipmap/jianhao_2x" />
<TextView <TextView
android:id="@+id/txt_count" android:id="@+id/txt_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -99,12 +97,13 @@ ...@@ -99,12 +97,13 @@
android:layout_marginRight="@dimen/padding10" android:layout_marginRight="@dimen/padding10"
android:text="1" android:text="1"
android:textColor="@color/textPrimary" android:textColor="@color/textPrimary"
android:textSize="@dimen/ts_goods_item_count" /> android:textSize="@dimen/ts_trolley_item_count"
android:textStyle="bold" />
<Button <Button
android:id="@+id/butn_add" android:id="@+id/butn_add"
style="@style/button_style" style="@style/button_style"
android:layout_width="@dimen/ic_add_size" android:layout_width="@dimen/ic_add_size"
android:layout_height="@dimen/ic_add_size" android:layout_height="@dimen/ic_add_size"
android:background="@drawable/ic_add" /> android:background="@mipmap/jiahao_2x" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/layout_root"
android:background="@color/white" android:background="@color/white"
android:padding="@dimen/padding15"> android:padding="@dimen/padding15">
<TextView <TextView
...@@ -33,16 +34,25 @@ ...@@ -33,16 +34,25 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding20"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/ic_scan_wx"
android:layout_height="@dimen/ic_scan_wx"
android:src="@mipmap/weixin_2x" />
<TextView <TextView
android:id="@+id/txt_scan" android:id="@+id/txt_scan"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding20" android:layout_marginStart="@dimen/padding5"
android:drawableStart="@mipmap/wx"
android:gravity="center"
android:text="使用微信扫一扫,确认订单并付款" android:text="使用微信扫一扫,确认订单并付款"
android:textColor="@color/textPrimary" android:textColor="@color/textPrimary"
android:textSize="@dimen/ts_scan" /> android:textSize="@dimen/ts_scan" />
</LinearLayout>
<TextView <TextView
android:id="@+id/txt_expire" android:id="@+id/txt_expire"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -62,11 +72,11 @@ ...@@ -62,11 +72,11 @@
android:id="@+id/img_succeed" android:id="@+id/img_succeed"
android:layout_width="@dimen/ic_scan_succ" android:layout_width="@dimen/ic_scan_succ"
android:layout_height="@dimen/ic_scan_succ" android:layout_height="@dimen/ic_scan_succ"
android:src="@mipmap/succ" /> android:src="@mipmap/weixinduigou_2x" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/padding10" android:layout_marginStart="@dimen/padding5"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/txt_return" android:id="@+id/txt_return"
...@@ -97,5 +107,5 @@ ...@@ -97,5 +107,5 @@
android:layout_width="@dimen/ic_dialog_close" android:layout_width="@dimen/ic_dialog_close"
android:layout_height="@dimen/ic_dialog_close" android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:src="@drawable/ic_outline_close_24" /> android:src="@mipmap/chahao_2x" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:layout_width="@dimen/dialog_detail_width" android:layout_width="@dimen/dialog_detail_width"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
...@@ -9,7 +10,8 @@ ...@@ -9,7 +10,8 @@
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1"> android:layout_weight="1"
android:descendantFocusability="afterDescendants">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -109,7 +111,7 @@ ...@@ -109,7 +111,7 @@
style="@style/button_style" style="@style/button_style"
android:layout_width="@dimen/ic_detail_add_size" android:layout_width="@dimen/ic_detail_add_size"
android:layout_height="@dimen/ic_detail_add_size" android:layout_height="@dimen/ic_detail_add_size"
android:background="@drawable/ic_sub" /> android:background="@mipmap/jianhao_2x" />
<TextView <TextView
android:id="@+id/txt_count" android:id="@+id/txt_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -124,7 +126,7 @@ ...@@ -124,7 +126,7 @@
style="@style/button_style" style="@style/button_style"
android:layout_width="@dimen/ic_detail_add_size" android:layout_width="@dimen/ic_detail_add_size"
android:layout_height="@dimen/ic_detail_add_size" android:layout_height="@dimen/ic_detail_add_size"
android:background="@drawable/ic_add" /> android:background="@mipmap/jiahao_2x" />
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/txt_sellout" android:id="@+id/txt_sellout"
...@@ -148,6 +150,7 @@ ...@@ -148,6 +150,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/bg_button" android:background="@drawable/bg_button"
android:padding="@dimen/padding10"
android:text="加入购物袋" android:text="加入购物袋"
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
android:textSize="@dimen/ts_detail_add_trolley" android:textSize="@dimen/ts_detail_add_trolley"
...@@ -158,6 +161,7 @@ ...@@ -158,6 +161,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:padding="@dimen/padding10"
android:text="立即购买" android:text="立即购买"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/ts_detail_buynow" android:textSize="@dimen/ts_detail_buynow"
...@@ -172,5 +176,5 @@ ...@@ -172,5 +176,5 @@
android:layout_height="@dimen/ic_dialog_close" android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_margin="@dimen/padding15" android:layout_margin="@dimen/padding15"
android:src="@drawable/ic_outline_close_24" /> android:src="@mipmap/chahao_2x" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dialog_tip_width" android:layout_width="@dimen/dialog_tip_width"
android:id="@+id/layout_root"
android:layout_height="match_parent"> android:layout_height="match_parent">
<WebView <WebView
android:id="@+id/web_view" android:id="@+id/web_view"
...@@ -13,5 +14,5 @@ ...@@ -13,5 +14,5 @@
android:layout_height="@dimen/ic_dialog_close" android:layout_height="@dimen/ic_dialog_close"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_margin="@dimen/padding15" android:layout_margin="@dimen/padding15"
android:src="@drawable/ic_outline_close_24" /> android:src="@mipmap/chahao_2x" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:padding="@dimen/padding10"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
...@@ -77,13 +78,14 @@ ...@@ -77,13 +78,14 @@
android:layout_width="@dimen/trolley_ic_size" android:layout_width="@dimen/trolley_ic_size"
android:layout_height="@dimen/trolley_ic_size" android:layout_height="@dimen/trolley_ic_size"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:src="@color/colorPrimaryDark" /> android:src="@mipmap/handbag_2x" />
<TextView <TextView
android:id="@+id/txt_count" android:id="@+id/txt_count"
android:layout_width="@dimen/trolley_count_size" android:layout_width="@dimen/trolley_count_size"
android:layout_height="@dimen/trolley_count_size" android:layout_height="@dimen/trolley_count_size"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:background="@drawable/ic_dot" android:background="@drawable/ic_dot"
android:layout_margin="@dimen/padding7"
android:gravity="center" android:gravity="center"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/ts_trolley_count" android:textSize="@dimen/ts_trolley_count"
...@@ -92,7 +94,6 @@ ...@@ -92,7 +94,6 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="@dimen/padding10"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
......
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources> <resources>
<dimen name="padding20">20dp</dimen> <dimen name="padding20">40dp</dimen>
<dimen name="padding15">15dp</dimen> <dimen name="padding15">30dp</dimen>
<dimen name="padding10">10dp</dimen> <dimen name="padding10">20dp</dimen>
<dimen name="padding5">5dp</dimen> <dimen name="padding7">14dp</dimen>
<dimen name="padding3">3dp</dimen> <dimen name="padding5">10dp</dimen>
<dimen name="logo_width">200dp</dimen> <dimen name="padding3">5dp</dimen>
<dimen name="goods_thum_size">80dp</dimen> <dimen name="rule_vertical_padding">8dp</dimen>
<dimen name="category_padding">20dp</dimen> <dimen name="spec_rule_margin">13dp</dimen>
<dimen name="category_margin">50dp</dimen> <dimen name="logo_width">400dp</dimen>
<dimen name="category_divider_padding">20dp</dimen> <dimen name="logo_padding">40dp</dimen>
<dimen name="menu_divider_padding_hor">10dp</dimen> <dimen name="goods_thum_size">150dp</dimen>
<dimen name="menu_divider_padding_ver">40dp</dimen> <dimen name="category_padding">40dp</dimen>
<dimen name="qrcode_size">150dp</dimen> <dimen name="category_margin">100dp</dimen>
<dimen name="category_divider_padding">40dp</dimen>
<dimen name="menu_divider_padding_hor">20dp</dimen>
<dimen name="menu_divider_padding_ver">80dp</dimen>
<dimen name="qrcode_size">300dp</dimen>
<dimen name="dialog_detail_width">600dp</dimen> <dimen name="dialog_detail_width">1200dp</dimen>
<dimen name="dialog_tip_width">600dp</dimen> <dimen name="dialog_tip_width">1200dp</dimen>
<dimen name="trolley_width">400dp</dimen> <dimen name="trolley_width">800dp</dimen>
<dimen name="trolley_item_height">100dp</dimen> <dimen name="trolley_item_height">200dp</dimen>
<dimen name="trolley_bar_height">60dp</dimen> <dimen name="trolley_bar_height">120dp</dimen>
<dimen name="trolley_pay_width">150dp</dimen> <dimen name="trolley_pay_width">300dp</dimen>
<dimen name="trolley_ic_size">40dp</dimen> <dimen name="trolley_ic_size">80dp</dimen>
<dimen name="trolley_ic_border_size">50dp</dimen> <dimen name="trolley_ic_border_size">120dp</dimen>
<dimen name="trolley_count_size">20dp</dimen> <dimen name="trolley_count_size">30dp</dimen>
<dimen name="ic_clear_size">15dp</dimen> <dimen name="ic_recommend">20dp</dimen>
<dimen name="ic_add_size">20dp</dimen> <dimen name="ic_clear_size">30dp</dimen>
<dimen name="ic_subtract_size">20dp</dimen> <dimen name="ic_add_size">40dp</dimen>
<dimen name="ic_price">15dp</dimen> <dimen name="ic_subtract_size">40dp</dimen>
<dimen name="ic_discount">10dp</dimen> <dimen name="ic_price">30dp</dimen>
<dimen name="ic_checkbox">25dp</dimen> <dimen name="ic_discount">20dp</dimen>
<dimen name="ic_corners">10dp</dimen> <dimen name="ic_checkbox">40dp</dimen>
<dimen name="ic_detail_add_size">20dp</dimen> <dimen name="ic_corners">20dp</dimen>
<dimen name="ic_detail_subtract_size">20dp</dimen> <dimen name="ic_detail_add_size">40dp</dimen>
<dimen name="ic_detail_price">15dp</dimen> <dimen name="ic_detail_subtract_size">40dp</dimen>
<dimen name="ic_detail_discount">10dp</dimen> <dimen name="ic_detail_price">30dp</dimen>
<dimen name="ic_dialog_close">30dp</dimen> <dimen name="ic_detail_discount">20dp</dimen>
<dimen name="ic_trolley_price">30dp</dimen> <dimen name="ic_dialog_close">35dp</dimen>
<dimen name="ic_scan_succ">40dp</dimen> <dimen name="ic_trolley_price">60dp</dimen>
<dimen name="ic_scan_succ">80dp</dimen>
<dimen name="ic_scan_wx">40dp</dimen>
<dimen name="ts_recommend_name">20sp</dimen> <dimen name="ts_recommend_name">36sp</dimen>
<dimen name="ts_recommend_desc">20sp</dimen> <dimen name="ts_recommend_desc">30sp</dimen>
<dimen name="ts_category_radio">12sp</dimen> <dimen name="ts_category_radio">20sp</dimen>
<dimen name="ts_category_item">18sp</dimen> <dimen name="ts_category_item">26sp</dimen>
<dimen name="ts_goods_item_name">14sp</dimen> <dimen name="ts_goods_item_name">20sp</dimen>
<dimen name="ts_goods_item_intro">12sp</dimen> <dimen name="ts_goods_item_intro">16sp</dimen>
<dimen name="ts_goods_item_price">12sp</dimen> <dimen name="ts_goods_item_price">16sp</dimen>
<dimen name="ts_goods_item_discount">9sp</dimen> <dimen name="ts_goods_item_discount">14sp</dimen>
<dimen name="ts_goods_item_sellout">12sp</dimen> <dimen name="ts_goods_item_sellout">15sp</dimen>
<dimen name="ts_goods_item_tag">9sp</dimen> <dimen name="ts_goods_item_tag">12sp</dimen>
<dimen name="ts_goods_item_count">12sp</dimen> <dimen name="ts_trolley_name">28sp</dimen>
<dimen name="ts_trolley_name">18sp</dimen> <dimen name="ts_trolley_clear">22sp</dimen>
<dimen name="ts_trolley_clear">12sp</dimen> <dimen name="ts_trolley_total">26sp</dimen>
<dimen name="ts_trolley_total">16sp</dimen> <dimen name="ts_trolley_item_count">20sp</dimen>
<dimen name="ts_trolley_count">12sp</dimen> <dimen name="ts_trolley_count">18sp</dimen>
<dimen name="ts_trolley_pay">16sp</dimen> <dimen name="ts_trolley_pay">28sp</dimen>
<dimen name="ts_tips">9sp</dimen> <dimen name="ts_tips">18sp</dimen>
<dimen name="ts_detail_name">20sp</dimen> <dimen name="ts_detail_name">30sp</dimen>
<dimen name="ts_detail_spec">14sp</dimen> <dimen name="ts_detail_spec">24sp</dimen>
<dimen name="ts_detail_rule">12sp</dimen> <dimen name="ts_detail_rule">22sp</dimen>
<dimen name="ts_detail_count">14sp</dimen> <dimen name="ts_detail_count">24sp</dimen>
<dimen name="ts_detail_price">14sp</dimen> <dimen name="ts_detail_price">24sp</dimen>
<dimen name="ts_detail_discount">12sp</dimen> <dimen name="ts_detail_discount">22sp</dimen>
<dimen name="ts_detail_sellout">12sp</dimen> <dimen name="ts_detail_sellout">22sp</dimen>
<dimen name="ts_detail_add_trolley">14sp</dimen> <dimen name="ts_detail_add_trolley">24sp</dimen>
<dimen name="ts_detail_buynow">14sp</dimen> <dimen name="ts_detail_buynow">24sp</dimen>
<dimen name="ts_header_text">14sp</dimen> <dimen name="ts_header_text">26sp</dimen>
<dimen name="ts_dialog_title">18sp</dimen> <dimen name="ts_dialog_title">28sp</dimen>
<dimen name="ts_scan">14sp</dimen> <dimen name="ts_scan">24sp</dimen>
<dimen name="ts_expire">12sp</dimen> <dimen name="ts_expire">22sp</dimen>
<dimen name="ts_order_number">12sp</dimen> <dimen name="ts_order_number">22sp</dimen>
<dimen name="ts_menu_title">22sp</dimen> <dimen name="ts_menu_title">22sp</dimen>
<dimen name="ts_menu_subtitle">18sp</dimen> <dimen name="ts_menu_subtitle">18sp</dimen>
<dimen name="ts_setting_name">16sp</dimen> <dimen name="ts_setting_name">18sp</dimen>
<dimen name="ts_setting_desc">14sp</dimen> <dimen name="ts_setting_desc">16sp</dimen>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorLogo">#FF006ECF</color>
<color name="colorPrimary">#FF2C9CFF</color> <color name="colorPrimary">#FF2C9CFF</color>
<color name="dialog_bg">#CC000000</color> <color name="dialog_bg">#CC000000</color>
<color name="textPrimary">#FF000000</color> <color name="textPrimary">#FF000000</color>
......
...@@ -2,9 +2,13 @@ ...@@ -2,9 +2,13 @@
<dimen name="padding20">20dp</dimen> <dimen name="padding20">20dp</dimen>
<dimen name="padding15">15dp</dimen> <dimen name="padding15">15dp</dimen>
<dimen name="padding10">10dp</dimen> <dimen name="padding10">10dp</dimen>
<dimen name="padding7">7dp</dimen>
<dimen name="padding5">5dp</dimen> <dimen name="padding5">5dp</dimen>
<dimen name="padding3">3dp</dimen> <dimen name="padding3">3dp</dimen>
<dimen name="rule_vertical_padding">3dp</dimen>
<dimen name="spec_rule_margin">5dp</dimen>
<dimen name="logo_width">200dp</dimen> <dimen name="logo_width">200dp</dimen>
<dimen name="logo_padding">20dp</dimen>
<dimen name="goods_thum_size">80dp</dimen> <dimen name="goods_thum_size">80dp</dimen>
<dimen name="category_padding">20dp</dimen> <dimen name="category_padding">20dp</dimen>
<dimen name="category_margin">50dp</dimen> <dimen name="category_margin">50dp</dimen>
...@@ -24,6 +28,7 @@ ...@@ -24,6 +28,7 @@
<dimen name="trolley_ic_border_size">50dp</dimen> <dimen name="trolley_ic_border_size">50dp</dimen>
<dimen name="trolley_count_size">20dp</dimen> <dimen name="trolley_count_size">20dp</dimen>
<dimen name="ic_recommend">10dp</dimen>
<dimen name="ic_clear_size">15dp</dimen> <dimen name="ic_clear_size">15dp</dimen>
<dimen name="ic_add_size">20dp</dimen> <dimen name="ic_add_size">20dp</dimen>
<dimen name="ic_subtract_size">20dp</dimen> <dimen name="ic_subtract_size">20dp</dimen>
...@@ -38,6 +43,7 @@ ...@@ -38,6 +43,7 @@
<dimen name="ic_dialog_close">30dp</dimen> <dimen name="ic_dialog_close">30dp</dimen>
<dimen name="ic_trolley_price">30dp</dimen> <dimen name="ic_trolley_price">30dp</dimen>
<dimen name="ic_scan_succ">40dp</dimen> <dimen name="ic_scan_succ">40dp</dimen>
<dimen name="ic_scan_wx">20dp</dimen>
<dimen name="ts_recommend_name">20sp</dimen> <dimen name="ts_recommend_name">20sp</dimen>
<dimen name="ts_recommend_desc">20sp</dimen> <dimen name="ts_recommend_desc">20sp</dimen>
...@@ -49,7 +55,7 @@ ...@@ -49,7 +55,7 @@
<dimen name="ts_goods_item_discount">9sp</dimen> <dimen name="ts_goods_item_discount">9sp</dimen>
<dimen name="ts_goods_item_sellout">12sp</dimen> <dimen name="ts_goods_item_sellout">12sp</dimen>
<dimen name="ts_goods_item_tag">9sp</dimen> <dimen name="ts_goods_item_tag">9sp</dimen>
<dimen name="ts_goods_item_count">12sp</dimen> <dimen name="ts_trolley_item_count">12sp</dimen>
<dimen name="ts_trolley_name">18sp</dimen> <dimen name="ts_trolley_name">18sp</dimen>
<dimen name="ts_trolley_clear">12sp</dimen> <dimen name="ts_trolley_clear">12sp</dimen>
<dimen name="ts_trolley_total">16sp</dimen> <dimen name="ts_trolley_total">16sp</dimen>
......
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