Commit b3bead92 by wjg

add update

parent fc7bd62d
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,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="1" android:versionCode="2"
android:versionName="1.0"> 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" />
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<application <application
android:name=".HLApplication" android:name=".HLApplication"
android:allowBackup="true" android:allowBackup="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:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
......
...@@ -63,9 +63,9 @@ public class HLApplication extends Application { ...@@ -63,9 +63,9 @@ public class HLApplication extends Application {
// 第一个点单屏默认显示交互屏 // 第一个点单屏默认显示交互屏
if (AppConfig.DEFAULT_SCREEN_NO.equals("1")) { if (AppConfig.DEFAULT_SCREEN_NO.equals("1")) {
AppConfig.DEFAULT_PRESENT = PresentState.INTERACTION.getName();
} else {
AppConfig.DEFAULT_PRESENT = PresentState.MENU.getName(); AppConfig.DEFAULT_PRESENT = PresentState.MENU.getName();
} else {
AppConfig.DEFAULT_PRESENT = PresentState.INTERACTION.getName();
} }
// if (AppConfig.DEBUG) { // TODO delete // if (AppConfig.DEBUG) { // TODO delete
......
...@@ -22,8 +22,6 @@ import com.ihaoin.hooloo.device.util.CollectionUtils; ...@@ -22,8 +22,6 @@ import com.ihaoin.hooloo.device.util.CollectionUtils;
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 java.util.Arrays;
public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHolder> { public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHolder> {
private Context mContext; private Context mContext;
...@@ -106,14 +104,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo ...@@ -106,14 +104,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
helper.setGone(R.id.txt_sellout, false); helper.setGone(R.id.txt_sellout, false);
helper.setGone(R.id.butn_add, true); helper.setGone(R.id.butn_add, true);
View butnAdd = helper.getView(R.id.butn_add); View butnAdd = helper.getView(R.id.butn_add);
butnAdd.setOnClickListener(v -> { butnAdd.setOnClickListener(v -> Utils.showGoodsDetail(mContext, goods));
if (!Base.TRUE.equals(sku.getIsDefault())) {
Utils.showToast(mContext, R.string.default_sku_sellout);
}
Utils.sendAddGoodsBroadcast(mContext, goods, sku, 1);
});
Utils.setTouchDelegate(layoutItem, Arrays.asList(butnAdd));
layoutItem.setOnClickListener(v -> Utils.showGoodsDetail(mContext, goods)); layoutItem.setOnClickListener(v -> Utils.showGoodsDetail(mContext, goods));
} else { } else {
helper.setGone(R.id.txt_sellout, true); helper.setGone(R.id.txt_sellout, true);
......
package com.ihaoin.hooloo.device.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.data.vo.KDSMsg;
public class MachineStateAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context context;
private KDSMsg msg;
private LayoutInflater inflater;
public MachineStateAdapter(Context context, KDSMsg msg) {
this.context = context;
this.msg = msg;
inflater = LayoutInflater.from(context);
}
public void setMsg(KDSMsg msg) {
this.msg = msg;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
switch (viewType) {
case 0:
return new ViewHolder0(inflater.inflate(R.layout.menu_line_0, parent, false));
case 1:
return new ViewHolder1(inflater.inflate(R.layout.menu_line_1, parent, false));
case 2:
return new ViewHolder2(inflater.inflate(R.layout.menu_line_2, parent, false));
case 3:
return new ViewHolder3(inflater.inflate(R.layout.menu_line_3, parent, false));
case 4:
return new ViewHolder4(inflater.inflate(R.layout.menu_line_4, parent, false));
}
return null;
}
@SuppressLint("StringFormatMatches")
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder h, int position) {
if (msg == null) {
return;
}
switch (position % 5) {
case 0:
ViewHolder0 holder0 = (ViewHolder0) h;
holder0.txtOutsideTemp.setText(context.getString(R.string.txt_outside_temp, msg.getOutTemperature()));
holder0.txtInsideTemp.setText(context.getString(R.string.txt_inside_temp, msg.getInTemperature()));
return;
case 1:
ViewHolder1 holder1 = (ViewHolder1) h;
holder1.txtFridgeTemp.setText(context.getString(R.string.txt_fridge_temp, msg.getFridgeTemperature()));
holder1.txtInsideHumidity.setText(context.getString(R.string.txt_inside_humidity, msg.getHumidity()));
return;
case 2:
ViewHolder2 holder2 = (ViewHolder2) h;
holder2.txtTimerClear.setText(context.getString(R.string.txt_timer_clear, msg.getCoffeeCleanTime()));
return;
case 3:
ViewHolder3 holder3 = (ViewHolder3) h;
holder3.txtTimerMaterial.setText(context.getString(R.string.txt_timer_material, msg.getChangeMaterialTime()));
return;
case 4:
ViewHolder4 holder4 = (ViewHolder4) h;
holder4.txtTimerUsual.setText(context.getString(R.string.txt_timer_usual, msg.getDailyCleanTime()));
return;
}
}
@Override
public int getItemViewType(int position) {
return position % 5;
}
@Override
public int getItemCount() {
return Integer.MAX_VALUE;
}
protected static class ViewHolder0 extends RecyclerView.ViewHolder {
public TextView txtOutsideTemp;
public TextView txtInsideTemp;
public ViewHolder0(View itemView) {
super(itemView);
txtOutsideTemp = itemView.findViewById(R.id.txt_outside_temp);
txtInsideTemp = itemView.findViewById(R.id.txt_inside_temp);
}
}
protected static class ViewHolder1 extends RecyclerView.ViewHolder {
public TextView txtFridgeTemp;
public TextView txtInsideHumidity;
public ViewHolder1(View itemView) {
super(itemView);
txtFridgeTemp = itemView.findViewById(R.id.txt_fridge_temp);
txtInsideHumidity = itemView.findViewById(R.id.txt_inside_humidity);
}
}
protected static class ViewHolder2 extends RecyclerView.ViewHolder {
public TextView txtTimerClear;
public ViewHolder2(View itemView) {
super(itemView);
txtTimerClear = itemView.findViewById(R.id.txt_timer_clear);
}
}
protected static class ViewHolder3 extends RecyclerView.ViewHolder {
public TextView txtTimerMaterial;
public ViewHolder3(View itemView) {
super(itemView);
txtTimerMaterial = itemView.findViewById(R.id.txt_timer_material);
}
}
protected static class ViewHolder4 extends RecyclerView.ViewHolder {
public TextView txtTimerUsual;
public ViewHolder4(View itemView) {
super(itemView);
txtTimerUsual = itemView.findViewById(R.id.txt_timer_usual);
}
}
}
...@@ -12,7 +12,7 @@ import io.socket.client.Ack; ...@@ -12,7 +12,7 @@ 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;
/** Linux通信 KDS 菜单屏 */ /** Linux通信 交互屏 */
public class InteractionSocket extends Thread { public class InteractionSocket extends Thread {
private Context mContext; private Context mContext;
private Socket mSocket; private Socket mSocket;
......
package com.ihaoin.hooloo.device.component;
import android.content.Context;
import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.vo.MachineInfoMsg;
import com.ihaoin.hooloo.device.util.CollectionUtils;
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.Utils;
import io.socket.client.Ack;
import io.socket.client.IO;
import io.socket.client.Socket;
/** Linux通信 获取机器编码 */
public class MachineInfoSocket extends Thread {
private Context mContext;
private Socket mSocket;
private static final String mUrl = "localhost:8000";
private static final String mNamespace = "getMachineInfo";
private String tag = "[HL_CLIENT]";
public MachineInfoSocket(Context context) {
this.mContext = context;
}
@Override
public void run() {
connectSocket();
}
private void connectSocket() {
try {
mSocket = IO.socket(mUrl + "/" + mNamespace);
} catch (Exception e) {
Utils.i("连接server失败,错误原因:" + e.getMessage());
e.printStackTrace();
}
}
public void close() {
try {
if (mSocket != null) {
mSocket.disconnect();
mSocket.close();
mSocket = null;
}
} catch (Exception e) {
Utils.i("close失败,错误原因:" + e.getMessage());
e.printStackTrace();
}
}
public void getMachineCode() {
if (mSocket == null) {
Utils.i("socket未连接");
return;
}
try {
mSocket.emit("notice", "", (Ack) args -> {
if (CollectionUtils.isEmpty(args)) {
Utils.i("notice args empty");
return;
}
String content = args[0].toString();
if (StringUtils.isEmpty(content)) {
Utils.i("notice content empty");
return;
}
MachineInfoMsg msg = JsonUtils.readValue(content, MachineInfoMsg.class);
if (msg == null) {
Utils.i("notice msg empty");
return;
}
Utils.i("get machine info: " + msg);
if (StringUtils.isEmpty(msg.getMachineCode())) {
Utils.i("get machine code is null");
return;
}
SharedPreferencesUtils.setMachineCode(mContext, msg.getMachineCode());
Utils.fastBroadcast(mContext, Base.BROADCAST_ACTION_GET_MACHINE_INFO);
});
} catch (Exception e) {
Utils.i("发送消息失败,错误原因:" + e.getMessage());
e.printStackTrace();
}
}
private void sendMessage(String content) {
if (mSocket == null) {
Utils.i("socket未连接");
return;
}
try {
mSocket.emit("notice", content, (Ack) args -> {
});
} catch (Exception e) {
Utils.i("发送消息失败,错误原因:" + e.getMessage());
e.printStackTrace();
}
}
}
...@@ -20,6 +20,7 @@ public class UpdateService extends Thread { ...@@ -20,6 +20,7 @@ public class UpdateService extends Thread {
@Override @Override
public void run() { public void run() {
checkUpdate(); checkUpdate();
// while (true) { // while (true) {
// try { // try {
// if (System.currentTimeMillis() / 1000 % 60 == 0) { // if (System.currentTimeMillis() / 1000 % 60 == 0) {
...@@ -38,14 +39,16 @@ public class UpdateService extends Thread { ...@@ -38,14 +39,16 @@ public class UpdateService extends Thread {
HttpUtil.checkUpdate(checkUpdateHandler); HttpUtil.checkUpdate(checkUpdateHandler);
} }
private Handler checkUpdateHandler = new Handler() { private CheckUpdateHandler checkUpdateHandler = new CheckUpdateHandler();
private class CheckUpdateHandler extends NetworkHandler {
@Override @Override
public void handleMessage(@NonNull Message msg) { public void handleMessage(@NonNull Message msg) {
try { try {
CheckUpdateVo updateVo = new CheckUpdateVo(); CheckUpdateVo updateVo = new CheckUpdateVo();
updateVo.setUrl("https://testapi.pecktoy.com/files/upload_test/app-debug.apk"); updateVo.setUrl("https://testapi.pecktoy.com/files/upload_test/signed-v10.apk");
updateVo.setVersion("1.0.1"); updateVo.setVersion("1.0.10");
updateVo.setVersionCode(3); updateVo.setVersionCode(10);
// Object obj = msg.obj; // Object obj = msg.obj;
// if (msg.what == 0 || obj == null) { // if (msg.what == 0 || obj == null) {
// Utils.i("check update error"); // Utils.i("check update error");
...@@ -77,7 +80,7 @@ public class UpdateService extends Thread { ...@@ -77,7 +80,7 @@ public class UpdateService extends Thread {
Utils.i("check update error"); Utils.i("check update error");
} }
} }
}; }
private void startDownload(CheckUpdateVo updateVo) { private void startDownload(CheckUpdateVo updateVo) {
String filename = "hooloo-device_" + updateVo.getVersion() + "_" + updateVo.getVersionCode() + ".apk"; String filename = "hooloo-device_" + updateVo.getVersion() + "_" + updateVo.getVersionCode() + ".apk";
...@@ -86,7 +89,7 @@ public class UpdateService extends Thread { ...@@ -86,7 +89,7 @@ public class UpdateService extends Thread {
new File(path).mkdirs(); new File(path).mkdirs();
} }
String file = path + "/" + filename; String file = path + "/" + filename;
Utils.i("start download file: " + file); Utils.i(String.format("start download url: %s, file: %s", updateVo.getUrl(), file));
HttpUtil.download(updateVo.getUrl(), file, downloadHandler); HttpUtil.download(updateVo.getUrl(), file, downloadHandler);
} }
......
...@@ -3,8 +3,8 @@ package com.ihaoin.hooloo.device.config; ...@@ -3,8 +3,8 @@ package com.ihaoin.hooloo.device.config;
import com.ihaoin.hooloo.device.data.enums.PresentState; import com.ihaoin.hooloo.device.data.enums.PresentState;
public class AppConfig { public class AppConfig {
public static Boolean DEBUG = false; // TODO 编译环境 public static Boolean DEBUG = true; // TODO 编译环境
/** 点单屏编码 */ /** 点单屏编码, 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.MENU.getName();
......
...@@ -24,4 +24,5 @@ public class Base { ...@@ -24,4 +24,5 @@ public class Base {
public static final String BROADCAST_ACTION_KDS_INFO = "ACTION_KDS_INFO"; public static final String BROADCAST_ACTION_KDS_INFO = "ACTION_KDS_INFO";
public static final String BROADCAST_ACTION_INTERACTION_INFO = "ACTION_INTERACTION_INFO"; public static final String BROADCAST_ACTION_INTERACTION_INFO = "ACTION_INTERACTION_INFO";
public static final String BROADCAST_ACTION_GET_MACHINE_INFO = "ACTION_GET_MACHINE_INFO";
} }
package com.ihaoin.hooloo.device.data.vo;
import java.io.Serializable;
public class MachineInfoMsg implements Serializable {
/** 机器id */
private Integer machineId;
/** 机器编码 */
private String machineCode;
private String deviceName;
private Integer modelId;
private String modelName;
public Integer getMachineId() {
return machineId;
}
public void setMachineId(Integer machineId) {
this.machineId = machineId;
}
public String getMachineCode() {
return machineCode;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public Integer getModelId() {
return modelId;
}
public void setModelId(Integer modelId) {
this.modelId = modelId;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
@Override
public String toString() {
return "MachineInfoMsg{" +
"machineId=" + machineId +
", machineCode='" + machineCode + '\'' +
", deviceName='" + deviceName + '\'' +
", modelId=" + modelId +
", modelName='" + modelName + '\'' +
'}';
}
}
...@@ -19,8 +19,6 @@ import java.util.Locale; ...@@ -19,8 +19,6 @@ import java.util.Locale;
public class ApkUtils { public class ApkUtils {
private static final String TAG = "ApkUtils";
// private static final String SP_NAME_PACKAGE_INSTALL_RESULT = "package_install_result"; // private static final String SP_NAME_PACKAGE_INSTALL_RESULT = "package_install_result";
// private static volatile Method sInstallPackage; // private static volatile Method sInstallPackage;
// private static volatile Method sDeletePackage; // private static volatile Method sDeletePackage;
...@@ -36,13 +34,14 @@ public class ApkUtils { ...@@ -36,13 +34,14 @@ public class ApkUtils {
@SuppressLint("PackageManagerGetSignatures") @SuppressLint("PackageManagerGetSignatures")
@RequiresPermission(Manifest.permission.INSTALL_PACKAGES) @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
public static synchronized boolean install(Context context, String apkFile) { public static synchronized boolean install(Context context, String apkFile) {
Utils.i("start install: " + apkFile);
File file; File file;
if (TextUtils.isEmpty(apkFile) || !(file = new File(apkFile)).exists()) if (TextUtils.isEmpty(apkFile) || !(file = new File(apkFile)).exists())
return false; return false;
//加上apk合法性判断 //加上apk合法性判断
AppUtils.AppInfo apkInfo = AppUtils.getApkInfo(file); AppUtils.AppInfo apkInfo = AppUtils.getApkInfo(file);
if (apkInfo == null || TextUtils.isEmpty(apkInfo.getPackageName())) { if (apkInfo == null || TextUtils.isEmpty(apkInfo.getPackageName())) {
Utils.i(TAG, "apk info is null, the file maybe damaged: " + file.getAbsolutePath()); Utils.i("apk info is null, the file maybe damaged: " + file.getAbsolutePath());
return false; return false;
} }
...@@ -51,7 +50,7 @@ public class ApkUtils { ...@@ -51,7 +50,7 @@ public class ApkUtils {
if (appInfo != null) { if (appInfo != null) {
// //已安装的版本比apk版本要高, 则不需要安装 // //已安装的版本比apk版本要高, 则不需要安装
// if (appInfo.getVersionCode() >= apkInfo.getVersionCode()) { // if (appInfo.getVersionCode() >= apkInfo.getVersionCode()) {
// Utils.i(TAG, "The latest version has been installed locally: " + file.getAbsolutePath() + // Utils.i( "The latest version has been installed locally: " + file.getAbsolutePath() +
// ", app info: packageName: " + appInfo.getPackageName() + "; app name: " + appInfo.getName() + // ", app info: packageName: " + appInfo.getPackageName() + "; app name: " + appInfo.getName() +
// ", apk version code: " + apkInfo.getVersionCode() + // ", apk version code: " + apkInfo.getVersionCode() +
// ", app version code: " + appInfo.getVersionCode()); // ", app version code: " + appInfo.getVersionCode());
...@@ -72,7 +71,7 @@ public class ApkUtils { ...@@ -72,7 +71,7 @@ public class ApkUtils {
if (appPackageInfo != null && apkPackageInfo != null && if (appPackageInfo != null && apkPackageInfo != null &&
!compareSharedUserId(appPackageInfo.sharedUserId, apkPackageInfo.sharedUserId)) { !compareSharedUserId(appPackageInfo.sharedUserId, apkPackageInfo.sharedUserId)) {
Utils.i(TAG, "Apk sharedUserId is not match, app shellUid: " + appPackageInfo.sharedUserId + ", apk shellUid: " + apkPackageInfo.sharedUserId); Utils.i("Apk sharedUserId is not match, app shellUid: " + appPackageInfo.sharedUserId + ", apk shellUid: " + apkPackageInfo.sharedUserId);
return false; return false;
} }
} catch (Throwable ignored) { } catch (Throwable ignored) {
...@@ -90,7 +89,7 @@ public class ApkUtils { ...@@ -90,7 +89,7 @@ public class ApkUtils {
// boolean success = installByPackageInstaller(context, file, apkInfo); // boolean success = installByPackageInstaller(context, file, apkInfo);
// sPreferences.edit().putBoolean(packageName, success).apply(); // sPreferences.edit().putBoolean(packageName, success).apply();
// if (success) { // if (success) {
// Utils.i(TAG, "Install Success[PackageInstaller]: " + file.getAbsolutePath()); // Utils.i( "Install Success[PackageInstaller]: " + file.getAbsolutePath());
// return true; // return true;
// } // }
// } // }
...@@ -99,17 +98,17 @@ public class ApkUtils { ...@@ -99,17 +98,17 @@ public class ApkUtils {
// if (installByReflect(context, file)) { // if (installByReflect(context, file)) {
// if (sPreferences != null) // if (sPreferences != null)
// sPreferences.edit().putBoolean(apkInfo.getPackageName(), true).apply(); // sPreferences.edit().putBoolean(apkInfo.getPackageName(), true).apply();
// Utils.i(TAG, "Install Success[Reflect]", file.getPath()); // Utils.i( "Install Success[Reflect]", file.getPath());
// return true; // return true;
// } // }
if (installByShell(file, DeviceUtils.isDeviceRooted())) { if (installByShell(file, DeviceUtils.isDeviceRooted())) {
// if (sPreferences != null) // if (sPreferences != null)
// sPreferences.edit().putBoolean(apkInfo.getPackageName(), true).apply(); // sPreferences.edit().putBoolean(apkInfo.getPackageName(), true).apply();
Utils.i(TAG, "Install Success[Shell]: " + file.getPath()); Utils.i("Install Success[Shell]: " + file.getPath());
return true; return true;
} }
Utils.i(TAG, "Install Failure: " + file.getAbsolutePath()); Utils.i("Install Failure: " + file.getAbsolutePath());
return false; return false;
} }
...@@ -130,7 +129,7 @@ public class ApkUtils { ...@@ -130,7 +129,7 @@ public class ApkUtils {
// //如果是系统app, 则不支持卸载 // //如果是系统app, 则不支持卸载
// AppUtils.AppInfo appInfo = AppUtils.getAppInfo(packageName); // AppUtils.AppInfo appInfo = AppUtils.getAppInfo(packageName);
// if (appInfo != null && appInfo.isSystem()) { // if (appInfo != null && appInfo.isSystem()) {
// Utils.i(TAG, "Uninstall Failure[System App]: " + packageName); // Utils.i( "Uninstall Failure[System App]: " + packageName);
// return false; // return false;
// } // }
// //
...@@ -139,25 +138,25 @@ public class ApkUtils { ...@@ -139,25 +138,25 @@ public class ApkUtils {
// //
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// if (uninstallByPackageInstaller(context, packageName)) { // if (uninstallByPackageInstaller(context, packageName)) {
// Utils.i(TAG, "Uninstall Success[PackageInstaller]: " + packageName); // Utils.i( "Uninstall Success[PackageInstaller]: " + packageName);
// return true; // return true;
// } // }
// } // }
// //
// if (uninstallByReflect(context, packageName)) { // if (uninstallByReflect(context, packageName)) {
// Utils.i(TAG, "Uninstall Success[Reflect]: " + packageName); // Utils.i( "Uninstall Success[Reflect]: " + packageName);
// return true; // return true;
// } // }
// //
// if (uninstallByShell(packageName, DeviceUtils.isDeviceRooted())) { // if (uninstallByShell(packageName, DeviceUtils.isDeviceRooted())) {
// Utils.i(TAG, "Uninstall Success[Shell]: " + packageName); // Utils.i( "Uninstall Success[Shell]: " + packageName);
// return true; // return true;
// } // }
// //
// } catch (Throwable ignored) { // } catch (Throwable ignored) {
// } // }
// //
// Utils.i(TAG, "Uninstall Failure: " + packageName); // Utils.i( "Uninstall Failure: " + packageName);
// return false; // return false;
// } // }
...@@ -181,11 +180,10 @@ public class ApkUtils { ...@@ -181,11 +180,10 @@ public class ApkUtils {
// return executeShell(cmd, isRoot) || executeShell(cmd, !isRoot); // return executeShell(cmd, isRoot) || executeShell(cmd, !isRoot);
// } // }
private static boolean executeShell(String cmd, boolean isRoot) { private static boolean executeShell(String cmd, boolean isRoot) {
Utils.i(TAG, "ShellCommand: " + cmd + ", isRoot: " + isRoot); Utils.i("ShellCommand: " + cmd + ", isRoot: " + isRoot);
ShellUtils.CommandResult result = ShellUtils.execCmd(cmd, isRoot); ShellUtils.CommandResult result = ShellUtils.execCmd(cmd, isRoot);
Utils.i(TAG, "ShellCommand Result: " + result.toString()); Utils.i("ShellCommand Result: " + result.toString());
return result.successMsg != null && result.successMsg.toLowerCase(Locale.US).contains("success"); return result.successMsg != null && result.successMsg.toLowerCase(Locale.US).contains("success");
} }
...@@ -193,7 +191,7 @@ public class ApkUtils { ...@@ -193,7 +191,7 @@ public class ApkUtils {
// * 调用反射方式安装, 通过PackageManager#installPackage方法进行安装, 该方法在7.0已经移除 // * 调用反射方式安装, 通过PackageManager#installPackage方法进行安装, 该方法在7.0已经移除
// */ // */
// private static boolean installByReflect(Context context, File file) throws InterruptedException { // private static boolean installByReflect(Context context, File file) throws InterruptedException {
// Utils.i(TAG, "InstallByReflect: "+ file.getPath()); // Utils.i( "InstallByReflect: "+ file.getPath());
// Method installer = getInstallPackageMethod(); // Method installer = getInstallPackageMethod();
// if (installer == null) // if (installer == null)
// return false; // return false;
...@@ -233,7 +231,7 @@ public class ApkUtils { ...@@ -233,7 +231,7 @@ public class ApkUtils {
// * 调用反射方式卸载, 通过PackageManager#deletePackage, 该方法在7.0已经移除 // * 调用反射方式卸载, 通过PackageManager#deletePackage, 该方法在7.0已经移除
// */ // */
// private static boolean uninstallByReflect(Context context, String packageName) throws InterruptedException { // private static boolean uninstallByReflect(Context context, String packageName) throws InterruptedException {
// Utils.i(TAG, "UninstallByReflect", packageName); // Utils.i( "UninstallByReflect", packageName);
// Method deleter = getDeletePackageMethod(); // Method deleter = getDeletePackageMethod();
// if (deleter == null) // if (deleter == null)
// return false; // return false;
...@@ -270,7 +268,7 @@ public class ApkUtils { ...@@ -270,7 +268,7 @@ public class ApkUtils {
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) // @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
// @RequiresPermission(Manifest.permission.INSTALL_PACKAGES) // @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
// private static boolean installByPackageInstaller(Context context, File file, AppUtils.AppInfo apkInfo) throws InterruptedException { // private static boolean installByPackageInstaller(Context context, File file, AppUtils.AppInfo apkInfo) throws InterruptedException {
// Utils.i(TAG, "InstallByPackageInstaller: " + file.getPath()); // Utils.i( "InstallByPackageInstaller: " + file.getPath());
// //
// OutputStream out = null; // OutputStream out = null;
// InputStream in = null; // InputStream in = null;
...@@ -310,7 +308,7 @@ public class ApkUtils { ...@@ -310,7 +308,7 @@ public class ApkUtils {
// throw e; // throw e;
// } catch (Throwable e) { // } catch (Throwable e) {
// e.printStackTrace(); // e.printStackTrace();
// Utils.i(TAG, e); // Utils.i( e);
// } finally { // } finally {
// //如果会话已经开启, 但是没有成功, 则需要将会话进行销毁 // //如果会话已经开启, 但是没有成功, 则需要将会话进行销毁
// try { // try {
...@@ -329,7 +327,7 @@ public class ApkUtils { ...@@ -329,7 +327,7 @@ public class ApkUtils {
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) // @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
// @RequiresPermission(Manifest.permission.DELETE_PACKAGES) // @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
// private static boolean uninstallByPackageInstaller(Context context, String packageName) { // private static boolean uninstallByPackageInstaller(Context context, String packageName) {
// Utils.i(TAG, "UninstallByPackageInstaller", packageName); // Utils.i( "UninstallByPackageInstaller", packageName);
// try { // try {
// InstallReceiver callback = new InstallReceiver(context, false, packageName); // InstallReceiver callback = new InstallReceiver(context, false, packageName);
// PackageInstaller installer = Utils.getApp().getPackageManager().getPackageInstaller(); // PackageInstaller installer = Utils.getApp().getPackageManager().getPackageInstaller();
...@@ -418,7 +416,7 @@ public class ApkUtils { ...@@ -418,7 +416,7 @@ public class ApkUtils {
// status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE); // status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE);
// mSuccess = status == PackageInstaller.STATUS_SUCCESS; // mSuccess = status == PackageInstaller.STATUS_SUCCESS;
// } // }
// Utils.i(TAG, mParam, mOperate + " Result: " + mSuccess + "[" + status + "]"); // Utils.i( mParam, mOperate + " Result: " + mSuccess + "[" + status + "]");
// } finally { // } finally {
// mCountDownLatch.countDown(); // mCountDownLatch.countDown();
// } // }
......
...@@ -7,6 +7,7 @@ import android.content.BroadcastReceiver; ...@@ -7,6 +7,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager;
...@@ -37,6 +38,7 @@ import com.ihaoin.hooloo.device.adapter.GoodsAdapter; ...@@ -37,6 +38,7 @@ 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.InteractionSocket; import com.ihaoin.hooloo.device.component.InteractionSocket;
import com.ihaoin.hooloo.device.component.KDSSocket; import com.ihaoin.hooloo.device.component.KDSSocket;
import com.ihaoin.hooloo.device.component.MachineInfoSocket;
import com.ihaoin.hooloo.device.component.NetworkHandler; import com.ihaoin.hooloo.device.component.NetworkHandler;
import com.ihaoin.hooloo.device.component.SettingsQueue; import com.ihaoin.hooloo.device.component.SettingsQueue;
import com.ihaoin.hooloo.device.component.UpdateService; import com.ihaoin.hooloo.device.component.UpdateService;
...@@ -113,6 +115,7 @@ public class LauncherActivity extends Activity { ...@@ -113,6 +115,7 @@ public class LauncherActivity extends Activity {
initSettingsQueue(); initSettingsQueue();
startMachineClient();
startTimeoutThread(); startTimeoutThread();
getMachineCode(); getMachineCode();
...@@ -146,14 +149,14 @@ public class LauncherActivity extends Activity { ...@@ -146,14 +149,14 @@ public class LauncherActivity extends Activity {
} }
private void getMachineCode() { private void getMachineCode() {
// AppConfig.MACHINE_CODE = SharedPreferencesUtils.getMachineCode(this); AppConfig.MACHINE_CODE = SharedPreferencesUtils.getMachineCode(this);
// if (StringUtils.isEmpty(AppConfig.MACHINE_CODE)) { if (StringUtils.isEmpty(AppConfig.MACHINE_CODE)) {
// Utils.fastBroadcast(this, Base.BROADCAST_SOCKET_GET_MACHINE_CODE); // 从设备上获取机器编码 machineSocket.getMachineCode(); // 从设备上获取机器编码
// return; return;
// } }
// Utils.i("machine code: " + AppConfig.MACHINE_CODE); Utils.i("machine code: " + AppConfig.MACHINE_CODE);
// loadData(); loadData();
// HttpUtil.postRegistrationId(); HttpUtil.postRegistrationId();
} }
private void initRecommends() { private void initRecommends() {
...@@ -447,6 +450,9 @@ public class LauncherActivity extends Activity { ...@@ -447,6 +450,9 @@ public class LauncherActivity extends Activity {
this.unregistSkuChangeReceiver(); this.unregistSkuChangeReceiver();
this.unregistGoodsChangeReceiver(); this.unregistGoodsChangeReceiver();
this.unregistTouchReceiver(); this.unregistTouchReceiver();
stopMachineClient();
stopKdsClient();
stopIAClient();
System.exit(0); System.exit(0);
} }
...@@ -613,6 +619,9 @@ public class LauncherActivity extends Activity { ...@@ -613,6 +619,9 @@ public class LauncherActivity extends Activity {
Utils.showToast(this, "未获取到菜单屏硬件"); Utils.showToast(this, "未获取到菜单屏硬件");
return; return;
} }
Point point = new Point();
displays[1].getRealSize(point);
Utils.i("point: " + point.toString());
menuView = new MenuPresentation(this, displays[1]); menuView = new MenuPresentation(this, displays[1]);
menuView.show(); menuView.show();
...@@ -633,8 +642,21 @@ public class LauncherActivity extends Activity { ...@@ -633,8 +642,21 @@ public class LauncherActivity extends Activity {
} }
private KDSSocket kdsSocket = null; private KDSSocket kdsSocket = null;
private MachineInfoSocket machineSocket = null;
private InteractionSocket interactionSocket = null; private InteractionSocket interactionSocket = null;
private void startMachineClient() {
machineSocket = new MachineInfoSocket(this);
machineSocket.start();
}
private void stopMachineClient() {
if (machineSocket != null) {
machineSocket.close();
machineSocket = null;
}
}
private void startKdsClient() { private void startKdsClient() {
kdsSocket = new KDSSocket(this); kdsSocket = new KDSSocket(this);
kdsSocket.start(); kdsSocket.start();
......
...@@ -12,6 +12,7 @@ import android.graphics.drawable.AnimationDrawable; ...@@ -12,6 +12,7 @@ import android.graphics.drawable.AnimationDrawable;
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.DisplayMetrics;
import android.view.Display; import android.view.Display;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -20,17 +21,21 @@ import android.widget.LinearLayout; ...@@ -20,17 +21,21 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
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.adapter.MachineStateAdapter;
import com.ihaoin.hooloo.device.component.IntroViewPager; import com.ihaoin.hooloo.device.component.IntroViewPager;
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.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.data.vo.OrderPkg;
import com.ihaoin.hooloo.device.test.KDSGen; import com.ihaoin.hooloo.device.test.KDSGen;
import com.ihaoin.hooloo.device.util.CollectionUtils; import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils; import com.ihaoin.hooloo.device.util.Utils;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -38,31 +43,12 @@ import java.util.List; ...@@ -38,31 +43,12 @@ import java.util.List;
public class MenuPresentation extends Presentation { public class MenuPresentation extends Presentation {
// private List<OrderPkg> orderPkgs;
private KDSMsg mKdsMsg; private KDSMsg mKdsMsg;
// private LoadOrdersHandler loadOrdersHandler;
// private OrderStateChangeReceiver orderStateChangeReceiver; private IntroViewPager imagePager;
private LinearLayoutManager layoutManager;
private IntroViewPager introPager; private RecyclerView recyclerMachineState;
// private List<Order> cookingOrders; private MachineStateAdapter machineStateAdapter;
// private List<Order> waitingOrders;
// private List<Order> completedOrders;
// private ImageView imgLeft;
// private GridView gridCooking;
// private GridView gridWaiting;
// private GridView gridCompleted;
// private OrderAdapter cookingAdapter;
// private OrderAdapter waitingAdapter;
// private OrderAdapter completedAdapter;
private TextView txtOutsideTemp;
private TextView txtInsideTemp;
private TextView txtFridgeTemp;
private TextView txtInsideHumidity;
private TextView txtTimerClear;
private TextView txtTimerMaterial;
private TextView txtTimerUsual;
private ImageView imgAvatar; private ImageView imgAvatar;
private List<View> progressViews = new ArrayList<>(); private List<View> progressViews = new ArrayList<>();
...@@ -79,34 +65,37 @@ public class MenuPresentation extends Presentation { ...@@ -79,34 +65,37 @@ public class MenuPresentation extends Presentation {
setContentView(R.layout.present_menu); setContentView(R.layout.present_menu);
initViews(); initViews();
// loadDatas();
// registOrderChangeReceiver();
registerKDSMessageReceiver(); registerKDSMessageReceiver();
setOnDismissListener(dismissListener); setOnDismissListener(dismissListener);
startPagerThread(); startImagePagerThread();
} }
private void initViews() { private void initViews() {
imgAvatar = findViewById(R.id.img_avatar); imgAvatar = findViewById(R.id.img_avatar);
introPager = findViewById(R.id.intro_pager); imagePager = findViewById(R.id.image_pager);
// imgLeft = findViewById(R.id.img_left);
// gridCooking = findViewById(R.id.grid_cooking); layoutManager = new LinearLayoutManager(getContext()) {
// gridWaiting = findViewById(R.id.grid_waiting); @Override
// gridCompleted = findViewById(R.id.grid_completed); public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
// LinearSmoothScroller smoothScroller =
// txtSupplement = findViewById(R.id.txt_timer_supplement); new LinearSmoothScroller(recyclerView.getContext()) {
// txtClear = findViewById(R.id.txt_timer_clear); // 返回:滑过1px时经历的时间(ms)。
// @Override
// cookingAdapter = new OrderAdapter(getContext()); protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
// waitingAdapter = new OrderAdapter(getContext()); return 10;
// completedAdapter = new OrderAdapter(getContext()); }
// };
// gridCooking.setAdapter(cookingAdapter); smoothScroller.setTargetPosition(position);
// gridWaiting.setAdapter(waitingAdapter); startSmoothScroll(smoothScroller);
// gridCompleted.setAdapter(completedAdapter); }
};
machineStateAdapter = new MachineStateAdapter(getContext(), null);
recyclerMachineState = findViewById(R.id.rec_machine_state);
recyclerMachineState.setAdapter(machineStateAdapter);
recyclerMachineState.setLayoutManager(layoutManager);
progressViews.add(findViewById(R.id.progress1)); progressViews.add(findViewById(R.id.progress1));
progressViews.add(findViewById(R.id.progress2)); progressViews.add(findViewById(R.id.progress2));
...@@ -128,73 +117,53 @@ public class MenuPresentation extends Presentation { ...@@ -128,73 +117,53 @@ public class MenuPresentation extends Presentation {
completedViews.add(findViewById(R.id.completed8)); completedViews.add(findViewById(R.id.completed8));
completedViews.add(findViewById(R.id.completed9)); completedViews.add(findViewById(R.id.completed9));
txtOutsideTemp = findViewById(R.id.txt_outside_temp);
txtInsideTemp = findViewById(R.id.txt_inside_temp);
txtFridgeTemp = findViewById(R.id.txt_fridge_temp);
txtInsideHumidity = findViewById(R.id.txt_inside_humidity);
txtTimerClear = findViewById(R.id.txt_timer_clear);
txtTimerMaterial = findViewById(R.id.txt_timer_material);
txtTimerUsual = findViewById(R.id.txt_timer_usual);
AnimationDrawable anim = (AnimationDrawable) getContext().getDrawable(R.drawable.menu_avatar); AnimationDrawable anim = (AnimationDrawable) getContext().getDrawable(R.drawable.menu_avatar);
imgAvatar.setImageDrawable(anim); imgAvatar.setImageDrawable(anim);
anim.start(); anim.start();
} }
// private String getRightImage(String state) {
// MainData mainData = HLApplication.getMainData();
// if (mainData == null || mainData.getImages() == null) {
// return null;
// }
// if (CollectionUtils.isEmpty(mainData.getImages().getRight())) {
// return null;
// }
// return mainData.getImages().getRight().get(state);
// }
private void showImages() { private void showImages() {
MainData mainData = HLApplication.getMainData(); MainData mainData = HLApplication.getMainData();
if (mainData == null || mainData.getImages() == null) { if (mainData == null || mainData.getImages() == null) {
return; return;
} }
introPager.removeAllViews(); imagePager.removeAllViews();
// List<String> lefts = Arrays.asList("https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/08/点单屏内容图-拿铁.png", "https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/08/点单屏内容图-拿铁.png"); // List<String> lefts = Arrays.asList("https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/08/点单屏内容图-拿铁.png", "https://hooloo-saas-test.oss-cn-beijing.aliyuncs.com/hooloo/2022/07/08/点单屏内容图-拿铁.png");
if (CollectionUtils.isEmpty(mainData.getImages().getLeft())) { if (CollectionUtils.isEmpty(mainData.getImages().getLeft())) {
return; return;
} }
List<View> introViews = new ArrayList<>(); List<View> introViews = new ArrayList<>();
mainData.getImages().getLeft().forEach(url -> introViews.add(getIntroImage(url))); mainData.getImages().getLeft().stream().filter(x -> !StringUtils.isEmpty(x)).forEach(url -> introViews.add(getLeftImage(url)));
introPager.setIntroViews(introViews); imagePager.setIntroViews(introViews);
} }
private ImageView getIntroImage(String url) { private ImageView getLeftImage(String url) {
ImageView imgIntro = new ImageView(getContext()); ImageView image = new ImageView(getContext());
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);
imgIntro.setLayoutParams(layoutParams); image.setLayoutParams(layoutParams);
imgIntro.setAdjustViewBounds(true); image.setAdjustViewBounds(true);
Utils.getGlide(getContext()).load(url).into(imgIntro); Utils.getGlide(getContext()).load(url).into(image);
return imgIntro; return image;
} }
private PagerThread pagerThread; private ImagePagerThread imagePagerThread;
private PagerHandler pagerHandler; private ImagePagerHandler imagePagerHandler;
private void startPagerThread() { private void startImagePagerThread() {
pagerHandler = new PagerHandler(); imagePagerHandler = new ImagePagerHandler();
pagerThread = new PagerThread(); imagePagerThread = new ImagePagerThread();
pagerThread.start(); imagePagerThread.start();
} }
private class PagerThread extends Thread { private class ImagePagerThread extends Thread {
@Override @Override
public void run() { public void run() {
KDSMsg msg = KDSGen.getKdsMsg();
Utils.sendKdsMsgBroadcast(getContext(), msg);
try { try {
while (true) { while (true) {
Thread.sleep(1000 * 5); Thread.sleep(1000 * 5);
pagerHandler.sendEmptyMessage(1); imagePagerHandler.sendEmptyMessage(1);
KDSMsg msg = KDSGen.getKdsMsg();
Utils.sendKdsMsgBroadcast(getContext(), msg);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -202,89 +171,47 @@ public class MenuPresentation extends Presentation { ...@@ -202,89 +171,47 @@ public class MenuPresentation extends Presentation {
} }
} }
private class PagerHandler extends Handler { private class ImagePagerHandler extends Handler {
@Override @Override
public void handleMessage(@NonNull Message msg) { public void handleMessage(@NonNull Message msg) {
int count = introPager.getCount(); setNextImage();
smoothMachineState();
}
}
private Integer position = 3;
private void smoothMachineState() {
position++;
recyclerMachineState.smoothScrollToPosition(position);
}
private void setNextImage() {
int count = imagePager.getCount();
if (count <= 1) { if (count <= 1) {
return; return;
} }
int index = introPager.getCurrentItem(); int index = imagePager.getCurrentItem();
if (index + 1 >= count) { if (index + 1 >= count) {
index = 0; index = 0;
} else { } else {
index++; index++;
} }
introPager.setCurrentItem(index, true); imagePager.setCurrentItem(index, true);
}
} }
public void mainDataChanged() { public void mainDataChanged() {
showImages(); showImages();
} }
// private void loadDatas() {
// loadOrdersHandler = new LoadOrdersHandler();
// HttpUtil.getOrders(loadOrdersHandler);
// }
//
// private void setDatas(String json) {
// try {
// orderPkgs = JsonUtils.getMapper().readValue(json, new TypeReference<List<OrderPkg>>() {
// });
// orderDataChanged();
//// List<OrderPkg> pkgs = JsonUtils.getMapper().readValue(json, new TypeReference<List<OrderPkg>>() {
//// });
//// setOrders(pkgs);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// private void setOrders(List<OrderPkg> pkgs) {
// try {
// if (CollectionUtils.isEmpty(pkgs)) {
// return;
// }
// List<Order> cookings = getOrders(pkgs, OrderState.COOKING.getCode());
// if (CollectionUtils.isEmpty(cookings)) {
// return;
// }
// cookings.forEach(order -> order.setProgress(getProgressByOrder(order)));
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// orderPkgs = pkgs;
// orderDataChanged();
// }
// }
//
// private Integer getProgressByOrder(Order order) {
// List<Order> cookings = getOrders(OrderState.COOKING.getCode());
// if (CollectionUtils.isEmpty(cookings)) {
// return 0;
// }
// for (Order o : cookings) {
// if (o.equals(order)) {
// return o.getProgress();
// }
// }
// return 0;
// }
@SuppressLint("StringFormatMatches") @SuppressLint("StringFormatMatches")
private void setMachineState() { private void setMachineState() {
if (mKdsMsg == null) { if (mKdsMsg == null) {
return; return;
} }
txtOutsideTemp.setText(getContext().getString(R.string.txt_outside_temp, mKdsMsg.getOutTemperature())); machineStateAdapter.setMsg(mKdsMsg);
txtInsideTemp.setText(getContext().getString(R.string.txt_inside_temp, mKdsMsg.getInTemperature())); machineStateAdapter.notifyDataSetChanged();
txtFridgeTemp.setText(getContext().getString(R.string.txt_fridge_temp, mKdsMsg.getFridgeTemperature()));
txtInsideHumidity.setText(getContext().getString(R.string.txt_inside_humidity, mKdsMsg.getHumidity()));
txtTimerClear.setText(getContext().getString(R.string.txt_timer_clear, mKdsMsg.getCoffeeCleanTime()));
txtTimerMaterial.setText(getContext().getString(R.string.txt_timer_material, mKdsMsg.getChangeMaterialTime()));
txtTimerUsual.setText(getContext().getString(R.string.txt_timer_usual, mKdsMsg.getDailyCleanTime()));
} }
private void orderDataChanged() { private void orderDataChanged() {
...@@ -321,7 +248,6 @@ public class MenuPresentation extends Presentation { ...@@ -321,7 +248,6 @@ public class MenuPresentation extends Presentation {
for (int i = 0; i < cookings.size(); i++) { for (int i = 0; i < cookings.size(); i++) {
KDSOrder order = cookings.get(i); KDSOrder order = cookings.get(i);
View v = progressViews.get(i); View v = progressViews.get(i);
// v.setText(cookings.get(i).getOrderNumber());
TextView orderNum = v.findViewById(R.id.txt_order_number); TextView orderNum = v.findViewById(R.id.txt_order_number);
View imgTmp = v.findViewById(R.id.img_tmp); View imgTmp = v.findViewById(R.id.img_tmp);
ImageView imgMask = v.findViewById(R.id.img_mask); ImageView imgMask = v.findViewById(R.id.img_mask);
...@@ -349,167 +275,21 @@ public class MenuPresentation extends Presentation { ...@@ -349,167 +275,21 @@ public class MenuPresentation extends Presentation {
} }
} }
// cookingAdapter.setOrders(cookings);
// waitingAdapter.setOrders(waitings);
// completedAdapter.setOrders(completes);
//
// cookingAdapter.notifyDataSetChanged();
// waitingAdapter.notifyDataSetChanged();
// completedAdapter.notifyDataSetChanged();
showImages();
}
// private List<Order> getOrders(Integer state) {
// return getOrders(orderPkgs, state);
// }
// private List<Order> getOrders(List<OrderPkg> pkgs, Integer state) {
// if (CollectionUtils.isEmpty(pkgs)) {
// return null;
// }
// Map<Integer, OrderPkg> map = pkgs.stream().collect(Collectors.toMap(OrderPkg::getState, Function.identity()));
// if (CollectionUtils.isEmpty(map)) {
// return null;
// }
// OrderPkg pkg = map.get(state);
// if (pkg == null) {
// return null;
// }
// return pkg.getOrders();
// }
// class LoadOrdersHandler extends NetworkHandler {
// @Override
// public void handleMessage(@NonNull Message msg) {
// super.handleMessage(msg);
// if (msg.what != 1) {
// return;
// }
//// String body = "[{\"state\":1,\"desc\":\"制作中\",\"orders\":[{\"orderId\":1011,\"orderNo\":\"N20220220A19231\",\"orderNumber\":\"Mon101\"},{\"orderId\":1012,\"orderNo\":\"N20220220A19232\",\"orderNumber\":\"Mon102\"},{\"orderId\":1013,\"orderNo\":\"N20220220A19233\",\"orderNumber\":\"Mon103\"}]},{\"state\":2,\"desc\":\"待制作\",\"orders\":[{\"orderId\":1014,\"orderNo\":\"N20220220A19234\",\"orderNumber\":\"Mon104\"},{\"orderId\":1015,\"orderNo\":\"N20220220A19235\",\"orderNumber\":\"Mon105\"},{\"orderId\":1016,\"orderNo\":\"N20220220A19236\",\"orderNumber\":\"Mon106\"},{\"orderId\":1017,\"orderNo\":\"N20220220A19237\",\"orderNumber\":\"Mon107\"},{\"orderId\":1018,\"orderNo\":\"N20220220A19238\",\"orderNumber\":\"Mon108\"}]},{\"state\":3,\"desc\":\"可取餐\",\"orders\":[{\"orderId\":1019,\"orderNo\":\"N20220220A19239\",\"orderNumber\":\"Mon109\"},{\"orderId\":1001,\"orderNo\":\"N20220220A19221\",\"orderNumber\":\"Mon121\"},{\"orderId\":1002,\"orderNo\":\"N20220220A19222\",\"orderNumber\":\"Mon122\"},{\"orderId\":1003,\"orderNo\":\"N20220220A19223\",\"orderNumber\":\"Mon123\"},{\"orderId\":1004,\"orderNo\":\"N20220220A19224\",\"orderNumber\":\"Mon124\"},{\"orderId\":1005,\"orderNo\":\"N20220220A19241\",\"orderNumber\":\"Mon141\"},{\"orderId\":1006,\"orderNo\":\"N20220220A19251\",\"orderNumber\":\"Mon151\"}]}]";
// if (msg.obj == null) {
// return;
// }
// String body = msg.obj.toString();
// if (StringUtils.isEmpty(body)) {
// return;
// }
// setDatas(body);
// }
// }
// private void registOrderChangeReceiver() {
// orderStateChangeReceiver = new OrderStateChangeReceiver();
// IntentFilter filter = new IntentFilter();
// filter.addAction(Base.PUSH_ACTION_ORDER_STATE_CHANGED);
// getContext().registerReceiver(orderStateChangeReceiver, filter);
// }
//
// private void unregistOrderChangeReceiver() {
// if (orderStateChangeReceiver != null) {
// getContext().unregisterReceiver(orderStateChangeReceiver);
// orderStateChangeReceiver = null;
// }
// }
//
// class OrderStateChangeReceiver extends BroadcastReceiver {
// @Override
// public void onReceive(Context context, Intent intent) {
// try {
// String msgBody = intent.getStringExtra(Base.PUSH_DEFAULT_EXTRA);
// if (StringUtils.isEmpty(msgBody)) {
// return;
// }
//
// Order order = JsonUtils.getMapper().readValue(msgBody, Order.class);
// if (order == null || order.getState() == null || order.getOrderId() == null || order.getOrderId() <= 0
// || StringUtils.isEmpty(order.getOrderNo()) || StringUtils.isEmpty(order.getOrderNumber())) {
// return;
// }
//
// if (CollectionUtils.isEmpty(orderPkgs)) {
// OrderState state = OrderState.get(order.getState());
// if (state == null) {
// return;
// }
// orderPkgs = new ArrayList<>();
//
// List<Order> orders = new ArrayList<>();
// orders.add(order);
// OrderPkg pkg = new OrderPkg();
// pkg.setState(order.getState());
// pkg.setOrders(orders);
// orderPkgs.add(pkg);
// } else {
// // 删除订单
// orderPkgs.forEach(pkg -> {
// if (CollectionUtils.isEmpty(pkg.getOrders())) {
// return;
// }
// pkg.getOrders().remove(order);
// });
//
// OrderState state = OrderState.get(order.getState());
// if (state == null) {
// return;
// }
// // 添加新订单状态
// OrderPkg pkg = getOrdersByState(orderPkgs, order.getState());
// if (pkg == null) {
// List<Order> orders = new ArrayList<>();
// orders.add(order);
// pkg = new OrderPkg();
// pkg.setState(order.getState());
// pkg.setOrders(orders);
// orderPkgs.add(pkg);
// } else {
// List<Order> orders = pkg.getOrders();
// if (CollectionUtils.isEmpty(orders)) {
// orders = new ArrayList<>();
// }
// orders.add(order);
// pkg.setOrders(orders);
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// orderDataChanged();
// }
// }
// }
private OrderPkg getOrdersByState(List<OrderPkg> pkgs, Integer state) {
if (CollectionUtils.isEmpty(pkgs)) {
return null;
}
for (OrderPkg pkg : pkgs) {
if (pkg.getState().equals(state)) {
return pkg;
}
}
return null;
} }
OnDismissListener dismissListener = new OnDismissListener() { OnDismissListener dismissListener = new OnDismissListener() {
@Override @Override
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {
Utils.i("menu present dismiss"); Utils.i("menu present dismiss");
// unregistOrderChangeReceiver();
unregistKDSMessageReceiver(); unregistKDSMessageReceiver();
// if (loadOrdersHandler != null) { if (imagePagerHandler != null) {
// loadOrdersHandler.removeCallbacksAndMessages(null); imagePagerHandler.removeCallbacksAndMessages(null);
// loadOrdersHandler = null; imagePagerHandler = null;
// } }
if (pagerHandler != null) { if (imagePagerThread != null) {
pagerHandler.removeCallbacksAndMessages(null); imagePagerThread.interrupt();
pagerHandler = null; imagePagerThread = null;
}
if (pagerThread != null) {
pagerThread.interrupt();
pagerThread = null;
} }
} }
}; };
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
android:strokeColor="#FFFFFFFF"> android:strokeColor="#FFFFFFFF">
<aapt:attr name="android:fillColor"> <aapt:attr name="android:fillColor">
<gradient <gradient
android:endColor="#33DDDDDD" android:endColor="#22DDDDDD"
android:endX="18" android:endX="18"
android:endY="30" android:endY="30"
android:startColor="#00FFFFFF" android:startColor="#00FFFFFF"
......
...@@ -104,7 +104,6 @@ ...@@ -104,7 +104,6 @@
android:layout_marginTop="@dimen/dialog_close_margin" android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin" android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin" android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px"> android:padding="20px">
<ImageView <ImageView
android:layout_width="@dimen/ic_dialog_close" android:layout_width="@dimen/ic_dialog_close"
......
...@@ -208,7 +208,6 @@ ...@@ -208,7 +208,6 @@
android:layout_marginTop="@dimen/dialog_close_margin" android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin" android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin" android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px"> android:padding="20px">
<ImageView <ImageView
android:layout_width="@dimen/ic_dialog_close" android:layout_width="@dimen/ic_dialog_close"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
android:layout_marginTop="@dimen/dialog_close_margin" android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin" android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin" android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px"> android:padding="20px">
<ImageView <ImageView
android:layout_width="@dimen/ic_dialog_close" android:layout_width="@dimen/ic_dialog_close"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
android:layout_marginTop="@dimen/dialog_close_margin" android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin" android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin" android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px"> android:padding="20px">
<ImageView <ImageView
android:layout_width="@dimen/ic_dialog_close" android:layout_width="@dimen/ic_dialog_close"
......
...@@ -120,8 +120,7 @@ ...@@ -120,8 +120,7 @@
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:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:background="@mipmap/jiahao" android:background="@mipmap/jiahao" />
android:foreground="?selectableItemBackground" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_line_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="@dimen/menu_state_padding_line">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/wendu" />
<TextView
android:id="@+id/txt_outside_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_outside_temp"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_inside_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_inside_temp"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_line_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="@dimen/menu_state_padding_line">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/bingxiang" />
<TextView
android:id="@+id/txt_fridge_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_fridge_temp"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_inside_humidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_inside_humidity"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_line_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/menu_state_padding_line"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/qingxi" />
<TextView
android:id="@+id/txt_timer_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_timer_clear"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_line_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/menu_state_padding_line"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/yuanliao" />
<TextView
android:id="@+id/txt_timer_material"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_timer_material"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_line_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/menu_state_padding_line">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/baojie" />
<TextView
android:id="@+id/txt_timer_usual"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_timer_usual"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
\ 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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@color/colorLogo">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">
<com.ihaoin.hooloo.device.component.IntroViewPager <com.ihaoin.hooloo.device.component.IntroViewPager
android:id="@+id/intro_pager" android:id="@+id/image_pager"
android:layout_width="0dp" android:layout_width="@dimen/menu_left"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.73125" /> android:background="@color/black" />
<!-- <ImageView-->
<!-- android:id="@+id/img_left"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="0.73125"-->
<!-- android:adjustViewBounds="true"-->
<!-- android:scaleType="centerCrop" />-->
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="@dimen/menu_right"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.26875"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="@dimen/menu_right_top"
android:layout_weight="0.70186"
android:background="@color/menu_order_bg" android:background="@color/menu_order_bg"
android:paddingStart="@dimen/menu_content_padding_hor" android:paddingStart="@dimen/menu_content_padding_hor"
android:paddingTop="@dimen/menu_content_padding_top"> android:paddingTop="@dimen/menu_content_padding_top">
...@@ -248,148 +239,19 @@ ...@@ -248,148 +239,19 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<LinearLayout <RelativeLayout
android:id="@+id/layout_machine_state"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="@dimen/menu_right_bottom"
android:layout_weight="0.29814"
android:background="@color/menu_state_bg" android:background="@color/menu_state_bg"
android:orientation="vertical"
android:paddingLeft="@dimen/menu_state_padding_hor" android:paddingLeft="@dimen/menu_state_padding_hor"
android:paddingTop="@dimen/menu_state_padding_ver"> android:paddingTop="@dimen/menu_state_padding_ver"
<LinearLayout android:paddingBottom="@dimen/menu_state_padding_bottom">
android:layout_width="match_parent" <androidx.recyclerview.widget.RecyclerView
android:layout_height="wrap_content" android:id="@+id/rec_machine_state"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/wendu" />
<TextView
android:id="@+id/txt_outside_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_outside_temp"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_inside_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_inside_temp"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginTop="@dimen/menu_state_padding_line" android:descendantFocusability="afterDescendants" />
android:orientation="horizontal"> </RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/bingxiang" />
<TextView
android:id="@+id/txt_fridge_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_fridge_temp"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_inside_humidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_inside_humidity"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/menu_state_padding_line"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/qingxi" />
<TextView
android:id="@+id/txt_timer_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_timer_clear"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/menu_state_padding_line"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/yuanliao" />
<TextView
android:id="@+id/txt_timer_material"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_timer_material"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/menu_state_padding_line"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="35px"
android:layout_height="34px"
android:src="@mipmap/baojie" />
<TextView
android:id="@+id/txt_timer_usual"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/menu_state_icon_margin"
android:text="@string/txt_timer_usual"
android:textColor="@color/menu_state_text"
android:textSize="@dimen/ts_menu_state" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<ImageView <ImageView
......
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
<dimen name="tip_margin_top">40px</dimen> <dimen name="tip_margin_top">40px</dimen>
<dimen name="tip_padding_top">33px</dimen> <dimen name="tip_padding_top">33px</dimen>
<dimen name="tip_padding_bottom">33px</dimen> <dimen name="tip_padding_bottom">33px</dimen>
<dimen name="menu_left">1872px</dimen>
<dimen name="menu_right">688px</dimen>
<dimen name="menu_right_top">758px</dimen>
<dimen name="menu_right_bottom">322px</dimen>
<dimen name="menu_divider_padding_hor">33px</dimen> <dimen name="menu_divider_padding_hor">33px</dimen>
<dimen name="menu_divider_padding_top">60px</dimen> <dimen name="menu_divider_padding_top">60px</dimen>
<dimen name="menu_divider_padding_bottom">50px</dimen> <dimen name="menu_divider_padding_bottom">50px</dimen>
...@@ -54,12 +58,13 @@ ...@@ -54,12 +58,13 @@
<dimen name="menu_logo_bar">110px</dimen> <dimen name="menu_logo_bar">110px</dimen>
<dimen name="menu_progress_start">33px</dimen> <dimen name="menu_progress_start">33px</dimen>
<dimen name="menu_progress_end">33px</dimen> <dimen name="menu_progress_end">33px</dimen>
<dimen name="menu_progress_width">280px</dimen> <dimen name="menu_progress_width">279px</dimen>
<dimen name="menu_progress_height">26px</dimen> <dimen name="menu_progress_height">26px</dimen>
<dimen name="menu_title_margin_top">20px</dimen> <dimen name="menu_title_margin_top">20px</dimen>
<dimen name="menu_title_margin_bottom">12px</dimen> <dimen name="menu_title_margin_bottom">12px</dimen>
<dimen name="menu_state_padding_hor">48px</dimen> <dimen name="menu_state_padding_hor">48px</dimen>
<dimen name="menu_state_padding_ver">35px</dimen> <dimen name="menu_state_padding_ver">35px</dimen>
<dimen name="menu_state_padding_bottom">15px</dimen>
<dimen name="menu_state_padding_line">20px</dimen> <dimen name="menu_state_padding_line">20px</dimen>
<dimen name="menu_state_icon_margin">22px</dimen> <dimen name="menu_state_icon_margin">22px</dimen>
......
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
<dimen name="tip_margin_top">40px</dimen> <dimen name="tip_margin_top">40px</dimen>
<dimen name="tip_padding_top">33px</dimen> <dimen name="tip_padding_top">33px</dimen>
<dimen name="tip_padding_bottom">33px</dimen> <dimen name="tip_padding_bottom">33px</dimen>
<dimen name="menu_left">1420px</dimen>
<dimen name="menu_right">500px</dimen>
<dimen name="menu_right_top">758px</dimen>
<dimen name="menu_right_bottom">322px</dimen>
<dimen name="menu_divider_padding_hor">10px</dimen> <dimen name="menu_divider_padding_hor">10px</dimen>
<dimen name="menu_divider_padding_top">20px</dimen> <dimen name="menu_divider_padding_top">20px</dimen>
<dimen name="menu_divider_padding_bottom">20px</dimen> <dimen name="menu_divider_padding_bottom">20px</dimen>
...@@ -60,7 +64,8 @@ ...@@ -60,7 +64,8 @@
<dimen name="menu_title_margin_bottom">10px</dimen> <dimen name="menu_title_margin_bottom">10px</dimen>
<dimen name="menu_state_padding_hor">40px</dimen> <dimen name="menu_state_padding_hor">40px</dimen>
<dimen name="menu_state_padding_ver">20px</dimen> <dimen name="menu_state_padding_ver">20px</dimen>
<dimen name="menu_state_padding_line">20px</dimen> <dimen name="menu_state_padding_bottom">15px</dimen>
<dimen name="menu_state_padding_line">30px</dimen>
<dimen name="menu_state_icon_margin">22px</dimen> <dimen name="menu_state_icon_margin">22px</dimen>
<dimen name="goods_detail_padding_ver">55px</dimen> <dimen name="goods_detail_padding_ver">55px</dimen>
...@@ -182,7 +187,7 @@ ...@@ -182,7 +187,7 @@
<dimen name="ts_menu_title">22sp</dimen> <dimen name="ts_menu_title">22sp</dimen>
<dimen name="ts_menu_subtitle">10sp</dimen> <dimen name="ts_menu_subtitle">10sp</dimen>
<dimen name="ts_menu_subtitle1">8sp</dimen> <dimen name="ts_menu_subtitle1">8sp</dimen>
<dimen name="ts_menu_state">36px</dimen> <dimen name="ts_menu_state">26px</dimen>
<dimen name="ts_setting_name">16sp</dimen> <dimen name="ts_setting_name">16sp</dimen>
<dimen name="ts_setting_desc">14sp</dimen> <dimen name="ts_setting_desc">14sp</dimen>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment