Browse Source

1、噪声检测图可以显示噪声值;2、优化了手动差值的数据显示
todolist:
1、优化显示测试信息;2、界面优化;3、配置界面有些配置信息不显示,要再读取一次;4、优化数据显示;5、删除多余代码

robbin 3 years ago
parent
commit
53fe950774

+ 7 - 0
.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/app/build.gradle" charset="GBK" />
+    <file url="PROJECT" charset="UTF-8" />
+  </component>
+</project>

+ 9 - 5
app/src/main/java/com/example/administrator/wingcool_gt9_apk/Config.java

@@ -1805,10 +1805,10 @@ public class Config extends AppCompatActivity
             HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
             if (deviceList != null) {
                 for (UsbDevice usbDevice : deviceList.values()) {
-                    int productId = usbDevice.getProductId();
+                    //int productId = usbDevice.getProductId();
                     int vendorId = usbDevice.getVendorId();
-                    if ((productId == 0x0818 && vendorId == 0x27C0)
-                            ||(productId == 0x0001 && vendorId == 0x222A))  //奕力的PID和VID
+                    if (( vendorId == 0x27C0)
+                            ||(vendorId == 0x222A))    //奕力的VID
                     {
                         //这里说明下,这里的377 , 7205是我这台机子上独有,因为我这上面有多台设备,所以我在这里
                         //判断了下.只有一台设备的无需这一步.
@@ -1842,8 +1842,12 @@ public class Config extends AppCompatActivity
         Collection<UsbDevice> values = deviceList.values();
         if (!values.isEmpty()) {
             for (UsbDevice usbDevice : values) {
-                int productId = usbDevice.getProductId();
-                if (productId == 0x0818 || productId == 0x0001) {  //0x0001是奕力的PID
+                //int productId = usbDevice.getProductId();
+                int vendorId = usbDevice.getVendorId();
+                //if (productId == 0x0818 || productId == 0x0001 )
+                if (( vendorId == 0x27C0)
+                        ||(vendorId == 0x222A))    //奕力的VID
+                {
                     if (mUsbManager.hasPermission(usbDevice)) {
 
                                     mUsbDeviceConnection = mUsbManager.openDevice(usbDevice);

+ 9 - 22
app/src/main/java/com/example/administrator/wingcool_gt9_apk/DataAnalysis.java

@@ -613,10 +613,10 @@ public class DataAnalysis extends AppCompatActivity
                     HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
                     if (deviceList != null) {
                         for (UsbDevice usbDevice : deviceList.values()) {
-                            int productId = usbDevice.getProductId();
+                            //int productId = usbDevice.getProductId();
                             int vendorId = usbDevice.getVendorId();
-                            if ((productId == 0x0818 && vendorId == 0x27C0)
-                                    ||(productId == 0x0001 && vendorId == 0x222A))   //奕力的PID和VID
+                            if (( vendorId == 0x27C0)
+                                    ||(vendorId == 0x222A))    //奕力的VID
                             {
                                 if (mUsbManager.hasPermission(usbDevice)) {
                                     initDevice();
@@ -641,9 +641,12 @@ public class DataAnalysis extends AppCompatActivity
         Collection<UsbDevice> values = deviceList.values();
         if (!values.isEmpty()) {
             for (UsbDevice usbDevice : values) {
-                int productId = usbDevice.getProductId();
-                if (productId == 0x0818 || productId == 0x0001) {  //0x0001是奕力的PID
-
+                //int productId = usbDevice.getProductId();
+                int vendorId = usbDevice.getVendorId();
+                //if (productId == 0x0818 || productId == 0x0001 )
+                if (( vendorId == 0x27C0)
+                        ||(vendorId == 0x222A))    //奕力的VID
+                {
                     if (mUsbManager.hasPermission(usbDevice)) {
 
                         mUsbDeviceConnection = mUsbManager.openDevice(usbDevice);
@@ -1310,22 +1313,6 @@ public class DataAnalysis extends AppCompatActivity
                                 datatemp[i] = ((mRawdataBytes[idtemp * 2] & 0xFF) << 8) + (mRawdataBytes[idtemp * 2 + 1] & 0xFF);
                                 datatemp[i] = mManualRefInt[idtemp] - datatemp[i];
                                 dv = Integer.toString(datatemp[i]);
-                                length = dv.length();
-
-                                while (length < 4){
-                                    if (datatemp[i] >= 0){
-                                        dv = "0" + dv;
-                                    }
-                                    length++;
-                                }
-
-                                if (datatemp[i] < -99){
-                                    dv = "  " + dv;
-                                }else if(datatemp[i] < -9){
-                                    dv = "    " + dv;
-                                }else if(datatemp[i] < 0){
-                                    dv = "      " + dv;
-                                }
 
                                 stringBuilder.append(dv + "│");
 

+ 10 - 11
app/src/main/java/com/example/administrator/wingcool_gt9_apk/FirmwareUpdate.java

@@ -368,16 +368,11 @@ public class FirmwareUpdate extends AppCompatActivity
                     HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
                     if (deviceList != null) {
                         for (UsbDevice usbDevice : deviceList.values()) {
-                            int productId = usbDevice.getProductId();
+                            //int productId = usbDevice.getProductId();
                             int vendorId = usbDevice.getVendorId();
-                            // if (productId == 0xC52F && vendorId == 0x046D) {
-                            //if (productId == 0x55e0 && vendorId == 0x4348) {
-                            if ((productId == 0x0818 && vendorId == 0x27C0)
-                                    ||(productId == 0x222A && vendorId == 0x0001)) {
-                                //这里说明下,这里的377 , 7205是我这台机子上独有,因为我这上面有多台设备,所以我在这里
-                                //判断了下.只有一台设备的无需这一步.
-                                //mUsbManager.requestPermission(usbDevice, pendingIntent);
-                                //SystemClock.sleep(100);
+                            if (( vendorId == 0x27C0)
+                                    ||(vendorId == 0x222A))    //奕力的VID
+                            {
                                 if (mUsbManager.hasPermission(usbDevice)) {
                                     initDevice();
 
@@ -409,8 +404,12 @@ public class FirmwareUpdate extends AppCompatActivity
         Collection<UsbDevice> values = deviceList.values();
         if (!values.isEmpty()) {
             for (UsbDevice usbDevice : values) {
-                int productId = usbDevice.getProductId();
-                if (productId == 0x0818 || productId == 0x222A) {
+                //int productId = usbDevice.getProductId();
+                int vendorId = usbDevice.getVendorId();
+                //if (productId == 0x0818 || productId == 0x0001 )
+                if (( vendorId == 0x27C0)
+                        ||(vendorId == 0x222A))    //奕力的VID
+                {
 
                     if (mUsbManager.hasPermission(usbDevice)) {
 

+ 9 - 6
app/src/main/java/com/example/administrator/wingcool_gt9_apk/IICOperation.java

@@ -404,11 +404,10 @@ public class IICOperation extends AppCompatActivity
                     HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
                     if (deviceList != null) {
                         for (UsbDevice usbDevice : deviceList.values()) {
-                            int productId = usbDevice.getProductId();
+                            //int productId = usbDevice.getProductId();
                             int vendorId = usbDevice.getVendorId();
-
-                            if ((productId == 0x0818 && vendorId == 0x27C0)
-                                    ||(productId == 0x0001 && vendorId == 0x222A))   //奕力的PID和VID
+                            if (( vendorId == 0x27C0)
+                                    ||(vendorId == 0x222A))    //奕力的VID
                             {
 
                                 if (mUsbManager.hasPermission(usbDevice)) {
@@ -440,8 +439,12 @@ public class IICOperation extends AppCompatActivity
         Collection<UsbDevice> values = deviceList.values();
         if (!values.isEmpty()) {
             for (UsbDevice usbDevice : values) {
-                int productId = usbDevice.getProductId();
-                if (productId == 0x0818 || productId == 0x0001) {  //0x0001是奕力的PID
+                //int productId = usbDevice.getProductId();
+                int vendorId = usbDevice.getVendorId();
+                //if (productId == 0x0818 || productId == 0x0001 )
+                if (( vendorId == 0x27C0)
+                        ||(vendorId == 0x222A))    //奕力的VID
+                {
 
                     if (mUsbManager.hasPermission(usbDevice)) {
 

+ 63 - 400
app/src/main/java/com/example/administrator/wingcool_gt9_apk/NoiseAnalysis.java

@@ -103,7 +103,7 @@ public class NoiseAnalysis extends AppCompatActivity
 
     private UsbEndpoint mUsbEndpointOut;
     private UsbEndpoint mUsbEndpointIn;
-    private boolean mToggle = true;
+    private boolean bIsconnected = false;
     private Button mSendMessage;
     private Button mlog1;
     private Button mSendCfg;
@@ -183,15 +183,18 @@ public class NoiseAnalysis extends AppCompatActivity
                 byte currentFreqIndex ;
                 int currentFreq;
                 int freqNum;
-               // StringBuilder stringBuilder1 = new StringBuilder("");
+                byte addressH;
+                byte addressL;
+
                 while(true) {
                     StringBuilder stringBuilder1 = new StringBuilder("");
                     StringBuilder stringBuilder2 = new StringBuilder("");
                     //获取噪声数据
-                    if(mUsbEndpointIn != null && mUsbEndpointOut != null) {
-                       byte showAddressHigh = (byte) 0xc6;
-                       byte showAddressLow = (byte) 0xe6;
-                        if (!iicRead(showAddressHigh, showAddressLow, mRawdataBytes, 156)) {  //读取ADC噪声
+                    //if((mUsbEndpointIn != null) || (mUsbEndpointOut != null)) {
+                    if (bIsconnected == true){
+                        addressH = (byte) 0xc6;
+                        addressL = (byte) 0xe6;
+                        if (!iicRead(addressH, addressL, mRawdataBytes, 156)) {  //读取ADC噪声
                            // mrawlog.setText("iicRead Noise failed");
                             //return false;
                             startFreq = 0;
@@ -204,7 +207,7 @@ public class NoiseAnalysis extends AppCompatActivity
                             freqNum = endFreq-startFreq ;
                             bitFreq = ((mRawdataBytes[2] & 0xFF) << 8) + (mRawdataBytes[3] & 0xFF);
                             currentFreqIndex = mRawdataBytes[5];
-                            currentFreq= currentFreqIndex*bitFreq;
+                            currentFreq = currentFreqIndex * bitFreq;
                         }
                     }
                     else{
@@ -223,7 +226,7 @@ public class NoiseAnalysis extends AppCompatActivity
                     //设置x轴
                     XAxis xAxis = mLineChart.getXAxis();
                     xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);//值:BOTTOM,BOTH_SIDED,BOTTOM_INSIDE,TOP,TOP_INSIDE
-                  //  xAxis.setGranularity(1f); //比例间隔
+                    //xAxis.setGranularity(1f); //比例间隔
                     if(startFreq != 0){
                         xAxis.setLabelCount(freqNum, true);//刻度数量 此函数只能显示26个标签
                         xAxis.setAxisMinimum(startFreq*bitFreq);// x刻度最小值
@@ -234,6 +237,7 @@ public class NoiseAnalysis extends AppCompatActivity
                         xAxis.setAxisMinimum(120f);// x刻度最小值
                         xAxis.setAxisMaximum(280f); //x刻度最大值
                     }
+                    xAxis.setTextSize(12f);
                     xAxis.setGridColor(Color.GRAY);
                     mLineChart.setScaleXEnabled(false);  //关闭缩放
 
@@ -244,19 +248,21 @@ public class NoiseAnalysis extends AppCompatActivity
 
                     rightYAxis.setAxisMinimum(0f);
                     rightYAxis.setAxisMaximum(255f);
-                   // rightYAxis.setGranularity(1f);
+                    //rightYAxis.setGranularity(1f);
                     rightYAxis.setLabelCount(16,true);
                     rightYAxis.setTextColor(Color.BLACK); //文字颜色
+                    rightYAxis.setTextSize(13f);
                     //rightYAxis.setGridColor(Color.GRAY); //网格线颜色
                     rightYAxis.setDrawGridLines(false);  //屏蔽网格线
 
-                YAxis leftYAxis = mLineChart.getAxisLeft();
+                    YAxis leftYAxis = mLineChart.getAxisLeft();
 
-                leftYAxis.setAxisMinimum(0f);
-                leftYAxis.setAxisMaximum(255f);
-                //leftYAxis.setGranularity(1f);
-                leftYAxis.setLabelCount(16,true);
-                leftYAxis.setTextColor(Color.BLACK); //文字颜色
+                    leftYAxis.setAxisMinimum(0f);
+                    leftYAxis.setAxisMaximum(255f);
+                    //leftYAxis.setGranularity(1f);
+                    leftYAxis.setLabelCount(16,true);
+                    leftYAxis.setTextColor(Color.BLACK); //文字颜色
+                    leftYAxis.setTextSize(13f);
                     // rightYAxis.setGridColor(Color.GRAY); //网格线颜色
                     leftYAxis.setDrawGridLines(false);  //屏蔽网格线
 
@@ -289,24 +295,24 @@ public class NoiseAnalysis extends AppCompatActivity
                             }
                         }
                     }  catch (ArithmeticException e) {
-                    // mShow.setText("ArithmeticException!");
-                    //  mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-                    e.printStackTrace();
-                } catch (ArrayIndexOutOfBoundsException e) {
-                    // mShow.setText("ArrayIndexOutOfBoundsException!");
-                    //  mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-                    e.printStackTrace();
-                }
+                        // mShow.setText("ArithmeticException!");
+                        //  mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                        e.printStackTrace();
+                    } catch (ArrayIndexOutOfBoundsException e) {
+                        // mShow.setText("ArrayIndexOutOfBoundsException!");
+                        //  mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                        e.printStackTrace();
+                    }
 
-                //最高点线
-                StringBuilder maxnoise = new StringBuilder("");
-                maxnoise.append((String)getResources().getString(R.string.maximumnoise));
-                LimitLine limitLine = new LimitLine(fl_max,maxnoise.toString()); //得到限制线
-                limitLine.setLineWidth(1f); //宽度
-                limitLine.setTextSize(8f);
-                limitLine.setTextColor(Color.parseColor("#F15A4A"));  //颜色
-                limitLine.setLineColor(Color.parseColor("#5C5C5C"));
-                rightYAxis.addLimitLine(limitLine); //
+                    //最高点线
+                    StringBuilder maxnoise = new StringBuilder("");
+                    maxnoise.append((String)getResources().getString(R.string.maximumnoise));
+                    LimitLine limitLine = new LimitLine(fl_max,maxnoise.toString()); //得到限制线
+                    limitLine.setLineWidth(1f); //宽度
+                    limitLine.setTextSize(12f);
+                    limitLine.setTextColor(Color.parseColor("#F15A4A"));  //颜色
+                    limitLine.setLineColor(Color.parseColor("#5C5C5C"));
+                    rightYAxis.addLimitLine(limitLine); //
 
 
 
@@ -316,39 +322,40 @@ public class NoiseAnalysis extends AppCompatActivity
                     String dv = Integer.toString(v);
                     stringBuilder1.append((String)getResources().getString(R.string.currentfrequency));
                     stringBuilder1.append(dv);
-                   // stringBuilder1.append(",");
+                    stringBuilder1.append("Hz");
 
                     LimitLine currentFreqLine = new LimitLine(currentFreq,stringBuilder1.toString()); //得到限制线
                     //LimitLine currentFreqLine = new LimitLine(137,"当前频点"); //得到限制线
-                    currentFreqLine.setLineWidth(2f); //宽度
-                    currentFreqLine.setTextSize(8f);
-                    currentFreqLine.setTextColor(Color.parseColor("#F15A4A"));  //颜色
-                    currentFreqLine.setLineColor(Color.parseColor("#269592"));
+                    currentFreqLine.setLineWidth(4f); //宽度
+                    currentFreqLine.setTextSize(40f);
+                    currentFreqLine.setTextColor(Color.parseColor("#e75049"));  //颜色
+                    currentFreqLine.setLineColor(Color.parseColor("#e75049"));
                     xAxis.addLimitLine(currentFreqLine); //X轴添加限制线
 
 
                     //设置描述内容
-                     v =  bitFreq;
-                     dv = Integer.toString(v);
-                    stringBuilder2.append("[" + (String)getResources().getString(R.string.bitfrequency) + "= ");
+                    v =  bitFreq;
+                    dv = Integer.toString(v);
+                    stringBuilder2.append("[" + (String)getResources().getString(R.string.bitfrequency) + " = ");
                     stringBuilder2.append(dv);
-                    stringBuilder2.append(",");
-                     v =  freqNum;
-                     dv = Integer.toString(v);
-                    stringBuilder2.append((String)getResources().getString(R.string.frequencyfactor) + "= ");
+                    stringBuilder2.append("Hz, ");
+                    v =  freqNum;
+                    dv = Integer.toString(v);
+                    stringBuilder2.append((String)getResources().getString(R.string.frequencyfactor) + " = ");
                     stringBuilder2.append(dv);
                     stringBuilder2.append("]");
 
                     Description description = new Description();
                     description.setText(stringBuilder2.toString());
-                    description.setTextColor(Color.parseColor("#269592"));
-                   // description.setTextAlign(Paint.Align.LEFT);
+                    description.setTextColor(Color.parseColor("#FFC800"));
+                    description.setTextSize(18f);
+                    // description.setTextAlign(Paint.Align.LEFT);
                     //description.setTextAlign(Paint.Align.CENTER);
                     //description.setPosition(1000,300);
                     mLineChart.setDescription(description);
 
 
-                   //一个LineDataSet就是一条线
+                    //一个LineDataSet就是一条线
                     LineDataSet lineDataSet;
                     lineDataSet = new LineDataSet(entries, "频点噪声(X轴单位:hz,Y轴单位:0-255)");
                     LineData data = new LineData(lineDataSet);
@@ -357,7 +364,7 @@ public class NoiseAnalysis extends AppCompatActivity
                     //线宽度
                     lineDataSet.setLineWidth(2f);
                     //不显示圆点
-                   // lineDataSet.setDrawCircles(false);
+                    // lineDataSet.setDrawCircles(false);
                     lineDataSet.setDrawCircleHole(true);
                     lineDataSet.setCircleColorHole(Color.parseColor("#F15A4A"));
                     lineDataSet.setCircleColor(Color.parseColor("#F15A4A"));  //淡红色
@@ -428,17 +435,11 @@ public class NoiseAnalysis extends AppCompatActivity
                     HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
                     if (deviceList != null) {
                         for (UsbDevice usbDevice : deviceList.values()) {
-                            int productId = usbDevice.getProductId();
+                            //int productId = usbDevice.getProductId();
                             int vendorId = usbDevice.getVendorId();
-                            // if (productId == 0xC52F && vendorId == 0x046D) {
-                            //if (productId == 0x55e0 && vendorId == 0x4348) {
-                            if ((productId == 0x0818 && vendorId == 0x27C0)
-                                    ||(productId == 0x0001 && vendorId == 0x222A))   //奕力的PID和VID
+                            if (( vendorId == 0x27C0)
+                                    ||(vendorId == 0x222A))    //奕力的VID
                             {
-                                //这里说明下,这里的377 , 7205是我这台机子上独有,因为我这上面有多台设备,所以我在这里
-                                //判断了下.只有一台设备的无需这一步.
-                                //mUsbManager.requestPermission(usbDevice, pendingIntent);
-                                //SystemClock.sleep(100);
                                 if (mUsbManager.hasPermission(usbDevice)) {
                                     //initAccessory(usbDevice);
                                     //mSendMessage.setEnabled(true); // dennis_debug
@@ -470,12 +471,6 @@ public class NoiseAnalysis extends AppCompatActivity
      * 初始化设备(手机) , 当手机进入Accessory模式后 , 手机的PID会变为Google定义的2个常量值其中的一个 ,
      */
     private void initDevice() {
-        // mThreadPool.execute(new Runnable() {
-        //@Override
-        //     public void run() {
-        //        while (mToggle) {
-        //            SystemClock.sleep(1000);
-
         HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
         Collection<UsbDevice> values = deviceList.values();
         if (!values.isEmpty()) {
@@ -484,10 +479,8 @@ public class NoiseAnalysis extends AppCompatActivity
                 int vendorId = usbDevice.getVendorId();
                 //if (productId == 0x0818 || productId == 0x0001 )
                 if (( vendorId == 0x27C0)
-                        ||(vendorId == 0x222A)    //奕力的VID
-                        ||(vendorId == 0x056A))   //8191主动笔和Wacom主动笔
-                {  //0x0001是奕力的PID
-
+                        ||(vendorId == 0x222A))    //奕力的VID
+                {
                     if (mUsbManager.hasPermission(usbDevice)) {
 
                         mUsbDeviceConnection = mUsbManager.openDevice(usbDevice);
@@ -542,7 +535,7 @@ public class NoiseAnalysis extends AppCompatActivity
 
                                     //if(0x80 == mUsbEndpointIn)
                                     //mlog1.setEnabled(true);
-                                    //mToggle = false;
+                                    bIsconnected = false;
                                     //isDetached = true;
                                     isNeedFindDevice = false;
                                     // mSendMessage.setEnabled(true);
@@ -550,7 +543,7 @@ public class NoiseAnalysis extends AppCompatActivity
                                     mUsbInterface = usbInterface;
                                     mUsbDeviceConnection = mUsbManager.openDevice(usbDevice);
                                     if(null != mUsbEndpointIn){
-
+                                        bIsconnected = true;
                                     }
                                 }
                             }
@@ -766,14 +759,6 @@ public class NoiseAnalysis extends AppCompatActivity
             return false;
     }
 
-    private boolean iicTest() {
-
-        if(isReceiverMessage)
-            return false;
-
-        return true;
-    }
-
     //发送命令,使得S818可以通过IIC向GT9的固定地址读取1byte数据
     private byte iicByteRead(byte addressHigh,byte addressLow) {
 
@@ -810,328 +795,6 @@ public class NoiseAnalysis extends AppCompatActivity
     }
 */
 
-/**
-    private boolean changeToDebugMode() {
-
-        byte maddressHigh = (byte)0x80;
-        byte maddressLow = (byte)0x46;
-        byte msubcommand =0x0f ;  //
-        byte mdata = (byte)0x01;
-
-        //if(false) {
-    maddressHigh = (byte) 0x80;
-    maddressLow = (byte) 0x40;
-    msubcommand = (byte) 0x06;   //ENTRY_DEBUG_MODE
-    mdata = (byte) 0x01;
-
-    if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) {
-       // mrawlog.setText("[changeDebug]0x8040 write failed");
-        return false;
-    }
-                 //}
-
-        return true;
-    }
-
-    private boolean changeToNormalMode() {
-
-        byte maddressHigh = (byte)0x80;
-        byte maddressLow = (byte)0x40;
-        byte msubcommand =0x07 ;  //QUIT_DEBUG_MODE
-        byte mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata)) {
-         //   mrawlog.setText("[changeNormal]0x8040 write failed");
-            return false;
-        }
-        else
-        {
-            mrawlog.setText("[changeNormal]0x8040 write success");
-        }
-        return true;
-    }
-
-
-   byte  showAddressHigh = (byte)0x8b;
-   byte  showAddressLow = (byte)0x98;  //需要显示的 address
-    private boolean getRawdata() {
-
-        byte maddressHigh = (byte)0x80;
-        byte maddressLow = (byte)0x40;  //rawdata address
-        byte msubcommand =0x0d ;  //  READ_SYNC
-        byte mdata = (byte)0x01;
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata)) {
-           // mrawlog.setText("READ_SYNC write failed");
-            return false;
-        }
-
-
-        if(!iicRead(showAddressHigh,showAddressLow,mRawdataBytes,42*30*2)) {  //读取rawData
-           // mrawlog.setText("iicRead rawdata failed");
-            return false;
-        }
-
-         maddressHigh = (byte)0x81;
-         maddressLow = (byte)0x4E;  // SYNC address
-         msubcommand =0x0f ;  //  READ_SYNC
-         mdata = (byte)0x00;
-
-        // MainActivity mMainAct = new MainActivity();
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata)) {
-          //  mrawlog.setText("0x814E_SYNC write failed");
-            return false;
-        }
-
-        return true;
-    }
-*/
-
-/**
-    private TextView mrawlog;
-    private TextView mtextView;
-    private TextView mt1;
-    private TextView mt2;
-    private TextView mt3;
-    private TextView mt4;
-    private Button mrd1;
-    private Button mbk;
-    private Button mmd;
-    private Button md;
-    private Button mr;
-    private Button msumr;
-    private Button mnd;
- */
-    //public void initTextView() {
-
-    //    mrawlog = (TextView) findViewById(R.id.rawlog);
-
-      //  mtextView = (TextView) findViewById(R.id.textView);
-
-        /**
-        mmd= (Button) findViewById(R.id.button2);
-        md = (Button) findViewById(R.id.button3);
-        mr = (Button) findViewById(R.id.button4);
-        msumr = (Button) findViewById(R.id.button5);
-        mnd = (Button) findViewById(R.id.button6);
-         */
-
-  //  }
-    /**
- int count = 1000;
-    private void showRawdata() {
-
-        mThreadPool.execute(new Runnable() {
-            @Override
-            public void run() {
-
-
-                int watch_dog = 0;
-                byte syncFlag = 1;
-
-                //show出噪声曲线
-                showNoiseView();
-           //if (!changeToDebugMode())
-              //  return false;
-       if(mUsbEndpointIn == null || mUsbEndpointOut == null)
-       {
-           SystemClock.sleep(500);
-       }
-       else
-       {
-           changeToDebugMode();
-
-           while (showFlag != 4) {
-
-               if (count-- == 0) {
-                   count = 0;
-               }
-               // if ((syncFlag != 0) && (syncFlag != 0x77)) {
-               //
-               // return false;
-
-               if (getRawdata() == true) {
-
-
-                   switch (showFlag) {
-                       case 1:// rawdata
-                           mHandler.sendEmptyMessage(RAWDATA_MESSAGE);
-                           break;
-                       case 2://manual diff
-                           if (count == 999)   //第一帧备份rawdata作为基准
-                           {
-
-                               for (int i = 0; i < 42 * 30 * 2; i++) {
-                                   // int v = mRawdataBytes[i] & 0xFF;
-                                   int j = i / 2;
-                                   mManualRefInt[j] = ((mRawdataBytes[i] & 0xFF) << 8) + (mRawdataBytes[i + 1] & 0xFF);
-                                   i++;
-                               }
-                           }
-
-                           mHandler.sendEmptyMessage(MANUALDIFF_MESSAGE);
-                           // mHandler.sendEmptyMessage(RAWDATA_MESSAGE);
-                           break;
-                       case 3://
-                           mHandler.sendEmptyMessage(DIFF_MESSAGE);
-                           break;
-
-                   }
-               } else {
-                   mHandler.sendEmptyMessage(CLEAR_MESSAGE); //清空文本框
-                   //break;
-               }
-
-               // }
-
-               while (true) {
-                   //轮询读取0x814E,如果非0,则读取rawdata
-                   byte maddressHigh = (byte) 0x81;
-                   byte maddressLow = (byte) 0x4E;  //_rRW_MISCTL__SWRST_B0_
-                   syncFlag = iicByteRead(maddressHigh, maddressLow);
-                   watch_dog++;
-                   //while ((syncFlag == 0 )|| (syncFlag == 0x77)) {
-                   if (((syncFlag == 0) || (syncFlag == 0x77))) {
-                       SystemClock.sleep(1);
-                       mHandler.sendEmptyMessage(LOG1_MESSAG);
-                   } else {
-                       if (count == 0) {
-                           mHandler.sendEmptyMessage(LOG2_MESSAGE);
-                       } else {
-                           // mHandler.sendEmptyMessage(SEND_MESSAGE_SUCCESS); //清空文本框
-                       }
-                       for (int i = 0; i < mRawdataBytes.length; i++) {
-                           mRawdataBytes[i] = (byte) 0x00;
-                       }
-                       break;
-                   }
-               }
-
-               SystemClock.sleep(500);
-
-
-           }
-       }
-            }   //ThreadPool
-        });   //ThreadPool
-     //   return true;
-
-
-    }
-*/
-
-    /**
-    Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-
-            StringBuilder stringBuilder1 = new StringBuilder("");
-            StringBuffer resultSb = new StringBuffer();
-            int checksum = 0 ;
-            switch (msg.what) {
-
-
-                case DIFF_MESSAGE://
-
-                    for (int i = 0; i < dataLength;i++ ) {
-                        int v = mRawdataBytes[i] & 0xFF;
-                        //int v =  (mManualRef[i] & 0xFF); //看alias noise
-                        // String hv = Integer.toHexString(v);
-                        String dv = Integer.toString(v);
-                        stringBuilder1.append(dv);
-                        stringBuilder1.append(" ");
-                        //i++;
-                    }
-                    mtextView.setText(stringBuilder1.toString());
-                    break;
-
-
-
-            }
-        }
-    };
-*/
-    /**
-byte showFlag = 0;
-    @Override
-    public void onClick(final View v) {
-
-
-        dataLength = 42*30;
-        switch (v.getId()) {
-            case R.id.rd1:  //raw data
-                showFlag =1;
-               // count = 1000;
-                showAddressHigh = (byte)0x8b;
-                showAddressLow = (byte)0x98;
-                if(count == 1000)
-                    showRawdata();
-                break;
-            case R.id.bk:    //back
-                showFlag =4;
-                count = 1000;
-                changeToNormalMode();
-                break;
-            case R.id.button2:  //manual diff
-                showFlag =2;
-                showAddressHigh = (byte)0x8b;
-                showAddressLow = (byte)0x98;
-                if(count == 1000) {
-                    showRawdata();
-                }
-                else
-                {
-                    count = 1000;
-                }
-                break;
-            case R.id.button3:  //diff
-                showFlag =3;
-                showAddressHigh = (byte)0xbb;
-                showAddressLow = (byte)0x10;
-                if(count == 1000)
-                    showRawdata();
-                break;
-            case R.id.button4:  //ref
-                showFlag =4;
-                count = 1000;
-                showAddressHigh = (byte)0x81;
-                showAddressLow = (byte)0xc0;
-                getRawdata();
-                mHandler.sendEmptyMessage(RAWDATA_MESSAGE);
-               // showRawdata();
-                break;
-            case  R.id.button5:  //set up manual ref
-                showFlag =2;
-                count = 1000;
-                showAddressHigh = (byte)0x8b;
-                showAddressLow = (byte)0x98;
-               // showRawdata();
-
-                break;
-
-            case  R.id.button6:  //read Noise data
-                showFlag =3;
-                count = 1000;
-                showAddressHigh = (byte)0xc6;
-                showAddressLow = (byte)0xe6;
-
-                //show出噪声曲线
-                showNoiseView();
-
-                //if(count == 1000)
-                   // showRawdata();
-
-
-
-                break;
-
-            default:
-              //  break;
-        }
-    }
-
-*/
-
-
     @Override
     protected void onDestroy() {
 
@@ -1144,7 +807,7 @@ byte showFlag = 0;
         }
         mUsbEndpointIn = null;
         mUsbEndpointOut = null;
-        //mToggle = false;
+        bIsconnected = false;
         isReceiverMessage = false;
         isNeedFindDevice = false;
         mThreadPool.shutdownNow();

+ 13 - 19
app/src/main/res/layout-hdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-land-hdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-land-mdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-land-xhdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-land-xxhdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-land-xxxhdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-land/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-mdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-xhdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-xxhdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout-xxxhdpi/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 13 - 19
app/src/main/res/layout/activity_noise_analysis.xml

@@ -8,24 +8,18 @@
     android:background="@drawable/wingcool_backgroup"
     tools:context=".NoiseAnalysis">
 
-    <HorizontalScrollView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.github.mikephil.charting.charts.LineChart
-            android:id="@+id/lineChart"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_centerInParent="true"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="8dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-    </HorizontalScrollView>
+    <com.github.mikephil.charting.charts.LineChart
+        android:id="@+id/lineChart"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_centerInParent="true"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginBottom="8dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </android.support.constraint.ConstraintLayout>