From 37059b1a27dadb97359996ab623625480020b458 Mon Sep 17 00:00:00 2001 From: Kai Morich Date: Mon, 21 Oct 2019 21:04:58 +0200 Subject: [PATCH] reduce non covered code move HexDump class from library to example remove unused UsbSerialRuntimeException --- .../examples/DeviceListActivity.java | 5 +- .../hoho/android/usbserial/util/HexDump.java | 0 .../driver/UsbSerialRuntimeException.java | 46 ------------------- 3 files changed, 1 insertion(+), 50 deletions(-) rename {usbSerialForAndroid => usbSerialExamples}/src/main/java/com/hoho/android/usbserial/util/HexDump.java (100%) delete mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java diff --git a/usbSerialExamples/src/main/java/com/hoho/android/usbserial/examples/DeviceListActivity.java b/usbSerialExamples/src/main/java/com/hoho/android/usbserial/examples/DeviceListActivity.java index 7b6fc0ad..a69a3c03 100644 --- a/usbSerialExamples/src/main/java/com/hoho/android/usbserial/examples/DeviceListActivity.java +++ b/usbSerialExamples/src/main/java/com/hoho/android/usbserial/examples/DeviceListActivity.java @@ -49,7 +49,6 @@ import com.hoho.android.usbserial.driver.UsbSerialDriver; import com.hoho.android.usbserial.driver.UsbSerialPort; import com.hoho.android.usbserial.driver.UsbSerialProber; -import com.hoho.android.usbserial.util.HexDump; import java.util.ArrayList; import java.util.List; @@ -134,9 +133,7 @@ public View getView(int position, View convertView, ViewGroup parent) { final UsbSerialDriver driver = port.getDriver(); final UsbDevice device = driver.getDevice(); - final String title = String.format("Vendor %s Product %s", - HexDump.toHexString((short) device.getVendorId()), - HexDump.toHexString((short) device.getProductId())); + final String title = String.format("Vendor %4X Product %4X", device.getVendorId(), device.getProductId()); row.getText1().setText(title); final String subtitle = driver.getClass().getSimpleName(); diff --git a/usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/util/HexDump.java b/usbSerialExamples/src/main/java/com/hoho/android/usbserial/util/HexDump.java similarity index 100% rename from usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/util/HexDump.java rename to usbSerialExamples/src/main/java/com/hoho/android/usbserial/util/HexDump.java diff --git a/usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java b/usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java deleted file mode 100644 index b48607c5..00000000 --- a/usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - */ - -package com.hoho.android.usbserial.driver; - -/** - * Generic unchecked exception for the usbserial package. - * - * @author mike wakerly (opensource@hoho.com) - */ -@SuppressWarnings("serial") -public class UsbSerialRuntimeException extends RuntimeException { - - public UsbSerialRuntimeException() { - super(); - } - - public UsbSerialRuntimeException(String detailMessage, Throwable throwable) { - super(detailMessage, throwable); - } - - public UsbSerialRuntimeException(String detailMessage) { - super(detailMessage); - } - - public UsbSerialRuntimeException(Throwable throwable) { - super(throwable); - } - -}