1 文件已重命名
25个文件已修改
39个文件已添加
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="CompilerConfiguration"> |
| | | <bytecodeTargetLevel target="1.8" /> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="GradleMigrationSettings" migrationVersion="1" /> |
| | | <component name="GradleSettings"> |
| | | <option name="linkedExternalProjectsSettings"> |
| | | <GradleProjectSettings> |
| | | <option name="testRunner" value="PLATFORM" /> |
| | | <option name="distributionType" value="DEFAULT_WRAPPED" /> |
| | | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
| | | <option name="gradleHome" value="$PROJECT_DIR$/../../AndroidStudio/.gradle/wrapper/dists/gradle-6.7.1-bin/bwlcbys1h7rz3272sye1xwiv6/gradle-6.7.1" /> |
| | | <option name="gradleJvm" value="11" /> |
| | | <option name="modules"> |
| | | <set> |
| | | <option value="$PROJECT_DIR$" /> |
| | | <option value="$PROJECT_DIR$/app" /> |
| | | </set> |
| | | </option> |
| | | <option name="resolveModulePerSourceSet" value="false" /> |
| | | <option name="useQualifiedModuleNames" value="true" /> |
| | | </GradleProjectSettings> |
| | | </option> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="RemoteRepositoriesConfiguration"> |
| | | <remote-repository> |
| | | <option name="id" value="central" /> |
| | | <option name="name" value="Maven Central repository" /> |
| | | <option name="url" value="https://repo1.maven.org/maven2" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="jboss.community" /> |
| | | <option name="name" value="JBoss Community repository" /> |
| | | <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="maven3" /> |
| | | <option name="name" value="maven3" /> |
| | | <option name="url" value="https://maven.aliyun.com/repository/google" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="maven" /> |
| | | <option name="name" value="maven" /> |
| | | <option name="url" value="https://maven.aliyun.com/repository/public" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="maven2" /> |
| | | <option name="name" value="maven2" /> |
| | | <option name="url" value="https://maven.aliyun.com/repository/central" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="BintrayJCenter" /> |
| | | <option name="name" value="BintrayJCenter" /> |
| | | <option name="url" value="https://jcenter.bintray.com/" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="maven5" /> |
| | | <option name="name" value="maven5" /> |
| | | <option name="url" value="https://jitpack.io" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="maven4" /> |
| | | <option name="name" value="maven4" /> |
| | | <option name="url" value="https://maven.aliyun.com/repository/gradle-plugin" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="Google" /> |
| | | <option name="name" value="Google" /> |
| | | <option name="url" value="https://dl.google.com/dl/android/maven2/" /> |
| | | </remote-repository> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" /> |
| | | </project> |
| | |
| | | |
| | | android { |
| | | compileSdkVersion 32 |
| | | buildToolsVersion "33.0.0" |
| | | /* buildToolsVersion "33.0.0"*/ |
| | | defaultConfig { |
| | | applicationId "com.lotaai.canguiayw" |
| | | minSdkVersion 22 |
| | |
| | | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' |
| | | |
| | | //轮播图 |
| | | implementation 'com.youth.banner:banner:1.4.9' |
| | | implementation 'com.youth.banner:banner:2.0.11' |
| | | implementation 'com.github.bumptech.glide:glide:4.11.0' |
| | | annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' |
| | | |
New file |
| | |
| | | [{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | package="com.lotaai.canguiayw"> |
| | | |
| | | <uses-permission android:name="android.permission.INTERNET"/> |
| | | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> |
| | | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> |
| | | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
| | | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" |
| | | tools:ignore="ScopedStorage" /> |
| | | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> |
| | | <uses-permission android:name="android.permission.WAKE_LOCK"/> |
| | | |
| | | <application |
| | | android:name=".application.ActivityLifecycleApplcation" |
| | | android:name=".application.App" |
| | | android:allowBackup="true" |
| | | android:icon="@mipmap/ic_launcher" |
| | | android:label="@string/app_name" |
| | | android:requestLegacyExternalStorage="true" |
| | | android:networkSecurityConfig="@xml/network_security_config" |
| | | android:roundIcon="@mipmap/ic_launcher_round" |
| | | android:supportsRtl="true" |
| | | android:theme="@style/AppTheme"> |
| | | <activity android:name=".MainActivity"> |
| | | android:theme="@style/AppTheme" |
| | | tools:replace="android:theme,android:label,android:allowBackup" > |
| | | |
| | | <activity android:name=".MainActivity" |
| | | android:screenOrientation="landscape" |
| | | android:exported="true"> |
| | | |
| | | </activity> |
| | | |
| | | <activity android:name=".CheckUserIdActivity" android:screenOrientation="landscape"/> |
| | | <activity android:name=".CunOjbActivity" android:screenOrientation="landscape"/> |
| | | |
| | | <activity android:name=".StartSaveActivity" android:screenOrientation="landscape"/> |
| | | |
| | | |
| | | <activity android:name=".TakeActivity" android:screenOrientation="landscape"/> |
| | | <activity android:name="ManageActivity" android:screenOrientation="landscape" android:windowSoftInputMode="adjustPan"/> |
| | | <activity android:name=".AdminLoginActivity" android:screenOrientation="landscape" /> |
| | | <activity android:name=".LoginActivity" |
| | | android:screenOrientation="landscape" |
| | | android:exported="true" > |
| | | <intent-filter> |
| | | <action android:name="android.intent.action.MAIN" /> |
| | | |
| | | <category android:name="android.intent.category.LAUNCHER" /> |
| | | </intent-filter> |
| | | </activity> |
| | | <activity android:name=".TakeActivity"/> |
| | | <activity android:name="ManageActivity" android:windowSoftInputMode="adjustPan"/> |
| | | <activity android:name=".AdminLoginActivity"/> |
| | | |
| | | <service |
| | | android:name=".device.service.CanGuiService" |
| | |
| | | |
| | | import android.util.Log; |
| | | |
| | | import com.blankj.utilcode.util.ConvertUtils; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.blankj.utilcode.util.ThreadUtils; |
| | | import com.lotaai.canguiayw.CThreadPoolExecutor; |
| | | import com.lotaai.canguiayw.application.App; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | public static String[] getAllDevices() { |
| | | SerialPortFinder serialPortFinder = new SerialPortFinder(); |
| | | String[] allDevices = serialPortFinder.getAllDevices(); |
| | | for (int i=0; i<allDevices.length; i++) { |
| | | for (int i = 0; i < allDevices.length; i++) { |
| | | allDevices[i] = "/dev/" + allDevices[i]; |
| | | Log.d(TAG, "No." + (i+1) + " = " + allDevices[i]); |
| | | Log.d(TAG, "No." + (i + 1) + " = " + allDevices[i]); |
| | | } |
| | | return allDevices; |
| | | } |
| | | |
| | | /** |
| | | * 打开串口 |
| | | * |
| | | * @return serialPort串口对象 |
| | | */ |
| | | public SerialPort openSerialPort(String path, int baudrate){ |
| | | public SerialPort openSerialPort(final String path, final int baudrate) { |
| | | try { |
| | | serialPort = new SerialPort(new File(path), baudrate, 0); |
| | | this.serialPortStatus = true; |
| | |
| | | @Override |
| | | public void run() { |
| | | //判断进程是否在运行,更安全的结束进程 |
| | | while (!threadStatus){ |
| | | while (!threadStatus) { |
| | | byte[] buffer = new byte[64]; |
| | | int size; //读取数据的大小 |
| | | try { |
| | | size = inputStream.read(buffer); |
| | | if (size > 0){ |
| | | if (onDataReceiveListener!=null) { |
| | | if (size > 0) { |
| | | if (onDataReceiveListener != null) { |
| | | onDataReceiveListener.onDataReceive(buffer, size); |
| | | } |
| | | |
| | | |
| | | // LogUtils.i(TAG, "锁串口返回:" + ConvertUtils.bytes2HexString(buffer)); |
| | | } |
| | | } catch (IOException e) { |
| | | LogUtils.e(TAG, "锁串口返回run: 数据读取异常:" +e.toString()); |
| | | } catch (final IOException e) { |
| | | LogUtils.e(TAG, "锁串口返回run: 数据读取异常:" + e.toString()); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeSuccess(App.app, "锁串口返回run: 数据读取异常:" + e.toString(), 3).show(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | SettingConfig.getInstance().getExecutor().execute(syncRunnable); |
| | | } catch (IOException e) { |
| | | LogUtils.e(TAG, "openSerialPort: 打开串口异常:" + e.toString()); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | } |
| | | }); |
| | | return serialPort; |
| | | } |
| | | LogUtils.i(TAG, "openSerialPort: 打开串口:" + path + ", 波特率:" + baudrate); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeSuccess(App.app, "打开串口:" + path + ", 波特率:" + baudrate, 3).show(); |
| | | } |
| | | }); |
| | | return serialPort; |
| | | } |
| | | |
| | |
| | | this.threadStatus = true; //线程状态 |
| | | serialPort.close(); |
| | | } catch (IOException e) { |
| | | Log.e(TAG, "closeSerialPort: 关闭串口异常:"+e.toString()); |
| | | Log.e(TAG, "closeSerialPort: 关闭串口异常:" + e.toString()); |
| | | return; |
| | | } |
| | | Log.d(TAG, "closeSerialPort: 关闭串口成功"); |
| | |
| | | * 发送串口指令(字符串) |
| | | * @param data String数据指令 |
| | | */ |
| | | public void sendSerialPort(String data){ |
| | | public void sendSerialPort(String data) { |
| | | byte[] sendData = data.getBytes(); //string转byte[] |
| | | sendSerialPort(sendData); |
| | | } |
| | | |
| | | public void sendSerialPort(byte[] sendData) { |
| | | try { |
| | | if (sendData==null){ |
| | | if (sendData == null) { |
| | | return; |
| | | } |
| | | this.data_ = new String(sendData); |
| | | if (sendData.length > 0) { |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for (int i=0; i<sendData.length; i++) { |
| | | for (int i = 0; i < sendData.length; i++) { |
| | | stringBuffer.append(String.format("0x%02x", sendData[i]) + " "); |
| | | } |
| | | // LogUtils.i(TAG, "发送串口数据:" + stringBuffer.toString()); |
| | | outputStream.write(sendData); |
| | | outputStream.flush(); |
| | | } |
| | | } catch (IOException e) { |
| | | LogUtils.e(TAG, "sendSerialPort: 串口数据发送失败:"+e.toString()); |
| | | } catch (final IOException e) { |
| | | LogUtils.e(TAG, "sendSerialPort: 串口数据发送失败:" + e.toString()); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeSuccess(App.app, "串口数据发送失败:" + e.toString(), 3).show(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //这是写了一监听器来监听接收数据 |
| | | public OnDataReceiveListener onDataReceiveListener = null; |
| | | |
| | | public interface OnDataReceiveListener { |
| | | void onDataReceive(byte[] buffer, int size); |
| | | } |
| | | |
| | | public void setOnDataReceiveListener(OnDataReceiveListener dataReceiveListener) { |
| | | onDataReceiveListener = dataReceiveListener; |
| | | } |
| | |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.lotaai.canguiayw.device.service.CanGuiService; |
| | | |
| | | public class AdminLoginActivity extends AppCompatActivity { |
| | | private Context context; |
New file |
| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.os.Handler; |
| | | import android.os.Looper; |
| | | import android.util.Log; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.concurrent.Callable; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.Future; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadFactory; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * <p>@Description: 自定义固定大小的线程池 |
| | | * 每次提交一个任务就创建一个线程,直到线程达到线程池的最大大小。 |
| | | * 线程池的大小一旦达到最大值就会保持不变,如果某个线程因为执行异常而结束,那么线程池会补充一个新线程。 |
| | | * <p> |
| | | * 合理利用线程池能够带来三个好处: |
| | | * 第一:降低资源消耗。通过重复利用已创建的线程降低线程创建和销毁造成的消耗。 |
| | | * 第二:提高响应速度。当任务到达时,任务可以不需要等到线程创建就能立即执行。 |
| | | * 第三:提高线程的可管理性。线程是稀缺资源,如果无限制的创建,不仅会消耗系统资源,还会降低系统的稳定性,使用线程池可以进行统一的分配,调优和监控。 |
| | | * 我们可以通过ThreadPoolExecutor来创建一个线程池: |
| | | * new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, milliseconds,runnableTaskQueue, handler); |
| | | * <p> |
| | | * corePoolSize(线程池的基本大小): |
| | | * 当提交一个任务到线程池时,线程池会创建一个线程来执行任务, |
| | | * 即使其他空闲的基本线程能够执行新任务也会创建线程,等到需要执行的任务数大于线程池基本大小时就不再创建。 |
| | | * 如果调用了线程池的prestartAllCoreThreads方法,线程池会提前创建并启动所有基本线程。 |
| | | * <p> |
| | | * runnableTaskQueue(任务队列):用于保存等待执行的任务的阻塞队列。 可以选择以下几个阻塞队列。 |
| | | * ArrayBlockingQueue:是一个基于数组结构的有界阻塞队列,此队列按 FIFO(先进先出)原则对元素进行排序。 |
| | | * <p> |
| | | * LinkedBlockingQueue:一个基于链表结构的阻塞队列,此队列按FIFO (先进先出) 排序元素,吞吐量通常要高于ArrayBlockingQueue。 |
| | | * 静态工厂方法Executors.newFixedThreadPool()使用了这个队列。 |
| | | * <p> |
| | | * SynchronousQueue:一个不存储元素的阻塞队列。每个插入操作必须等到另一个线程调用移除操作,否则插入操作一直处于阻塞状态, |
| | | * 吞吐量通常要高于LinkedBlockingQueue,静态工厂方法Executors.newCachedThreadPool使用了这个队列。 |
| | | * <p> |
| | | * PriorityBlockingQueue:一个具有优先级的无限阻塞队列。 |
| | | * <p> |
| | | * maximumPoolSize(线程池最大大小): |
| | | * 线程池允许创建的最大线程数。如果队列满了,并且已创建的线程数小于最大线程数,则线程池会再创建新的线程执行任务。值得注意的是如果使用了无界的任务队列这个参数就没什么效果。 |
| | | * <p> |
| | | * ThreadFactory: |
| | | * 用于设置创建线程的工厂,可以通过线程工厂给每个创建出来的线程设置更有意义的名字。 |
| | | * <p> |
| | | * RejectedExecutionHandler(饱和策略):当队列和线程池都满了,说明线程池处于饱和状态,那么必须采取一种策略处理提交的新任务。 |
| | | * 这个策略默认情况下是AbortPolicy,表示无法处理新任务时抛出异常。以下是JDK1.5提供的四种策略。 |
| | | * AbortPolicy:直接抛出异常。 |
| | | * CallerRunsPolicy:只用调用者所在线程来运行任务。 |
| | | * DiscardOldestPolicy:丢弃队列里最近的一个任务,并执行当前任务。 |
| | | * DiscardPolicy:不处理,丢弃掉。 |
| | | * 当然也可以根据应用场景需要来实现RejectedExecutionHandler接口自定义策略。如记录日志或持久化不能处理的任务。 |
| | | * <p> |
| | | * keepAliveTime(线程活动保持时间):线程池的工作线程空闲后,保持存活的时间。 |
| | | * 所以如果任务很多,并且每个任务执行的时间比较短,可以调大这个时间,提高线程的利用率。 |
| | | * <p> |
| | | * TimeUnit(线程活动保持时间的单位):可选的单位有天(DAYS),小时(HOURS),分钟(MINUTES), |
| | | * 毫秒(MILLISECONDS),微秒(MICROSECONDS, 千分之一毫秒)和毫微秒(NANOSECONDS, 千分之一微秒)。</p> |
| | | * |
| | | */ |
| | | public class CThreadPoolExecutor { |
| | | |
| | | private static final String TAG = CThreadPoolExecutor.class.getSimpleName(); |
| | | private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();// CPU个数 |
| | | // private static final int CORE_POOL_SIZE = CPU_COUNT + 1;// 线程池中核心线程的数量 |
| | | // private static final int MAXIMUM_POOL_SIZE = 2 * CPU_COUNT + 1;// 线程池中最大线程数量 |
| | | private static final int CORE_POOL_SIZE = Math.max(2, Math.min(CPU_COUNT - 1, 4));// 线程池中核心线程的数量 |
| | | private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1;// 线程池中最大线程数量 |
| | | private static final long KEEP_ALIVE_TIME = 30L;// 非核心线程的超时时长,当系统中非核心线程闲置时间超过keepAliveTime之后,则会被回收。如果ThreadPoolExecutor的allowCoreThreadTimeOut属性设置为true,则该参数也表示核心线程的超时时长 |
| | | private static final int WAIT_COUNT = 128; // 最多排队个数,这里控制线程创建的频率 |
| | | |
| | | private static ThreadPoolExecutor pool = createThreadPoolExecutor(); |
| | | |
| | | private static ThreadPoolExecutor createThreadPoolExecutor() { |
| | | if (pool == null) { |
| | | pool = new ThreadPoolExecutor( |
| | | CORE_POOL_SIZE, |
| | | MAXIMUM_POOL_SIZE, |
| | | KEEP_ALIVE_TIME, |
| | | TimeUnit.SECONDS, |
| | | new LinkedBlockingQueue<Runnable>(WAIT_COUNT), |
| | | new CThreadFactory("CThreadPool", Thread.NORM_PRIORITY - 2), |
| | | new CHandlerException()); |
| | | } |
| | | return pool; |
| | | } |
| | | |
| | | public static class CThreadFactory implements ThreadFactory { |
| | | private AtomicInteger counter = new AtomicInteger(1); |
| | | private String prefix = ""; |
| | | private int priority = Thread.NORM_PRIORITY; |
| | | |
| | | public CThreadFactory(String prefix, int priority) { |
| | | this.prefix = prefix; |
| | | this.priority = priority; |
| | | } |
| | | |
| | | public CThreadFactory(String prefix) { |
| | | this.prefix = prefix; |
| | | } |
| | | |
| | | public Thread newThread(Runnable r) { |
| | | Thread executor = new Thread(r, prefix + " #" + counter.getAndIncrement()); |
| | | executor.setDaemon(true); |
| | | executor.setPriority(priority); |
| | | return executor; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 抛弃当前的任务 |
| | | */ |
| | | private static class CHandlerException extends ThreadPoolExecutor.AbortPolicy { |
| | | |
| | | @Override |
| | | public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { |
| | | Log.d(TAG, "rejectedExecution:" + r); |
| | | Log.e(TAG, logAllThreadStackTrace().toString()); |
| | | // Tips.showForce("任务被拒绝", 5000); |
| | | if (!pool.isShutdown()) { |
| | | pool.shutdown(); |
| | | pool = null; |
| | | } |
| | | |
| | | pool = createThreadPoolExecutor(); |
| | | } |
| | | } |
| | | |
| | | private static ExecutorService jobsForUI = Executors.newFixedThreadPool( |
| | | CORE_POOL_SIZE, new CThreadFactory("CJobsForUI", Thread.NORM_PRIORITY - 1)); |
| | | |
| | | /** |
| | | * 启动一个消耗线程,常驻后台 |
| | | * |
| | | * @param r |
| | | */ |
| | | public static void startConsumer(final Runnable r, final String name) { |
| | | runInBackground(new Runnable() { |
| | | public void run() { |
| | | new CThreadFactory(name, Thread.NORM_PRIORITY - 3).newThread(r).start(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 提交到其他线程去跑,需要取数据的时候会等待任务完成再继续 |
| | | * |
| | | * @param task |
| | | * @return |
| | | */ |
| | | public static <T> Future<T> submitTask(Callable<T> task) { |
| | | return jobsForUI.submit(task); |
| | | } |
| | | |
| | | /** |
| | | * 强制清理任务 |
| | | * |
| | | * @param task |
| | | * @return |
| | | */ |
| | | public static <T> void cancelTask(Future<T> task) { |
| | | if (task != null) { |
| | | task.cancel(true); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 从 Future 中获取值,如果发生异常,打日志 |
| | | * |
| | | * @param future |
| | | * @param tag |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public static <T> T getFromTask(Future<T> future, String tag, String name) { |
| | | try { |
| | | return future.get(); |
| | | } catch (Exception e) { |
| | | Log.e(tag, (name != null ? name + ": " : "") + e.toString()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static void runInBackground(Runnable runnable) { |
| | | if (pool == null) { |
| | | createThreadPoolExecutor(); |
| | | } |
| | | |
| | | pool.execute(runnable); |
| | | // Future future = pool.submit(runnable); |
| | | // try { |
| | | // future.get(); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (ExecutionException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | } |
| | | |
| | | private static Thread mainThread; |
| | | private static Handler mainHandler; |
| | | |
| | | static { |
| | | Looper mainLooper = Looper.getMainLooper(); |
| | | mainThread = mainLooper.getThread(); |
| | | mainHandler = new Handler(mainLooper); |
| | | } |
| | | |
| | | public static boolean isOnMainThread() { |
| | | return mainThread == Thread.currentThread(); |
| | | } |
| | | |
| | | public static void runOnMainThread(Runnable r) { |
| | | if (isOnMainThread()) { |
| | | r.run(); |
| | | } else { |
| | | mainHandler.post(r); |
| | | } |
| | | } |
| | | |
| | | public static void runOnMainThread(Runnable r, long delayMillis) { |
| | | if (delayMillis <= 0) { |
| | | runOnMainThread(r); |
| | | } else { |
| | | mainHandler.postDelayed(r, delayMillis); |
| | | } |
| | | } |
| | | |
| | | // 用于记录后台等待的Runnable,第一个参数外面的Runnable,第二个参数是等待中的Runnable |
| | | private static HashMap<Runnable, Runnable> mapToMainHandler = new HashMap<Runnable, Runnable>(); |
| | | |
| | | public static void runInBackground(final Runnable runnable, long delayMillis) { |
| | | if (delayMillis <= 0) { |
| | | runInBackground(runnable); |
| | | } else { |
| | | Runnable mainRunnable = new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | | mapToMainHandler.remove(runnable); |
| | | pool.execute(runnable); |
| | | } |
| | | }; |
| | | |
| | | mapToMainHandler.put(runnable, mainRunnable); |
| | | mainHandler.postDelayed(mainRunnable, delayMillis); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 对runOnMainThread的,移除Runnable |
| | | * |
| | | * @param r |
| | | */ |
| | | public static void removeCallbackOnMainThread(Runnable r) { |
| | | mainHandler.removeCallbacks(r); |
| | | } |
| | | |
| | | public static void removeCallbackInBackground(Runnable runnable) { |
| | | Runnable mainRunnable = mapToMainHandler.get(runnable); |
| | | if (mainRunnable != null) { |
| | | mainHandler.removeCallbacks(mainRunnable); |
| | | } |
| | | } |
| | | |
| | | public static void logStatus() { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("getActiveCount"); |
| | | sb.append(pool.getActiveCount()); |
| | | sb.append("\ngetTaskCount"); |
| | | sb.append(pool.getTaskCount()); |
| | | sb.append("\ngetCompletedTaskCount"); |
| | | sb.append(pool.getCompletedTaskCount()); |
| | | Log.d(TAG, sb.toString()); |
| | | } |
| | | |
| | | public static StringBuilder logAllThreadStackTrace() { |
| | | StringBuilder builder = new StringBuilder(); |
| | | Map<Thread, StackTraceElement[]> liveThreads = Thread.getAllStackTraces(); |
| | | for (Iterator<Thread> i = liveThreads.keySet().iterator(); i.hasNext(); ) { |
| | | Thread key = i.next(); |
| | | builder.append("Thread ").append(key.getName()) |
| | | .append("\n"); |
| | | StackTraceElement[] trace = liveThreads.get(key); |
| | | for (int j = 0; j < trace.length; j++) { |
| | | builder.append("\tat ").append(trace[j]).append("\n"); |
| | | } |
| | | } |
| | | return builder; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | for (int i = 0; i < 10000; i++) { |
| | | final int index = i; |
| | | System.out.println("index=" + index); |
| | | CThreadPoolExecutor.runInBackground(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | System.out.println("正在运行第[" + (index + 1) + "]个线程."); |
| | | } |
| | | }); |
| | | try { |
| | | Thread.sleep(10); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.text.Editable; |
| | | import android.text.InputType; |
| | | import android.view.View; |
| | | import android.widget.Button; |
| | | import android.widget.EditText; |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.blankj.utilcode.util.CacheDiskUtils; |
| | | import com.blankj.utilcode.util.GsonUtils; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.lotaai.canguiayw.common.HttpLoggerInterceptor; |
| | | import com.lotaai.canguiayw.common.HttpUrlDefine; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.lotaai.canguiayw.data.BaseDto; |
| | | import com.lotaai.canguiayw.device.DeviceMessage; |
| | | import com.lotaai.canguiayw.device.MessageType; |
| | | import com.lotaai.canguiayw.mqtt.DeviceAction; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.TreeMap; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | | import okhttp3.FormBody; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | |
| | | //验证员工号 |
| | | public class CheckUserIdActivity extends AppCompatActivity { |
| | | private Context context; |
| | | private EditText editText; |
| | | |
| | | int type; //1 存 2 取 |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_checkuser); |
| | | type=getIntent().getIntExtra("type",0); |
| | | context = CheckUserIdActivity.this; |
| | | editText = (EditText) findViewById(R.id.edt_borrow_case_number); |
| | | editText.setInputType(InputType.TYPE_NULL); // 屏蔽软键盘 |
| | | DynamicToast.Config.getInstance().setTextSize(30).apply(); |
| | | // 软键盘设置统一按钮监听方法,数字键直接将text内容填充到edittext中,删除和确认才设置事件 |
| | | View.OnClickListener clickListener = new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | int index = editText.getSelectionEnd(); |
| | | Editable editable = editText.getText(); |
| | | int key = v.getId(); |
| | | if (key == R.id.borrow_bt_delete) { |
| | | if (0 != index) { |
| | | editable.delete(index - 1, index); |
| | | } |
| | | } else if (key == R.id.borrow_bt_confirm) { |
| | | // 调用后台 |
| | | String gridNo = editable.toString(); |
| | | if (null == gridNo || "".equals(gridNo.trim())) { |
| | | DynamicToast.makeError(context, "员工号不能为空。", 3).show(); |
| | | return; |
| | | } else { |
| | | if (gridNo.length() !=6) { |
| | | editText.setText(""); |
| | | DynamicToast.makeError(context, "员工号输入错误,请重试。", 3).show(); |
| | | return; |
| | | } |
| | | //调用判断是否可以取餐 |
| | | editText.setText(""); |
| | | takeCheckCode(gridNo); |
| | | } |
| | | |
| | | } else { |
| | | Button button = (Button) v; |
| | | editable.insert(index, button.getText()); |
| | | } |
| | | } |
| | | }; |
| | | View view1 = findViewById(R.id.borrow_bt1); |
| | | View view2 = findViewById(R.id.borrow_bt2); |
| | | View view3 = findViewById(R.id.borrow_bt3); |
| | | View view4 = findViewById(R.id.borrow_bt4); |
| | | View view5 = findViewById(R.id.borrow_bt5); |
| | | View view6 = findViewById(R.id.borrow_bt6); |
| | | View view7 = findViewById(R.id.borrow_bt7); |
| | | View view8 = findViewById(R.id.borrow_bt8); |
| | | View view9 = findViewById(R.id.borrow_bt9); |
| | | View view0 = findViewById(R.id.borrow_bt0); |
| | | View view11 = findViewById(R.id.borrow_bt_delete); |
| | | View view12 = findViewById(R.id.borrow_bt_confirm); |
| | | view1.setOnClickListener(clickListener); |
| | | view2.setOnClickListener(clickListener); |
| | | view3.setOnClickListener(clickListener); |
| | | view4.setOnClickListener(clickListener); |
| | | view5.setOnClickListener(clickListener); |
| | | view6.setOnClickListener(clickListener); |
| | | view7.setOnClickListener(clickListener); |
| | | view8.setOnClickListener(clickListener); |
| | | view9.setOnClickListener(clickListener); |
| | | view0.setOnClickListener(clickListener); |
| | | view11.setOnClickListener(clickListener); |
| | | view12.setOnClickListener(clickListener); |
| | | } |
| | | |
| | | public void backMian(View view) { |
| | | DeviceMessage message = new DeviceMessage(); |
| | | message.setMessageType(MessageType.FANHUI.ordinal()); |
| | | EventBus.getDefault().post(message); |
| | | finish(); |
| | | } |
| | | |
| | | public void takeCheckCode(String code) { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
| | | OkHttpClient client = new OkHttpClient.Builder() |
| | | .connectTimeout(20, TimeUnit.SECONDS)//响应时间,读取时间 |
| | | .readTimeout(20, TimeUnit.SECONDS) |
| | | .callTimeout(20, TimeUnit.SECONDS) |
| | | .addInterceptor(loggingInterceptor)//添加日志拦截器 |
| | | .build(); |
| | | |
| | | LogUtils.i(CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code), code); |
| | | RequestBody body = new FormBody.Builder() |
| | | .build(); |
| | | |
| | | final Request request = new Request.Builder() |
| | | .url(HttpUrlDefine.chekobj+"?workNum="+code) |
| | | /* .addHeader("language", "zh-CN")*/ |
| | | .post(body) |
| | | .build(); |
| | | client.newCall(request).enqueue(new Callback() { |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeError(context, "请求失败!", 3).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:" + result); |
| | | final BaseDto baseDto = GsonUtils.fromJson(result, BaseDto.class); |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (baseDto.isData()) { |
| | | DynamicToast.makeSuccess(context, "员工号验证成功!", 3).show(); |
| | | switch (type){ |
| | | |
| | | case 1: |
| | | startActivity(new Intent(CheckUserIdActivity.this,CunOjbActivity.class)); |
| | | finish(); |
| | | break; |
| | | |
| | | /* case 2: |
| | | startActivity(new Intent(CheckUserIdActivity.this,TakeActivity.class)); |
| | | finish(); |
| | | break;*/ |
| | | } |
| | | |
| | | }else{ |
| | | DynamicToast.makeError(context, "员工号验证失败!", 3).show(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private Handler showHandler = new Handler() { |
| | | @Override |
| | | public void handleMessage(Message msg) { |
| | | if (msg.what == 0) { |
| | | DynamicToast.makeError(context, msg.obj.toString(), 3).show(); |
| | | } else if (msg.what == 1) { |
| | | DynamicToast.makeSuccess(context, msg.obj.toString(), 3).show(); |
| | | } else { |
| | | DynamicToast.makeWarning(context, msg.obj.toString(), 3).show(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.text.Editable; |
| | | import android.text.InputType; |
| | | import android.view.View; |
| | | import android.widget.Button; |
| | | import android.widget.EditText; |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import com.blankj.utilcode.util.CacheDiskUtils; |
| | | import com.blankj.utilcode.util.GsonUtils; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.lotaai.canguiayw.R; |
| | | import com.lotaai.canguiayw.common.HttpLoggerInterceptor; |
| | | import com.lotaai.canguiayw.common.HttpUrlDefine; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.lotaai.canguiayw.data.BaseDto; |
| | | import com.lotaai.canguiayw.device.CanguiStatus; |
| | | import com.lotaai.canguiayw.device.DeviceMessage; |
| | | import com.lotaai.canguiayw.device.MessageType; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | | import okhttp3.FormBody; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | |
| | | public class CunOjbActivity extends AppCompatActivity { |
| | | OpenDoorFragment openDoorFragment; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_cunobj); |
| | | openDoorFragment = new OpenDoorFragment(); |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.mframe, openDoorFragment).commitAllowingStateLoss(); |
| | | } |
| | | |
| | | public void setData(CanguiStatus cangui) { |
| | | Intent i = new Intent(this, StartSaveActivity.class); |
| | | i.putExtra("info", cangui); |
| | | startActivity(i); |
| | | finish(); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import com.lotaai.canguiayw.device.CanguiStatus; |
| | | |
| | | public class GuiziListActivity extends AppCompatActivity { |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_guizilist); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Build.VERSION; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.view.View; |
| | | import android.widget.EditText; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.blankj.utilcode.util.CacheDiskUtils; |
| | | import com.blankj.utilcode.util.DeviceUtils; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.lotaai.canguiayw.common.HttpLoggerInterceptor; |
| | | import com.lotaai.canguiayw.common.HttpUrlDefine; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.lotaai.canguiayw.device.service.CanGuiService; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | | import okhttp3.FormBody; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | |
| | | /* 262743 员工号*/ |
| | | public class LoginActivity extends AppCompatActivity { |
| | | private Context context; |
| | | private TextView tv_action; |
| | | private EditText et_acc; |
| | | private EditText et_pwd; |
| | | private EditText et_device; |
| | | private TextView tv_type; |
| | | private View bg_type; |
| | | private View ll_type; |
| | | private View tv_user; |
| | | private View tv_staff; |
| | | private String side = "1"; //1用户 2员工 |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_login); |
| | | String _side = CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Side, ""); |
| | | if (_side.equals("1")){ |
| | | Intent intent = new Intent(); |
| | | intent.setClass(LoginActivity.this, TakeActivity.class); |
| | | startActivity(intent); |
| | | }else if (_side.equals("2")){ |
| | | |
| | | } |
| | | LogUtils.i("VERSION.SDK_INT:" + VERSION.SDK_INT); |
| | | context = LoginActivity.this; |
| | | tv_action = findViewById(R.id.tv_action); |
| | | et_acc = findViewById(R.id.et_acc); |
| | | et_pwd = findViewById(R.id.et_pwd); |
| | | et_device = findViewById(R.id.et_device); |
| | | tv_type = findViewById(R.id.tv_type); |
| | | bg_type = findViewById(R.id.bg_type); |
| | | ll_type = findViewById(R.id.ll_type); |
| | | tv_user = findViewById(R.id.tv_user); |
| | | tv_staff = findViewById(R.id.tv_staff); |
| | | // Intent startIntent = new Intent(context, CanGuiService.class); |
| | | // startService(startIntent); |
| | | tv_type.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | bg_type.setVisibility(View.VISIBLE); |
| | | ll_type.setVisibility(View.VISIBLE); |
| | | } |
| | | }); |
| | | bg_type.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | bg_type.setVisibility(View.GONE); |
| | | ll_type.setVisibility(View.GONE); |
| | | } |
| | | }); |
| | | tv_user.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | bg_type.setVisibility(View.GONE); |
| | | ll_type.setVisibility(View.GONE); |
| | | tv_type.setText("User Side"); |
| | | side = "1"; |
| | | } |
| | | }); |
| | | tv_staff.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | bg_type.setVisibility(View.GONE); |
| | | ll_type.setVisibility(View.GONE); |
| | | tv_type.setText("Staff Side"); |
| | | side = "2"; |
| | | } |
| | | }); |
| | | tv_action.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | String acc = et_acc.getText().toString(); |
| | | if (acc.isEmpty()){ |
| | | Message msg = new Message(); |
| | | msg.what = 1; |
| | | msg.obj = "Please enter account"; |
| | | showHandler.sendMessage(msg); |
| | | return; |
| | | } |
| | | String pwd = et_pwd.getText().toString(); |
| | | if (pwd.isEmpty()){ |
| | | Message msg = new Message(); |
| | | msg.what = 1; |
| | | msg.obj = "Please enter password"; |
| | | showHandler.sendMessage(msg); |
| | | return; |
| | | } |
| | | String device = et_device.getText().toString(); |
| | | if (device.isEmpty()){ |
| | | Message msg = new Message(); |
| | | msg.what = 1; |
| | | msg.obj = "Please enter device number"; |
| | | showHandler.sendMessage(msg); |
| | | return; |
| | | } |
| | | login(acc,pwd,device); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | public void login(String acc, String pwd, final String device) { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
| | | OkHttpClient client = new OkHttpClient.Builder() |
| | | .connectTimeout(20, TimeUnit.SECONDS)//响应时间,读取时间 |
| | | .readTimeout(20, TimeUnit.SECONDS) |
| | | .callTimeout(20, TimeUnit.SECONDS) |
| | | .addInterceptor(loggingInterceptor)//添加日志拦截器 |
| | | .build(); |
| | | |
| | | RequestBody body = new FormBody.Builder() |
| | | .build(); |
| | | final Request request = new Request.Builder() |
| | | .url(HttpUrlDefine.login + "?account=" + acc+"&deviceNumber="+device+"&deviceType=1&password="+pwd) |
| | | .post(body) |
| | | .build(); |
| | | client.newCall(request).enqueue(new Callback() { |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | Message msg = new Message(); |
| | | msg.what = 0; |
| | | msg.obj = "Login failed"; |
| | | showHandler.sendMessage(msg); |
| | | LogUtils.e(e); |
| | | } |
| | | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:" + result); |
| | | JSONObject obj = JSONObject.parseObject(result); |
| | | if ("200".equals(obj.getString("code"))) { |
| | | Message msg = new Message(); |
| | | msg.what = 1; |
| | | msg.obj = "Login successful!"; |
| | | showHandler.sendMessage(msg); |
| | | //equipmentCode |
| | | CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Code, device); |
| | | CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Side, side); |
| | | if (side.equals("1")){ |
| | | Intent intent = new Intent(); |
| | | intent.setClass(LoginActivity.this, TakeActivity.class); |
| | | startActivity(intent); |
| | | }else if (side.equals("2")){ |
| | | |
| | | } |
| | | } else { |
| | | Message msg = new Message(); |
| | | msg.what = 0; |
| | | msg.obj = obj.getString("msg"); |
| | | showHandler.sendMessage(msg); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private Handler showHandler = new Handler() { |
| | | @Override |
| | | public void handleMessage(Message msg) { |
| | | if (msg.what == 0) { |
| | | DynamicToast.makeError(context, msg.obj.toString(), 3).show(); |
| | | } else if (msg.what == 1) { |
| | | DynamicToast.makeSuccess(context, msg.obj.toString(), 3).show(); |
| | | } else { |
| | | DynamicToast.makeWarning(context, msg.obj.toString(), 3).show(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | public void toset(View view) { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(LoginActivity.this, ManageActivity.class); |
| | | startActivity(intent); |
| | | } |
| | | } |
| | |
| | | import com.lotaai.canguiayw.common.HttpLoggerInterceptor; |
| | | import com.lotaai.canguiayw.common.HttpUrlDefine; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.lotaai.canguiayw.device.CanGuiCommand; |
| | | import com.lotaai.canguiayw.device.DeviceMessage; |
| | | import com.lotaai.canguiayw.device.DeviceType; |
| | | import com.lotaai.canguiayw.device.MessageType; |
| | | import com.lotaai.canguiayw.device.service.CanGuiService; |
| | | import com.lotaai.canguiayw.mqtt.MyMQTTService; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | |
| | | /* 262743 员工号*/ |
| | | public class MainActivity extends AppCompatActivity { |
| | | private Context context; |
| | | private ImageView logoView; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_main); |
| | | LogUtils.i("VERSION.SDK_INT:" +VERSION.SDK_INT); |
| | | LogUtils.i("VERSION.SDK_INT:" + VERSION.SDK_INT); |
| | | logoView = findViewById(R.id.logo); |
| | | context = MainActivity.this; |
| | | |
| | | /*new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | while (true){ |
| | | |
| | | try { |
| | | Thread.sleep(2000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeSuccess(getApplicationContext(), "测试!", 3).show(); |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | }).start();*/ |
| | | |
| | | Intent startIntent = new Intent(context, CanGuiService.class); |
| | | startService(startIntent); |
| | | Intent startMqttIntent = new Intent(context, MyMQTTService.class); |
| | | startService(startMqttIntent); |
| | | |
| | | login(); |
| | | |
| | | logoView.setOnLongClickListener(new View.OnLongClickListener() { |
| | | /* */ |
| | | /* Intent startMqttIntent = new Intent(context, MyMQTTService.class); |
| | | startService(startMqttIntent);*/ |
| | | // login(); |
| | | /* logoView.setOnLongClickListener(new View.OnLongClickListener() { |
| | | @Override |
| | | public boolean onLongClick(View view) { |
| | | Intent intent = new Intent(); |
| | |
| | | startActivity(intent); |
| | | return true; |
| | | } |
| | | }); |
| | | });*/ |
| | | // testData(); |
| | | } |
| | | |
| | |
| | | // LogUtils.i("插入订单数据:" + order.getOrderNo()); |
| | | // } |
| | | |
| | | public void gotoSetting(View view){ |
| | | public void gotoSetting(View view) { |
| | | // Intent intent = new Intent(); |
| | | // intent.setClass(MainActivity.this, AdminLoginActivity.class); |
| | | // startActivity(intent); |
| | | } |
| | | |
| | | public void take(View view){ |
| | | |
| | | public void putIn(View view) { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(MainActivity.this, TakeActivity.class); |
| | | intent.putExtra("type",1); |
| | | intent.setClass(MainActivity.this, CheckUserIdActivity.class); |
| | | startActivity(intent); |
| | | } |
| | | |
| | | public void putIn(View view){ |
| | | public void take(View view) { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(MainActivity.this, ManageActivity.class); |
| | | intent.setClass(MainActivity.this, TakeActivity.class); |
| | | startActivity(intent); |
| | | |
| | | } |
| | | |
| | | public void login() { |
| | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:"+result); |
| | | LogUtils.i("获取到的数据:" + result); |
| | | JSONObject obj = JSONObject.parseObject(result); |
| | | if ("0".equals(obj.getString("code"))) { |
| | | JSONObject dataObj = obj.getJSONObject("data"); |
| | |
| | | } else { |
| | | Message msg = new Message(); |
| | | msg.what = 0; |
| | | msg.obj = "登录失败:请重新激活!" ; |
| | | msg.obj = "登录失败:请重新激活!"; |
| | | showHandler.sendMessage(msg); |
| | | } |
| | | } |
| | |
| | | } |
| | | }; |
| | | |
| | | public void toset(View view) { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(MainActivity.this, ManageActivity.class); |
| | | startActivity(intent); |
| | | } |
| | | } |
| | |
| | | tabSelect = new SelectFragment(); |
| | | tabsetting = new SettingFragment(); |
| | | |
| | | mFragments.add(tabcuncan); |
| | | mFragments.add(tabOpenDoor); |
| | | mFragments.add(tabSelect); |
| | | // mFragments.add(tabcuncan); |
| | | //mFragments.add(tabOpenDoor); |
| | | // mFragments.add(tabSelect); |
| | | mFragments.add(tabsetting); |
| | | |
| | | mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) { |
| | |
| | | import com.lotaai.canguiayw.device.DeviceType; |
| | | import com.lotaai.canguiayw.device.MessageType; |
| | | import com.lotaai.canguiayw.view.GridTableAdapter; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | |
| | | private Button fugui003; |
| | | private Button fugui004; |
| | | private Button fugui005; |
| | | private int cureentSelectGui =0; |
| | | private boolean isCanRun = true; |
| | | private int cureentSelectGui = 0; |
| | | private boolean isCanRun = false; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | |
| | | @Subscribe(threadMode = ThreadMode.ASYNC) |
| | | public void recvCommand(DeviceMessage mssage){ |
| | | public void recvCommand(DeviceMessage mssage) { |
| | | try { |
| | | if (mssage.getMessageType() == MessageType.FANHUI.ordinal()){ |
| | | if (mssage.getMessageType() == MessageType.FANHUI.ordinal()) { |
| | | isCanRun = false; |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | LogUtils.e(e); |
| | | } |
| | | } |
| | |
| | | initView(); |
| | | intitSwitch(); |
| | | initButton(); |
| | | SettingConfig.getInstance().getExecutor().execute(syncRunnable); |
| | | // SettingConfig.getInstance().getExecutor().execute(syncRunnable); |
| | | return root; |
| | | } |
| | | |
| | | Runnable syncRunnable = new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | while (isCanRun){ |
| | | try { |
| | | Thread.sleep(1000); |
| | | showHandler.sendEmptyMessage(1); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | }catch (Exception e){ |
| | | while (isCanRun) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | showHandler.sendEmptyMessage(1); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | private void initButton(){ |
| | | private void initButton() { |
| | | zhugui = root.findViewById(R.id.zhu001); |
| | | fugui001 = root.findViewById(R.id.gui001); |
| | | fugui002 = root.findViewById(R.id.gui002); |
| | | fugui003 = root.findViewById(R.id.gui003); |
| | | fugui004 = root.findViewById(R.id.gui004); |
| | | fugui005 = root.findViewById(R.id.gui005); |
| | | for (int g =0; g <SettingConfig.getInstance().statusList.size();g++){ |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 0){ |
| | | if (zhugui.getVisibility()!=View.VISIBLE){ |
| | | for (int g = 0; g < SettingConfig.getInstance().statusList.size(); g++) { |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 0) { |
| | | if (zhugui.getVisibility() != View.VISIBLE) { |
| | | zhugui.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 1){ |
| | | if (fugui001.getVisibility()!=View.VISIBLE){ |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 1) { |
| | | if (fugui001.getVisibility() != View.VISIBLE) { |
| | | fugui001.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 2){ |
| | | if (fugui002.getVisibility()!=View.VISIBLE){ |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 2) { |
| | | if (fugui002.getVisibility() != View.VISIBLE) { |
| | | fugui002.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 3){ |
| | | if (fugui003.getVisibility()!=View.VISIBLE){ |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 3) { |
| | | if (fugui003.getVisibility() != View.VISIBLE) { |
| | | fugui003.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 4){ |
| | | if (fugui004.getVisibility()!=View.VISIBLE){ |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 4) { |
| | | if (fugui004.getVisibility() != View.VISIBLE) { |
| | | fugui004.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 5){ |
| | | if (fugui005.getVisibility()!=View.VISIBLE){ |
| | | if (SettingConfig.getInstance().statusList.get(g).getGuiHao() == 5) { |
| | | if (fugui005.getVisibility() != View.VISIBLE) { |
| | | fugui005.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | |
| | | cancelAllBtn(); |
| | | zhugui.setBackgroundColor(getResources().getColor(R.color.cheng)); |
| | | cureentSelectGui = 0; |
| | | |
| | | /* CanguiStatus cangui =new CanguiStatus(); |
| | | cangui.setGuiHao(8); |
| | | cangui.setGridNo(88); |
| | | ((CunOjbActivity) getActivity()).setData(cangui);*/ |
| | | } |
| | | }); |
| | | |
| | |
| | | cancelAllBtn(); |
| | | fugui001.setBackgroundColor(getResources().getColor(R.color.cheng)); |
| | | cureentSelectGui = 1; |
| | | initView(); |
| | | } |
| | | }); |
| | | |
| | |
| | | cancelAllBtn(); |
| | | fugui002.setBackgroundColor(getResources().getColor(R.color.cheng)); |
| | | cureentSelectGui = 2; |
| | | |
| | | initView(); |
| | | } |
| | | }); |
| | | |
| | |
| | | cancelAllBtn(); |
| | | fugui003.setBackgroundColor(getResources().getColor(R.color.cheng)); |
| | | cureentSelectGui = 3; |
| | | |
| | | initView(); |
| | | } |
| | | }); |
| | | |
| | |
| | | cancelAllBtn(); |
| | | fugui004.setBackgroundColor(getResources().getColor(R.color.cheng)); |
| | | cureentSelectGui = 4; |
| | | |
| | | initView(); |
| | | } |
| | | }); |
| | | |
| | |
| | | cancelAllBtn(); |
| | | fugui005.setBackgroundColor(getResources().getColor(R.color.cheng)); |
| | | cureentSelectGui = 5; |
| | | |
| | | initView(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public void cancelAllBtn(){ |
| | | public void cancelAllBtn() { |
| | | zhugui.setBackgroundColor(Color.GRAY); |
| | | fugui001.setBackgroundColor(Color.GRAY); |
| | | fugui002.setBackgroundColor(Color.GRAY); |
| | |
| | | } |
| | | for (int p = 0; p < selectedList.size(); p++) { |
| | | CanguiStatus grid = selectedList.get(p); |
| | | byte[] command = CanGuiCommand.getInstance().controlGridCommand(grid.getGuiHao() , |
| | | grid.getGridNo() , 0, 255, 0, caozuo, 0, 0); |
| | | byte[] command = CanGuiCommand.getInstance().controlGridCommand(grid.getGuiHao(), |
| | | grid.getGridNo(), 0, 255, 0, caozuo, 0, 0); |
| | | DeviceMessage message = new DeviceMessage(); |
| | | message.setMessageType(MessageType.SENDMESSAGE.ordinal()); |
| | | message.setDeviceType(DeviceType.CANGUI.ordinal()); |
| | |
| | | public void onClick(View view) { |
| | | for (int p = 0; p < selectedList.size(); p++) { |
| | | CanguiStatus grid = selectedList.get(p); |
| | | LogUtils.i(TAG,grid.getGuiHao(),grid.getGridNo()); |
| | | byte[] command = CanGuiCommand.getInstance().controlGridCommand(grid.getGuiHao() , |
| | | grid.getGridNo() , 1, 255, 0, 0, 0, 0); |
| | | LogUtils.i(TAG, grid.getGuiHao(), grid.getGridNo()); |
| | | byte[] command = CanGuiCommand.getInstance().controlGridCommand(grid.getGuiHao(), |
| | | grid.getGridNo(), 1, 255, 0, 0, 0, 0); |
| | | DeviceMessage message = new DeviceMessage(); |
| | | message.setMessageType(MessageType.SENDMESSAGE.ordinal()); |
| | | message.setDeviceType(DeviceType.CANGUI.ordinal()); |
| | |
| | | |
| | | public void initView() { |
| | | gridStatusList.clear(); |
| | | for (int i = 0; i< SettingConfig.getInstance().statusList.size();i++){ |
| | | for (int i = 0; i < SettingConfig.getInstance().statusList.size(); i++) { |
| | | CanguiStatus ss = SettingConfig.getInstance().statusList.get(i); |
| | | if (ss.getGuiHao() == cureentSelectGui) { |
| | | CanguiStatus status = new CanguiStatus(); |
| | |
| | | @Override |
| | | public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { |
| | | CanguiStatus cangui = gridStatusList.get(i); |
| | | View item = gridtable.getChildAt(i).findViewById(R.id.gridLineLayout); |
| | | ((CunOjbActivity) getActivity()).setData(cangui); |
| | | |
| | | /* View item = gridtable.getChildAt(i).findViewById(R.id.gridLineLayout); |
| | | if (checkIsSelectedAndOrRemove(cangui,true)) { |
| | | item.setBackgroundColor(Color.GRAY); |
| | | } else { |
| | | item.setBackgroundColor(getResources().getColor(R.color.cheng)); |
| | | } |
| | | }*/ |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param status |
| | | * @param isControl 是否从控制删除和添加,选中变不选,不选变选 |
| | | * @param isControl 是否从控制删除和添加,选中变不选,不选变选 |
| | | * @return |
| | | */ |
| | | private boolean checkIsSelectedAndOrRemove(CanguiStatus status,boolean isControl) { |
| | | private boolean checkIsSelectedAndOrRemove(CanguiStatus status, boolean isControl) { |
| | | boolean isFind = false; |
| | | for (int i = 0; i < selectedList.size(); i++) { |
| | | if (selectedList.get(i).getGridNo() == status.getGridNo() && selectedList.get(i).getGuiHao() == status.getGuiHao()) { |
| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.app.AlarmManager; |
| | | import android.app.PendingIntent; |
| | | import android.content.ComponentName; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Color; |
| | | import android.graphics.Paint; |
| | |
| | | jihuoBtn.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | String code = deviceCode.getText().toString().trim(); |
| | | /* String code = deviceCode.getText().toString().trim(); |
| | | String pwd = devicePwd.getText().toString().trim(); |
| | | if ("".equals(code) || "".equals(pwd)) { |
| | | DynamicToast.makeError(context, "设备号和设备秘钥必填", 3).show(); |
| | | return; |
| | | } |
| | | active(); |
| | | active();*/ |
| | | } |
| | | }); |
| | | saveBtn.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | DynamicToast.Config.getInstance().setTextSize(30).apply(); |
| | | String code = deviceCode.getText().toString().trim(); |
| | | String pwd = devicePwd.getText().toString().trim(); |
| | | /* String code = deviceCode.getText().toString().trim(); |
| | | String pwd = devicePwd.getText().toString().trim();*/ |
| | | String tty = list.get(chuanKouSpinner.getSelectedIndex()); |
| | | if ("".equals(code)) { |
| | | if ("".equals(tty)) { |
| | | DynamicToast.makeError(context, "设备号必填", 3).show(); |
| | | } else { |
| | | CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Code, code); |
| | | //CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Code, code); |
| | | // CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Pwd,pwd); |
| | | CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Tty, tty); |
| | | DynamicToast.makeSuccess(context, "保存成功", 3).show(); |
| | | restartApp(); |
| | | } |
| | | } |
| | | }); |
| | | return root; |
| | | } |
| | | |
| | | public void restartApp() { |
| | | Intent intent =getActivity().getPackageManager().getLaunchIntentForPackage(getActivity().getPackageName()); |
| | | ComponentName componentName = intent.getComponent(); |
| | | Intent mainIntent = Intent.makeRestartActivityTask(componentName); |
| | | startActivity(mainIntent); |
| | | Runtime.getRuntime().exit(0); |
| | | } |
| | | |
| | | public void active() { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
New file |
| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Looper; |
| | | import android.os.Message; |
| | | import android.text.Editable; |
| | | import android.text.InputType; |
| | | import android.view.View; |
| | | import android.widget.Button; |
| | | import android.widget.EditText; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import com.blankj.utilcode.util.CacheDiskUtils; |
| | | import com.blankj.utilcode.util.GsonUtils; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.lotaai.canguiayw.common.HttpLoggerInterceptor; |
| | | import com.lotaai.canguiayw.common.HttpUrlDefine; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.lotaai.canguiayw.data.BaseDto; |
| | | import com.lotaai.canguiayw.device.CanGuiCommand; |
| | | import com.lotaai.canguiayw.device.CanguiStatus; |
| | | import com.lotaai.canguiayw.device.DeviceMessage; |
| | | import com.lotaai.canguiayw.device.DeviceType; |
| | | import com.lotaai.canguiayw.device.MessageType; |
| | | import com.lotaai.canguiayw.device.service.CrontrolGridModel; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | | import okhttp3.FormBody; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | |
| | | public class StartSaveActivity extends AppCompatActivity { |
| | | private Context context; |
| | | private EditText editText; |
| | | CanguiStatus canguidata; |
| | | private TextView titleinfo; |
| | | String ss; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_startsave); |
| | | canguidata = (CanguiStatus) getIntent().getSerializableExtra("info"); |
| | | initView(); |
| | | ss = CrontrolGridModel.getGridNoStr(canguidata.getGuiHao(), canguidata.getGridNo()); |
| | | titleinfo.setText("选择的格子号:" + ss); |
| | | context = StartSaveActivity.this; |
| | | editText = (EditText) findViewById(R.id.edt_borrow_case_number); |
| | | editText.setInputType(InputType.TYPE_NULL); // 屏蔽软键盘 |
| | | DynamicToast.Config.getInstance().setTextSize(30).apply(); |
| | | // 软键盘设置统一按钮监听方法,数字键直接将text内容填充到edittext中,删除和确认才设置事件 |
| | | View.OnClickListener clickListener = new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | int index = editText.getSelectionEnd(); |
| | | Editable editable = editText.getText(); |
| | | int key = v.getId(); |
| | | if (key == R.id.borrow_bt_delete) { |
| | | if (0 != index) { |
| | | editable.delete(index - 1, index); |
| | | } |
| | | } else if (key == R.id.borrow_bt_confirm) { |
| | | // 调用后台 |
| | | String gridNo = editable.toString(); |
| | | if (null == gridNo || "".equals(gridNo.trim())) { |
| | | DynamicToast.makeError(context, "取餐码不能为空。", 3).show(); |
| | | return; |
| | | } else { |
| | | if (gridNo.length() != 6) { |
| | | editText.setText(""); |
| | | DynamicToast.makeError(context, "取餐码输入错误,请重试。", 3).show(); |
| | | return; |
| | | } |
| | | //调用判断是否可以取餐 |
| | | editText.setText(""); |
| | | takeCheckCode(gridNo, canguidata.getGuiHao(), canguidata.getGridNo()); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | Button button = (Button) v; |
| | | editable.insert(index, button.getText()); |
| | | } |
| | | } |
| | | }; |
| | | View view1 = findViewById(R.id.borrow_bt1); |
| | | View view2 = findViewById(R.id.borrow_bt2); |
| | | View view3 = findViewById(R.id.borrow_bt3); |
| | | View view4 = findViewById(R.id.borrow_bt4); |
| | | View view5 = findViewById(R.id.borrow_bt5); |
| | | View view6 = findViewById(R.id.borrow_bt6); |
| | | View view7 = findViewById(R.id.borrow_bt7); |
| | | View view8 = findViewById(R.id.borrow_bt8); |
| | | View view9 = findViewById(R.id.borrow_bt9); |
| | | View view0 = findViewById(R.id.borrow_bt0); |
| | | View view11 = findViewById(R.id.borrow_bt_delete); |
| | | View view12 = findViewById(R.id.borrow_bt_confirm); |
| | | view1.setOnClickListener(clickListener); |
| | | view2.setOnClickListener(clickListener); |
| | | view3.setOnClickListener(clickListener); |
| | | view4.setOnClickListener(clickListener); |
| | | view5.setOnClickListener(clickListener); |
| | | view6.setOnClickListener(clickListener); |
| | | view7.setOnClickListener(clickListener); |
| | | view8.setOnClickListener(clickListener); |
| | | view9.setOnClickListener(clickListener); |
| | | view0.setOnClickListener(clickListener); |
| | | view11.setOnClickListener(clickListener); |
| | | view12.setOnClickListener(clickListener); |
| | | |
| | | } |
| | | |
| | | public void backMian(View view) { |
| | | DeviceMessage message = new DeviceMessage(); |
| | | message.setMessageType(MessageType.FANHUI.ordinal()); |
| | | EventBus.getDefault().post(message); |
| | | finish(); |
| | | } |
| | | |
| | | public void takeCheckCode(String code, int guino, int gridno) { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
| | | OkHttpClient client = new OkHttpClient.Builder() |
| | | .connectTimeout(20, TimeUnit.SECONDS)//响应时间,读取时间 |
| | | .readTimeout(20, TimeUnit.SECONDS) |
| | | .callTimeout(20, TimeUnit.SECONDS) |
| | | .addInterceptor(loggingInterceptor)//添加日志拦截器 |
| | | .build(); |
| | | |
| | | LogUtils.i(CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code), code); |
| | | RequestBody body = new FormBody.Builder() |
| | | .build(); |
| | | |
| | | final Request request = new Request.Builder() |
| | | .url(HttpUrlDefine.checkStatus + "?pickNum=" + code + "&boxNum=" + guino + "&cartNum=" + gridno) |
| | | /* .addHeader("language", "zh-CN")*/ |
| | | .post(body) |
| | | .build(); |
| | | client.newCall(request).enqueue(new Callback() { |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeError(context, "请求失败!", 3).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:" + result); |
| | | final BaseDto baseDto = GsonUtils.fromJson(result, BaseDto.class); |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (baseDto.getCode() == 200) { |
| | | /* byte[] command = CanGuiCommand.getInstance().controlGridCommand(guino, |
| | | gridno, 1, 255, 0, 0, 0, 0); |
| | | DeviceMessage message = new DeviceMessage(); |
| | | message.setMessageType(MessageType.SENDMESSAGE.ordinal()); |
| | | message.setDeviceType(DeviceType.CANGUI.ordinal()); |
| | | message.setMessageByte(command); |
| | | EventBus.getDefault().post(message);*/ |
| | | DynamicToast.makeSuccess(context, "订单已创建,请将餐食放入" + ss + "柜中", 3).show(); |
| | | // new Handler(Looper.getMainLooper()).postDelayed(() -> finish(), 3000); |
| | | |
| | | finish(); |
| | | |
| | | } else { |
| | | DynamicToast.makeError(context, baseDto.getMsg(), 3).show(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | public void pickOrder(String code) { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
| | | OkHttpClient client = new OkHttpClient.Builder() |
| | | .connectTimeout(20, TimeUnit.SECONDS)//响应时间,读取时间 |
| | | .readTimeout(20, TimeUnit.SECONDS) |
| | | .callTimeout(20, TimeUnit.SECONDS) |
| | | .addInterceptor(loggingInterceptor)//添加日志拦截器 |
| | | .build(); |
| | | |
| | | LogUtils.i(CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code), code); |
| | | RequestBody body = new FormBody.Builder() |
| | | .build(); |
| | | |
| | | final Request request = new Request.Builder() |
| | | .url(HttpUrlDefine.pickOrder + "?pickNum=" + code) |
| | | /* .addHeader("language", "zh-CN")*/ |
| | | .post(body) |
| | | .build(); |
| | | client.newCall(request).enqueue(new Callback() { |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeError(context, "请求失败!", 3).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:" + result); |
| | | final BaseDto baseDto = GsonUtils.fromJson(result, BaseDto.class); |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (baseDto.isData()) { |
| | | DynamicToast.makeSuccess(context, "验证成功!", 3).show(); |
| | | } else { |
| | | DynamicToast.makeError(context, "验证失败!", 3).show(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private Handler showHandler = new Handler() { |
| | | @Override |
| | | public void handleMessage(Message msg) { |
| | | if (msg.what == 0) { |
| | | DynamicToast.makeError(context, msg.obj.toString(), 3).show(); |
| | | } else if (msg.what == 1) { |
| | | DynamicToast.makeSuccess(context, msg.obj.toString(), 3).show(); |
| | | } else { |
| | | DynamicToast.makeWarning(context, msg.obj.toString(), 3).show(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | private void initView() { |
| | | titleinfo = (TextView) findViewById(R.id.titleinfo); |
| | | } |
| | | } |
| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Looper; |
| | | import android.os.Message; |
| | | import android.text.Editable; |
| | | import android.text.InputType; |
| | | import android.view.View; |
| | | import android.widget.Button; |
| | | import android.widget.EditText; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.blankj.utilcode.util.CacheDiskUtils; |
| | | import com.blankj.utilcode.util.DeviceUtils; |
| | | import com.blankj.utilcode.util.GsonUtils; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.lotaai.canguiayw.common.HttpLoggerInterceptor; |
| | | import com.lotaai.canguiayw.common.HttpUrlDefine; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.lotaai.canguiayw.data.BaseDto; |
| | | import com.lotaai.canguiayw.data.BoxInfoDto; |
| | | import com.lotaai.canguiayw.device.CanGuiCommand; |
| | | import com.lotaai.canguiayw.device.DeviceMessage; |
| | | import com.lotaai.canguiayw.device.DeviceType; |
| | | import com.lotaai.canguiayw.device.MessageType; |
| | | import com.lotaai.canguiayw.mqtt.DeviceAction; |
| | | import com.lotaai.canguiayw.sqllitedb.Order; |
| | | import com.lotaai.canguiayw.sqllitedb.SqlliteDbManage; |
| | | import com.lotaai.canguiayw.device.service.CanGuiService; |
| | | import com.lotaai.canguiayw.view.AdBannerAdapter; |
| | | import com.lotaai.canguiayw.view.TipDialog; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | import com.youth.banner.Banner; |
| | | import com.youth.banner.indicator.CircleIndicator; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.logging.Logger; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | |
| | | public class TakeActivity extends AppCompatActivity { |
| | | private Context context; |
| | | private EditText editText; |
| | | private Banner banner; |
| | | private ArrayList<String> imgs = new ArrayList<String>(); |
| | | private AdBannerAdapter adapter; |
| | | private Handler handler; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_take); |
| | | |
| | | |
| | | handler = new Handler(Looper.getMainLooper()){ |
| | | @Override |
| | | public void handleMessage(@NonNull Message msg) { |
| | | super.handleMessage(msg); |
| | | if (msg.what == 0){ |
| | | adver(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | context = TakeActivity.this; |
| | | |
| | | Intent startIntent = new Intent(context, CanGuiService.class); |
| | | startService(startIntent); |
| | | |
| | | editText = (EditText)findViewById(R.id.edt_borrow_case_number); |
| | | editText.setInputType(InputType.TYPE_NULL); // 屏蔽软键盘 |
| | | DynamicToast.Config.getInstance().setTextSize(30).apply(); |
| | |
| | | View.OnClickListener clickListener = new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | |
| | | int index = editText.getSelectionEnd(); |
| | | Editable editable = editText.getText(); |
| | | int key = v.getId(); |
| | |
| | | // 调用后台 |
| | | String gridNo = editable.toString(); |
| | | if (null == gridNo || "".equals(gridNo.trim())) { |
| | | DynamicToast.makeError(context, "取餐码不能为空。", 3).show(); |
| | | showResult("Please enter pickup code."); |
| | | return; |
| | | } else { |
| | | if (gridNo.length() !=6) { |
| | | editText.setText(""); |
| | | DynamicToast.makeError(context, "取餐码输入错误,请重试。", 3).show(); |
| | | showResult("The pickup code input is incorrect,\nplease try again."); |
| | | return; |
| | | } |
| | | //调用判断是否可以取餐 |
| | | editText.setText(""); |
| | | takeCheckCode(gridNo); |
| | | } |
| | | |
| | | } else { |
| | | Button button = (Button) v; |
| | | editable.insert(index, button.getText()); |
| | | } |
| | | } |
| | | }; |
| | | banner = findViewById(R.id.banner); |
| | | View view1 = findViewById(R.id.borrow_bt1); |
| | | View view2 = findViewById(R.id.borrow_bt2); |
| | | View view3 = findViewById(R.id.borrow_bt3); |
| | |
| | | view0.setOnClickListener(clickListener); |
| | | view11.setOnClickListener(clickListener); |
| | | view12.setOnClickListener(clickListener); |
| | | adapter = new AdBannerAdapter(this,imgs); |
| | | banner.setAdapter(adapter); |
| | | banner.setIndicator(new CircleIndicator(this)); |
| | | handler.sendEmptyMessage(0); |
| | | } |
| | | |
| | | public void backMian(View view){ |
| | | DeviceMessage message = new DeviceMessage(); |
| | | message.setMessageType(MessageType.FANHUI.ordinal()); |
| | | EventBus.getDefault().post(message); |
| | | finish(); |
| | | } |
| | | |
| | | public void takeCheckCode(String code) { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
| | |
| | | .addInterceptor(loggingInterceptor)//添加日志拦截器 |
| | | .build(); |
| | | |
| | | LogUtils.i(CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code),code); |
| | | LogUtils.i(CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code), code); |
| | | RequestBody body = new FormBody.Builder() |
| | | .add("equipmentCode", CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code)) |
| | | .add("takeCode", code).build(); |
| | | .build(); |
| | | |
| | | final Request request = new Request.Builder() |
| | | .url(HttpUrlDefine.equipmentTakeOut) |
| | | .addHeader("language", "zh-CN") |
| | | .url(HttpUrlDefine.pickOrder+"?pickNum="+code) |
| | | /* .addHeader("language", "zh-CN")*/ |
| | | .post(body) |
| | | .build(); |
| | | client.newCall(request).enqueue(new Callback() { |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | DynamicToast.makeError(context, "取餐失败!", 3).show(); |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeError(context, "请求失败!", 3).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:"+result); |
| | | |
| | | LogUtils.i("获取到的数据:" + result); |
| | | final BoxInfoDto baseDto = GsonUtils.fromJson(result, BoxInfoDto.class); |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (baseDto.getCode()==200) { |
| | | byte[] command = CanGuiCommand.getInstance().controlGridCommand(baseDto.getData().getBoxNum(), |
| | | baseDto.getData().getCartNum(), 1, 255, 0, 0, 0, 0); |
| | | DeviceMessage message = new DeviceMessage(); |
| | | message.setMessageType(MessageType.SENDMESSAGE.ordinal()); |
| | | message.setDeviceType(DeviceType.CANGUI.ordinal()); |
| | | message.setMessageByte(command); |
| | | EventBus.getDefault().post(message); |
| | | showResult("Door opened succcessfully! \n" + |
| | | "Please pickup your meal."); |
| | | }else{ |
| | | showResult(baseDto.getMsg()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public void showResult(String msg){ |
| | | TipDialog tipDialog = new TipDialog(); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putString("msg",msg); |
| | | tipDialog.setArguments(bundle); |
| | | tipDialog.show(getSupportFragmentManager(),"res"); |
| | | } |
| | | |
| | | |
| | | public void pickOrder(String code) { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
| | | OkHttpClient client = new OkHttpClient.Builder() |
| | | .connectTimeout(20, TimeUnit.SECONDS)//响应时间,读取时间 |
| | | .readTimeout(20, TimeUnit.SECONDS) |
| | | .callTimeout(20, TimeUnit.SECONDS) |
| | | .addInterceptor(loggingInterceptor)//添加日志拦截器 |
| | | .build(); |
| | | |
| | | LogUtils.i(CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code), code); |
| | | RequestBody body = new FormBody.Builder() |
| | | .build(); |
| | | |
| | | final Request request = new Request.Builder() |
| | | .url(HttpUrlDefine.pickOrder+"?pickNum="+code) |
| | | /* .addHeader("language", "zh-CN")*/ |
| | | .post(body) |
| | | .build(); |
| | | client.newCall(request).enqueue(new Callback() { |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeError(context, "请求失败!", 3).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:" + result); |
| | | final BaseDto baseDto = GsonUtils.fromJson(result, BaseDto.class); |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (baseDto.isData()) { |
| | | DynamicToast.makeSuccess(context, "验证成功!", 3).show(); |
| | | }else{ |
| | | DynamicToast.makeError(context, "验证失败!", 3).show(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | public void adver() { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |
| | | OkHttpClient client = new OkHttpClient.Builder() |
| | | .connectTimeout(20, TimeUnit.SECONDS)//响应时间,读取时间 |
| | | .readTimeout(20, TimeUnit.SECONDS) |
| | | .callTimeout(20, TimeUnit.SECONDS) |
| | | .addInterceptor(loggingInterceptor)//添加日志拦截器 |
| | | .build(); |
| | | |
| | | String code = CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Code); |
| | | RequestBody body = new FormBody.Builder() |
| | | .build(); |
| | | final Request request = new Request.Builder() |
| | | .url(HttpUrlDefine.adver+"?sn="+code) |
| | | /* .addHeader("language", "zh-CN")*/ |
| | | .post(body) |
| | | .build(); |
| | | client.newCall(request).enqueue(new Callback() { |
| | | @Override |
| | | public void onFailure(Call call, IOException e) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onResponse(Call call, Response response) throws IOException { |
| | | String result = response.body().string(); |
| | | LogUtils.i("获取到的数据:" + result); |
| | | JSONObject obj = JSONObject.parseObject(result); |
| | | if ("0".equals(obj.getString("code"))) { |
| | | String g = obj.getString("data"); |
| | | //发送mqtt 进行开门 |
| | | JSONObject json = new JSONObject(); |
| | | json.put("action", DeviceAction.CONTROLDEVICE.name()); |
| | | json.put(DeviceAction.doorIsOpen.name(), "1"); |
| | | json.put(DeviceAction.xiaoDuIsOpen.name(), "0"); |
| | | json.put(DeviceAction.jiareIsOpen.name(), "0"); |
| | | json.put(DeviceAction.dengGuangIsOpen.name(), "0"); |
| | | json.put("gridNo", g); |
| | | json.put("qucan","1"); |
| | | DeviceMessage deviceMessage = new DeviceMessage(); |
| | | deviceMessage.setMessageType(MessageType.MQTT.ordinal()); |
| | | deviceMessage.setMsgString(json.toJSONString()); |
| | | EventBus.getDefault().post(deviceMessage); |
| | | String string = obj.getString("msg"); |
| | | Message msg = new Message(); |
| | | msg.what = 1; |
| | | msg.obj = "取餐格口:" + g; |
| | | showHandler.sendMessage(msg); |
| | | } else { |
| | | String string = obj.getString("msg"); |
| | | Message msg = new Message(); |
| | | msg.what = 0; |
| | | msg.obj = "取餐失败:" + string; |
| | | showHandler.sendMessage(msg); |
| | | if ("200".equals(obj.getString("code"))) { |
| | | String imgs = obj.getString("data"); |
| | | TakeActivity.this.imgs.clear(); |
| | | String[] split = imgs.split(","); |
| | | for (int i = 0;i< split.length;i++){ |
| | | if (!split[i].isEmpty()){ |
| | | TakeActivity.this.imgs.add(split[i]); |
| | | } |
| | | } |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | adapter.notifyDataSetChanged(); |
| | | banner.setCurrentItem(1); |
| | | } |
| | | }); |
| | | handler.sendEmptyMessageDelayed(0,60000); |
| | | } |
| | | } |
| | | }); |
File was renamed from app/src/main/java/com/lotaai/canguiayw/application/ActivityLifecycleApplcation.java |
| | |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | |
| | | import com.lotaai.canguiayw.logger.CrashManager; |
| | | import com.lotaai.canguiayw.logger.LoggerInit; |
| | | import com.lotaai.canguiayw.sqllitedb.DaoMaster; |
| | | import com.lotaai.canguiayw.sqllitedb.DaoSession; |
| | | |
| | | public class ActivityLifecycleApplcation extends Application { |
| | | public class App extends Application { |
| | | private final String TAG = "ActivityLifecycle: "; |
| | | private static ActivityLifecycleApplcation mTestActivityLifecycleApplcation; |
| | | private static App mTestActivityLifecycleApplcation; |
| | | private int mActivityCount = 0; |
| | | public static DaoSession mSession; |
| | | |
| | | public static App app; |
| | | @Override |
| | | public void onCreate() { |
| | | super.onCreate(); |
| | | app=this; |
| | | //初始化本地sqllite数据库 |
| | | initDb(); |
| | | //捕捉崩溃的日志 |
| | | CrashManager crashManager = CrashManager.getInstance(); |
| | | crashManager.init(getApplicationContext()); |
| | | mTestActivityLifecycleApplcation = new ActivityLifecycleApplcation(); |
| | | /* CrashManager crashManager = CrashManager.getInstance(); |
| | | crashManager.init(getApplicationContext());*/ |
| | | mTestActivityLifecycleApplcation = new App(); |
| | | //初始化日志 |
| | | LoggerInit.init(); |
| | | registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() { |
| | |
| | | }); |
| | | } |
| | | |
| | | public static ActivityLifecycleApplcation getInstance( ) { |
| | | public static App getInstance( ) { |
| | | if (null == mTestActivityLifecycleApplcation) { |
| | | mTestActivityLifecycleApplcation = new ActivityLifecycleApplcation(); |
| | | mTestActivityLifecycleApplcation = new App(); |
| | | } |
| | | return mTestActivityLifecycleApplcation; |
| | | } |
| | |
| | | package com.lotaai.canguiayw.common; |
| | | |
| | | public class HttpUrlDefine { |
| | | // private String rootHost = "http://localhost:9081"; |
| | | private static String rootHost = "http://test.lotaai.com/"; |
| | | private static String rootHost = "http://192.168.110.111:8080/"; |
| | | //private static String rootHost = "http://221.182.45.100:8081/"; |
| | | // private static String rootHost = " http://18.130.221.37:8080/"; |
| | | |
| | | // private static String rootHost = "http://13.42.24.196:8080/"; |
| | | public static String equipmentBind = rootHost + "/lotaai-api/api/eq/equipmentBind"; |
| | | public static String equipmentLogin = rootHost + "/lotaai-api/api/eq/equipmentLogin"; |
| | | public static String equipmentCunCan = rootHost + "/lotaai-api/api/eq/putInFood"; |
| | | public static String equipmentTakeOut = rootHost + "/lotaai-api/api/eq/takeFood"; |
| | | public static String equipmentAndminTakeOut = rootHost + "/lotaai-api/api/eq/takeOut"; |
| | | |
| | | public static String chekobj = rootHost + "system/user/check"; |
| | | |
| | | public static String checkStatus = rootHost + "order/order/checkStatus"; |
| | | |
| | | public static String pickOrder = rootHost + "order/order/pick"; |
| | | |
| | | public static String login = rootHost + "equipment/equipment/deviceBlind1"; |
| | | public static String adver = rootHost + "order/order/get/adver"; |
| | | |
| | | } |
| | |
| | | public String Cache_Device_Code ="Cache_Device_Code"; |
| | | public String Cache_Device_Pwd ="Cache_Device_Pwd"; |
| | | public String Cache_Device_Tty ="Cache_Device_Tty"; |
| | | public String Cache_Device_Side ="Cache_Device_Side"; //1用户 2员工 |
| | | |
| | | private SettingConfig(){ |
| | | |
New file |
| | |
| | | package com.lotaai.canguiayw.data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class BaseDto implements Serializable { |
| | | |
| | | private int code; |
| | | private String msg; |
| | | private boolean data; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public boolean isData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(boolean data) { |
| | | this.data = data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw.data; |
| | | |
| | | public class BoxInfo { |
| | | int boxNum; |
| | | |
| | | int cartNum; |
| | | |
| | | public int getBoxNum() { |
| | | return boxNum; |
| | | } |
| | | |
| | | public void setBoxNum(int boxNum) { |
| | | this.boxNum = boxNum; |
| | | } |
| | | |
| | | public int getCartNum() { |
| | | return cartNum; |
| | | } |
| | | |
| | | public void setCartNum(int cartNum) { |
| | | this.cartNum = cartNum; |
| | | } |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw.data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class BoxInfoDto implements Serializable { |
| | | |
| | | private int code; |
| | | private String msg; |
| | | private BoxInfo data; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg == null ? "" : msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg == null ? "" : msg; |
| | | } |
| | | |
| | | public BoxInfo getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(BoxInfo data) { |
| | | this.data = data; |
| | | } |
| | | } |
| | |
| | | package com.lotaai.canguiayw.device; |
| | | |
| | | public class CanguiStatus implements Comparable<CanguiStatus>{ |
| | | import java.io.Serializable; |
| | | |
| | | public class CanguiStatus implements Comparable<CanguiStatus>, Serializable { |
| | | //门是否打开 |
| | | private boolean doorIsOpen; |
| | | //消毒是否打开 |
| | |
| | | |
| | | package com.lotaai.canguiayw.device.service; |
| | | |
| | | import android.app.Application; |
| | | import android.app.Service; |
| | | import android.content.Intent; |
| | | import android.os.Handler; |
| | | import android.os.IBinder; |
| | | |
| | | import androidx.annotation.Nullable; |
| | |
| | | import com.blankj.utilcode.util.ConvertUtils; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.blankj.utilcode.util.ThreadUtils; |
| | | import com.lotaai.canguiayw.CThreadPoolExecutor; |
| | | import com.lotaai.canguiayw.common.SettingConfig; |
| | | import com.lotaai.canguiayw.device.CanGuiCommand; |
| | | import com.lotaai.canguiayw.device.CanguiStatus; |
| | |
| | | import com.lotaai.canguiayw.device.MessageType; |
| | | import com.lotaai.canguiayw.sqllitedb.GridModel; |
| | | import com.lotaai.canguiayw.sqllitedb.SqlliteDbManage; |
| | | import com.pranavpandey.android.dynamic.toasts.DynamicToast; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | |
| | | */ |
| | | public class CanGuiService extends Service { |
| | | |
| | | |
| | | private List<byte[]> commandQueue = new LinkedList<byte[]>(); |
| | | SerialPortUtils serialPortUtils = new SerialPortUtils(); |
| | | private HashMap<String,List<GridModel>> gridStatus = new HashMap<>(); |
| | | private HashMap<String, List<GridModel>> gridStatus = new HashMap<>(); |
| | | |
| | | @Nullable |
| | | @Override |
| | |
| | | public void onCreate() { |
| | | super.onCreate(); |
| | | // serialPortUtils.openSerialPort("/dev/ttyS4",4800); |
| | | String str = CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Tty); |
| | | if (str == null || "".equals(str)){ |
| | | return; |
| | | |
| | | try { |
| | | String str = CacheDiskUtils.getInstance().getString(SettingConfig.getInstance().Cache_Device_Tty); |
| | | if (str == null || "".equals(str)) { |
| | | return; |
| | | } |
| | | LogUtils.i("串口号" + str); |
| | | serialPortUtils.openSerialPort(str, 4800); |
| | | registerListener(); |
| | | SettingConfig.getInstance().getExecutor().execute(selectRunnable); |
| | | SettingConfig.getInstance().getExecutor().execute(sendRunnable); |
| | | EventBus.getDefault().register(CanGuiService.this); |
| | | } catch (Exception e) { |
| | | /* CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeSuccess(getApplicationContext(), "捕获到错误:" + e.getMessage(), 3).show(); |
| | | } |
| | | });*/ |
| | | } |
| | | serialPortUtils.openSerialPort(str,4800); |
| | | registerListener(); |
| | | SettingConfig.getInstance().getExecutor().execute(selectRunnable); |
| | | SettingConfig.getInstance().getExecutor().execute(sendRunnable); |
| | | EventBus.getDefault().register(CanGuiService.this); |
| | | } |
| | | |
| | | //查询柜子的状态 |
| | |
| | | @Override |
| | | public void run() { |
| | | //开始之前先查询是不是已经有了 |
| | | for (int i = 0; i<20;i++) { |
| | | for (int i = 0; i < 20; i++) { |
| | | List<GridModel> lists = SqlliteDbManage.getInstance().selectGridByGui(i); |
| | | if (lists != null && lists.size() > 0) { |
| | | gridStatus.put(Integer.toString(i), lists); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | while(true){ |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(2000); |
| | | //查询指令 |
| | | byte[] command = CanGuiCommand.getInstance().selectStatusCommand(0,0,0,0,0,0,0,0); |
| | | byte[] command = CanGuiCommand.getInstance().selectStatusCommand(0, 0, 0, 0, 0, 0, 0, 0); |
| | | commandQueue.add(command); |
| | | } catch (InterruptedException e) { |
| | | LogUtils.e(e); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | LogUtils.e(e); |
| | | } |
| | | } |
| | |
| | | Runnable sendRunnable = new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | while(true){ |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(200); |
| | | //发送指令 |
| | | if (!commandQueue.isEmpty() && commandQueue.size()>0) { |
| | | byte[] cc= commandQueue.get(0); |
| | | if (cc!=null) { |
| | | if (!commandQueue.isEmpty() && commandQueue.size() > 0) { |
| | | byte[] cc = commandQueue.get(0); |
| | | if (cc != null) { |
| | | serialPortUtils.sendSerialPort(cc); |
| | | } |
| | | commandQueue.remove(0); |
| | | } |
| | | } catch (InterruptedException e) { |
| | | LogUtils.e(e); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | /* CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DynamicToast.makeSuccess(getApplicationContext(), "捕获到错误2:" + e.getMessage(), 3).show(); |
| | | } |
| | | });*/ |
| | | LogUtils.e(e); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | public void registerListener(){ |
| | | public void registerListener() { |
| | | serialPortUtils.setOnDataReceiveListener(new SerialPortUtils.OnDataReceiveListener() { |
| | | @Override |
| | | public void onDataReceive(byte[] buffer, int size) { |
| | | if (size >3){ |
| | | List<CanguiStatus> statuses = CanGuiCommand.getInstance().analysisRecvByte(buffer); |
| | | if (size > 3) { |
| | | List<CanguiStatus> statuses = CanGuiCommand.getInstance().analysisRecvByte(buffer); |
| | | |
| | | |
| | | boolean isHas = false; |
| | | int gui = -1; |
| | | if (statuses!=null &&statuses.size()>0){ |
| | | if (gridStatus.containsKey(Integer.toString(statuses.get(0).getGuiHao()))){ |
| | | if (statuses != null && statuses.size() > 0) { |
| | | if (gridStatus.containsKey(Integer.toString(statuses.get(0).getGuiHao()))) { |
| | | isHas = true; |
| | | } |
| | | for (int i = 0; i < statuses.size(); i++){ |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < statuses.size(); i++) { |
| | | CanguiStatus s = statuses.get(i); |
| | | sb.append("柜子号" + s.getGuiHao() + " 格子号" + s.getGridNo()); |
| | | SettingConfig.getInstance().addStatusInList(s); |
| | | if (!isHas) { |
| | | GridModel model = new GridModel(); |
| | |
| | | // LogUtils.i("柜:" + s.getGuiHao(),"格:" + s.getGridNo(),"温度:" + s.getWendu(), |
| | | //// "门:"+s.isDoorIsOpen(),"加热:"+s.isJiareIsOpen(),"灯光:" + s.isDengGuangIsOpen(),"消毒:" + s.isXiaoDuIsOpen()); |
| | | } |
| | | if (gui > -1 && !isHas){ |
| | | |
| | | |
| | | |
| | | |
| | | if (gui > -1 && !isHas) { |
| | | List<GridModel> lists = SqlliteDbManage.getInstance().selectGridByGui(gui); |
| | | if (lists!=null && lists.size()>0){ |
| | | gridStatus.put(Integer.toString(gui),lists); |
| | | if (lists != null && lists.size() > 0) { |
| | | gridStatus.put(Integer.toString(gui), lists); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Subscribe(threadMode = ThreadMode.ASYNC) |
| | | public void recvCommand(DeviceMessage mssage){ |
| | | public void recvCommand(DeviceMessage mssage) { |
| | | LogUtils.i("开门命令接收"); |
| | | try { |
| | | if (mssage.getMessageType() == MessageType.SENDMESSAGE.ordinal()){ |
| | | if (mssage.getMessageType() == MessageType.SENDMESSAGE.ordinal()) { |
| | | if (mssage.getDeviceType() == DeviceType.CANGUI.ordinal()) { |
| | | byte[] cc = mssage.getMessageByte(); |
| | | if (cc != null) { |
| | | commandQueue.add(cc); |
| | | |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | LogUtils.e(e); |
| | | } |
| | | } |
| | |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | |
| | | public class CrashManager implements Thread.UncaughtExceptionHandler{ |
| | | public class CrashManager implements Thread.UncaughtExceptionHandler { |
| | | public static final String TAG = "CrashManager"; |
| | | private static final CrashManager INSTANCE = new CrashManager(); |
| | | private Context context; |
| | |
| | | return false; |
| | | } |
| | | ex.printStackTrace(); |
| | | LogUtils.e(ex); |
| | | if (ex != null) |
| | | LogUtils.e(ex); |
| | | collectDeviceInfo(context);// 收集设备参数信息 |
| | | saveCrashInfoToFile(ex);// 保存日志文件 |
| | | // 使用Toast显示异常信息 |
| | |
| | | |
| | | // 写入文件 |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US); |
| | | String rootPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/ltNormalLogs/crash" ; |
| | | String rootPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/ltNormalLogs/crash"; |
| | | File ff = new File(rootPath); |
| | | if (!ff.exists() || !ff.isDirectory()){ |
| | | if (!ff.exists() || !ff.isDirectory()) { |
| | | ff.mkdir(); |
| | | } |
| | | String crashFileName = rootPath + "/crash_" + simpleDateFormat.format(new Date()) + ".log"; |
| | | try { |
| | | FileOutputStream fos =null; |
| | | FileOutputStream fos = null; |
| | | File logFile = new File(crashFileName); |
| | | if (logFile.exists()){ |
| | | fos = new FileOutputStream(crashFileName,true); |
| | | }else { |
| | | if (logFile.exists()) { |
| | | fos = new FileOutputStream(crashFileName, true); |
| | | } else { |
| | | fos = new FileOutputStream(crashFileName); |
| | | } |
| | | fos.write(stringBuffer.toString().getBytes()); |
New file |
| | |
| | | package com.lotaai.canguiayw.sqllitedb; |
| | | |
| | | import android.database.Cursor; |
| | | import android.database.sqlite.SQLiteStatement; |
| | | |
| | | import org.greenrobot.greendao.AbstractDao; |
| | | import org.greenrobot.greendao.Property; |
| | | import org.greenrobot.greendao.internal.DaoConfig; |
| | | import org.greenrobot.greendao.database.Database; |
| | | import org.greenrobot.greendao.database.DatabaseStatement; |
| | | |
| | | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. |
| | | /** |
| | | * DAO for table "GRID_MODEL". |
| | | */ |
| | | public class GridModelDao extends AbstractDao<GridModel, Long> { |
| | | |
| | | public static final String TABLENAME = "GRID_MODEL"; |
| | | |
| | | /** |
| | | * Properties of entity GridModel.<br/> |
| | | * Can be used for QueryBuilder and for referencing column names. |
| | | */ |
| | | public static class Properties { |
| | | public final static Property Id = new Property(0, Long.class, "id", true, "_id"); |
| | | public final static Property GuiHao = new Property(1, int.class, "guiHao", false, "GUI_HAO"); |
| | | public final static Property GridNo = new Property(2, int.class, "gridNo", false, "GRID_NO"); |
| | | public final static Property State = new Property(3, int.class, "state", false, "STATE"); |
| | | } |
| | | |
| | | |
| | | public GridModelDao(DaoConfig config) { |
| | | super(config); |
| | | } |
| | | |
| | | public GridModelDao(DaoConfig config, DaoSession daoSession) { |
| | | super(config, daoSession); |
| | | } |
| | | |
| | | /** Creates the underlying database table. */ |
| | | public static void createTable(Database db, boolean ifNotExists) { |
| | | String constraint = ifNotExists? "IF NOT EXISTS ": ""; |
| | | db.execSQL("CREATE TABLE " + constraint + "\"GRID_MODEL\" (" + // |
| | | "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id |
| | | "\"GUI_HAO\" INTEGER NOT NULL ," + // 1: guiHao |
| | | "\"GRID_NO\" INTEGER NOT NULL ," + // 2: gridNo |
| | | "\"STATE\" INTEGER NOT NULL );"); // 3: state |
| | | } |
| | | |
| | | /** Drops the underlying database table. */ |
| | | public static void dropTable(Database db, boolean ifExists) { |
| | | String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"GRID_MODEL\""; |
| | | db.execSQL(sql); |
| | | } |
| | | |
| | | @Override |
| | | protected final void bindValues(DatabaseStatement stmt, GridModel entity) { |
| | | stmt.clearBindings(); |
| | | |
| | | Long id = entity.getId(); |
| | | if (id != null) { |
| | | stmt.bindLong(1, id); |
| | | } |
| | | stmt.bindLong(2, entity.getGuiHao()); |
| | | stmt.bindLong(3, entity.getGridNo()); |
| | | stmt.bindLong(4, entity.getState()); |
| | | } |
| | | |
| | | @Override |
| | | protected final void bindValues(SQLiteStatement stmt, GridModel entity) { |
| | | stmt.clearBindings(); |
| | | |
| | | Long id = entity.getId(); |
| | | if (id != null) { |
| | | stmt.bindLong(1, id); |
| | | } |
| | | stmt.bindLong(2, entity.getGuiHao()); |
| | | stmt.bindLong(3, entity.getGridNo()); |
| | | stmt.bindLong(4, entity.getState()); |
| | | } |
| | | |
| | | @Override |
| | | public Long readKey(Cursor cursor, int offset) { |
| | | return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); |
| | | } |
| | | |
| | | @Override |
| | | public GridModel readEntity(Cursor cursor, int offset) { |
| | | GridModel entity = new GridModel( // |
| | | cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id |
| | | cursor.getInt(offset + 1), // guiHao |
| | | cursor.getInt(offset + 2), // gridNo |
| | | cursor.getInt(offset + 3) // state |
| | | ); |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | public void readEntity(Cursor cursor, GridModel entity, int offset) { |
| | | entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); |
| | | entity.setGuiHao(cursor.getInt(offset + 1)); |
| | | entity.setGridNo(cursor.getInt(offset + 2)); |
| | | entity.setState(cursor.getInt(offset + 3)); |
| | | } |
| | | |
| | | @Override |
| | | protected final Long updateKeyAfterInsert(GridModel entity, long rowId) { |
| | | entity.setId(rowId); |
| | | return rowId; |
| | | } |
| | | |
| | | @Override |
| | | public Long getKey(GridModel entity) { |
| | | if(entity != null) { |
| | | return entity.getId(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasKey(GridModel entity) { |
| | | return entity.getId() != null; |
| | | } |
| | | |
| | | @Override |
| | | protected final boolean isEntityUpdateable() { |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw.sqllitedb; |
| | | |
| | | import android.database.Cursor; |
| | | import android.database.sqlite.SQLiteStatement; |
| | | |
| | | import org.greenrobot.greendao.AbstractDao; |
| | | import org.greenrobot.greendao.Property; |
| | | import org.greenrobot.greendao.internal.DaoConfig; |
| | | import org.greenrobot.greendao.database.Database; |
| | | import org.greenrobot.greendao.database.DatabaseStatement; |
| | | |
| | | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. |
| | | /** |
| | | * DAO for table "ORDER_DETAIL". |
| | | */ |
| | | public class OrderDetailDao extends AbstractDao<OrderDetail, Long> { |
| | | |
| | | public static final String TABLENAME = "ORDER_DETAIL"; |
| | | |
| | | /** |
| | | * Properties of entity OrderDetail.<br/> |
| | | * Can be used for QueryBuilder and for referencing column names. |
| | | */ |
| | | public static class Properties { |
| | | public final static Property Id = new Property(0, Long.class, "id", true, "_id"); |
| | | public final static Property OrderNo = new Property(1, String.class, "orderNo", false, "ORDER_NO"); |
| | | public final static Property ItemName = new Property(2, String.class, "itemName", false, "ITEM_NAME"); |
| | | public final static Property Num = new Property(3, int.class, "num", false, "NUM"); |
| | | } |
| | | |
| | | |
| | | public OrderDetailDao(DaoConfig config) { |
| | | super(config); |
| | | } |
| | | |
| | | public OrderDetailDao(DaoConfig config, DaoSession daoSession) { |
| | | super(config, daoSession); |
| | | } |
| | | |
| | | /** Creates the underlying database table. */ |
| | | public static void createTable(Database db, boolean ifNotExists) { |
| | | String constraint = ifNotExists? "IF NOT EXISTS ": ""; |
| | | db.execSQL("CREATE TABLE " + constraint + "\"ORDER_DETAIL\" (" + // |
| | | "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id |
| | | "\"ORDER_NO\" TEXT NOT NULL ," + // 1: orderNo |
| | | "\"ITEM_NAME\" TEXT," + // 2: itemName |
| | | "\"NUM\" INTEGER NOT NULL );"); // 3: num |
| | | } |
| | | |
| | | /** Drops the underlying database table. */ |
| | | public static void dropTable(Database db, boolean ifExists) { |
| | | String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"ORDER_DETAIL\""; |
| | | db.execSQL(sql); |
| | | } |
| | | |
| | | @Override |
| | | protected final void bindValues(DatabaseStatement stmt, OrderDetail entity) { |
| | | stmt.clearBindings(); |
| | | |
| | | Long id = entity.getId(); |
| | | if (id != null) { |
| | | stmt.bindLong(1, id); |
| | | } |
| | | stmt.bindString(2, entity.getOrderNo()); |
| | | |
| | | String itemName = entity.getItemName(); |
| | | if (itemName != null) { |
| | | stmt.bindString(3, itemName); |
| | | } |
| | | stmt.bindLong(4, entity.getNum()); |
| | | } |
| | | |
| | | @Override |
| | | protected final void bindValues(SQLiteStatement stmt, OrderDetail entity) { |
| | | stmt.clearBindings(); |
| | | |
| | | Long id = entity.getId(); |
| | | if (id != null) { |
| | | stmt.bindLong(1, id); |
| | | } |
| | | stmt.bindString(2, entity.getOrderNo()); |
| | | |
| | | String itemName = entity.getItemName(); |
| | | if (itemName != null) { |
| | | stmt.bindString(3, itemName); |
| | | } |
| | | stmt.bindLong(4, entity.getNum()); |
| | | } |
| | | |
| | | @Override |
| | | public Long readKey(Cursor cursor, int offset) { |
| | | return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetail readEntity(Cursor cursor, int offset) { |
| | | OrderDetail entity = new OrderDetail( // |
| | | cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id |
| | | cursor.getString(offset + 1), // orderNo |
| | | cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // itemName |
| | | cursor.getInt(offset + 3) // num |
| | | ); |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | public void readEntity(Cursor cursor, OrderDetail entity, int offset) { |
| | | entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); |
| | | entity.setOrderNo(cursor.getString(offset + 1)); |
| | | entity.setItemName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); |
| | | entity.setNum(cursor.getInt(offset + 3)); |
| | | } |
| | | |
| | | @Override |
| | | protected final Long updateKeyAfterInsert(OrderDetail entity, long rowId) { |
| | | entity.setId(rowId); |
| | | return rowId; |
| | | } |
| | | |
| | | @Override |
| | | public Long getKey(OrderDetail entity) { |
| | | if(entity != null) { |
| | | return entity.getId(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasKey(OrderDetail entity) { |
| | | return entity.getId() != null; |
| | | } |
| | | |
| | | @Override |
| | | protected final boolean isEntityUpdateable() { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.lotaai.canguiayw.sqllitedb; |
| | | |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | import com.lotaai.canguiayw.application.ActivityLifecycleApplcation; |
| | | import com.lotaai.canguiayw.application.App; |
| | | import com.lotaai.canguiayw.device.service.CrontrolGridModel; |
| | | |
| | | import org.greenrobot.greendao.query.QueryBuilder; |
| | |
| | | } |
| | | |
| | | private DaoSession getDaoSession() { |
| | | DaoSession daoSession = ActivityLifecycleApplcation.getInstance().getDaoSession(); |
| | | DaoSession daoSession = App.getInstance().getDaoSession(); |
| | | return daoSession; |
| | | } |
| | | |
New file |
| | |
| | | package com.lotaai.canguiayw.view; |
| | | |
| | | import android.content.Context; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.ImageView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.lotaai.canguiayw.R; |
| | | import com.youth.banner.adapter.BannerAdapter; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class AdBannerAdapter extends BannerAdapter<String, RecyclerView.ViewHolder> { |
| | | private Context context; |
| | | |
| | | public AdBannerAdapter(List<String> datas) { |
| | | super(datas); |
| | | } |
| | | |
| | | public AdBannerAdapter(Context context,List<String> datas) { |
| | | super(datas); |
| | | this.context = context; |
| | | } |
| | | |
| | | @Override |
| | | public RecyclerView.ViewHolder onCreateHolder(ViewGroup parent, int viewType) { |
| | | View view = LayoutInflater.from(context).inflate(R.layout.item_banner, parent, false); |
| | | return new BannerViewHolder(view); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindView(RecyclerView.ViewHolder holder, String data, int position, int size) { |
| | | BannerViewHolder bannerViewHolder = (BannerViewHolder) holder; |
| | | Glide.with(context) |
| | | .load(data) |
| | | .apply(getRequestOption()) |
| | | .into(bannerViewHolder.imageView); |
| | | } |
| | | |
| | | private static RequestOptions getRequestOption() { |
| | | RequestOptions chatcricleFoursUserHead; |
| | | DiskCacheStrategy diskCacheStrategy = DiskCacheStrategy.RESOURCE; |
| | | chatcricleFoursUserHead = new RequestOptions() |
| | | .error(R.color.black) |
| | | .placeholder(R.color.black) |
| | | .diskCacheStrategy(diskCacheStrategy) |
| | | .centerCrop(); |
| | | return chatcricleFoursUserHead; |
| | | } |
| | | |
| | | public static class BannerViewHolder extends RecyclerView.ViewHolder{ |
| | | public BannerViewHolder(@NonNull View itemView) { |
| | | super(itemView); |
| | | } |
| | | public ImageView imageView = itemView.findViewById(R.id.iv_img); |
| | | } |
| | | } |
New file |
| | |
| | | package com.lotaai.canguiayw.view; |
| | | |
| | | import android.os.Bundle; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.fragment.app.DialogFragment; |
| | | |
| | | import com.lotaai.canguiayw.R; |
| | | |
| | | public class TipDialog extends DialogFragment { |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | return inflater.inflate(R.layout.dialog_tip,container,false); |
| | | } |
| | | |
| | | public ExitCallback callback; |
| | | |
| | | @Override |
| | | public void onCreate(@Nullable Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setStyle(STYLE_NO_FRAME,R.style.FadeDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onActivityCreated(@Nullable Bundle savedInstanceState) { |
| | | super.onActivityCreated(savedInstanceState); |
| | | getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | getDialog().getWindow().setGravity(Gravity.CENTER); |
| | | getDialog().setCanceledOnTouchOutside(false); |
| | | } |
| | | |
| | | @Override |
| | | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| | | super.onViewCreated(view, savedInstanceState); |
| | | TextView tvMsg = view.findViewById(R.id.tv_msg); |
| | | tvMsg.setText(getArguments().getString("msg")); |
| | | view.findViewById(R.id.tv_action).setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (callback!=null) |
| | | callback.onExit(); |
| | | dismissAllowingStateLoss(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public interface ExitCallback { |
| | | void onExit(); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="8dp"/> |
| | | <solid android:color="#EDEBE8"/> |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="6dp"/> |
| | | <solid android:color="@color/white"/> |
| | | <stroke android:color="@color/grey" android:width="1dp"/> |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="6dp"/> |
| | | <solid android:color="@color/colorPrimary"/> |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="10dp"/> |
| | | <solid android:color="@color/white"/> |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <stroke android:color="#A7A7A7" android:width="1dp"/> |
| | | <solid android:color="@color/white"/> |
| | | <corners android:radius="3dp"/> |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@color/bgcolor" |
| | | android:focusable="true" |
| | | android:focusableInTouchMode="true" |
| | | android:orientation="vertical" |
| | | tools:context=".TakeActivity"> |
| | | |
| | | <RelativeLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="5"> |
| | | |
| | | <ImageButton |
| | | android:layout_width="80dp" |
| | | android:layout_height="80dp" |
| | | android:layout_alignParentRight="true" |
| | | android:layout_centerVertical="true" |
| | | android:layout_gravity="center" |
| | | android:alpha="1" |
| | | android:background="@drawable/back_go_button" |
| | | android:onClick="backMian" |
| | | android:scaleType="centerCrop" |
| | | android:src="@mipmap/fanhui" /> |
| | | |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <EditText |
| | | android:id="@+id/edt_borrow_case_number" |
| | | android:layout_width="0dp" |
| | | app:layout_constraintWidth_percent="0.5" |
| | | android:layout_height="0dp" |
| | | android:background="@null" |
| | | android:layout_marginTop="10dp" |
| | | android:gravity="center" |
| | | android:hint="请输入员工号" |
| | | android:inputType="number" |
| | | android:textAlignment="center" |
| | | android:textColor="@color/white" |
| | | android:textColorHint="@color/white" |
| | | android:textSize="30dp" |
| | | app:layout_constraintHeight_percent="0.2" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | |
| | | <TableLayout |
| | | android:layout_width="0dp" |
| | | app:layout_constraintDimensionRatio="2:1" |
| | | android:layout_height="0dp" |
| | | android:layout_alignParentBottom="true" |
| | | android:layout_centerHorizontal="true" |
| | | android:stretchColumns="*" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintHeight_percent="0.6" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent"> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt1" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="1" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt2" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="2" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt3" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="3" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt4" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="4" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt5" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="5" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt6" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="6" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt7" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="7" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt8" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="8" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt9" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="9" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt_delete" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="DEL" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt0" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="0" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt_confirm" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:gravity="center" |
| | | android:text="OK" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | </TableLayout> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | |
| | | </RelativeLayout> |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:id="@+id/mframe" |
| | | android:layout_height="match_parent"> |
| | | |
| | | </FrameLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:background="@color/black" |
| | | android:layout_height="match_parent"> |
| | | |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@color/black" |
| | | tools:context=".MainActivity"> |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/bg_white_10" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | android:layout_marginBottom="20dp"> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | android:layout_marginTop="25dp" |
| | | android:text="Blind Device Number" |
| | | android:textColor="@color/textColor" |
| | | android:textStyle="bold" |
| | | android:id="@+id/tv_1" |
| | | android:textSize="30sp"/> |
| | | <EditText |
| | | android:layout_width="212dp" |
| | | android:layout_height="44dp" |
| | | app:layout_constraintTop_toBottomOf="@id/tv_1" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | android:layout_marginEnd="60dp" |
| | | android:hint="Please enter" |
| | | android:paddingVertical="12dp" |
| | | android:paddingHorizontal="10dp" |
| | | android:singleLine="true" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="28dp" |
| | | android:background="@drawable/bg_greyline_6dp" |
| | | android:textStyle="bold" |
| | | android:id="@+id/et_acc"/> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="Account:" |
| | | android:textStyle="bold" |
| | | android:textSize="14sp" |
| | | app:layout_constraintBaseline_toBaselineOf="@id/et_acc" |
| | | app:layout_constraintEnd_toStartOf="@id/et_acc" |
| | | android:layout_marginEnd="28dp"/> |
| | | <EditText |
| | | android:layout_width="212dp" |
| | | android:layout_height="44dp" |
| | | app:layout_constraintTop_toBottomOf="@id/et_acc" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | android:layout_marginEnd="60dp" |
| | | android:hint="Please enter" |
| | | android:paddingVertical="12dp" |
| | | android:paddingHorizontal="10dp" |
| | | android:singleLine="true" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="20dp" |
| | | android:inputType="textPassword" |
| | | android:background="@drawable/bg_greyline_6dp" |
| | | android:textStyle="bold" |
| | | android:id="@+id/et_pwd"/> |
| | | <EditText |
| | | android:layout_width="212dp" |
| | | android:layout_height="44dp" |
| | | app:layout_constraintTop_toBottomOf="@id/et_pwd" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | android:layout_marginEnd="60dp" |
| | | android:hint="Please enter" |
| | | android:paddingVertical="12dp" |
| | | android:paddingHorizontal="10dp" |
| | | android:singleLine="true" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="20dp" |
| | | android:background="@drawable/bg_greyline_6dp" |
| | | android:textStyle="bold" |
| | | android:id="@+id/et_device"/> |
| | | <TextView |
| | | android:layout_width="212dp" |
| | | android:layout_height="44dp" |
| | | app:layout_constraintTop_toBottomOf="@id/et_device" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | android:layout_marginEnd="60dp" |
| | | android:text="User Side" |
| | | android:paddingVertical="12dp" |
| | | android:paddingHorizontal="10dp" |
| | | android:singleLine="true" |
| | | android:drawableEnd="@mipmap/ic_down" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="20dp" |
| | | android:background="@drawable/bg_greyline_6dp" |
| | | android:textStyle="bold" |
| | | android:id="@+id/tv_type"/> |
| | | <TextView |
| | | android:id="@+id/tv_action" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="44dp" |
| | | app:layout_constraintTop_toBottomOf="@id/tv_type" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | android:layout_marginBottom="20dp" |
| | | android:textSize="18sp" |
| | | android:gravity="center" |
| | | android:layout_marginTop="30dp" |
| | | android:paddingHorizontal="40dp" |
| | | android:textColor="@color/white" |
| | | android:textStyle="bold" |
| | | android:text="Confirm" |
| | | android:background="@drawable/bg_oragne_6"/> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="Password:" |
| | | android:textStyle="bold" |
| | | android:textSize="14sp" |
| | | app:layout_constraintBaseline_toBaselineOf="@id/et_pwd" |
| | | app:layout_constraintEnd_toStartOf="@id/et_acc" |
| | | android:layout_marginEnd="28dp"/> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="Device Number:" |
| | | android:textStyle="bold" |
| | | android:textSize="14sp" |
| | | app:layout_constraintBaseline_toBaselineOf="@id/et_device" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | android:layout_marginStart="50dp" |
| | | app:layout_constraintEnd_toStartOf="@id/et_acc" |
| | | android:layout_marginEnd="28dp"/> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="Type:" |
| | | android:textStyle="bold" |
| | | android:textSize="14sp" |
| | | app:layout_constraintBaseline_toBaselineOf="@id/tv_type" |
| | | app:layout_constraintEnd_toStartOf="@id/et_acc" |
| | | android:layout_marginEnd="28dp"/> |
| | | <View |
| | | android:id="@+id/bg_type" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | android:layout_width="0dp" |
| | | android:visibility="gone" |
| | | android:layout_height="0dp"/> |
| | | <LinearLayout |
| | | android:id="@+id/ll_type" |
| | | android:layout_width="212dp" |
| | | android:visibility="gone" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" |
| | | android:background="@drawable/bg_greyline_6dp" |
| | | app:layout_constraintTop_toBottomOf="@id/tv_type" |
| | | app:layout_constraintStart_toStartOf="@id/tv_type" |
| | | > |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:id="@+id/tv_user" |
| | | android:textSize="15sp" |
| | | android:paddingVertical="10dp" |
| | | android:paddingHorizontal="8dp" |
| | | android:text="User Side"/> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1px" |
| | | android:background="@color/grey"/> |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:id="@+id/tv_staff" |
| | | android:textSize="15sp" |
| | | android:paddingVertical="10dp" |
| | | android:paddingHorizontal="8dp" |
| | | android:text="Staff Side"/> |
| | | </LinearLayout> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | |
| | | android:background="@mipmap/bgm" |
| | | tools:context=".MainActivity"> |
| | | |
| | | <com.google.android.material.floatingactionbutton.FloatingActionButton |
| | | <!-- <com.google.android.material.floatingactionbutton.FloatingActionButton |
| | | android:id="@+id/fab" |
| | | android:visibility="gone" |
| | | android:layout_width="wrap_content" |
| | |
| | | app:elevation="20dp" |
| | | app:fabSize="normal" |
| | | app:pressedTranslationZ="5dp" |
| | | app:rippleColor="@color/DarkGray" /> |
| | | app:rippleColor="@color/DarkGray" />--> |
| | | |
| | | <ImageView |
| | | android:id="@+id/logo" |
| | | android:layout_width="100dp" |
| | | android:layout_height="100dp" |
| | | android:scaleType="center" |
| | | android:layout_marginTop="50dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginLeft="50dp" |
| | | android:src="@mipmap/logo"/> |
| | | |
| | |
| | | android:padding="0dp" |
| | | android:background="@drawable/round_button_down" /> |
| | | </LinearLayout> |
| | | |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="设置" |
| | | android:onClick="toset" |
| | | android:textColor="@color/white" |
| | | android:textSize="30sp" |
| | | android:layout_alignParentRight="true" |
| | | android:layout_margin="10dp" |
| | | android:layout_alignParentBottom="true"/> |
| | | </RelativeLayout> |
| | |
| | | <LinearLayout |
| | | android:id="@+id/id_tab_cuncan" |
| | | android:layout_width="0dp" |
| | | android:visibility="invisible" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:orientation="vertical" |
| | |
| | | android:background="@drawable/tab_btn_normal"/> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:visibility="invisible" |
| | | android:id="@+id/id_tab_opendoor" |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | |
| | | android:background="@drawable/tab_btn_normal"/> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:visibility="invisible" |
| | | android:id="@+id/id_tab_select" |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | |
| | | android:background="@drawable/tab_btn_normal"/> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:visibility="invisible" |
| | | android:id="@+id/id_tab_setting" |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@color/bgcolor" |
| | | android:focusable="true" |
| | | android:focusableInTouchMode="true" |
| | | android:orientation="vertical" |
| | | tools:context=".TakeActivity"> |
| | | |
| | | <RelativeLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="5"> |
| | | |
| | | <ImageButton |
| | | android:layout_width="80dp" |
| | | android:layout_height="80dp" |
| | | android:layout_alignParentRight="true" |
| | | android:layout_centerVertical="true" |
| | | android:layout_gravity="center" |
| | | android:alpha="1" |
| | | android:background="@drawable/back_go_button" |
| | | android:onClick="backMian" |
| | | android:scaleType="centerCrop" |
| | | android:src="@mipmap/fanhui" /> |
| | | |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <TextView |
| | | android:id="@+id/titleinfo" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="0dp" |
| | | android:layout_marginTop="16dp" |
| | | android:background="@null" |
| | | android:gravity="center" |
| | | android:text="选择的柜子号:" |
| | | android:textAlignment="center" |
| | | android:textColor="@color/white" |
| | | android:textColorHint="@color/white" |
| | | android:textSize="30dp" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintWidth_percent="0.5" /> |
| | | |
| | | <EditText |
| | | app:layout_constraintTop_toBottomOf="@+id/titleinfo" |
| | | android:id="@+id/edt_borrow_case_number" |
| | | android:layout_width="0dp" |
| | | app:layout_constraintWidth_percent="0.5" |
| | | android:layout_height="0dp" |
| | | android:background="@null" |
| | | android:layout_marginTop="10dp" |
| | | android:gravity="center" |
| | | android:hint="请输入取餐码" |
| | | android:inputType="number" |
| | | android:textAlignment="center" |
| | | android:textColor="@color/white" |
| | | android:textColorHint="@color/white" |
| | | android:textSize="30dp" |
| | | app:layout_constraintHeight_percent="0.15" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent" |
| | | /> |
| | | |
| | | <TableLayout |
| | | android:layout_width="0dp" |
| | | app:layout_constraintDimensionRatio="2:1" |
| | | android:layout_height="0dp" |
| | | android:layout_alignParentBottom="true" |
| | | android:layout_centerHorizontal="true" |
| | | android:stretchColumns="*" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintHeight_percent="0.6" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent"> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt1" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="1" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt2" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="2" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt3" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="3" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt4" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="4" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt5" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="5" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt6" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="6" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt7" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="7" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt8" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="8" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt9" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="9" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt_delete" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="DEL" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt0" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="0" |
| | | android:textSize="30sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt_confirm" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:gravity="center" |
| | | android:text="OK" |
| | | android:textSize="30sp" /> |
| | | </TableRow> |
| | | </TableLayout> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | |
| | | </RelativeLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:focusable="true" |
| | | android:background="@color/bgcolor" |
| | | android:focusable="true" |
| | | android:focusableInTouchMode="true" |
| | | android:orientation="vertical" |
| | | tools:context=".TakeActivity"> |
| | | <RelativeLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="5"> |
| | | <ImageButton |
| | | android:layout_width="80dp" |
| | | android:layout_height="80dp" |
| | | android:src="@mipmap/fanhui" |
| | | android:scaleType="centerCrop" |
| | | android:onClick="backMian" |
| | | android:alpha="1" |
| | | android:background="@drawable/back_go_button" |
| | | android:layout_centerVertical="true" |
| | | android:layout_alignParentRight="true" |
| | | android:layout_gravity="center" |
| | | /> |
| | | <RelativeLayout |
| | | android:id="@+id/edttxmr" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_marginTop="100dp"> |
| | | <EditText |
| | | android:id="@+id/edt_borrow_case_number" |
| | | android:layout_width="500dp" |
| | | android:layout_height="80dp" |
| | | android:gravity="center" |
| | | android:background="@null" |
| | | android:hint="请输入取餐码" |
| | | android:textColorHint="@color/white" |
| | | android:textAlignment="center" |
| | | android:textColor="@color/white" |
| | | android:textSize="30dp" /> |
| | | </RelativeLayout> |
| | | <TableLayout |
| | | android:layout_width="600dp" |
| | | android:layout_height="480dp" |
| | | android:layout_alignParentBottom ="true" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_marginTop="151dp" |
| | | android:stretchColumns="*"> |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | <Button |
| | | android:id="@+id/borrow_bt1" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="1" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:id="@+id/borrow_bt2" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="2" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:id="@+id/borrow_bt3" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="3" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt4" |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <com.youth.banner.Banner |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:id="@+id/banner" |
| | | app:indicator_selected_color="@color/white" |
| | | app:indicator_normal_color="#565659" |
| | | app:indicator_height="15dp" |
| | | app:indicator_marginBottom="30dp" |
| | | app:indicator_normal_width="15dp" |
| | | app:indicator_selected_width="15dp" |
| | | app:indicator_space="20dp" |
| | | app:delay_time="5000" |
| | | app:indicator_radius="10dp" |
| | | app:is_auto_loop="true"/> |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | android:layout_marginEnd="24dp" |
| | | android:background="@mipmap/bg_keybord"> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="4" |
| | | android:textSize="30sp"/> |
| | | android:layout_height="wrap_content" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | android:text="Enter pickup code" |
| | | android:textSize="27sp" |
| | | android:layout_marginTop="17dp" |
| | | android:id="@+id/tv_1" |
| | | android:textColor="@color/black"/> |
| | | <EditText |
| | | android:id="@+id/edt_borrow_case_number" |
| | | android:layout_width="0dp" |
| | | android:layout_height="65dp" |
| | | android:background="@drawable/bg_white_3" |
| | | android:layout_marginTop="24dp" |
| | | android:gravity="center" |
| | | android:inputType="number" |
| | | android:textAlignment="center" |
| | | android:textColor="@color/black" |
| | | android:textColorHint="@color/white" |
| | | android:textSize="24sp" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent" |
| | | android:layout_marginHorizontal="29dp" |
| | | app:layout_constraintTop_toBottomOf="@id/tv_1" /> |
| | | <TableLayout |
| | | android:id="@+id/keyboard" |
| | | android:layout_width="390dp" |
| | | android:layout_height="219dp" |
| | | android:stretchColumns="*" |
| | | app:layout_constraintTop_toBottomOf="@id/edt_borrow_case_number" |
| | | android:layout_marginTop="15dp" |
| | | android:paddingVertical="6dp" |
| | | android:paddingHorizontal="4dp" |
| | | android:layout_marginHorizontal="29dp" |
| | | android:background="@drawable/bg_grey_6dp" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt5" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="5" |
| | | android:textSize="30sp"/> |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt6" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="6" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | <Button |
| | | android:id="@+id/borrow_bt1" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="1" |
| | | android:textSize="24sp" /> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | <Button |
| | | android:id="@+id/borrow_bt2" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginStart="8dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="2" |
| | | android:textSize="24sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt7" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="7" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:id="@+id/borrow_bt3" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginStart="8dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="3" |
| | | android:textSize="24sp" /> |
| | | </TableRow> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt8" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="8" |
| | | android:textSize="30sp"/> |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_marginTop="6dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt9" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="9" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | <Button |
| | | android:id="@+id/borrow_bt4" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="4" |
| | | android:textSize="24sp" /> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | <Button |
| | | android:id="@+id/borrow_bt5" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="5" |
| | | android:layout_marginStart="8dp" |
| | | android:textSize="24sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt_delete" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="DEL" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:id="@+id/borrow_bt6" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="6" |
| | | android:layout_marginStart="8dp" |
| | | android:textSize="24sp" /> |
| | | </TableRow> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt0" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="0" |
| | | android:textSize="30sp"/> |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_marginTop="6dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | <Button |
| | | android:id="@+id/borrow_bt7" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="7" |
| | | android:textSize="24sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt8" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="8" |
| | | android:layout_marginStart="8dp" |
| | | android:textSize="24sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt9" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="9" |
| | | android:layout_marginStart="8dp" |
| | | android:textSize="24sp" /> |
| | | </TableRow> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_marginTop="6dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@null" |
| | | android:textSize="24sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt0" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="0" |
| | | android:layout_marginStart="8dp" |
| | | android:textSize="24sp" /> |
| | | |
| | | <ImageView |
| | | android:id="@+id/borrow_bt_delete" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:gravity="center" |
| | | android:src="@mipmap/delete" |
| | | android:scaleType="center" |
| | | android:layout_marginStart="8dp" |
| | | android:textSize="24sp" /> |
| | | </TableRow> |
| | | </TableLayout> |
| | | <TextView |
| | | android:id="@+id/borrow_bt_confirm" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:layout_height="44dp" |
| | | app:layout_constraintTop_toBottomOf="@id/keyboard" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | android:layout_marginBottom="29dp" |
| | | android:textSize="18sp" |
| | | android:gravity="center" |
| | | android:text="OK" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | </TableLayout> |
| | | </RelativeLayout> |
| | | android:layout_marginTop="15dp" |
| | | android:paddingHorizontal="40dp" |
| | | android:textColor="@color/white" |
| | | android:textStyle="bold" |
| | | android:text="Confirm" |
| | | android:background="@drawable/bg_oragne_6"/> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | |
| | | |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"> |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="320dp" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | android:layout_height="wrap_content" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | android:background="@drawable/bg_white_3" |
| | | android:paddingBottom="25dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_title" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="27dp" |
| | | android:gravity="center" |
| | | android:text="Notice" |
| | | android:textColor="@color/black" |
| | | android:textSize="16sp" |
| | | android:textStyle="bold" |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_msg" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="14dp" |
| | | android:layout_marginTop="23dp" |
| | | android:layout_marginEnd="14dp" |
| | | android:gravity="center" |
| | | android:text="Pickup failed, pickup code incorrect!" |
| | | android:textColor="#333333" |
| | | android:textSize="13sp" |
| | | app:layout_constraintTop_toBottomOf="@id/tv_title" /> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_action" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="44dp" |
| | | app:layout_constraintTop_toBottomOf="@id/tv_msg" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | android:textSize="18sp" |
| | | android:gravity="center" |
| | | android:layout_marginTop="30dp" |
| | | android:paddingHorizontal="40dp" |
| | | android:textColor="@color/white" |
| | | android:textStyle="bold" |
| | | android:text="Confirm" |
| | | android:background="@drawable/bg_oragne_6"/> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="5"> |
| | | <RelativeLayout |
| | | android:id="@+id/edttxmr" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_marginTop="20dp"> |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | <EditText |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | android:id="@+id/edt_borrow_case_number" |
| | | android:layout_width="400dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | app:layout_constraintWidth_percent="0.7" |
| | | app:layout_constraintHeight_percent="0.2" |
| | | android:gravity="center" |
| | | android:background="@drawable/round_editstyle" |
| | | android:hint="取餐序号" |
| | | android:textColorHint="@color/white" |
| | | android:textAlignment="center" |
| | | android:textColor="@color/white" |
| | | android:textSize="30dp" /> |
| | | </RelativeLayout> |
| | | <TableLayout |
| | | android:layout_width="600dp" |
| | | android:layout_height="480dp" |
| | | android:layout_alignParentBottom ="true" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_margin="5dp" |
| | | android:stretchColumns="*"> |
| | | <TableRow |
| | | android:textSize="25dp" /> |
| | | <TableLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | <Button |
| | | android:id="@+id/borrow_bt1" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="1" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:id="@+id/borrow_bt2" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="2" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:id="@+id/borrow_bt3" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="3" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintLeft_toLeftOf="parent" |
| | | app:layout_constraintRight_toRightOf="parent" |
| | | app:layout_constraintWidth_percent="0.6" |
| | | app:layout_constraintDimensionRatio="1:1" |
| | | android:layout_alignParentBottom ="true" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_margin="5dp" |
| | | android:stretchColumns="*"> |
| | | <LinearLayout |
| | | android:orientation="horizontal" |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt1" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="1" |
| | | android:textSize="25sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt2" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="2" |
| | | android:textSize="25sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt3" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="3" |
| | | android:textSize="25sp"/> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt4" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="4" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt4" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="4" |
| | | android:textSize="25sp"/> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt5" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="5" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt5" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="5" |
| | | android:textSize="25sp"/> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt6" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="6" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt6" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="6" |
| | | android:textSize="25sp"/> |
| | | </LinearLayout> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | <LinearLayout |
| | | android:orientation="horizontal" |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt7" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="7" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt7" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="7" |
| | | android:textSize="25sp"/> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt8" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="8" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt8" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="8" |
| | | android:textSize="25sp"/> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt9" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="9" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt9" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:text="9" |
| | | android:textSize="25sp"/> |
| | | </LinearLayout> |
| | | |
| | | <TableRow |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | <LinearLayout |
| | | android:orientation="horizontal" |
| | | android:layout_width="0dp" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="2"> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt_delete" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="DEL" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt_delete" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_left" |
| | | android:text="DEL" |
| | | android:textSize="25sp"/> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt0" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="0" |
| | | android:textSize="30sp"/> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt0" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_mid" |
| | | android:text="0" |
| | | android:textSize="25sp"/> |
| | | |
| | | <Button |
| | | android:id="@+id/borrow_bt_confirm" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="120dp" |
| | | android:background="@drawable/number_button_right" |
| | | android:gravity="center" |
| | | android:text="OK" |
| | | android:textSize="30sp"/> |
| | | </TableRow> |
| | | </TableLayout> |
| | | <Button |
| | | android:layout_weight="1" |
| | | android:id="@+id/borrow_bt_confirm" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/number_button_right" |
| | | android:gravity="center" |
| | | android:text="OK" |
| | | android:textSize="25sp"/> |
| | | </LinearLayout> |
| | | </TableLayout> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | |
| | | </RelativeLayout> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | |
| | | android:layout_height="80dp" |
| | | android:orientation="horizontal"> |
| | | <TextView |
| | | android:layout_width="100dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:textColor="@color/white" |
| | | android:gravity="right|center_vertical" |
| | |
| | | android:text="格口:"/> |
| | | <TextView |
| | | android:id="@+id/geKoueText" |
| | | android:layout_width="150dp" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:textColor="@color/cheng" |
| | | android:gravity="center" |
| | | android:textSize="50dp" |
| | | android:text=""/> |
| | | <TextView |
| | | android:layout_width="100dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:textColor="@color/white" |
| | | android:textSize="30dp" |
| | | android:textSize="25sp" |
| | | android:gravity="right|center_vertical" |
| | | android:text="订单:"/> |
| | | <TextView |
| | | android:id="@+id/orderNoText" |
| | | android:layout_width="300dp" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:textColor="@color/white" |
| | | android:textSize="30dp" |
| | | android:textSize="25sp" |
| | | android:gravity="center" |
| | | android:text=""/> |
| | | |
| | |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:background="@color/bgcolor" |
| | | android:orientation="vertical"> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="4" |
| | | android:orientation="horizontal"> |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | <Button |
| | | android:id="@+id/zhu001" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:textSize="30dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/cheng" |
| | | android:text="主柜"/> |
| | | <Button |
| | | android:id="@+id/gui001" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:textSize="30dp" |
| | | android:visibility="gone" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜1"/> |
| | | <Button |
| | | android:id="@+id/gui002" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:textSize="30dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:visibility="gone" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜2"/> |
| | | <Button |
| | | android:id="@+id/gui003" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:textSize="30dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:visibility="gone" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜3"/> |
| | | <Button |
| | | android:id="@+id/gui004" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:textSize="30dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:visibility="gone" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜4"/> |
| | | <Button |
| | | android:id="@+id/gui005" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:visibility="gone" |
| | | android:textSize="30dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜5"/> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="3"> |
| | | <GridView |
| | | android:id="@+id/gridtable" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:verticalSpacing="10dp" |
| | | android:horizontalSpacing="10dp" |
| | | android:columnWidth="80dp" |
| | | android:numColumns="3"> |
| | | </GridView> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="4" |
| | | android:orientation="horizontal"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:orientation="vertical"> |
| | | |
| | | <Button |
| | | android:id="@+id/zhu001" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/cheng" |
| | | android:text="主柜" |
| | | android:textSize="25sp" /> |
| | | |
| | | <Button |
| | | android:id="@+id/gui001" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜1" |
| | | android:textSize="25sp" |
| | | android:visibility="gone" /> |
| | | |
| | | <Button |
| | | android:id="@+id/gui002" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜2" |
| | | android:textSize="25sp" |
| | | android:visibility="gone" /> |
| | | |
| | | <Button |
| | | android:id="@+id/gui003" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜3" |
| | | android:textSize="25sp" |
| | | android:visibility="gone" /> |
| | | |
| | | <Button |
| | | android:id="@+id/gui004" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜4" |
| | | android:textSize="25sp" |
| | | android:visibility="gone" /> |
| | | |
| | | <Button |
| | | android:id="@+id/gui005" |
| | | android:layout_width="200dp" |
| | | android:layout_height="60dp" |
| | | android:layout_gravity="center" |
| | | android:layout_margin="5dp" |
| | | android:background="@color/DarkGray" |
| | | android:text="副柜5" |
| | | android:textSize="25sp" |
| | | android:visibility="gone" /> |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="3"> |
| | | |
| | | <GridView |
| | | android:id="@+id/gridtable" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:columnWidth="80dp" |
| | | android:horizontalSpacing="10dp" |
| | | android:numColumns="3" |
| | | android:verticalSpacing="10dp"></GridView> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:visibility="gone" |
| | | android:layout_gravity="center" |
| | | android:gravity="center" |
| | | android:layout_weight="1"> |
| | | android:layout_weight="1.2" |
| | | android:gravity="center"> |
| | | |
| | | <Button |
| | | android:id="@+id/openDoorBtn" |
| | | android:layout_width="250dp" |
| | | android:layout_height="80dp" |
| | | android:textSize="30dp" |
| | | android:layout_margin="10dp" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/circular_button" |
| | | android:text="OPEN"/> |
| | | android:text="OPEN" |
| | | android:textSize="25sp" /> |
| | | |
| | | <com.liys.lswitch.LSwitch |
| | | android:id="@+id/lswitchjiare" |
| | | android:layout_margin="10dp" |
| | | android:layout_width="250dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | app:checked="false" |
| | | app:text_off="加热开" |
| | | app:text_size_off="20dp" |
| | | app:text_on="加热关" |
| | | app:text_show="true" |
| | | app:text_size_off="20dp" |
| | | app:text_size_on="20dp" |
| | | app:track_color_on="@color/DarkGray" |
| | | app:track_color_off="@color/cheng" |
| | | app:text_show ="true" |
| | | app:checked="false"/> |
| | | app:track_color_on="@color/DarkGray" /> |
| | | |
| | | <com.liys.lswitch.LSwitch |
| | | android:id="@+id/lswitchxiaodu" |
| | | android:layout_margin="10dp" |
| | | android:layout_width="250dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | app:checked="false" |
| | | app:text_off="消毒开" |
| | | app:text_size_off="20dp" |
| | | app:text_on="消毒关" |
| | | app:text_show="true" |
| | | app:text_size_off="20dp" |
| | | app:text_size_on="20dp" |
| | | app:track_color_on="@color/DarkGray" |
| | | app:track_color_off="@color/cheng" |
| | | app:text_show ="true" |
| | | app:checked="false"/> |
| | | app:track_color_on="@color/DarkGray" /> |
| | | |
| | | <com.liys.lswitch.LSwitch |
| | | android:id="@+id/lswitdeng" |
| | | android:layout_margin="10dp" |
| | | android:layout_width="250dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | app:checked="false" |
| | | app:text_off="灯光开" |
| | | app:text_size_off="20dp" |
| | | app:text_on="灯光关" |
| | | app:text_show="true" |
| | | app:text_size_off="20dp" |
| | | app:text_size_on="20dp" |
| | | app:track_color_on="@color/DarkGray" |
| | | app:track_color_off="@color/cheng" |
| | | app:text_show ="true" |
| | | app:checked="false"/> |
| | | app:track_color_on="@color/DarkGray" /> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | |
| | | android:layout_gravity="center" |
| | | android:orientation="vertical"> |
| | | <LinearLayout |
| | | android:layout_width="1000dp" |
| | | android:layout_height="120dp" |
| | | android:visibility="gone" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:orientation="horizontal"> |
| | | <TextView |
| | | android:layout_width="150dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="60dp" |
| | | android:gravity="right|center_vertical" |
| | | android:text="设备号:" |
| | | android:layout_margin="10dp" |
| | |
| | | android:textSize="30dp" /> |
| | | <EditText |
| | | android:id="@+id/deviceCode" |
| | | android:layout_width="300dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="60dp" |
| | | android:layout_margin="10dp" |
| | | android:gravity="center" |
| | | android:background="@drawable/round_editstyle" |
| | |
| | | android:textSize="30dp" /> |
| | | |
| | | <TextView |
| | | android:layout_width="150dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="60dp" |
| | | android:layout_margin="10dp" |
| | | android:gravity="right|center_vertical" |
| | | android:text="设备秘钥:" |
| | |
| | | android:textSize="30dp" /> |
| | | <EditText |
| | | android:id="@+id/devicePwd" |
| | | android:layout_width="300dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="60dp" |
| | | android:layout_margin="10dp" |
| | | android:gravity="center" |
| | | android:background="@drawable/round_editstyle" |
| | |
| | | android:textSize="30dp" /> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="1000dp" |
| | | android:layout_height="120dp" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:orientation="horizontal"> |
| | | <TextView |
| | | android:layout_width="150dp" |
| | | android:layout_height="80dp" |
| | | android:layout_height="60dp" |
| | | android:gravity="right|center_vertical" |
| | | android:text="串口号:" |
| | | android:layout_margin="10dp" |
| | |
| | | android:textSize="30dp" /> |
| | | <org.angmarch.views.NiceSpinner |
| | | android:id="@+id/chuankouhao" |
| | | android:layout_width="300dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="60dp" |
| | | android:layout_margin="10dp" /> |
| | | |
| | | <TextView |
| | | android:layout_width="150dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="60dp" |
| | | android:layout_margin="10dp" |
| | | android:visibility="invisible" |
| | | android:gravity="right|center_vertical" |
| | |
| | | android:textColor="@color/white" |
| | | android:textSize="30dp" /> |
| | | <EditText |
| | | android:layout_width="300dp" |
| | | android:layout_height="80dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="60dp" |
| | | android:layout_margin="10dp" |
| | | android:visibility="invisible" |
| | | android:gravity="center" |
| | |
| | | android:textSize="30dp" /> |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="540dp" |
| | | android:layout_height="120dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:layout_gravity="center" |
| | | android:layout_marginTop="50dp" |
| | | android:orientation="horizontal"> |
| | | <Button |
| | | android:id="@+id/jihuo" |
| | | android:layout_width="250dp" |
| | | android:layout_height="80dp" |
| | | android:layout_height="60dp" |
| | | android:textSize="30dp" |
| | | android:visibility="gone" |
| | | android:layout_margin="10dp" |
| | | android:layout_gravity="center" |
| | | android:gravity="center" |
| | |
| | | <Button |
| | | android:id="@+id/save" |
| | | android:layout_width="250dp" |
| | | android:layout_height="80dp" |
| | | android:layout_height="60dp" |
| | | android:textSize="30dp" |
| | | android:layout_margin="10dp" |
| | | android:layout_gravity="center" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto"> |
| | | <ImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:scaleType="centerCrop" |
| | | android:id="@+id/iv_img"/> |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | <color name="colorPrimary">#008577</color> |
| | | <color name="colorPrimary">#FB9A3D</color> |
| | | <color name="colorPrimaryDark">#00574B</color> |
| | | <color name="colorAccent">#D81B60</color> |
| | | <color name="selector_num_text">#D81B60</color> |
| | |
| | | <color name="bg_color_box_btn_occupy">#ffff0000</color> |
| | | <color name="bg_color_box_btn_unlocked">#ffff8800</color> |
| | | <color name="bg_color_box_btn_disable">#ff888888</color> |
| | | <color name="textColor">#515151</color> |
| | | <color name="grey">#DCDCDC</color> |
| | | </resources> |
| | |
| | | <!--退出时的动画--> |
| | | <item name="android:windowExitAnimation">@anim/smile_dialog_exit</item> |
| | | </style> |
| | | |
| | | <style name="BaseDialog" parent="Theme.AppCompat.Light.NoActionBar"> |
| | | <item name="colorPrimary">@color/colorPrimary</item> |
| | | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> |
| | | <item name="colorAccent">@color/colorAccent</item> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <item name="android:windowTitleBackgroundStyle">@android:color/transparent</item> |
| | | <item name="windowActionBar">false</item> |
| | | <item name="android:windowIsFloating">true</item> |
| | | <item name="android:windowIsTranslucent">true</item> |
| | | <item name="android:windowBackground">@android:color/transparent</item> |
| | | <item name="android:windowContentOverlay">@null</item> |
| | | <item name="android:windowFrame">@null</item> |
| | | </style> |
| | | |
| | | <style name="FadeDialog" parent="BaseDialog"> |
| | | </style> |
| | | </resources> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <network-security-config xmlns:tools="http://schemas.android.com/tools"> |
| | | <base-config cleartextTrafficPermitted="true" |
| | | tools:ignore="NetworkSecurityConfig" /> |
| | | </network-security-config> |
| | |
| | | |
| | | } |
| | | dependencies { |
| | | classpath 'com.android.tools.build:gradle:3.5.3' |
| | | classpath 'com.android.tools.build:gradle:3.6.4' |
| | | classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6' |
| | | classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0' |
| | | // NOTE: Do not place your application dependencies here; they belong |
| | |
| | | #Sat May 06 18:00:29 CST 2023 |
| | | #Tue Jun 18 21:39:03 CST 2024 |
| | | distributionBase=GRADLE_USER_HOME |
| | | distributionPath=wrapper/dists |
| | | zipStoreBase=GRADLE_USER_HOME |
| | | zipStorePath=wrapper/dists |
| | | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip |
| | | zipStoreBase=GRADLE_USER_HOME |
| | | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip |