renevy 5 年 前
コミット
edcef2fd59

+ 2 - 0
.gitignore

@@ -31,4 +31,6 @@ proguard/
 
 # Android Studio captures folder
 captures/
+.idea
+*.md
 

+ 2 - 0
app/.gitignore

@@ -1,3 +1,5 @@
 build
 .cxx
 *.iml
+release
+proguard-rules.pro

+ 77 - 14
app/src/main/java/com/ifastore/goodsmanage/MainActivity.java

@@ -5,7 +5,6 @@ import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.graphics.Color;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
@@ -22,7 +21,6 @@ import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.RelativeLayout;
 import android.widget.Spinner;
-import android.widget.TextClock;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -50,24 +48,28 @@ import butterknife.ButterKnife;
 import butterknife.OnClick;
 
 import static android.widget.Toast.LENGTH_SHORT;
+import static com.ifastore.goodsmanage.common.Constants.CONTROL_IN;
+import static com.ifastore.goodsmanage.common.Constants.CONTROL_OUT;
+import static com.ifastore.goodsmanage.common.Constants.MOTOR_START;
+import static com.ifastore.goodsmanage.common.Constants.MOTOR_TEST;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_DEVICE_ADDR;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_DEVICE_SERIAL;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_MOTOR_STATUS;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_TEMP;
 import static com.ifastore.goodsmanage.common.Constants.REPORT_EVENT_GOODS;
-import static com.ifastore.goodsmanage.common.Constants.REPORT_EVENT_MOTOR;
+import static com.ifastore.goodsmanage.common.Constants.SET_DEVICE_ADDR;
 import static com.ifastore.goodsmanage.common.Constants.RESULT_CONTROL_LIGHT;
 import static com.ifastore.goodsmanage.common.Constants.RESULT_CONTROL_SALE;
 
 
 public class MainActivity extends AppCompatActivity {
 
-    @BindView(R.id.sale)
-    Button sale;
     @BindView(R.id.openSerial)
     Button openSerial;
     @BindView(R.id.closeSerial)
     Button closeSerial;
     @BindView(R.id.clearLog)
     Button clearLog;
-    @BindView(R.id.controlLight)
-    Button controlLight;
     @BindView(R.id.serial)
     Spinner serial;
     @BindView(R.id.baute)
@@ -77,6 +79,25 @@ public class MainActivity extends AppCompatActivity {
     @BindView(R.id.logLayout)
     RelativeLayout logLayout;
 
+    @BindView(R.id.temp)
+    TextView temp;
+    @BindView(R.id.readAddr)
+    Button readAddr;
+    @BindView(R.id.setAddr)
+    Button setAddr;
+    @BindView(R.id.querySerial)
+    Button querySerial;
+    @BindView(R.id.queryStatus)
+    Button queryStatus;
+    @BindView(R.id.motoTest)
+    Button motoTest;
+    @BindView(R.id.motoStart)
+    Button motoStart;
+    @BindView(R.id.controlOut)
+    Button controlOut;
+    @BindView(R.id.controlIn)
+    Button controlIn;
+
     private Window window;
     private LayoutInflater inflater;
     private View linearLayout;
@@ -129,8 +150,9 @@ public class MainActivity extends AppCompatActivity {
     });
 
 
-    @SuppressLint("ShowToast")
-    @OnClick({R.id.sale, R.id.closeSerial, R.id.openSerial, R.id.clearLog, R.id.controlLight})
+    @SuppressLint({"ShowToast", "NonConstantResourceId"})
+    @OnClick({R.id.motoStart, R.id.closeSerial, R.id.openSerial, R.id.clearLog, R.id.motoTest,
+            R.id.queryStatus, R.id.querySerial, R.id.controlIn, R.id.controlOut, R.id.readAddr, R.id.setAddr})
      public void onClick (View view){
         if(!isFirst){
             isFirst = true;
@@ -154,6 +176,7 @@ public class MainActivity extends AppCompatActivity {
         }
     }
 
+    @SuppressLint("NonConstantResourceId")
     private void serialCmdHandler(int id){
         if(commTask == null) {
             Toast.makeText(this, "请打开串口!", LENGTH_SHORT).show();
@@ -167,12 +190,28 @@ public class MainActivity extends AppCompatActivity {
             case R.id.closeSerial:
                 closeSerial();
                 break;
-            case R.id.sale:
+            case R.id.motoStart:
                 if(commTask.isopen){
                     setOutGoodsInfo();
                 }
                 break;
-            case R.id.controlLight:
+            case R.id.motoTest:
+                selectLight();
+                break;
+            case R.id.readAddr:
+                break;
+            case R.id.setAddr:
+                break;
+            case R.id.querySerial:
+                selectLight();
+                break;
+            case R.id.queryStatus:
+                selectLight();
+                break;
+            case R.id.controlOut:
+                selectLight();
+                break;
+            case R.id.controlIn:
                 selectLight();
                 break;
         }
@@ -184,7 +223,15 @@ public class MainActivity extends AppCompatActivity {
         intentFilter.addAction(RESULT_CONTROL_SALE);
         intentFilter.addAction(RESULT_CONTROL_LIGHT);
         intentFilter.addAction(REPORT_EVENT_GOODS);
-        intentFilter.addAction(REPORT_EVENT_MOTOR);
+        intentFilter.addAction(SET_DEVICE_ADDR);
+        intentFilter.addAction(QUERY_DEVICE_ADDR);
+        intentFilter.addAction(QUERY_DEVICE_SERIAL);
+        intentFilter.addAction(QUERY_MOTOR_STATUS);
+        intentFilter.addAction(QUERY_TEMP);
+        intentFilter.addAction(CONTROL_IN);
+        intentFilter.addAction(CONTROL_OUT);
+        intentFilter.addAction(MOTOR_START);
+        intentFilter.addAction(MOTOR_TEST);
         this.registerReceiver(broadCastReceiver, intentFilter);
     }
 
@@ -226,8 +273,8 @@ public class MainActivity extends AppCompatActivity {
                             }
                         }
                         break;
-                    case REPORT_EVENT_MOTOR:
-                        int motorResult = intent.getIntExtra(REPORT_EVENT_MOTOR, -1);
+                    case SET_DEVICE_ADDR:
+                        int motorResult = intent.getIntExtra(SET_DEVICE_ADDR, -1);
                         Logger.debug("motor error result:" +motorResult);
                         showLog("电机异常:"+motorResult);
                         pupWindows("电机异常:"+motorResult);
@@ -244,6 +291,22 @@ public class MainActivity extends AppCompatActivity {
 
                         }
                         break;
+                    case QUERY_DEVICE_ADDR:
+                        break;
+                    case QUERY_DEVICE_SERIAL:
+                        break;
+                    case QUERY_MOTOR_STATUS:
+                        break;
+                    case QUERY_TEMP:
+                        break;
+                    case CONTROL_OUT:
+                        break;
+                    case CONTROL_IN:
+                        break;
+                    case MOTOR_START:
+                        break;
+                    case MOTOR_TEST:
+                        break;
                 }
             }
         }

+ 10 - 0
app/src/main/java/com/ifastore/goodsmanage/common/Constants.java

@@ -10,5 +10,15 @@ public class Constants {
     public static final String REPORT_EVENT_GOODS = "out_goods";
     public static final String REPORT_EVENT_MOTOR = "motor_error";
 
+    public static final String SET_DEVICE_ADDR     = "set_device_addr";
+    public static final String QUERY_DEVICE_ADDR   = "query_device_addr";
+    public static final String QUERY_DEVICE_SERIAL = "query_device_serial";
+    public static final String QUERY_MOTOR_STATUS  = "query_motor_status";
+    public static final String QUERY_TEMP          = "query_temp";
+    public static final String MOTOR_TEST          = "motor_test";
+    public static final String MOTOR_START         = "motor_start";
+    public static final String CONTROL_OUT         = "control_out";
+    public static final String CONTROL_IN          = "control_in";
+
 
 }

+ 95 - 4
app/src/main/java/com/ifastore/goodsmanage/serialport/CommSerial.java

@@ -210,6 +210,18 @@ public class CommSerial {
         //cmd controll
         ControlSale,
         ControlLight,
+
+        SetAddress,
+        QueryAddress,
+
+        QuerySerial,
+        QueryStatus,
+        MotoTest,
+        MotoStart,
+        QueryTemp,
+        ControlWriteOut,
+        ControlReadIn,
+
         // auto report
         EventOutGoods,
         EventMotor,
@@ -366,7 +378,7 @@ public class CommSerial {
         }
     }
 
-    private ProtocolCMDEnum frameCMD2ProtocolDataCMD(String cmd) {
+    private ProtocolCMDEnum frameCMD2ProtocolDataCMD(int cmd) {
         ProtocolCMDEnum _cmd = null;
 
         switch (cmd) {
@@ -382,6 +394,33 @@ public class CommSerial {
             case Constant.CMD_EVENT_MOTOR:
                 _cmd = ProtocolCMDEnum.EventMotor;
                 break;
+            case Constant.CMD_SET_ADDR:
+                _cmd = ProtocolCMDEnum.SetAddress;
+                break;
+            case Constant.CMD_QUERY_ADDR:
+                _cmd = ProtocolCMDEnum.QueryAddress;
+                break;
+            case Constant.CMD_QUERY_SERIAL:
+                _cmd = ProtocolCMDEnum.QuerySerial;
+                break;
+            case Constant.CMD_QUERY_STATUS:
+                _cmd = ProtocolCMDEnum.QueryStatus;
+                break;
+            case Constant.CMD_MOTO_TEST:
+                _cmd = ProtocolCMDEnum.MotoTest;
+                break;
+            case Constant.CMD_MOTO_RUN:
+                _cmd = ProtocolCMDEnum.MotoStart;
+                break;
+            case Constant.CMD_QUERY_TEMP:
+                _cmd = ProtocolCMDEnum.QueryTemp;
+                break;
+            case Constant.CMD_WRITE_OUT:
+                _cmd = ProtocolCMDEnum.ControlWriteOut;
+                break;
+            case Constant.CMD_READ_IN:
+                _cmd = ProtocolCMDEnum.ControlReadIn;
+                break;
             default:
                 break;
         }
@@ -404,7 +443,7 @@ public class CommSerial {
         }
     }
 
-    private void sendFrame(int type, String cmd, byte[] data) {
+    private void sendFrame(int type, int cmd, byte[] data) {
         Frame _frame = new Frame();
         _frame.ID = getID();
         _frame.Type = type;
@@ -422,7 +461,7 @@ public class CommSerial {
         new Thread(new Runnable() {
             @Override
             public void run() {
-                String cmd = Constant.CMD_CONTROL_SALE;
+                int cmd = Constant.CMD_CONTROL_SALE;
                 byte[]data = new byte[]{0x1, 0x02, 0x03};
                /*testRecvFrame(1, cmd, data);
                 try {
@@ -453,7 +492,7 @@ public class CommSerial {
         }).start();
     }
 
-    private void testRecvFrame(int id, String cmd, byte[] data) {
+    private void testRecvFrame(int id, int cmd, byte[] data) {
         Frame _frame = new Frame();
         _frame.ID = id;
         _frame.Type = Constant.TYPE_DATA;
@@ -535,5 +574,57 @@ public class CommSerial {
         sendFrame(Constant.TYPE_DATA, Constant.CMD_CONTROL_LIGHT, data);
     }
 
+    public void setAddress(int addr) {
+        byte[]data = new byte[1];
+        data[0] = (byte) addr;
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_SET_ADDR, data);
+    }
+
+    public void querySerailNum() {
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_QUERY_SERIAL, null);
+    }
+
+    public void queryAddress() {
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_QUERY_ADDR, null);
+    }
+
+    public void queryMotorStatus() {
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_QUERY_STATUS, null);
+    }
+
+    public void queryTemp() {
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_QUERY_TEMP, null);
+    }
+
+    public void startMotor(byte[]data) {
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_MOTO_RUN, data);
+    }
+
+    //00~100
+    public void testMotor(int motorIndex) {
+        byte[] data = new byte[1];
+        data[0] = (byte) motorIndex;
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_MOTO_TEST, data);
+    }
+
+
+    public void controlOut(int index, int ctl) {
+        byte[] data = new byte[2];
+        data[0] = (byte) index;
+        data[1] = (byte) ctl;
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_WRITE_OUT, data);
+    }
+
+
+    public void controlIn(int index) {
+        byte[] data = new byte[1];
+        data[0] = (byte) index;
+        sendFrame(Constant.TYPE_DATA, Constant.CMD_READ_IN, data);
+    }
+
+
+
+
+
 }
 

+ 99 - 2
app/src/main/java/com/ifastore/goodsmanage/serialport/CommTask.java

@@ -4,14 +4,25 @@ package com.ifastore.goodsmanage.serialport;
 import android.content.Context;
 import android.content.Intent;
 import android.icu.text.SimpleDateFormat;
+
+import com.ifastore.goodsmanage.serialport.protocol.Constant;
 import com.ifastore.goodsmanage.utils.Logger;
 import com.ifastore.goodsmanage.utils.TypeConverter;
 import com.reduxsolutions.serialport.drivers.SerialPort;
 import java.io.File;
 import java.io.IOException;
 import java.util.Date;
+
+import static com.ifastore.goodsmanage.common.Constants.CONTROL_IN;
+import static com.ifastore.goodsmanage.common.Constants.CONTROL_OUT;
+import static com.ifastore.goodsmanage.common.Constants.MOTOR_START;
+import static com.ifastore.goodsmanage.common.Constants.MOTOR_TEST;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_DEVICE_ADDR;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_DEVICE_SERIAL;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_MOTOR_STATUS;
+import static com.ifastore.goodsmanage.common.Constants.QUERY_TEMP;
 import static com.ifastore.goodsmanage.common.Constants.REPORT_EVENT_GOODS;
-import static com.ifastore.goodsmanage.common.Constants.REPORT_EVENT_MOTOR;
+import static com.ifastore.goodsmanage.common.Constants.SET_DEVICE_ADDR;
 import static com.ifastore.goodsmanage.common.Constants.RESULT_CONTROL_LIGHT;
 import static com.ifastore.goodsmanage.common.Constants.RESULT_CONTROL_SALE;
 
@@ -64,6 +75,33 @@ public class CommTask{
                     case ControlLight:
                         resultLight(RESULT_CONTROL_LIGHT, value);
                         break;
+                    case SetAddress:
+                        resultLight(SET_DEVICE_ADDR, value);
+                        break;
+                    case QueryAddress:
+                        resultLight(QUERY_DEVICE_ADDR, value);
+                        break;
+                    case QuerySerial:
+                        resultLight(QUERY_DEVICE_SERIAL, value);
+                        break;
+                    case QueryStatus:
+                        resultLight(QUERY_MOTOR_STATUS, value);
+                        break;
+                    case MotoTest:
+                        resultLight(MOTOR_TEST, value);
+                        break;
+                    case MotoStart:
+                        resultLight(MOTOR_START, value);
+                        break;
+                    case QueryTemp:
+                        resultLight(QUERY_TEMP, value);
+                        break;
+                    case ControlWriteOut:
+                        resultLight(CONTROL_OUT, value);
+                        break;
+                    case ControlReadIn:
+                        resultLight(CONTROL_IN, value);
+                        break;
                 }
             }
 
@@ -74,7 +112,7 @@ public class CommTask{
                         resultOutGoods(REPORT_EVENT_GOODS, value);
                         break;
                     case EventMotor:
-                        resultLight(REPORT_EVENT_MOTOR, value);
+                        resultLight(SET_DEVICE_ADDR, value);
                         break;
                 }
             }
@@ -94,6 +132,7 @@ public class CommTask{
         //byte[] test = {0,    0x1,   1, 1, 0, 0,  0x2,  1, 0, 1, 0,      0x3,   1, 0, 0, 1,     0x4,   1, 0, 0, 1};
         //byte[] test = {1,    0x1,   2, 1, 3, 0,  4,  1, 5, 1,6,     1,  7,   1, 8, 0,9,     0x4,   0xA, 0, 0xB, 1};
     }
+
     public void controlLight(byte cmd) {
         if(commTask.isopen){
             commSerial.controlLight(cmd);
@@ -102,6 +141,64 @@ public class CommTask{
         //byte[] test = {1,    0x1,   2, 1, 3, 0,  4,  1, 5, 1,6,     1,  7,   1, 8, 0,9,     0x4,   0xA, 0, 0xB, 1};
     }
 
+    public void setAddress(int addr) {
+        if(commTask.isopen){
+            commSerial.setAddress(addr);
+        }
+    }
+
+
+    public void querySerailNum() {
+        if(commTask.isopen){
+            commSerial.querySerailNum();
+        }
+    }
+
+    public void queryAddress() {
+        if(commTask.isopen){
+            commSerial.queryAddress();
+        }
+    }
+
+    public void queryMotorStatus() {
+        if(commTask.isopen){
+            commSerial.queryMotorStatus();
+        }
+    }
+
+    public void queryTemp() {
+        if(commTask.isopen){
+            commSerial.queryTemp();
+        }
+    }
+
+    public void startMotor(byte[]data) {
+        if(commTask.isopen){
+            commSerial.startMotor(data);
+        }
+    }
+
+    //00~100
+    public void testMotor(int motorIndex) {
+        if(commTask.isopen){
+            commSerial.testMotor(motorIndex);
+        }
+    }
+
+
+    public void controlOut(int index, int ctl) {
+        if(commTask.isopen){
+            commSerial.controlOut(index, ctl);
+        }
+    }
+
+
+    public void controlIn(int index) {
+        if(commTask.isopen){
+            commSerial.controlIn(index);
+        }
+    }
+
     public static CommTask openSerialport(Context ctx, String serial, int baute){
         if(commTask != null){
             if(!commTask.isopen){

+ 26 - 4
app/src/main/java/com/ifastore/goodsmanage/serialport/protocol/Constant.java

@@ -7,12 +7,34 @@ public class Constant {
     public static final int TYPE_NAK =                  (byte) 0x13;
     public static final int TYPE_DATA_MULTI =           (byte) 0xF1;
     //control
-    public static final String CMD_CONTROL_SALE =      "SA";
-    public static final String CMD_CONTROL_LIGHT=      "UL";
+    public static final int CMD_CONTROL_SALE  =    0x5341; //"SA"
+    public static final int CMD_CONTROL_LIGHT =    0x554C;    //"UL";
+
+    //设置设备地址:0x5344"SD" (set ID)
+    public static final int CMD_SET_ADDR      =    0x5344;
+    //读取设备地址:0x5244"RD" (read ID)
+    public static final int CMD_QUERY_ADDR    =    0x5244;
+
+
+    //控制设备命令
+    // 获取序列号:0x0001
+    public static final byte CMD_QUERY_SERIAL    =    0x0001;
+    //查询Run执行状态(Motor Poll):0x0003
+    public static final byte CMD_QUERY_STATUS    =    0x0003;
+    //测试(Motor Scan):0x0004
+    public static final byte CMD_MOTO_TEST       =    0x0004;
+    //启动(Motor Run):0x0005
+    public static final byte CMD_MOTO_RUN        =    0x0005;
+    //读温度(Read Temp):0x0007
+    public static final byte CMD_QUERY_TEMP      =    0x0007;
+    //开关量输出(Write DO):0x0008
+    public static final byte CMD_WRITE_OUT       =    0x0008;
+    //开关量输入(Read DI):0x0009
+    public static final byte CMD_READ_IN         =    0x0009;
 
     //event upload
-    public static final String CMD_EVENT_SALE   =      "SE";
-    public static final String CMD_EVENT_MOTOR  =      "MA";
+    public static final int CMD_EVENT_SALE   =      0x5345; //"SE";
+    public static final int CMD_EVENT_MOTOR  =      0x4D41; //"MA";
 
 
 

+ 1 - 1
app/src/main/java/com/ifastore/goodsmanage/serialport/protocol/Frame.java

@@ -5,7 +5,7 @@ public class Frame {
     public int ID;
     public int Type;
     //private int Len;
-    public String CMD;
+    public int CMD;
     public byte[] Data = new byte[0];
     public int CRC16;
 }

+ 8 - 6
app/src/main/java/com/ifastore/goodsmanage/serialport/protocol/Protocol.java

@@ -97,7 +97,7 @@ public class Protocol {
     }
 
     /** Frame encoding process */
-    public byte[] encode(int id, int type, String cmd, byte[] data) {
+    public byte[] encode(int id, int type, int cmd, byte[] data) {
 
         int _Length = BUFFER_LENGTH_MIN;
 
@@ -112,7 +112,9 @@ public class Protocol {
         _buffer[_Length + OFFSET_R_EOF] = B_EOF;
 
         // 1.set CMD
-        byte[] _cmd = cmd.getBytes();
+        byte[] _cmd =new byte[2];
+        _cmd[0] = (byte) ((cmd >> 8)  & 0xff);
+        _cmd[1] = (byte) (cmd & 0xff);
         System.arraycopy(_cmd, 0, _buffer, OFFSET_CMD_H, 2);
         if (mDebug) Logger.debug( String.format("cmd: [%x][%x] %d", (int)_cmd[0], (int)_cmd[1], _cmd.length));
         // 2.set DATA
@@ -227,10 +229,10 @@ public class Protocol {
         }
         _frame.ID = buffer[OFFSET_ID] & 0xFF;
         _frame.Type = buffer[OFFSET_TYPE] & 0xFF;
-        byte[] _cmd = new byte[2];
-        _cmd[0] = buffer[OFFSET_CMD_H];
-        _cmd[1] = buffer[OFFSET_CMD_L];
-        _frame.CMD = new String(_cmd);
+        int _cmd = 0;
+        _cmd += (buffer[OFFSET_CMD_H] << 8) & 0xff00;
+        _cmd +=  buffer[OFFSET_CMD_L];
+        _frame.CMD = _cmd;
         if (len > BUFFER_LENGTH_MIN) {
             byte[] _data = new byte[len - BUFFER_LENGTH_MIN];
             System.arraycopy(buffer, OFFSET_DATA, _data, 0, _data.length);

+ 161 - 33
app/src/main/res/layout-land/activity_main.xml

@@ -9,28 +9,43 @@
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="0dp"
-        android:layout_weight="2"
+        android:layout_weight="1.2"
         android:background="@color/holo_blue_light"
         >
-        <TextView
+        <LinearLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:background="@color/white"
+            android:id="@+id/logview"
             android:layout_marginTop="10dp"
-            android:textColor="@color/github_con_0"
-            android:layout_marginStart="1dp"
-            android:textSize="30sp"
-            android:text="日志">
+            android:layout_marginStart="0dp"
+            >
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="10dp"
+                android:layout_marginEnd="10dp"
+                android:layout_marginTop="5dp"
+                android:layout_marginBottom="5dp"
+                android:textColor="@color/black"
+                android:textSize="30sp"
+                android:text="日志">
+            </TextView>
+        </LinearLayout>
 
-        </TextView>
         <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
+            android:layout_marginStart="100dp"
+            android:layout_marginEnd="100dp"
+            android:layout_marginTop="60dp"
+            android:layout_marginBottom="30dp"
             android:gravity="center"
             >
             <RelativeLayout
                 android:id="@+id/logLayout"
-                android:layout_width="1000dp"
-                android:layout_height="400dp"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
                 android:fadeScrollbars="false"
                 android:scrollbars="vertical"
                 android:gravity="center"
@@ -59,17 +74,54 @@
         android:layout_height="0dp"
 
         >
-        <TextView
+        <LinearLayout
+            android:id="@+id/controlView"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:background="@color/white"
             android:layout_marginTop="10dp"
-            android:layout_marginStart="1dp"
-            android:textSize="30sp"
-            android:textColor="@color/github_con_0"
-            android:text="控制"
-            android:layout_alignParentTop="true"
+            android:layout_marginStart="0dp"
             >
-        </TextView>
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="10dp"
+                android:layout_marginEnd="10dp"
+                android:layout_marginTop="5dp"
+                android:layout_marginBottom="5dp"
+                android:textSize="30sp"
+                android:textColor="@color/black"
+                android:text="控制"
+                >
+            </TextView>
+
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/controlView"
+            android:layout_marginTop="40dp"
+            >
+            <TextView
+                android:id="@+id/tempText"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:textColor="@color/black"
+                android:textSize="30sp"
+                android:text="温度:">
+            </TextView>
+            <TextView
+                android:id="@+id/temp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toEndOf="@+id/tempText"
+                android:layout_marginStart="10dp"
+                android:textColor="@color/black"
+                android:textSize="30sp"
+                android:text="0.0"/>
+        </RelativeLayout>
         <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
@@ -77,7 +129,9 @@
             >
             <RelativeLayout
                 android:id="@+id/operate"
-                android:layout_width="800dp"
+                android:layout_width="match_parent"
+                android:layout_marginStart="150dp"
+                android:layout_marginEnd="150dp"
                 android:background="@drawable/bg_account_shape"
                 android:layout_height="match_parent"
                 android:gravity="center"
@@ -100,7 +154,7 @@
                     android:layout_toEndOf="@id/serial"
                     android:background="@drawable/bg_spin_normal"
                     style="@style/Spinner"
-                    android:layout_marginStart="60dp" />
+                    android:layout_marginStart="40dp" />
 
                 <Button
                     android:id="@+id/openSerial"
@@ -110,7 +164,7 @@
                     android:layout_width="150dp"
                     android:layout_height="70dp"
                     android:layout_toEndOf="@id/baute"
-                    android:layout_marginStart="60dp"
+                    android:layout_marginStart="40dp"
                     android:textSize="20sp"
                     />
 
@@ -122,48 +176,122 @@
                     android:layout_width="150dp"
                     android:layout_height="70dp"
                     android:layout_toEndOf="@id/baute"
-                    android:layout_marginStart="60dp"
+                    android:layout_marginStart="40dp"
                     android:visibility="invisible"
                     android:textSize="20sp"
                     />
 
                 <Button
-                    android:id="@+id/controlLight"
+                    android:id="@+id/clearLog"
                     android:background="@drawable/bg_btn_button"
-                    android:text="光幕开关"
+                    android:text="@string/clearLog"
+                    android:layout_marginTop="0dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_toEndOf="@id/openSerial"
+                    android:layout_marginStart="40dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/setAddr"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="设备配置"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_below="@+id/serial"
                     android:layout_marginTop="40dp"
+                    android:textSize="20sp"
+                    />
+
+
+                <Button
+                    android:id="@+id/readAddr"
+                    android:text="设备地址"
                     android:layout_width="150dp"
                     android:layout_height="70dp"
-                    android:layout_toEndOf="@+id/clearLog"
+                    android:layout_below="@id/setAddr"
+                    android:textSize="20sp"
+                    android:layout_marginTop="40dp"
+                    android:background="@drawable/bg_btn_button"
+                    />
+
+                <Button
+                    android:id="@+id/motoTest"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="电机测试"
+                    android:layout_marginTop="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_toEndOf="@+id/readAddr"
                     android:layout_below="@id/baute"
                     android:textSize="20sp"
-                    android:layout_marginStart="60dp"/>
+                    android:layout_marginStart="40dp"/>
 
                 <Button
-                    android:id="@+id/sale"
+                    android:id="@+id/motoStart"
                     android:background="@drawable/bg_btn_button"
-                    android:text="@string/sale"
+                    android:text="电机启动"
                     android:layout_marginTop="40dp"
                     android:layout_below="@+id/baute"
-                    android:layout_toEndOf="@+id/controlLight"
-                    android:layout_marginStart="60dp"
+                    android:layout_toEndOf="@+id/motoTest"
+                    android:layout_marginStart="40dp"
                     android:layout_width="150dp"
                     android:layout_height="70dp"
                     android:textSize="20sp"
                     />
 
+                <Button
+                    android:id="@+id/querySerial"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="序列号"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/baute"
+                    android:layout_toEndOf="@+id/motoStart"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
 
                 <Button
-                    android:id="@+id/clearLog"
-                    android:text="@string/clearLog"
+                    android:id="@+id/queryStatus"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="执行状态"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/setAddr"
+                    android:layout_toEndOf="@+id/readAddr"
+                    android:layout_marginStart="40dp"
                     android:layout_width="150dp"
                     android:layout_height="70dp"
-                    android:layout_below="@id/serial"
                     android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/controlIn"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="开关量输入"
                     android:layout_marginTop="40dp"
+                    android:layout_below="@+id/setAddr"
+                    android:layout_toEndOf="@+id/queryStatus"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/controlOut"
                     android:background="@drawable/bg_btn_button"
-                    >
-                </Button>
+                    android:text="开关量输出"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/setAddr"
+                    android:layout_toEndOf="@+id/controlIn"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
 
 
 

+ 297 - 162
app/src/main/res/layout-port/activity_main.xml

@@ -1,168 +1,303 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context=".MainActivity"
-    tools:ignore="MissingDefaultResource">
+    android:orientation="vertical"
+    tools:context=".MainActivity">
 
-    <TextView
-        android:id="@+id/recvView"
+    <RelativeLayout
         android:layout_width="match_parent"
-        android:background="@color/colorAccent"
-        android:layout_height="300dp"
-        android:layout_alignParentStart="true"
-        android:layout_alignParentTop="true" />
-    <Button
-        android:id="@+id/sale"
-        android:background="#009688"
-        android:text="@string/sale"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/recvView"
-        android:layout_marginStart="50dp"
-        android:layout_marginTop="30dp"
-        />
-
-    <Button
-        android:id="@+id/getVersion"
-        android:background="#009688"
-        android:text="@string/version"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/recvView"
-        android:layout_marginTop="30dp"
-        android:layout_toEndOf="@+id/sale"
-        android:layout_marginStart="20dp"/>
-
-    <Button
-        android:id="@+id/getTemp"
-        android:background="#009688"
-        android:text="@string/gettemp"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/sale"
-        android:layout_marginStart="50dp"
-        android:layout_marginTop="30dp"
-         />
-    <Button
-        android:id="@+id/reboot"
-        android:background="#009688"
-        android:text="@string/reboot"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/getVersion"
-        android:layout_toEndOf="@id/getTemp"
-        android:layout_marginStart="20dp"
-        android:layout_marginTop="30dp"/>
-
-    <Button
-        android:id="@+id/setTemp"
-        android:background="#009688"
-        android:text="@string/settemp"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/getTemp"
-        android:layout_marginTop="30dp"
-        android:layout_marginStart="50dp" />
-
-    <EditText
-        android:id="@+id/editTemp"
-        android:layout_width="88dp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="20dp"
-        android:layout_toEndOf="@id/setTemp"
-        android:layout_below="@id/reboot"
-        android:layout_marginTop="30dp"
-        />
-
-    <Button
-        android:id="@+id/startDownload"
-        android:background="#009688"
-        android:text="@string/startdownload"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/recvView"
-        android:layout_marginStart="20dp"
-        android:layout_toEndOf="@id/reboot"
-        android:layout_marginTop="30dp"/>
-
-    <Button
-        android:id="@+id/firmwareTransfer"
-        android:background="#009688"
-        android:text="@string/content"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="30dp"
-        android:layout_below="@id/startDownload"
-        android:layout_toEndOf="@id/reboot"
-        android:layout_marginStart="20dp"/>
-
-    <Button
-        android:id="@+id/stopDownload"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:background="#009688"
-        android:text="@string/stopdownload"
-        android:layout_below="@id/firmwareTransfer"
-        android:layout_marginTop="30dp"
-        android:layout_toEndOf="@id/editTemp"
-        android:layout_marginStart="20dp"
-        />
-
-    <Button
-        android:id="@+id/getRealWeight"
-        android:background="#009688"
-        android:text="@string/getRealWeight"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="50dp"
-        android:layout_below="@id/setTemp"
-        android:layout_marginTop="30dp" />
-
-    <Button
-        android:id="@+id/clearStandard"
-        android:background="#009688"
-        android:text="@string/clearStandard"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/editTemp"
-        android:layout_marginStart="20dp"
-        android:layout_marginTop="30dp"
-        android:layout_toEndOf="@id/getRealWeight"
-        />
-
-    <Button
-        android:id="@+id/setZero"
-        android:background="#009688"
-        android:text="@string/setZero"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/stopDownload"
-        android:layout_centerVertical="true"
-        android:layout_marginStart="20dp"
-        android:layout_marginTop="30dp"
-        android:layout_toEndOf="@id/clearStandard"
-        />
-
-    <Button
-        android:id="@+id/setThreshold"
-        android:background="#009688"
-        android:text="@string/setThreshold"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="50dp"
-        android:layout_below="@id/getRealWeight"
-        android:layout_marginTop="30dp" />
-    <EditText
-        android:id="@+id/editThreshold"
-        android:layout_width="88dp"
-        android:inputType="numberDecimal"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/getRealWeight"
-        android:layout_marginStart="20dp"
-        android:layout_marginTop="30dp"
-        android:layout_toEndOf="@id/setTemp" />
-
-
-</RelativeLayout>
+        android:layout_height="0dp"
+        android:layout_weight="1.2"
+        android:background="@color/holo_blue_light"
+        >
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:background="@color/white"
+            android:id="@+id/logview"
+            android:layout_marginTop="10dp"
+            android:layout_marginStart="0dp"
+            >
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="10dp"
+                android:layout_marginEnd="10dp"
+                android:layout_marginTop="5dp"
+                android:layout_marginBottom="5dp"
+                android:textColor="@color/black"
+                android:textSize="30sp"
+                android:text="日志">
+            </TextView>
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginStart="100dp"
+            android:layout_marginEnd="100dp"
+            android:layout_marginTop="60dp"
+            android:layout_marginBottom="30dp"
+            android:gravity="center"
+            >
+            <RelativeLayout
+                android:id="@+id/logLayout"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:fadeScrollbars="false"
+                android:scrollbars="vertical"
+                android:gravity="center"
+                android:textColor="#000000"
+                android:textSize="80sp"
+                android:background="@drawable/bg_account_shape">
+                <ListView
+                    android:id="@+id/listLog"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:stackFromBottom="false"
+                    android:transcriptMode="alwaysScroll"
+                    android:visibility="invisible"
+                    >
+
+                </ListView>
+
+            </RelativeLayout>
+        </RelativeLayout>
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:background="@color/holo_blue_light"
+        android:layout_weight="1"
+        android:layout_height="0dp"
+
+        >
+        <LinearLayout
+            android:id="@+id/controlView"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:background="@color/white"
+            android:layout_marginTop="10dp"
+            android:layout_marginStart="0dp"
+            >
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="10dp"
+                android:layout_marginEnd="10dp"
+                android:layout_marginTop="5dp"
+                android:layout_marginBottom="5dp"
+                android:textSize="30sp"
+                android:textColor="@color/black"
+                android:text="控制"
+                >
+            </TextView>
+
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/controlView"
+            android:layout_marginTop="40dp"
+            >
+            <TextView
+                android:id="@+id/tempText"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:textColor="@color/black"
+                android:textSize="30sp"
+                android:text="温度:">
+            </TextView>
+            <TextView
+                android:id="@+id/temp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toEndOf="@+id/tempText"
+                android:layout_marginStart="10dp"
+                android:textColor="@color/black"
+                android:textSize="30sp"
+                android:text="0.0"/>
+        </RelativeLayout>
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:gravity="center"
+            >
+            <RelativeLayout
+                android:id="@+id/operate"
+                android:layout_width="match_parent"
+                android:layout_marginStart="150dp"
+                android:layout_marginEnd="150dp"
+                android:background="@drawable/bg_account_shape"
+                android:layout_height="match_parent"
+                android:gravity="center"
+                android:layout_centerVertical="true">
+                <Spinner
+                    android:id="@+id/serial"
+                    android:layout_width="150dp"
+                    android:layout_marginTop="0dp"
+                    android:layout_height="70dp"
+                    style="@style/Spinner"
+                    android:gravity="center"
+                    android:background="@drawable/bg_spin_normal"
+                    />
+                <Spinner
+                    android:id="@+id/baute"
+                    android:gravity="center"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_marginTop="0dp"
+                    android:layout_toEndOf="@id/serial"
+                    android:background="@drawable/bg_spin_normal"
+                    style="@style/Spinner"
+                    android:layout_marginStart="40dp" />
+
+                <Button
+                    android:id="@+id/openSerial"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="@string/openserial"
+                    android:layout_marginTop="0dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_toEndOf="@id/baute"
+                    android:layout_marginStart="40dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/closeSerial"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="@string/closeSerial"
+                    android:layout_marginTop="0dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_toEndOf="@id/baute"
+                    android:layout_marginStart="40dp"
+                    android:visibility="invisible"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/clearLog"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="@string/clearLog"
+                    android:layout_marginTop="0dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_toEndOf="@id/openSerial"
+                    android:layout_marginStart="40dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/setAddr"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="设备配置"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_below="@+id/serial"
+                    android:layout_marginTop="40dp"
+                    android:textSize="20sp"
+                    />
+
+
+                <Button
+                    android:id="@+id/readAddr"
+                    android:text="设备地址"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_below="@id/setAddr"
+                    android:textSize="20sp"
+                    android:layout_marginTop="40dp"
+                    android:background="@drawable/bg_btn_button"
+                    />
+
+                <Button
+                    android:id="@+id/motoTest"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="电机测试"
+                    android:layout_marginTop="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:layout_toEndOf="@+id/readAddr"
+                    android:layout_below="@id/baute"
+                    android:textSize="20sp"
+                    android:layout_marginStart="40dp"/>
+
+                <Button
+                    android:id="@+id/motoStart"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="电机启动"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/baute"
+                    android:layout_toEndOf="@+id/motoTest"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/querySerial"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="序列号"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/baute"
+                    android:layout_toEndOf="@+id/motoStart"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/queryStatus"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="执行状态"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/setAddr"
+                    android:layout_toEndOf="@+id/readAddr"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/controlIn"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="开关量输入"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/setAddr"
+                    android:layout_toEndOf="@+id/queryStatus"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
+
+                <Button
+                    android:id="@+id/controlOut"
+                    android:background="@drawable/bg_btn_button"
+                    android:text="开关量输出"
+                    android:layout_marginTop="40dp"
+                    android:layout_below="@+id/setAddr"
+                    android:layout_toEndOf="@+id/controlIn"
+                    android:layout_marginStart="40dp"
+                    android:layout_width="150dp"
+                    android:layout_height="70dp"
+                    android:textSize="20sp"
+                    />
+
+
+
+            </RelativeLayout>
+        </RelativeLayout>
+    </RelativeLayout>
+
+
+</LinearLayout>

+ 8 - 0
app/src/main/res/layout-port/item_layout.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:id="@+id/textView"
+    android:padding="5dp"
+    android:layout_height="wrap_content">
+
+</TextView>

+ 62 - 0
app/src/main/res/layout-port/scrollviewtest.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/text_linear"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    tools:ignore="MissingDefaultResource">
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:orientation="horizontal">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="24sp"
+                android:text="X货道:"
+                >
+            </TextView>
+            <Spinner
+                android:id="@+id/xNum"
+                android:layout_width="80dp"
+                android:layout_height="40dp"
+                android:layout_gravity="center"
+                android:background="@drawable/bg_spin_goods" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="24sp"
+                android:text="Y货道:"
+                >
+            </TextView>
+            <Spinner
+                android:id="@+id/yNum"
+                android:layout_width="80dp"
+                android:layout_height="40dp"
+                android:layout_gravity="center"
+                android:background="@drawable/bg_spin_goods" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="24sp"
+                android:text="数量:"
+                >
+            </TextView>
+            <Spinner
+                android:id="@+id/goodsNum"
+                android:layout_width="80dp"
+                android:layout_height="40dp"
+                android:layout_gravity="center"
+                android:background="@drawable/bg_spin_goods" />
+        </LinearLayout>
+
+    </ScrollView>
+
+
+</LinearLayout>

+ 3 - 3
app/src/main/res/layout/activity_main.xml

@@ -15,7 +15,7 @@
         android:layout_alignParentStart="true"
         android:layout_alignParentTop="true" />
     <Button
-        android:id="@+id/sale"
+        android:id="@+id/motoStart"
         android:background="#009688"
         android:text="@string/sale"
         android:layout_width="wrap_content"
@@ -33,7 +33,7 @@
         android:layout_height="wrap_content"
         android:layout_below="@+id/recvView"
         android:layout_marginTop="30dp"
-        android:layout_toEndOf="@+id/sale"
+        android:layout_toEndOf="@+id/motoStart"
         android:layout_marginStart="20dp"/>
 
     <Button
@@ -42,7 +42,7 @@
         android:text="@string/gettemp"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/sale"
+        android:layout_below="@+id/motoStart"
         android:layout_marginStart="50dp"
         android:layout_marginTop="30dp"
         />

+ 0 - 0
gradlew


+ 0 - 0
gradlew.bat


+ 1 - 1
settings.gradle

@@ -1,3 +1,3 @@
-rootProject.name='GoodsManage'
+rootProject.name='puruitong-demo'
 include ':app'
 include ':DialogLibrary'