Commit cb3908f0 by wjg

add update

parent 0ef0f1f0
...@@ -10,8 +10,8 @@ android { ...@@ -10,8 +10,8 @@ android {
applicationId "com.ihaoin.hooloo.device" applicationId "com.ihaoin.hooloo.device"
minSdkVersion 26 minSdkVersion 26
targetSdkVersion 30 targetSdkVersion 30
versionCode 1 versionCode 10
versionName "1.0" versionName "1.0.10"
ndk { ndk {
//选择要添加的对应 cpu 类型的 .so 库。 //选择要添加的对应 cpu 类型的 .so 库。
...@@ -51,7 +51,8 @@ dependencies { ...@@ -51,7 +51,8 @@ dependencies {
implementation 'com.kyleduo.switchbutton:library:2.0.0' implementation 'com.kyleduo.switchbutton:library:2.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.github.bumptech.glide:glide:4.9.0' // implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.bumptech.glide:glide:4.13.2'
implementation 'com.squareup.okhttp3:okhttp:3.5.0' implementation 'com.squareup.okhttp3:okhttp:3.5.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
...@@ -74,4 +75,5 @@ dependencies { ...@@ -74,4 +75,5 @@ dependencies {
implementation 'com.umeng.umsdk:apm:1.6.2'// U-APM产品包依赖(必选) implementation 'com.umeng.umsdk:apm:1.6.2'// U-APM产品包依赖(必选)
implementation 'io.socket:socket.io-client:1.0.0' implementation 'io.socket:socket.io-client:1.0.0'
implementation 'com.blankj:utilcode:1.28.6' implementation 'com.blankj:utilcode:1.28.6'
// debugImplementation 'com.github.getActivity:Logcat:10.6'
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.ihaoin.hooloo.device" package="com.ihaoin.hooloo.device">
android:versionCode="2"
android:versionName="1.0.2">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
...@@ -27,12 +25,20 @@ ...@@ -27,12 +25,20 @@
android:extractNativeLibs="true" android:extractNativeLibs="true"
android:icon="@mipmap/hooloo_launcher" android:icon="@mipmap/hooloo_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:hardwareAccelerated="true"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:sharedUserId="android.uid.system" android:sharedUserId="android.uid.system"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:replace="android:allowBackup,android:icon"> tools:replace="android:allowBackup,android:icon">
<!-- 悬浮窗入口 -->
<meta-data
android:name="LogcatWindowEntrance"
android:value="true" />
<!-- 通知栏入口 -->
<meta-data
android:name="LogcatNotifyEntrance"
android:value="true" />
<activity <activity
android:name=".home.view.LauncherActivity" android:name=".home.view.LauncherActivity"
android:exported="true" android:exported="true"
......
...@@ -4,7 +4,6 @@ import android.app.Application; ...@@ -4,7 +4,6 @@ import android.app.Application;
import android.graphics.Typeface; import android.graphics.Typeface;
import com.ihaoin.hooloo.device.base.AppConfig; import com.ihaoin.hooloo.device.base.AppConfig;
import com.ihaoin.hooloo.device.update.UpdateSocket;
import com.ihaoin.hooloo.device.data.MainData; import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.data.TrolleyGoods; import com.ihaoin.hooloo.device.data.TrolleyGoods;
import com.ihaoin.hooloo.device.data.enums.PresentState; import com.ihaoin.hooloo.device.data.enums.PresentState;
...@@ -24,7 +23,6 @@ import cn.jpush.android.api.JPushInterface; ...@@ -24,7 +23,6 @@ import cn.jpush.android.api.JPushInterface;
public class HLApplication extends Application { public class HLApplication extends Application {
public static HLApplication SELF = null; public static HLApplication SELF = null;
public static String RECOGNIZE_PERSON = ""; public static String RECOGNIZE_PERSON = "";
private UpdateSocket updateSocket = null;
@Override @Override
public void onCreate() { public void onCreate() {
...@@ -41,8 +39,6 @@ public class HLApplication extends Application { ...@@ -41,8 +39,6 @@ public class HLApplication extends Application {
AppConfig.REGISTRATION_ID = JPushInterface.getRegistrationID(this); AppConfig.REGISTRATION_ID = JPushInterface.getRegistrationID(this);
HttpUtil.postRegistrationId(); HttpUtil.postRegistrationId();
startUpdateSocket();
} }
@Override @Override
...@@ -50,19 +46,6 @@ public class HLApplication extends Application { ...@@ -50,19 +46,6 @@ public class HLApplication extends Application {
super.onTerminate(); super.onTerminate();
Utils.i("Application onTerminate"); Utils.i("Application onTerminate");
stopUpdateSocket();
}
private void startUpdateSocket() {
updateSocket = new UpdateSocket(this);
updateSocket.start();
}
private void stopUpdateSocket() {
if (updateSocket != null) {
updateSocket.close();
updateSocket = null;
}
} }
private void setDefaultTypeface() { private void setDefaultTypeface() {
...@@ -89,14 +72,10 @@ public class HLApplication extends Application { ...@@ -89,14 +72,10 @@ public class HLApplication extends Application {
// 第一个点单屏默认显示交互屏 // 第一个点单屏默认显示交互屏
if (AppConfig.DEFAULT_SCREEN_NO.equals("1")) { if (AppConfig.DEFAULT_SCREEN_NO.equals("1")) {
AppConfig.DEFAULT_PRESENT = PresentState.MENU.getName(); AppConfig.DEFAULT_PRESENT = PresentState.KDS.getName();
} else { } else {
AppConfig.DEFAULT_PRESENT = PresentState.INTERACTION.getName(); AppConfig.DEFAULT_PRESENT = PresentState.INTERACTION.getName();
} }
// if (AppConfig.DEBUG) { // TODO delete
// return "SN0091290001";
// }
} }
private static MainData mainData = new MainData(); private static MainData mainData = new MainData();
......
...@@ -7,7 +7,7 @@ public class AppConfig { ...@@ -7,7 +7,7 @@ public class AppConfig {
/** 点单屏编码, 1-菜单屏,2-交互屏 */ /** 点单屏编码, 1-菜单屏,2-交互屏 */
public static String DEFAULT_SCREEN_NO = "1"; // TODO 编译点单屏编码 public static String DEFAULT_SCREEN_NO = "1"; // TODO 编译点单屏编码
/** 副屏内容 */ /** 副屏内容 */
public static String DEFAULT_PRESENT = PresentState.MENU.getName(); public static String DEFAULT_PRESENT = PresentState.KDS.getName();
public static String HL = "HL"; public static String HL = "HL";
public static String TAG = HL + "_TEST"; public static String TAG = HL + "_TEST";
......
...@@ -24,7 +24,7 @@ public class Base { ...@@ -24,7 +24,7 @@ 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_MACHINE_CODE_CHANGED = "ACTION_MACHINE_CODE_CHANGED";
public static final String BROADCAST_ACTION_PRESENT_CHANGED = "ACTION_MENU_STATE_CHANGED"; public static final String BROADCAST_ACTION_PRESENT_CHANGED = "ACTION_PRESENT_STATE_CHANGED";
public static final String BROADCAST_ACTION_LOGCAT_STATE_CHANGED = "ACTION_LOGCAT_STATE_CHANGED"; public static final String BROADCAST_ACTION_LOGCAT_STATE_CHANGED = "ACTION_LOGCAT_STATE_CHANGED";
public static final String BROADCAST_ACTION_TOUCH_EVENT = "ACTION_TOUCH_EVENT"; public static final String BROADCAST_ACTION_TOUCH_EVENT = "ACTION_TOUCH_EVENT";
public static final String BROADCAST_ACTION_TIMEOUT = "ACTION_TIMEOUT"; public static final String BROADCAST_ACTION_TIMEOUT = "ACTION_TIMEOUT";
......
...@@ -12,6 +12,7 @@ import com.ihaoin.hooloo.device.util.Utils; ...@@ -12,6 +12,7 @@ import com.ihaoin.hooloo.device.util.Utils;
import io.socket.client.Ack; import io.socket.client.Ack;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import io.socket.emitter.Emitter;
/** Linux通信 获取机器编码 */ /** Linux通信 获取机器编码 */
public class MachineInfoSocket extends Thread { public class MachineInfoSocket extends Thread {
...@@ -31,18 +32,27 @@ public class MachineInfoSocket extends Thread { ...@@ -31,18 +32,27 @@ public class MachineInfoSocket extends Thread {
try { try {
mSocket = IO.socket(Base.NSP_MACHINE); mSocket = IO.socket(Base.NSP_MACHINE);
mSocket.connect(); mSocket.connect();
mSocket.on("connect", onConnect);
mSocket.on("disconnect", onDisconnect);
} catch (Exception e) { } catch (Exception e) {
Utils.i("连接server失败,错误原因:" + e.getMessage()); Utils.i("连接server失败,错误原因:" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
Emitter.Listener onConnect = args -> Utils.i("machine socket connected");
Emitter.Listener onDisconnect = args -> Utils.i("machine socket disconnected");
public void close() { public void close() {
try { try {
Utils.i("close machine socket");
if (mSocket != null) { if (mSocket != null) {
mSocket.disconnect(); mSocket.disconnect();
mSocket.close(); mSocket.off("connect", onConnect);
mSocket = null; mSocket.off("disconnect", onDisconnect);
// mSocket.close();
// mSocket = null;
} }
} catch (Exception e) { } catch (Exception e) {
Utils.i("close失败,错误原因:" + e.getMessage()); Utils.i("close失败,错误原因:" + e.getMessage());
......
...@@ -4,7 +4,7 @@ import com.ihaoin.hooloo.device.util.StringUtils; ...@@ -4,7 +4,7 @@ import com.ihaoin.hooloo.device.util.StringUtils;
public enum PresentState { public enum PresentState {
NONE("不显示"), NONE("不显示"),
MENU("菜单屏"), KDS("菜单屏"),
INTERACTION("交互屏"); INTERACTION("交互屏");
private String name; private String name;
......
...@@ -39,7 +39,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo ...@@ -39,7 +39,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
protected void convert(BaseViewHolder helper, ScrollBean item) { protected void convert(BaseViewHolder helper, ScrollBean item) {
ScrollBean.ScrollItemBean t = item.t; ScrollBean.ScrollItemBean t = item.t;
ViewGroup layoutItem = helper.getView(R.id.layout_item); ViewGroup layoutItem = helper.getView(R.id.layout_item);
layoutItem.setForeground(null); // layoutItem.setForeground(null);
Goods goods = (Goods) t.getObject(); Goods goods = (Goods) t.getObject();
helper.setText(R.id.txt_name, goods.getName()); helper.setText(R.id.txt_name, goods.getName());
...@@ -67,12 +67,9 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo ...@@ -67,12 +67,9 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
} }
ImageView imgThumbnail = helper.getView(R.id.img_thumbnail); ImageView imgThumbnail = helper.getView(R.id.img_thumbnail);
// RoundedCorners roundedCorners = new RoundedCorners(5);
// RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
if (goods.getPics() == null) { if (goods.getPics() == null) {
imgThumbnail.setImageDrawable(null); imgThumbnail.setImageDrawable(null);
} else { } else {
// Utils.getGlide(mContext).load(Utils.getThumbnailUrl(goods.getPics().getThumbnail())).apply(options).into(imgThumbnail);
Utils.getGlide(mContext).load(Utils.getThumbnailUrl(goods.getPics().getThumbnail())).into(imgThumbnail); Utils.getGlide(mContext).load(Utils.getThumbnailUrl(goods.getPics().getThumbnail())).into(imgThumbnail);
} }
......
...@@ -193,8 +193,8 @@ public class GoodsDetailDialog extends Dialog { ...@@ -193,8 +193,8 @@ public class GoodsDetailDialog extends Dialog {
txtName.setText(mGoods.getName()); txtName.setText(mGoods.getName());
butnSubtract.setOnClickListener(v -> subtractCount()); butnSubtract.setOnClickListener(v -> subtractCount());
butnAdd.setOnClickListener(v -> addCount()); butnAdd.setOnClickListener(v -> addCount());
butnSubtract.setForeground(null); // butnSubtract.setForeground(null);
butnAdd.setForeground(null); // butnAdd.setForeground(null);
icoPrice.setPaintFlags(icoPrice.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); icoPrice.setPaintFlags(icoPrice.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
txtPrice.setPaintFlags(txtPrice.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); txtPrice.setPaintFlags(txtPrice.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
......
...@@ -17,10 +17,14 @@ import android.os.Message; ...@@ -17,10 +17,14 @@ import android.os.Message;
import android.view.Display; import android.view.Display;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.LinearInterpolator;
import android.widget.OverScroller;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -33,14 +37,9 @@ import com.bumptech.glide.request.target.CustomTarget; ...@@ -33,14 +37,9 @@ import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition; import com.bumptech.glide.request.transition.Transition;
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.base.MachineInfoSocket;
import com.ihaoin.hooloo.device.home.adapter.GoodsAdapter;
import com.ihaoin.hooloo.device.home.adapter.RecommendAdapter;
import com.ihaoin.hooloo.device.network.NetworkHandler;
import com.ihaoin.hooloo.device.setting.SettingsQueue;
import com.ihaoin.hooloo.device.update.UpdateService;
import com.ihaoin.hooloo.device.base.AppConfig; import com.ihaoin.hooloo.device.base.AppConfig;
import com.ihaoin.hooloo.device.base.Base; import com.ihaoin.hooloo.device.base.Base;
import com.ihaoin.hooloo.device.base.MachineInfoSocket;
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.enums.PresentState; import com.ihaoin.hooloo.device.data.enums.PresentState;
...@@ -50,16 +49,22 @@ import com.ihaoin.hooloo.device.data.vo.Goods; ...@@ -50,16 +49,22 @@ import com.ihaoin.hooloo.device.data.vo.Goods;
import com.ihaoin.hooloo.device.data.vo.Recommend; 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.data.vo.SkuStateChangedVo; import com.ihaoin.hooloo.device.data.vo.SkuStateChangedVo;
import com.ihaoin.hooloo.device.home.adapter.GoodsAdapter;
import com.ihaoin.hooloo.device.home.adapter.RecommendAdapter;
import com.ihaoin.hooloo.device.interaction.view.InteractionPresentation;
import com.ihaoin.hooloo.device.kds.view.KdsPresentation;
import com.ihaoin.hooloo.device.network.HttpUtil; import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.network.NetworkHandler;
import com.ihaoin.hooloo.device.setting.SettingsQueue;
import com.ihaoin.hooloo.device.trolley.view.TrolleyView;
import com.ihaoin.hooloo.device.update.UpdateSocket;
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.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;
import com.ihaoin.hooloo.device.interaction.view.InteractionPresentation;
import com.ihaoin.hooloo.device.kds.view.MenuPresentation;
import com.ihaoin.hooloo.device.trolley.view.TrolleyView;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -68,6 +73,7 @@ public class LauncherActivity extends Activity { ...@@ -68,6 +73,7 @@ public class LauncherActivity extends Activity {
private GoodsChangeReceiver goodsChangeReceiver; private GoodsChangeReceiver goodsChangeReceiver;
private TouchReceiver touchReceiver; private TouchReceiver touchReceiver;
private ScrollView scrollCategory;
private RadioGroup groupCategory; private RadioGroup groupCategory;
private RecyclerView recGoods; private RecyclerView recGoods;
private RecyclerView recRecommends; private RecyclerView recRecommends;
...@@ -87,8 +93,8 @@ public class LauncherActivity extends Activity { ...@@ -87,8 +93,8 @@ public class LauncherActivity extends Activity {
//记录商品当前可见的第一个item的position //记录商品当前可见的第一个item的position
private int first = 0; private int first = 0;
private TrolleyView trolleyView; private TrolleyView trolleyView;
private MenuPresentation menuView; private KdsPresentation kdsView;
private InteractionPresentation presentView; private InteractionPresentation interactionView;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -116,16 +122,17 @@ public class LauncherActivity extends Activity { ...@@ -116,16 +122,17 @@ public class LauncherActivity extends Activity {
initSettingsQueue(); initSettingsQueue();
// startUpdateSocket();
startMachineClient(); startMachineClient();
startTimeoutThread(); startTimeoutThread();
getMachineCode(); getMachineCode();
// new UpdateService().start();
new UpdateService().start();
} }
private void initViews() { private void initViews() {
txtCategory = findViewById(R.id.txt_category); txtCategory = findViewById(R.id.txt_category);
trolleyView = findViewById(R.id.view_trolley); trolleyView = findViewById(R.id.view_trolley);
scrollCategory = findViewById(R.id.scroll_category);
groupCategory = findViewById(R.id.group_category); groupCategory = findViewById(R.id.group_category);
recGoods = findViewById(R.id.rec_right); recGoods = findViewById(R.id.rec_right);
recRecommends = findViewById(R.id.rec_recommend); recRecommends = findViewById(R.id.rec_recommend);
...@@ -139,7 +146,7 @@ public class LauncherActivity extends Activity { ...@@ -139,7 +146,7 @@ public class LauncherActivity extends Activity {
@Override @Override
public boolean dispatchTouchEvent(MotionEvent ev) { public boolean dispatchTouchEvent(MotionEvent ev) {
Utils.i("dispatchTouchEvent"); // Utils.i("dispatchTouchEvent");
TIMESTAMP = Utils.getTimestamp(); TIMESTAMP = Utils.getTimestamp();
return super.dispatchTouchEvent(ev); return super.dispatchTouchEvent(ev);
} }
...@@ -274,6 +281,7 @@ public class LauncherActivity extends Activity { ...@@ -274,6 +281,7 @@ public class LauncherActivity extends Activity {
break; break;
} }
groupCategory.check(category.getId()); groupCategory.check(category.getId());
smoothTo(groupCategory.findViewById(groupCategory.getCheckedRadioButtonId()));
} }
} }
...@@ -283,6 +291,15 @@ public class LauncherActivity extends Activity { ...@@ -283,6 +291,15 @@ public class LauncherActivity extends Activity {
} }
} }
}); });
try {
Field field = ScrollView.class.getDeclaredField("mScroller");
field.setAccessible(true);
OverScroller scroller = new OverScroller(this, new LinearInterpolator());
scroller.setFriction(50);
field.set(scrollCategory, scroller);
} catch (Exception e) {
e.printStackTrace();
}
} }
/** 判断RecyclerView是否滚动到最下面 */ /** 判断RecyclerView是否滚动到最下面 */
...@@ -315,31 +332,37 @@ public class LauncherActivity extends Activity { ...@@ -315,31 +332,37 @@ public class LauncherActivity extends Activity {
butnRadio.setText(category.getName()); butnRadio.setText(category.getName());
butnRadio.setId(category.getId()); butnRadio.setId(category.getId());
butnRadio.setTag(category); butnRadio.setTag(category);
if (i == 0) {
butnRadio.setChecked(true);
butnRadio.getPaint().setFakeBoldText(true);
}
Utils.getGlide(LauncherActivity.this).load(category.getIcon()).into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable drawable, @Nullable Transition<? super Drawable> transition) {
drawable.setBounds(rect);
butnRadio.setCompoundDrawablePadding(drawablePadding);
butnRadio.setCompoundDrawables(null, drawable, null, null);
Integer left = Utils.getDimens(LauncherActivity.this, R.dimen.category_padding_hor);
Integer top = Utils.getDimens(LauncherActivity.this, R.dimen.category_padding_top);
Integer right = left;
Integer bottom = Utils.getDimens(LauncherActivity.this, R.dimen.category_padding_bottom);
butnRadio.setPadding(left, top, right, bottom);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
if (StringUtils.isEmpty(category.getIcon())) {
if (i == 0) {
addLayoutListener(butnRadio);
} }
}); } else {
int finalIndex = i;
Utils.getGlide(LauncherActivity.this).load(category.getIcon()).into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable drawable, @Nullable Transition<? super Drawable> transition) {
drawable.setBounds(rect);
butnRadio.setCompoundDrawablePadding(drawablePadding);
butnRadio.setCompoundDrawables(null, drawable, null, null);
Integer left = Utils.getDimens(LauncherActivity.this, R.dimen.category_padding_hor);
Integer top = Utils.getDimens(LauncherActivity.this, R.dimen.category_padding_top);
Integer right = left;
Integer bottom = Utils.getDimens(LauncherActivity.this, R.dimen.category_padding_bottom);
butnRadio.setPadding(left, top, right, bottom);
if (finalIndex == 0) {
addLayoutListener(butnRadio);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
groupCategory.addView(butnRadio, layoutParams); groupCategory.addView(butnRadio, layoutParams);
butnRadio.setForeground(null); // butnRadio.setForeground(null);
butnRadio.setOnClickListener(v -> { butnRadio.setOnClickListener(v -> {
Integer checkedId = v.getId(); Integer checkedId = v.getId();
Category tagCategory = (Category) groupCategory.findViewById(checkedId).getTag(); Category tagCategory = (Category) groupCategory.findViewById(checkedId).getTag();
...@@ -350,20 +373,61 @@ public class LauncherActivity extends Activity { ...@@ -350,20 +373,61 @@ public class LauncherActivity extends Activity {
} }
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); RadioButton butnRadio = (RadioButton) groupCategory.getChildAt(i);
if (!(child instanceof RadioButton)) { if (butnRadio.getId() == checkedId) {
continue; setShadowView(butnRadio);
} butnRadio.getPaint().setFakeBoldText(true);
RadioButton butn = (RadioButton) child;
if (butn.getId() == checkedId) {
butn.getPaint().setFakeBoldText(true);
} else { } else {
butn.getPaint().setFakeBoldText(false); butnRadio.getPaint().setFakeBoldText(false);
} }
} }
}); });
} }
private void smoothTo(RadioButton butnRadio) {
scrollCategory.smoothScrollTo(0, getSmoothHeight(butnRadio));
}
private void addLayoutListener(RadioButton butnRadio) {
butnRadio.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
butnRadio.getViewTreeObserver().removeOnGlobalLayoutListener(this);
butnRadio.performClick();
}
});
}
private void setShadowView(View butnRadio) {
View shadow = findViewById(R.id.shadow);
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) shadow.getLayoutParams();
lp.topMargin = getShadowHeight(butnRadio);
shadow.setLayoutParams(lp);
}
private int getShadowHeight(View butnRadio) {
return getHeight(butnRadio, true);
}
private int getSmoothHeight(View butnRadio) {
return getHeight(butnRadio, false);
}
private int getHeight(View butnRadio, boolean self) {
int height = Utils.getDimens(this, R.dimen.category_margin);
for (int i = 0; i < groupCategory.getChildCount(); i++) {
View v = groupCategory.getChildAt(i);
if (!self && v.getId() == butnRadio.getId()) {
return height;
}
height += v.getHeight();
if (v.getId() == butnRadio.getId()) {
return height;
}
}
return height;
}
private void setGoodsData() { private void setGoodsData() {
List<Category> categorys = HLApplication.getMainData().getCategorys(); List<Category> categorys = HLApplication.getMainData().getCategorys();
if (CollectionUtils.isEmpty(categorys)) { if (CollectionUtils.isEmpty(categorys)) {
...@@ -440,8 +504,8 @@ public class LauncherActivity extends Activity { ...@@ -440,8 +504,8 @@ public class LauncherActivity extends Activity {
setRecommendsData(); setRecommendsData();
initCategorys(); initCategorys();
setGoodsData(); setGoodsData();
if (menuView != null) { if (kdsView != null) {
menuView.mainDataChanged(); kdsView.mainDataChanged();
} }
} }
...@@ -460,6 +524,7 @@ public class LauncherActivity extends Activity { ...@@ -460,6 +524,7 @@ public class LauncherActivity extends Activity {
this.unregistTouchReceiver(); this.unregistTouchReceiver();
this.unregistHdmiReceiver(); this.unregistHdmiReceiver();
stopMachineClient(); stopMachineClient();
stopUpdateSocket();
System.exit(0); System.exit(0);
} }
...@@ -551,10 +616,12 @@ public class LauncherActivity extends Activity { ...@@ -551,10 +616,12 @@ public class LauncherActivity extends Activity {
} else if (intent.getAction().equals(Base.BROADCAST_ACTION_PRESENT_CHANGED)) { } else if (intent.getAction().equals(Base.BROADCAST_ACTION_PRESENT_CHANGED)) {
preparePresentView(); preparePresentView();
} else if (intent.getAction().equals(Base.BROADCAST_ACTION_LOGCAT_STATE_CHANGED)) { } else if (intent.getAction().equals(Base.BROADCAST_ACTION_LOGCAT_STATE_CHANGED)) {
if (SharedPreferencesUtils.getShowLogcat(LauncherActivity.this)) { if (AppConfig.DEBUG) {
Utils.showToast(LauncherActivity.this, "展示Logcat"); if (SharedPreferencesUtils.getShowLogcat(LauncherActivity.this)) {
} else { Utils.showToast(LauncherActivity.this, "展示Logcat");
Utils.showToast(LauncherActivity.this, "隐藏Logcat"); } else {
Utils.showToast(LauncherActivity.this, "隐藏Logcat");
}
} }
} }
} }
...@@ -564,15 +631,14 @@ public class LauncherActivity extends Activity { ...@@ -564,15 +631,14 @@ public class LauncherActivity extends Activity {
private boolean preparePresentView() { private boolean preparePresentView() {
PresentState present = PresentState.get(SharedPreferencesUtils.getPresentation(LauncherActivity.this)); PresentState present = PresentState.get(SharedPreferencesUtils.getPresentation(LauncherActivity.this));
switch (present) { switch (present) {
case MENU: case KDS:
hideInteractionView(); hideInteractionView();
return showMenuView(); return showKdsView();
case INTERACTION: case INTERACTION:
hideMenuView(); hideKdsView();
return showInteractionView(); return showInteractionView();
default: default:
hideMenuView(); hidePresentView();
hideInteractionView();
return false; return false;
} }
// return true; // return true;
...@@ -581,7 +647,7 @@ public class LauncherActivity extends Activity { ...@@ -581,7 +647,7 @@ public class LauncherActivity extends Activity {
/** 隐藏副屏内容 */ /** 隐藏副屏内容 */
private void hidePresentView() { private void hidePresentView() {
hideInteractionView(); hideInteractionView();
hideMenuView(); hideKdsView();
} }
/** 显示交互屏 */ /** 显示交互屏 */
...@@ -589,17 +655,17 @@ public class LauncherActivity extends Activity { ...@@ -589,17 +655,17 @@ public class LauncherActivity extends Activity {
if (AppConfig.DEBUG) { if (AppConfig.DEBUG) {
Utils.showToast(this, "展示交互屏"); Utils.showToast(this, "展示交互屏");
} }
if (presentView != null) { if (interactionView != null) {
return true; return true;
} }
DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE); DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
Display[] displays = displayManager.getDisplays(); Display[] displays = displayManager.getDisplays();
if (CollectionUtils.isEmpty(displays) || displays.length < 2) { if (CollectionUtils.isEmpty(displays) || displays.length < 2) {
Utils.showToast(this, "未获取到菜单屏硬件"); Utils.showToast(this, "未获取到扩展屏幕");
return false; return false;
} }
presentView = new InteractionPresentation(this, displays[1]); interactionView = new InteractionPresentation(this, displays[1]);
presentView.show(); interactionView.show();
return true; return true;
} }
...@@ -608,46 +674,47 @@ public class LauncherActivity extends Activity { ...@@ -608,46 +674,47 @@ public class LauncherActivity extends Activity {
if (AppConfig.DEBUG) { if (AppConfig.DEBUG) {
Utils.showToast(this, "隐藏交互屏"); Utils.showToast(this, "隐藏交互屏");
} }
if (presentView == null) { if (interactionView == null) {
return; return;
} }
presentView.dismiss(); interactionView.dismiss();
presentView = null; interactionView = null;
} }
/** 显示菜单屏KDS */ /** 显示菜单屏KDS */
private boolean showMenuView() { private boolean showKdsView() {
if (AppConfig.DEBUG) { if (AppConfig.DEBUG) {
Utils.showToast(this, "展示菜单屏"); Utils.showToast(this, "展示菜单屏");
} }
if (menuView != null) { if (kdsView != null) {
return true; return true;
} }
DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE); DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
Display[] displays = displayManager.getDisplays(); Display[] displays = displayManager.getDisplays();
if (CollectionUtils.isEmpty(displays) || displays.length < 2) { if (CollectionUtils.isEmpty(displays) || displays.length < 2) {
Utils.showToast(this, "未获取到菜单屏硬件"); Utils.showToast(this, "未获取到扩展屏幕");
return false; return false;
} }
menuView = new MenuPresentation(this, displays[1]); kdsView = new KdsPresentation(this, displays[1]);
menuView.show(); kdsView.show();
return true; return true;
} }
private void hideMenuView() { private void hideKdsView() {
if (AppConfig.DEBUG) { if (AppConfig.DEBUG) {
Utils.showToast(this, "隐藏菜单屏"); Utils.showToast(this, "隐藏菜单屏");
} }
if (menuView == null) { if (kdsView == null) {
return; return;
} }
menuView.dismiss(); kdsView.dismiss();
menuView = null; kdsView = null;
} }
private UpdateSocket updateSocket = null;
private MachineInfoSocket machineSocket = null; private MachineInfoSocket machineSocket = null;
private void startMachineClient() { private void startMachineClient() {
machineSocket = new MachineInfoSocket(this); machineSocket = new MachineInfoSocket(this);
machineSocket.start(); machineSocket.start();
...@@ -660,6 +727,18 @@ public class LauncherActivity extends Activity { ...@@ -660,6 +727,18 @@ public class LauncherActivity extends Activity {
} }
} }
private void startUpdateSocket() {
updateSocket = new UpdateSocket(this);
updateSocket.start();
}
private void stopUpdateSocket() {
if (updateSocket != null) {
updateSocket.close();
updateSocket = null;
}
}
private void requestPermissions() { private void requestPermissions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100); requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
...@@ -822,8 +901,10 @@ public class LauncherActivity extends Activity { ...@@ -822,8 +901,10 @@ public class LauncherActivity extends Activity {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
boolean state = intent.getBooleanExtra("state", false); boolean state = intent.getBooleanExtra("state", false);
Utils.showToast(LauncherActivity.this, "hdmi state: " + state); if (AppConfig.DEBUG) {
// TODO test Utils.showToast(LauncherActivity.this, "hdmi state: " + state);
}
// TODO TEST
// if (state) { // if (state) {
// new Handler().postDelayed(() -> preparePresentView(), 1000 * 5); // new Handler().postDelayed(() -> preparePresentView(), 1000 * 5);
// } else { // } else {
......
...@@ -2,11 +2,17 @@ package com.ihaoin.hooloo.device.interaction; ...@@ -2,11 +2,17 @@ package com.ihaoin.hooloo.device.interaction;
import android.content.Context; import android.content.Context;
import com.ihaoin.hooloo.device.base.Base;
import com.ihaoin.hooloo.device.data.vo.InteractionMsg;
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 com.ihaoin.hooloo.device.util.Utils;
import io.socket.client.Ack; import io.socket.client.Ack;
import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import test.IAGen; import io.socket.emitter.Emitter;
/** Linux通信 交互屏 */ /** Linux通信 交互屏 */
public class InteractionSocket extends Thread { public class InteractionSocket extends Thread {
...@@ -24,47 +30,68 @@ public class InteractionSocket extends Thread { ...@@ -24,47 +30,68 @@ public class InteractionSocket extends Thread {
private void connectSocket() { private void connectSocket() {
try { try {
// TODO test // TODO TEST
Utils.sendInteractionMsgBroadcast(mContext, IAGen.getMsg1()); // Utils.sendInteractionMsgBroadcast(mContext, IAGen.getMsg1());
Thread.sleep(30 * 1000); // Thread.sleep(30 * 1000);
Utils.sendInteractionMsgBroadcast(mContext, IAGen.getMsg3()); // Utils.sendInteractionMsgBroadcast(mContext, IAGen.getMsg3());
Thread.sleep(30 * 1000); // Thread.sleep(30 * 1000);
Utils.sendInteractionMsgBroadcast(mContext, IAGen.getMsg2()); // Utils.sendInteractionMsgBroadcast(mContext, IAGen.getMsg2());
while (true) { // while (true) {
Thread.sleep(30 * 1000); // Thread.sleep(30 * 1000);
} // }
// mSocket = IO.socket(Base.NSP_INTERACTION); mSocket = IO.socket(Base.NSP_INTERACTION);
// mSocket.connect(); mSocket.connect();
// mSocket.on("reply", args -> { mSocket.on("connect", onConnect);
// if (CollectionUtils.isEmpty(args)) { mSocket.on("disconnect", onDisconnect);
// Utils.i("reply args empty"); mSocket.on("reply", onReply);
// return;
// }
// String content = args[0].toString();
// if (StringUtils.isEmpty(content)) {
// Utils.i("reply content empty");
// return;
// }
// InteractionMsg msg = JsonUtils.readValue(content, InteractionMsg.class);
// if (msg == null) {
// Utils.i("reply msg empty");
// return;
// }
// Utils.sendInteractionMsgBroadcast(mContext, msg);
// });
} catch (Exception e) { } catch (Exception e) {
Utils.i("连接server失败,错误原因:" + e.getMessage()); Utils.i("连接server失败,错误原因:" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
Emitter.Listener onConnect = args -> {
Utils.i("interaction socket connected");
mSocket.emit("notice", "test", (Ack) ack -> process("notice", ack));
};
Emitter.Listener onDisconnect = args -> Utils.i("interaction socket disconnected");
Emitter.Listener onReply = args -> {
Utils.i("interaction socket reply");
process("reply", args);
};
private void process(String func, Object[] args) {
if (CollectionUtils.isEmpty(args)) {
Utils.i(func + " args empty");
return;
}
String content = args[0].toString();
if (StringUtils.isEmpty(content)) {
Utils.i(func + " content empty");
return;
}
InteractionMsg msg = JsonUtils.readValue(content, InteractionMsg.class);
if (msg == null) {
Utils.i(func + " msg empty");
return;
}
Utils.i(func + " receive msg: " + content);
Utils.sendInteractionMsgBroadcast(mContext, msg);
}
public void close() { public void close() {
try { try {
Utils.i("close interaction socket");
if (mSocket != null) { if (mSocket != null) {
mSocket.disconnect(); mSocket.disconnect();
mSocket.close(); mSocket.off("connect", onConnect);
mSocket = null; mSocket.off("disconnect", onDisconnect);
mSocket.off("reply", onReply);
// mSocket.close();
// mSocket = null;
} }
} catch (Exception e) { } catch (Exception e) {
Utils.i("close失败,错误原因:" + e.getMessage()); Utils.i("close失败,错误原因:" + e.getMessage());
......
...@@ -92,7 +92,7 @@ public class InteractionPresentation extends Presentation { ...@@ -92,7 +92,7 @@ public class InteractionPresentation extends Presentation {
while (true) { while (true) {
InteractionMsg msg = mMsgQueue.poll(); InteractionMsg msg = mMsgQueue.poll();
if (msg == null) { if (msg == null) {
Utils.i("msg is null"); // Utils.i("msg is null");
continue; continue;
} }
try { try {
......
...@@ -12,6 +12,7 @@ import com.ihaoin.hooloo.device.util.Utils; ...@@ -12,6 +12,7 @@ import com.ihaoin.hooloo.device.util.Utils;
import io.socket.client.Ack; import io.socket.client.Ack;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import io.socket.emitter.Emitter;
/** Linux通信 KDS 菜单屏 */ /** Linux通信 KDS 菜单屏 */
public class KDSSocket extends Thread { public class KDSSocket extends Thread {
...@@ -31,42 +32,51 @@ public class KDSSocket extends Thread { ...@@ -31,42 +32,51 @@ public class KDSSocket extends Thread {
try { try {
mSocket = IO.socket(Base.NSP_KDS); mSocket = IO.socket(Base.NSP_KDS);
mSocket.connect(); mSocket.connect();
mSocket.emit("notice", "test", (Ack) args -> { mSocket.on("connect", onConnect);
if (CollectionUtils.isEmpty(args)) { mSocket.on("disconnect", onDisconnect);
Utils.i("notice args empty"); mSocket.on("reply", onReply);
return;
}
Utils.i("notice: " + args[0].toString());
});
mSocket.on("reply", args -> {
if (CollectionUtils.isEmpty(args)) {
Utils.i("reply args empty");
return;
}
String content = args[0].toString();
if (StringUtils.isEmpty(content)) {
Utils.i("reply content empty");
return;
}
KDSMsg msg = JsonUtils.readValue(content, KDSMsg.class);
if (msg == null) {
Utils.i("reply msg empty");
return;
}
Utils.sendKdsMsgBroadcast(mContext, msg);
});
} catch (Exception e) { } catch (Exception e) {
Utils.i("连接server失败,错误原因:" + e.getMessage()); Utils.i("连接server失败,错误原因:" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
Emitter.Listener onConnect = args -> {
Utils.i("kds socket connected");
mSocket.emit("notice", "test", (Ack) ack -> Utils.i("notice: " + JsonUtils.toString(ack)));
};
Emitter.Listener onDisconnect = args -> Utils.i("kds socket disconnected");
Emitter.Listener onReply = args -> {
Utils.i("kds socket reply");
if (CollectionUtils.isEmpty(args)) {
Utils.i("reply args empty");
return;
}
String content = args[0].toString();
if (StringUtils.isEmpty(content)) {
Utils.i("reply content empty");
return;
}
KDSMsg msg = JsonUtils.readValue(content, KDSMsg.class);
if (msg == null) {
Utils.i("reply msg empty");
return;
}
Utils.sendKdsMsgBroadcast(mContext, msg);
};
public void close() { public void close() {
try { try {
Utils.i("close kds socket");
if (mSocket != null) { if (mSocket != null) {
mSocket.disconnect(); mSocket.disconnect();
mSocket.close(); mSocket.off("connect", onConnect);
mSocket = null; mSocket.off("disconnect", onDisconnect);
mSocket.off("reply", onReply);
// mSocket.close();
// mSocket = null;
} }
} catch (Exception e) { } catch (Exception e) {
Utils.i("close失败,错误原因:" + e.getMessage()); Utils.i("close失败,错误原因:" + e.getMessage());
......
...@@ -33,15 +33,15 @@ public class MachineStateAdapter extends RecyclerView.Adapter<RecyclerView.ViewH ...@@ -33,15 +33,15 @@ public class MachineStateAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
switch (viewType) { switch (viewType) {
case 0: case 0:
return new ViewHolder0(inflater.inflate(R.layout.menu_line_0, parent, false)); return new ViewHolder0(inflater.inflate(R.layout.kds_line_0, parent, false));
case 1: case 1:
return new ViewHolder1(inflater.inflate(R.layout.menu_line_1, parent, false)); return new ViewHolder1(inflater.inflate(R.layout.kds_line_1, parent, false));
case 2: case 2:
return new ViewHolder2(inflater.inflate(R.layout.menu_line_2, parent, false)); return new ViewHolder2(inflater.inflate(R.layout.kds_line_2, parent, false));
case 3: case 3:
return new ViewHolder3(inflater.inflate(R.layout.menu_line_3, parent, false)); return new ViewHolder3(inflater.inflate(R.layout.kds_line_3, parent, false));
case 4: case 4:
return new ViewHolder4(inflater.inflate(R.layout.menu_line_4, parent, false)); return new ViewHolder4(inflater.inflate(R.layout.kds_line_4, parent, false));
} }
return null; return null;
} }
......
...@@ -32,7 +32,6 @@ import com.ihaoin.hooloo.device.base.Base; ...@@ -32,7 +32,6 @@ import com.ihaoin.hooloo.device.base.Base;
import com.ihaoin.hooloo.device.component.FixedSpeedScroller; import com.ihaoin.hooloo.device.component.FixedSpeedScroller;
import com.ihaoin.hooloo.device.component.IntroViewPager; import com.ihaoin.hooloo.device.component.IntroViewPager;
import com.ihaoin.hooloo.device.data.MainData; import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.data.vo.Images;
import com.ihaoin.hooloo.device.data.vo.KDSMsg; import com.ihaoin.hooloo.device.data.vo.KDSMsg;
import com.ihaoin.hooloo.device.data.vo.KDSOrder; import com.ihaoin.hooloo.device.data.vo.KDSOrder;
import com.ihaoin.hooloo.device.kds.KDSSocket; import com.ihaoin.hooloo.device.kds.KDSSocket;
...@@ -43,10 +42,9 @@ import com.ihaoin.hooloo.device.util.Utils; ...@@ -43,10 +42,9 @@ import com.ihaoin.hooloo.device.util.Utils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
public class MenuPresentation extends Presentation { public class KdsPresentation extends Presentation {
private KDSMsg mKdsMsg; private KDSMsg mKdsMsg;
...@@ -61,14 +59,14 @@ public class MenuPresentation extends Presentation { ...@@ -61,14 +59,14 @@ public class MenuPresentation extends Presentation {
private List<TextView> completedViews = new ArrayList<>(); private List<TextView> completedViews = new ArrayList<>();
private KDSSocket kdsSocket = null; private KDSSocket kdsSocket = null;
public MenuPresentation(Context outerContext, Display display) { public KdsPresentation(Context outerContext, Display display) {
super(outerContext, display); super(outerContext, display);
} }
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.present_menu); setContentView(R.layout.present_kds);
initViews(); initViews();
registerKDSMessageReceiver(); registerKDSMessageReceiver();
...@@ -142,10 +140,10 @@ public class MenuPresentation extends Presentation { ...@@ -142,10 +140,10 @@ public class MenuPresentation extends Presentation {
private void showImages() { private void showImages() {
MainData mainData = HLApplication.getMainData(); MainData mainData = HLApplication.getMainData();
// TODO TEST // TODO TEST
List<String> imgs = Arrays.asList("https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/04/%E7%82%B9%E5%8D%95%E5%B1%8F%E5%86%85%E5%AE%B9%E5%9B%BE3.png", "https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/04/%E7%82%B9%E5%8D%95%E5%B1%8F%E5%86%85%E5%AE%B9%E5%9B%BE3.png", "https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/04/%E7%82%B9%E5%8D%95%E5%B1%8F%E5%86%85%E5%AE%B9%E5%9B%BE3.png"); // List<String> imgs = Arrays.asList("https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/04/%E7%82%B9%E5%8D%95%E5%B1%8F%E5%86%85%E5%AE%B9%E5%9B%BE3.png", "https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/04/%E7%82%B9%E5%8D%95%E5%B1%8F%E5%86%85%E5%AE%B9%E5%9B%BE3.png", "https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/04/%E7%82%B9%E5%8D%95%E5%B1%8F%E5%86%85%E5%AE%B9%E5%9B%BE3.png");
Images img = new Images(); // Images img = new Images();
img.setLeft(imgs); // img.setLeft(imgs);
mainData.setImages(img); // mainData.setImages(img);
if (mainData == null || mainData.getImages() == null) { if (mainData == null || mainData.getImages() == null) {
return; return;
} }
...@@ -164,6 +162,7 @@ public class MenuPresentation extends Presentation { ...@@ -164,6 +162,7 @@ public class MenuPresentation extends Presentation {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
image.setLayoutParams(layoutParams); image.setLayoutParams(layoutParams);
image.setAdjustViewBounds(true); image.setAdjustViewBounds(true);
image.setScaleType(ImageView.ScaleType.CENTER_CROP);
Utils.getGlide(getContext()).load(url).into(image); Utils.getGlide(getContext()).load(url).into(image);
return image; return image;
} }
...@@ -318,7 +317,7 @@ public class MenuPresentation extends Presentation { ...@@ -318,7 +317,7 @@ public class MenuPresentation extends Presentation {
} }
OnDismissListener dismissListener = dialog -> { OnDismissListener dismissListener = dialog -> {
Utils.i("menu present dismiss"); Utils.i("kds present dismiss");
unregistKDSMessageReceiver(); unregistKDSMessageReceiver();
if (imagePagerHandler != null) { if (imagePagerHandler != null) {
......
...@@ -88,7 +88,7 @@ public class SettingsActivity extends Activity { ...@@ -88,7 +88,7 @@ public class SettingsActivity extends Activity {
private void showEditPresentation() { private void showEditPresentation() {
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("修改副屏内容"); builder.setTitle("修改副屏内容");
String[] items = new String[]{PresentState.NONE.getName(), PresentState.MENU.getName(), PresentState.INTERACTION.getName()}; String[] items = new String[]{PresentState.NONE.getName(), PresentState.KDS.getName(), PresentState.INTERACTION.getName()};
builder.setSingleChoiceItems(items, StringUtils.indexOf(items, SharedPreferencesUtils.getPresentation(SettingsActivity.this)), (dialog, which) -> { builder.setSingleChoiceItems(items, StringUtils.indexOf(items, SharedPreferencesUtils.getPresentation(SettingsActivity.this)), (dialog, which) -> {
SharedPreferencesUtils.setPresentation(SettingsActivity.this, items[which]); SharedPreferencesUtils.setPresentation(SettingsActivity.this, items[which]);
txtPresentation.setText(SharedPreferencesUtils.getPresentation(SettingsActivity.this)); txtPresentation.setText(SharedPreferencesUtils.getPresentation(SettingsActivity.this));
......
...@@ -80,7 +80,7 @@ public class UpdateService extends Thread { ...@@ -80,7 +80,7 @@ public class UpdateService extends Thread {
PackageInfo packageInfo = Utils.getPackageInfo(); PackageInfo packageInfo = Utils.getPackageInfo();
if (updateVo.getVersionCode() <= packageInfo.versionCode) { if (updateVo.getVersionCode() <= packageInfo.versionCode) {
Utils.i(String.format("dont update, current: %s, update: %s", packageInfo.versionCode, updateVo.getVersionCode())); Utils.i(String.format("do not update, current: %s, update: %s", packageInfo.versionCode, updateVo.getVersionCode()));
return; return;
} }
......
...@@ -14,6 +14,7 @@ import java.io.IOException; ...@@ -14,6 +14,7 @@ import java.io.IOException;
import io.socket.client.Ack; import io.socket.client.Ack;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import io.socket.emitter.Emitter;
/** Linux通信 检查更新 */ /** Linux通信 检查更新 */
public class UpdateSocket extends Thread { public class UpdateSocket extends Thread {
...@@ -33,21 +34,37 @@ public class UpdateSocket extends Thread { ...@@ -33,21 +34,37 @@ public class UpdateSocket extends Thread {
try { try {
mSocket = IO.socket(Base.NSP_UPGRADE); mSocket = IO.socket(Base.NSP_UPGRADE);
mSocket.connect(); mSocket.connect();
mSocket.on("upgrade", args -> process("upgrade", args)); mSocket.on("connect", onConnect);
mSocket.on("disconnect", onDisconnect);
checkUpdate(); mSocket.on("upgrade", onUpgrade);
} catch (Exception e) { } catch (Exception e) {
Utils.i("连接server失败,错误原因:" + e.getMessage()); Utils.i("连接server失败,错误原因:" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
Emitter.Listener onConnect = args -> {
Utils.i("update socket connected");
mSocket.emit("state", "", (Ack) ack -> process("state", ack));
};
Emitter.Listener onDisconnect = args -> Utils.i("update socket disconnected");
Emitter.Listener onUpgrade = args -> {
Utils.i("update socket upgrade");
process("upgrade", args);
};
public void close() { public void close() {
try { try {
Utils.i("close update socket");
if (mSocket != null) { if (mSocket != null) {
mSocket.disconnect(); mSocket.disconnect();
mSocket.close(); mSocket.off("connect", onConnect);
mSocket = null; mSocket.off("disconnect", onDisconnect);
mSocket.off("upgrade", onUpgrade);
// mSocket.close();
// mSocket = null;
} }
} catch (Exception e) { } catch (Exception e) {
Utils.i("close失败,错误原因:" + e.getMessage()); Utils.i("close失败,错误原因:" + e.getMessage());
...@@ -55,19 +72,6 @@ public class UpdateSocket extends Thread { ...@@ -55,19 +72,6 @@ public class UpdateSocket extends Thread {
} }
} }
public void checkUpdate() {
if (mSocket == null) {
Utils.i("socket未连接");
return;
}
try {
mSocket.emit("state", "", (Ack) args -> process("state", args));
} catch (Exception e) {
Utils.i("发送消息失败,错误原因:" + e.getMessage());
e.printStackTrace();
}
}
private void process(String func, Object[] args) { private void process(String func, Object[] args) {
if (CollectionUtils.isEmpty(args)) { if (CollectionUtils.isEmpty(args)) {
Utils.i(func + " args empty"); Utils.i(func + " args empty");
......
...@@ -5,27 +5,27 @@ ...@@ -5,27 +5,27 @@
android:height="33dp" android:height="33dp"
android:viewportWidth="33" android:viewportWidth="33"
android:viewportHeight="33"> android:viewportHeight="33">
<!-- <path-->
<!-- android:pathData="M0,0L0,33"-->
<!-- android:strokeWidth="0.5"-->
<!-- android:strokeColor="@color/line" />-->
<path <path
android:pathData="M0,0L0,33" android:pathData="M1,0L1,33"
android:strokeWidth="0.5"
android:strokeColor="@color/line" />
<path
android:pathData="M1,0L1,30"
android:strokeWidth="3" android:strokeWidth="3"
android:strokeColor="@color/colorPrimary" /> android:strokeColor="@color/colorPrimary" />
<path <!-- <path-->
android:pathData="M18,30L18,33" <!-- android:pathData="M17,30L17,33"-->
android:strokeWidth="31" <!-- android:strokeWidth="34"-->
android:strokeColor="#FFFFFFFF"> <!-- android:strokeColor="#FFFFFFFF">-->
<aapt:attr name="android:fillColor"> <!-- <aapt:attr name="android:fillColor">-->
<gradient <!-- <gradient-->
android:endColor="#22DDDDDD" <!-- android:endColor="#22DDDDDD"-->
android:endX="18" <!-- android:endX="18"-->
android:endY="30" <!-- android:endY="30"-->
android:startColor="#00FFFFFF" <!-- android:startColor="#00FFFFFF"-->
android:startX="18" <!-- android:startX="18"-->
android:startY="33" <!-- android:startY="33"-->
android:type="linear"></gradient> <!-- android:type="linear"></gradient>-->
</aapt:attr> <!-- </aapt:attr>-->
</path> <!-- </path>-->
</vector> </vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="33dp"
android:height="33dp"
android:viewportWidth="33"
android:viewportHeight="33">
<path
android:pathData="M0,0L0,33"
android:strokeWidth="0.5"
android:strokeColor="@color/line" />
<path
android:pathData="M1,0L1,30"
android:strokeWidth="3"
android:strokeColor="@color/colorPrimary" />
<path
android:pathData="M18,30L18,33"
android:strokeWidth="31"
android:strokeColor="#FFFFFFFF">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#22DDDDDD"
android:endX="18"
android:endY="30"
android:startColor="#00FFFFFF"
android:startX="18"
android:startY="33"
android:type="linear"></gradient>
</aapt:attr>
</path>
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="33dp"
android:height="3dp"
android:viewportWidth="33"
android:viewportHeight="3">
<path
android:pathData="M17,0L17,3"
android:strokeWidth="34"
android:strokeColor="#FFFFFFFF">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#22DDDDDD"
android:endX="17"
android:endY="0"
android:startColor="#00FFFFFF"
android:startX="17"
android:startY="3"
android:type="linear" />
</aapt:attr>
</path>
</vector>
\ No newline at end of file
...@@ -45,17 +45,16 @@ ...@@ -45,17 +45,16 @@
<include layout="@layout/item_goods_category" /> <include layout="@layout/item_goods_category" />
</FrameLayout> </FrameLayout>
<ScrollView <ScrollView
android:id="@+id/scroll_category"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.09792" android:layout_weight="0.09792"
android:descendantFocusability="afterDescendants" android:descendantFocusability="afterDescendants"
android:overScrollMode="never" android:overScrollMode="never"
android:scrollbars="none"> android:scrollbars="none">
<LinearLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:gravity="center_horizontal"
android:orientation="vertical">
<RadioGroup <RadioGroup
android:id="@+id/group_category" android:id="@+id/group_category"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -67,8 +66,14 @@ ...@@ -67,8 +66,14 @@
<include <include
layout="@layout/item_tips" layout="@layout/item_tips"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
</LinearLayout> android:layout_below="@+id/group_category" />
<ImageView
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_label_shadow" />
</RelativeLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>
...@@ -76,4 +81,5 @@ ...@@ -76,4 +81,5 @@
android:id="@+id/view_trolley" android:id="@+id/view_trolley"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
android:id="@+id/layout_test" android:id="@+id/layout_test"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
android:id="@+id/layout_sys_settings" android:id="@+id/layout_sys_settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
android:id="@+id/layout_version" android:id="@+id/layout_version"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
android:id="@+id/layout_machine_code" android:id="@+id/layout_machine_code"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
android:id="@+id/layout_screen" android:id="@+id/layout_screen"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
android:id="@+id/layout_presentation" android:id="@+id/layout_presentation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
android:id="@+id/layout_logcat" android:id="@+id/layout_logcat"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/padding10" android:layout_marginEnd="@dimen/padding10"
android:foreground="?selectableItemBackground" /> android:foreground="@null" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
android:layout_height="@dimen/clear_butn_height" android:layout_height="@dimen/clear_butn_height"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/bg_clear_yes" android:background="@drawable/bg_clear_yes"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:text="是" android:text="是"
android:textColor="@color/textPrimary" android:textColor="@color/textPrimary"
android:textSize="@dimen/clear_butn_text" /> android:textSize="@dimen/clear_butn_text" />
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
android:layout_height="@dimen/clear_butn_height" android:layout_height="@dimen/clear_butn_height"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/bg_clear_no" android:background="@drawable/bg_clear_no"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:text="否" android:text="否"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/clear_butn_text" /> android:textSize="@dimen/clear_butn_text" />
......
...@@ -3,98 +3,101 @@ ...@@ -3,98 +3,101 @@
android:id="@+id/layout_root" android:id="@+id/layout_root"
android:layout_width="@dimen/confirm_order_width" android:layout_width="@dimen/confirm_order_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:background="@color/white">
android:paddingTop="@dimen/confirm_order_padding_top" <RelativeLayout
android:paddingBottom="@dimen/confirm_order_padding_bottom">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="确认订单"
android:textColor="@color/textPrimary"
android:textSize="@dimen/ts_dialog_title"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/layout_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/title" android:paddingTop="@dimen/confirm_order_padding_top"
android:layout_marginTop="@dimen/confirm_order_qr_margin_top" android:paddingBottom="@dimen/confirm_order_padding_bottom">
android:gravity="center_horizontal" <TextView
android:orientation="vertical"> android:id="@+id/title"
<ImageView
android:id="@+id/img_qrcode"
android:layout_width="@dimen/confirm_order_qrcode_size"
android:layout_height="@dimen/confirm_order_qrcode_size"
android:adjustViewBounds="true"
android:src="@mipmap/qrcode" />
<LinearLayout
android:id="@+id/layout_confirm"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" android:layout_centerHorizontal="true"
android:orientation="vertical"> android:text="确认订单"
<TextView android:textColor="@color/textPrimary"
android:id="@+id/txt_scan" android:textSize="@dimen/ts_dialog_title"
android:layout_width="wrap_content" android:textStyle="bold" />
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/confirm_order_text_one"
android:text="使用微信扫一扫,确认订单并付款"
android:textColor="@color/textPrimary"
android:textSize="@dimen/ts_scan" />
<TextView
android:id="@+id/txt_expire"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/confirm_order_text_two"
android:text="60秒后失效"
android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_expire" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/layout_succeed" android:id="@+id/layout_content"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/confirm_order_text_one" android:layout_below="@+id/title"
android:gravity="center_vertical" android:layout_marginTop="@dimen/confirm_order_qr_margin_top"
android:visibility="gone"> android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/img_succeed" android:id="@+id/img_qrcode"
android:layout_width="@dimen/ic_scan_succ_width" android:layout_width="@dimen/confirm_order_qrcode_size"
android:layout_height="@dimen/ic_scan_succ_height" android:layout_height="@dimen/confirm_order_qrcode_size"
android:src="@mipmap/zhifuchenggong" /> android:adjustViewBounds="true"
android:src="@mipmap/qrcode" />
<LinearLayout <LinearLayout
android:id="@+id/layout_confirm"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/confirm_order_icon_margin" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/txt_return" 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:text="扫码成功" android:layout_marginTop="@dimen/confirm_order_text_one"
android:text="使用微信扫一扫,确认订单并付款"
android:textColor="@color/textPrimary" android:textColor="@color/textPrimary"
android:textSize="@dimen/ts_scan" android:textSize="@dimen/ts_scan" />
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/txt_expire"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/confirm_order_text_two" android:layout_marginTop="@dimen/confirm_order_text_two"
android:text="在微信小程序上确认订单并付款" android:text="60秒后失效"
android:textColor="@color/textSecondPrimary" android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_expire" /> android:textSize="@dimen/ts_expire" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/layout_succeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/confirm_order_text_one"
android:gravity="center_vertical"
android:visibility="gone">
<ImageView
android:id="@+id/img_succeed"
android:layout_width="@dimen/ic_scan_succ_width"
android:layout_height="@dimen/ic_scan_succ_height"
android:src="@mipmap/zhifuchenggong" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/confirm_order_icon_margin"
android:orientation="vertical">
<TextView
android:id="@+id/txt_return"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫码成功"
android:textColor="@color/textPrimary"
android:textSize="@dimen/ts_scan"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/confirm_order_text_two"
android:text="在微信小程序上确认订单并付款"
android:textColor="@color/textSecondPrimary"
android:textSize="@dimen/ts_expire" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> <ImageView
<ImageView android:id="@+id/loading"
android:id="@+id/loading" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_centerInParent="true"
android:layout_centerInParent="true" android:background="@drawable/anim_qrcode_loading"
android:background="@drawable/anim_qrcode_loading" android:visibility="invisible" />
android:visibility="invisible" /> </RelativeLayout>
<FrameLayout <FrameLayout
android:id="@+id/butn_close" android:id="@+id/butn_close"
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
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="@mipmap/jianhao" android:background="@mipmap/jianhao"
android:foreground="?selectableItemBackground" /> android:foreground="@null" />
<TextView <TextView
android:id="@+id/txt_count" android:id="@+id/txt_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
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="@mipmap/jiahao" android:background="@mipmap/jiahao"
android:foreground="?selectableItemBackground" /> android:foreground="@null" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,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:foreground="?selectableItemBackground" android:foreground="@null"
android:padding="@dimen/goods_detail_butn_padding" android:padding="@dimen/goods_detail_butn_padding"
android:text="加入购物袋" android:text="加入购物袋"
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,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:foreground="?selectableItemBackground" android:foreground="@null"
android:padding="@dimen/goods_detail_butn_padding" android:padding="@dimen/goods_detail_butn_padding"
android:text="立即购买" android:text="立即购买"
android:textColor="@color/white" android:textColor="@color/white"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/sel_category_label" android:background="@drawable/sel_category_label"
android:button="@null" android:button="@null"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center" android:gravity="center"
android:paddingHorizontal="@dimen/category_padding_hor" android:paddingHorizontal="@dimen/category_padding_hor"
android:paddingTop="@dimen/category_padding_top_noimg" android:paddingTop="@dimen/category_padding_top_noimg"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
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:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingVertical="@dimen/goods_padding_ver"> android:paddingVertical="@dimen/goods_padding_ver">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
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:foreground="?selectableItemBackground"> android:foreground="@null">
<ImageView <ImageView
android:id="@+id/img_recommend" android:id="@+id/img_recommend"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
android:layout_marginTop="@dimen/goods_detail_rule_margin_top" android:layout_marginTop="@dimen/goods_detail_rule_margin_top"
android:layout_marginEnd="@dimen/goods_detail_rule_margin_right" android:layout_marginEnd="@dimen/goods_detail_rule_margin_right"
android:background="@drawable/sel_spec_bg" android:background="@drawable/sel_spec_bg"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center" android:gravity="center"
android:minWidth="@dimen/goods_detail_rule_width" android:minWidth="@dimen/goods_detail_rule_width"
android:paddingHorizontal="@dimen/goods_detail_rule_padding_hor" android:paddingHorizontal="@dimen/goods_detail_rule_padding_hor"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/tip_margin_top" android:layout_marginTop="@dimen/tip_margin_top"
android:button="@null" android:button="@null"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center" android:gravity="center"
android:lines="1" android:lines="1"
android:paddingTop="@dimen/tip_padding_top" android:paddingTop="@dimen/tip_padding_top"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
android:layout_height="@dimen/ic_checkbox" android:layout_height="@dimen/ic_checkbox"
android:background="@drawable/sel_butn_check" android:background="@drawable/sel_butn_check"
android:checked="true" android:checked="true"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:textOff="" android:textOff=""
android:textOn="" /> android:textOn="" />
<ImageView <ImageView
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
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="@mipmap/jianhao" android:background="@mipmap/jianhao"
android:foreground="?selectableItemBackground" /> android:foreground="@null" />
<TextView <TextView
android:id="@+id/txt_count" android:id="@+id/txt_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -116,6 +116,6 @@ ...@@ -116,6 +116,6 @@
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="@mipmap/jiahao" android:background="@mipmap/jiahao"
android:foreground="?selectableItemBackground" /> android:foreground="@null" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +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="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/black"> android:background="@android:color/holo_red_dark">
<ImageView <ImageView
android:id="@+id/img_background1" android:id="@+id/img_background1"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:padding="@dimen/padding10" android:padding="@dimen/padding10"
android:src="@drawable/ic_baseline_chevron_left_24" /> android:src="@drawable/ic_baseline_chevron_left_24" />
<TextView <TextView
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
android:id="@+id/butn_clear" android:id="@+id/butn_clear"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
android:layout_height="@dimen/trolley_bar_height" android:layout_height="@dimen/trolley_bar_height"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="@color/white" android:background="@color/white"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<RelativeLayout <RelativeLayout
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
android:layout_width="@dimen/trolley_pay_width" android:layout_width="@dimen/trolley_pay_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:foreground="?selectableItemBackground" android:foreground="@null"
android:text="结算" android:text="结算"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/ts_trolley_pay" android:textSize="@dimen/ts_trolley_pay"
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
<dimen name="goods_price_margin">5px</dimen> <dimen name="goods_price_margin">5px</dimen>
<dimen name="category_padding_top">17px</dimen> <dimen name="category_padding_top">17px</dimen>
<dimen name="category_padding_bottom">32px</dimen> <dimen name="category_padding_bottom">32px</dimen>
<dimen name="category_padding_top_noimg">56px</dimen> <dimen name="category_padding_top_noimg">68px</dimen>
<dimen name="category_padding_bottom_noimg">70px</dimen> <dimen name="category_padding_bottom_noimg">68px</dimen>
<dimen name="category_padding_hor">35px</dimen> <dimen name="category_padding_hor">35px</dimen>
<dimen name="category_drawable_padding">10px</dimen> <dimen name="category_drawable_padding">10px</dimen>
<dimen name="category_drawable_width">100px</dimen> <dimen name="category_drawable_width">100px</dimen>
...@@ -140,37 +140,21 @@ ...@@ -140,37 +140,21 @@
<dimen name="confirm_order_text_one">62px</dimen> <dimen name="confirm_order_text_one">62px</dimen>
<dimen name="confirm_order_text_two">7px</dimen> <dimen name="confirm_order_text_two">7px</dimen>
<dimen name="interaction_padding_top">117px</dimen> <dimen name="interaction_padding_top">234px</dimen>
<dimen name="interaction_padding_left">75px</dimen> <dimen name="interaction_padding_left">150px</dimen>
<dimen name="interaction_padding_bottom">66px</dimen> <dimen name="interaction_padding_bottom">132px</dimen>
<dimen name="interaction_padding_right">58px</dimen> <dimen name="interaction_padding_right">106px</dimen>
<dimen name="interaction_text_space">40px</dimen> <dimen name="interaction_text_space">80px</dimen>
<dimen name="interaction_recommend_margin">55px</dimen> <dimen name="interaction_recommend_margin">115px</dimen>
<dimen name="interaction_goods_icon_width">230px</dimen> <dimen name="interaction_goods_icon_width">470px</dimen>
<dimen name="interaction_goods_icon_height">230px</dimen> <dimen name="interaction_goods_icon_height">470px</dimen>
<dimen name="ts_interaction_line1">130px</dimen> <dimen name="ts_interaction_line1">260px</dimen>
<dimen name="ts_interaction_line2">50px</dimen> <dimen name="ts_interaction_line2">100px</dimen>
<dimen name="ts_interaction_line3">50px</dimen> <dimen name="ts_interaction_line3">100px</dimen>
<dimen name="ts_interaction_recommend_small">60px</dimen> <dimen name="ts_interaction_recommend_small">100px</dimen>
<dimen name="ts_interaction_recommend_big">75px</dimen> <dimen name="ts_interaction_recommend_big">120px</dimen>
<!-- <dimen name="interaction_padding_top">234px</dimen>-->
<!-- <dimen name="interaction_padding_left">150px</dimen>-->
<!-- <dimen name="interaction_padding_bottom">132px</dimen>-->
<!-- <dimen name="interaction_padding_right">106px</dimen>-->
<!-- <dimen name="interaction_text_space">80px</dimen>-->
<!-- <dimen name="interaction_recommend_margin">115px</dimen>-->
<!-- <dimen name="interaction_goods_icon_width">470px</dimen>-->
<!-- <dimen name="interaction_goods_icon_height">470px</dimen>-->
<!-- <dimen name="ts_interaction_line1">260px</dimen>-->
<!-- <dimen name="ts_interaction_line2">100px</dimen>-->
<!-- <dimen name="ts_interaction_line3">100px</dimen>-->
<!-- <dimen name="ts_interaction_recommend_small">120px</dimen>-->
<!-- <dimen name="ts_interaction_recommend_big">150px</dimen>-->
<dimen name="ic_recommend">17px</dimen> <dimen name="ic_recommend">17px</dimen>
<dimen name="ic_clear_size">20px</dimen> <dimen name="ic_clear_size">20px</dimen>
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
<dimen name="goods_price_margin">5px</dimen> <dimen name="goods_price_margin">5px</dimen>
<dimen name="category_padding_top">17px</dimen> <dimen name="category_padding_top">17px</dimen>
<dimen name="category_padding_bottom">32px</dimen> <dimen name="category_padding_bottom">32px</dimen>
<dimen name="category_padding_top_noimg">20px</dimen> <dimen name="category_padding_top_noimg">68px</dimen>
<dimen name="category_padding_bottom_noimg">70px</dimen> <dimen name="category_padding_bottom_noimg">68px</dimen>
<dimen name="category_padding_hor">35px</dimen> <dimen name="category_padding_hor">35px</dimen>
<dimen name="category_drawable_padding">10px</dimen> <dimen name="category_drawable_padding">10px</dimen>
<dimen name="category_drawable_width">100px</dimen> <dimen name="category_drawable_width">100px</dimen>
...@@ -140,37 +140,37 @@ ...@@ -140,37 +140,37 @@
<dimen name="confirm_order_text_one">62px</dimen> <dimen name="confirm_order_text_one">62px</dimen>
<dimen name="confirm_order_text_two">7px</dimen> <dimen name="confirm_order_text_two">7px</dimen>
<dimen name="interaction_padding_top">117px</dimen> <!-- <dimen name="interaction_padding_top">117px</dimen>-->
<dimen name="interaction_padding_left">75px</dimen> <!-- <dimen name="interaction_padding_left">75px</dimen>-->
<dimen name="interaction_padding_bottom">66px</dimen> <!-- <dimen name="interaction_padding_bottom">66px</dimen>-->
<dimen name="interaction_padding_right">58px</dimen> <!-- <dimen name="interaction_padding_right">58px</dimen>-->
<dimen name="interaction_text_space">40px</dimen> <!-- <dimen name="interaction_text_space">40px</dimen>-->
<dimen name="interaction_recommend_margin">55px</dimen> <!-- <dimen name="interaction_recommend_margin">55px</dimen>-->
<dimen name="interaction_goods_icon_width">230px</dimen> <!-- <dimen name="interaction_goods_icon_width">230px</dimen>-->
<dimen name="interaction_goods_icon_height">230px</dimen> <!-- <dimen name="interaction_goods_icon_height">230px</dimen>-->
<dimen name="ts_interaction_line1">130px</dimen> <!-- <dimen name="ts_interaction_line1">130px</dimen>-->
<dimen name="ts_interaction_line2">50px</dimen> <!-- <dimen name="ts_interaction_line2">50px</dimen>-->
<dimen name="ts_interaction_line3">50px</dimen> <!-- <dimen name="ts_interaction_line3">50px</dimen>-->
<dimen name="ts_interaction_recommend_small">60px</dimen> <!-- <dimen name="ts_interaction_recommend_small">60px</dimen>-->
<dimen name="ts_interaction_recommend_big">75px</dimen> <!-- <dimen name="ts_interaction_recommend_big">75px</dimen>-->
<!-- <dimen name="interaction_padding_top">234px</dimen>--> <dimen name="interaction_padding_top">234px</dimen>
<!-- <dimen name="interaction_padding_left">150px</dimen>--> <dimen name="interaction_padding_left">150px</dimen>
<!-- <dimen name="interaction_padding_bottom">132px</dimen>--> <dimen name="interaction_padding_bottom">132px</dimen>
<!-- <dimen name="interaction_padding_right">106px</dimen>--> <dimen name="interaction_padding_right">106px</dimen>
<!-- <dimen name="interaction_text_space">80px</dimen>--> <dimen name="interaction_text_space">80px</dimen>
<!-- <dimen name="interaction_recommend_margin">115px</dimen>--> <dimen name="interaction_recommend_margin">115px</dimen>
<!-- <dimen name="interaction_goods_icon_width">470px</dimen>--> <dimen name="interaction_goods_icon_width">470px</dimen>
<!-- <dimen name="interaction_goods_icon_height">470px</dimen>--> <dimen name="interaction_goods_icon_height">470px</dimen>
<!-- <dimen name="ts_interaction_line1">260px</dimen>--> <dimen name="ts_interaction_line1">260px</dimen>
<!-- <dimen name="ts_interaction_line2">100px</dimen>--> <dimen name="ts_interaction_line2">100px</dimen>
<!-- <dimen name="ts_interaction_line3">100px</dimen>--> <dimen name="ts_interaction_line3">100px</dimen>
<!-- <dimen name="ts_interaction_recommend_small">120px</dimen>--> <dimen name="ts_interaction_recommend_small">100px</dimen>
<!-- <dimen name="ts_interaction_recommend_big">150px</dimen>--> <dimen name="ts_interaction_recommend_big">120px</dimen>
<dimen name="ic_recommend">17px</dimen> <dimen name="ic_recommend">17px</dimen>
<dimen name="ic_clear_size">20px</dimen> <dimen name="ic_clear_size">20px</dimen>
......
...@@ -16,9 +16,13 @@ allprojects { ...@@ -16,9 +16,13 @@ allprojects {
repositories { repositories {
google() google()
jcenter() jcenter()
mavenCentral()
maven { maven {
url "https://maven.aliyun.com/nexus/content/repositories/releases/" url "https://maven.aliyun.com/nexus/content/repositories/releases/"
} }
maven {
url 'https://jitpack.io'
}
} }
} }
......
## 未解决事项 TODO ## 未解决事项 TODO
***** *****
1、设置字体 购物袋总数量,购物袋item数量,商品详情数量 \ No newline at end of file
2、设置字体 购物袋总金额
\ No newline at end of file
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