Commit b3bead92 by wjg

add update

parent fc7bd62d
......@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.ihaoin.hooloo.device"
android:versionCode="1"
android:versionName="1.0">
android:versionCode="2"
android:versionName="1.0.2">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
......@@ -24,6 +24,7 @@
<application
android:name=".HLApplication"
android:allowBackup="true"
android:extractNativeLibs="true"
android:icon="@mipmap/hooloo_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
......
......@@ -63,9 +63,9 @@ public class HLApplication extends Application {
// 第一个点单屏默认显示交互屏
if (AppConfig.DEFAULT_SCREEN_NO.equals("1")) {
AppConfig.DEFAULT_PRESENT = PresentState.INTERACTION.getName();
} else {
AppConfig.DEFAULT_PRESENT = PresentState.MENU.getName();
} else {
AppConfig.DEFAULT_PRESENT = PresentState.INTERACTION.getName();
}
// if (AppConfig.DEBUG) { // TODO delete
......
......@@ -22,8 +22,6 @@ import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
import java.util.Arrays;
public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHolder> {
private Context mContext;
......@@ -106,14 +104,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
helper.setGone(R.id.txt_sellout, false);
helper.setGone(R.id.butn_add, true);
View butnAdd = helper.getView(R.id.butn_add);
butnAdd.setOnClickListener(v -> {
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));
butnAdd.setOnClickListener(v -> Utils.showGoodsDetail(mContext, goods));
layoutItem.setOnClickListener(v -> Utils.showGoodsDetail(mContext, goods));
} else {
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;
import io.socket.client.IO;
import io.socket.client.Socket;
/** Linux通信 KDS 菜单屏 */
/** Linux通信 交互屏 */
public class InteractionSocket extends Thread {
private Context mContext;
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 {
@Override
public void run() {
checkUpdate();
// while (true) {
// try {
// if (System.currentTimeMillis() / 1000 % 60 == 0) {
......@@ -38,14 +39,16 @@ public class UpdateService extends Thread {
HttpUtil.checkUpdate(checkUpdateHandler);
}
private Handler checkUpdateHandler = new Handler() {
private CheckUpdateHandler checkUpdateHandler = new CheckUpdateHandler();
private class CheckUpdateHandler extends NetworkHandler {
@Override
public void handleMessage(@NonNull Message msg) {
try {
CheckUpdateVo updateVo = new CheckUpdateVo();
updateVo.setUrl("https://testapi.pecktoy.com/files/upload_test/app-debug.apk");
updateVo.setVersion("1.0.1");
updateVo.setVersionCode(3);
updateVo.setUrl("https://testapi.pecktoy.com/files/upload_test/signed-v10.apk");
updateVo.setVersion("1.0.10");
updateVo.setVersionCode(10);
// Object obj = msg.obj;
// if (msg.what == 0 || obj == null) {
// Utils.i("check update error");
......@@ -77,7 +80,7 @@ public class UpdateService extends Thread {
Utils.i("check update error");
}
}
};
}
private void startDownload(CheckUpdateVo updateVo) {
String filename = "hooloo-device_" + updateVo.getVersion() + "_" + updateVo.getVersionCode() + ".apk";
......@@ -86,7 +89,7 @@ public class UpdateService extends Thread {
new File(path).mkdirs();
}
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);
}
......
......@@ -3,8 +3,8 @@ package com.ihaoin.hooloo.device.config;
import com.ihaoin.hooloo.device.data.enums.PresentState;
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_PRESENT = PresentState.MENU.getName();
......
......@@ -24,4 +24,5 @@ public class Base {
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_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;
public class ApkUtils {
private static final String TAG = "ApkUtils";
// private static final String SP_NAME_PACKAGE_INSTALL_RESULT = "package_install_result";
// private static volatile Method sInstallPackage;
// private static volatile Method sDeletePackage;
......@@ -36,13 +34,14 @@ public class ApkUtils {
@SuppressLint("PackageManagerGetSignatures")
@RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
public static synchronized boolean install(Context context, String apkFile) {
Utils.i("start install: " + apkFile);
File file;
if (TextUtils.isEmpty(apkFile) || !(file = new File(apkFile)).exists())
return false;
//加上apk合法性判断
AppUtils.AppInfo apkInfo = AppUtils.getApkInfo(file);
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;
}
......@@ -51,7 +50,7 @@ public class ApkUtils {
if (appInfo != null) {
// //已安装的版本比apk版本要高, 则不需要安装
// 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() +
// ", apk version code: " + apkInfo.getVersionCode() +
// ", app version code: " + appInfo.getVersionCode());
......@@ -72,7 +71,7 @@ public class ApkUtils {
if (appPackageInfo != null && apkPackageInfo != null &&
!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;
}
} catch (Throwable ignored) {
......@@ -90,7 +89,7 @@ public class ApkUtils {
// boolean success = installByPackageInstaller(context, file, apkInfo);
// sPreferences.edit().putBoolean(packageName, success).apply();
// if (success) {
// Utils.i(TAG, "Install Success[PackageInstaller]: " + file.getAbsolutePath());
// Utils.i( "Install Success[PackageInstaller]: " + file.getAbsolutePath());
// return true;
// }
// }
......@@ -99,17 +98,17 @@ public class ApkUtils {
// if (installByReflect(context, file)) {
// if (sPreferences != null)
// sPreferences.edit().putBoolean(apkInfo.getPackageName(), true).apply();
// Utils.i(TAG, "Install Success[Reflect]", file.getPath());
// Utils.i( "Install Success[Reflect]", file.getPath());
// return true;
// }
if (installByShell(file, DeviceUtils.isDeviceRooted())) {
// if (sPreferences != null)
// sPreferences.edit().putBoolean(apkInfo.getPackageName(), true).apply();
Utils.i(TAG, "Install Success[Shell]: " + file.getPath());
Utils.i("Install Success[Shell]: " + file.getPath());
return true;
}
Utils.i(TAG, "Install Failure: " + file.getAbsolutePath());
Utils.i("Install Failure: " + file.getAbsolutePath());
return false;
}
......@@ -130,7 +129,7 @@ public class ApkUtils {
// //如果是系统app, 则不支持卸载
// AppUtils.AppInfo appInfo = AppUtils.getAppInfo(packageName);
// if (appInfo != null && appInfo.isSystem()) {
// Utils.i(TAG, "Uninstall Failure[System App]: " + packageName);
// Utils.i( "Uninstall Failure[System App]: " + packageName);
// return false;
// }
//
......@@ -139,25 +138,25 @@ public class ApkUtils {
//
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// if (uninstallByPackageInstaller(context, packageName)) {
// Utils.i(TAG, "Uninstall Success[PackageInstaller]: " + packageName);
// Utils.i( "Uninstall Success[PackageInstaller]: " + packageName);
// return true;
// }
// }
//
// if (uninstallByReflect(context, packageName)) {
// Utils.i(TAG, "Uninstall Success[Reflect]: " + packageName);
// Utils.i( "Uninstall Success[Reflect]: " + packageName);
// return true;
// }
//
// if (uninstallByShell(packageName, DeviceUtils.isDeviceRooted())) {
// Utils.i(TAG, "Uninstall Success[Shell]: " + packageName);
// Utils.i( "Uninstall Success[Shell]: " + packageName);
// return true;
// }
//
// } catch (Throwable ignored) {
// }
//
// Utils.i(TAG, "Uninstall Failure: " + packageName);
// Utils.i( "Uninstall Failure: " + packageName);
// return false;
// }
......@@ -181,11 +180,10 @@ public class ApkUtils {
// return executeShell(cmd, isRoot) || executeShell(cmd, !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);
Utils.i(TAG, "ShellCommand Result: " + result.toString());
Utils.i("ShellCommand Result: " + result.toString());
return result.successMsg != null && result.successMsg.toLowerCase(Locale.US).contains("success");
}
......@@ -193,7 +191,7 @@ public class ApkUtils {
// * 调用反射方式安装, 通过PackageManager#installPackage方法进行安装, 该方法在7.0已经移除
// */
// private static boolean installByReflect(Context context, File file) throws InterruptedException {
// Utils.i(TAG, "InstallByReflect: "+ file.getPath());
// Utils.i( "InstallByReflect: "+ file.getPath());
// Method installer = getInstallPackageMethod();
// if (installer == null)
// return false;
......@@ -233,7 +231,7 @@ public class ApkUtils {
// * 调用反射方式卸载, 通过PackageManager#deletePackage, 该方法在7.0已经移除
// */
// private static boolean uninstallByReflect(Context context, String packageName) throws InterruptedException {
// Utils.i(TAG, "UninstallByReflect", packageName);
// Utils.i( "UninstallByReflect", packageName);
// Method deleter = getDeletePackageMethod();
// if (deleter == null)
// return false;
......@@ -270,7 +268,7 @@ public class ApkUtils {
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
// @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
// 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;
// InputStream in = null;
......@@ -310,7 +308,7 @@ public class ApkUtils {
// throw e;
// } catch (Throwable e) {
// e.printStackTrace();
// Utils.i(TAG, e);
// Utils.i( e);
// } finally {
// //如果会话已经开启, 但是没有成功, 则需要将会话进行销毁
// try {
......@@ -329,7 +327,7 @@ public class ApkUtils {
// @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
// @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
// private static boolean uninstallByPackageInstaller(Context context, String packageName) {
// Utils.i(TAG, "UninstallByPackageInstaller", packageName);
// Utils.i( "UninstallByPackageInstaller", packageName);
// try {
// InstallReceiver callback = new InstallReceiver(context, false, packageName);
// PackageInstaller installer = Utils.getApp().getPackageManager().getPackageInstaller();
......@@ -418,7 +416,7 @@ public class ApkUtils {
// status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE);
// mSuccess = status == PackageInstaller.STATUS_SUCCESS;
// }
// Utils.i(TAG, mParam, mOperate + " Result: " + mSuccess + "[" + status + "]");
// Utils.i( mParam, mOperate + " Result: " + mSuccess + "[" + status + "]");
// } finally {
// mCountDownLatch.countDown();
// }
......
......@@ -7,6 +7,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager;
......@@ -37,6 +38,7 @@ import com.ihaoin.hooloo.device.adapter.GoodsAdapter;
import com.ihaoin.hooloo.device.adapter.RecommendAdapter;
import com.ihaoin.hooloo.device.component.InteractionSocket;
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.SettingsQueue;
import com.ihaoin.hooloo.device.component.UpdateService;
......@@ -113,6 +115,7 @@ public class LauncherActivity extends Activity {
initSettingsQueue();
startMachineClient();
startTimeoutThread();
getMachineCode();
......@@ -146,14 +149,14 @@ public class LauncherActivity extends Activity {
}
private void getMachineCode() {
// AppConfig.MACHINE_CODE = SharedPreferencesUtils.getMachineCode(this);
// if (StringUtils.isEmpty(AppConfig.MACHINE_CODE)) {
// Utils.fastBroadcast(this, Base.BROADCAST_SOCKET_GET_MACHINE_CODE); // 从设备上获取机器编码
// return;
// }
// Utils.i("machine code: " + AppConfig.MACHINE_CODE);
// loadData();
// HttpUtil.postRegistrationId();
AppConfig.MACHINE_CODE = SharedPreferencesUtils.getMachineCode(this);
if (StringUtils.isEmpty(AppConfig.MACHINE_CODE)) {
machineSocket.getMachineCode(); // 从设备上获取机器编码
return;
}
Utils.i("machine code: " + AppConfig.MACHINE_CODE);
loadData();
HttpUtil.postRegistrationId();
}
private void initRecommends() {
......@@ -447,6 +450,9 @@ public class LauncherActivity extends Activity {
this.unregistSkuChangeReceiver();
this.unregistGoodsChangeReceiver();
this.unregistTouchReceiver();
stopMachineClient();
stopKdsClient();
stopIAClient();
System.exit(0);
}
......@@ -613,6 +619,9 @@ public class LauncherActivity extends Activity {
Utils.showToast(this, "未获取到菜单屏硬件");
return;
}
Point point = new Point();
displays[1].getRealSize(point);
Utils.i("point: " + point.toString());
menuView = new MenuPresentation(this, displays[1]);
menuView.show();
......@@ -633,8 +642,21 @@ public class LauncherActivity extends Activity {
}
private KDSSocket kdsSocket = null;
private MachineInfoSocket machineSocket = 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() {
kdsSocket = new KDSSocket(this);
kdsSocket.start();
......
......@@ -19,7 +19,7 @@
android:strokeColor="#FFFFFFFF">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#33DDDDDD"
android:endColor="#22DDDDDD"
android:endX="18"
android:endY="30"
android:startColor="#00FFFFFF"
......
......@@ -104,7 +104,6 @@
android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px">
<ImageView
android:layout_width="@dimen/ic_dialog_close"
......
......@@ -208,7 +208,6 @@
android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px">
<ImageView
android:layout_width="@dimen/ic_dialog_close"
......
......@@ -17,7 +17,6 @@
android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px">
<ImageView
android:layout_width="@dimen/ic_dialog_close"
......
......@@ -17,7 +17,6 @@
android:layout_marginTop="@dimen/dialog_close_margin"
android:layout_marginEnd="@dimen/dialog_close_margin"
android:layout_marginBottom="@dimen/dialog_close_margin"
android:foreground="?selectableItemBackground"
android:padding="20px">
<ImageView
android:layout_width="@dimen/ic_dialog_close"
......
......@@ -120,8 +120,7 @@
android:layout_width="@dimen/ic_add_size"
android:layout_height="@dimen/ic_add_size"
android:layout_alignParentEnd="true"
android:background="@mipmap/jiahao"
android:foreground="?selectableItemBackground" />
android:background="@mipmap/jiahao" />
</RelativeLayout>
</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
......@@ -43,6 +43,10 @@
<dimen name="tip_margin_top">40px</dimen>
<dimen name="tip_padding_top">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_top">60px</dimen>
<dimen name="menu_divider_padding_bottom">50px</dimen>
......@@ -54,12 +58,13 @@
<dimen name="menu_logo_bar">110px</dimen>
<dimen name="menu_progress_start">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_title_margin_top">20px</dimen>
<dimen name="menu_title_margin_bottom">12px</dimen>
<dimen name="menu_state_padding_hor">48px</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_icon_margin">22px</dimen>
......
......@@ -43,6 +43,10 @@
<dimen name="tip_margin_top">40px</dimen>
<dimen name="tip_padding_top">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_top">20px</dimen>
<dimen name="menu_divider_padding_bottom">20px</dimen>
......@@ -60,7 +64,8 @@
<dimen name="menu_title_margin_bottom">10px</dimen>
<dimen name="menu_state_padding_hor">40px</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="goods_detail_padding_ver">55px</dimen>
......@@ -182,7 +187,7 @@
<dimen name="ts_menu_title">22sp</dimen>
<dimen name="ts_menu_subtitle">10sp</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_desc">14sp</dimen>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment