diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java index 488ba2feb..e2c7227d1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java @@ -191,7 +191,7 @@ public class ConfigActivity extends AbstractGBActivity { helper = new PackageConfigHelper(getApplicationContext()); list = helper.getNotificationConfigurations(); } catch (GBException e) { - e.printStackTrace(); + GB.log("error getting configurations", GB.ERROR, e); GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e); list = new ArrayList<>(); } @@ -219,7 +219,8 @@ public class ConfigActivity extends AbstractGBActivity { helper.saveNotificationConfiguration(config); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED)); } catch (GBException e) { - e.printStackTrace(); + GB.log("error saving configuration", GB.ERROR, e); + GB.toast("error saving notification", Toast.LENGTH_SHORT, GB.ERROR, e); } refreshList(); @@ -246,7 +247,7 @@ public class ConfigActivity extends AbstractGBActivity { helper.deleteNotificationConfiguration((NotificationConfiguration) adapterView.getItemAtPosition(i)); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED)); } catch (GBException e) { - e.printStackTrace(); + GB.log("error deleting configuration", GB.ERROR, e); GB.toast("error deleting setting", Toast.LENGTH_SHORT, GB.ERROR, e); } refreshList(); @@ -446,7 +447,7 @@ public class ConfigActivity extends AbstractGBActivity { buttonIntent.putExtra(FossilWatchAdapter.ITEM_BUTTONS, buttonConfig.toString()); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(buttonIntent); } catch (JSONException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); } } }) @@ -459,7 +460,7 @@ public class ConfigActivity extends AbstractGBActivity { buttonLayout.addView(buttonTextView); } } catch (JSONException e) { - e.printStackTrace(); + GB.log("error parsing button config", GB.ERROR, e); GB.toast("error parsing button config", Toast.LENGTH_LONG, GB.ERROR); } } @@ -493,7 +494,7 @@ public class ConfigActivity extends AbstractGBActivity { try { list.addAll(helper.getNotificationConfigurations()); } catch (GBException e) { - e.printStackTrace(); + GB.log("error getting configurations", GB.ERROR, e); GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e); } // null is added to indicate the plus button added handled in PackageAdapter#getView @@ -571,7 +572,7 @@ public class ConfigActivity extends AbstractGBActivity { try { ((ImageView) view.findViewById(R.id.packageIcon)).setImageDrawable(manager.getApplicationIcon(settings.getPackageName())); } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); } final int width = 100; ((TextView) view.findViewById(R.id.packageName)).setText(settings.getAppName()); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridAppChoserActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridAppChoserActivity.java index c2035c092..cda3dcfe0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridAppChoserActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridAppChoserActivity.java @@ -46,7 +46,7 @@ public class QHybridAppChoserActivity extends AbstractGBActivity { try { helper = new PackageConfigHelper(getApplicationContext()); } catch (GBException e) { - e.printStackTrace(); + GB.log("database error", GB.ERROR, e); GB.toast("error getting database helper", Toast.LENGTH_SHORT, GB.ERROR, e); finish(); return; @@ -125,7 +125,7 @@ public class QHybridAppChoserActivity extends AbstractGBActivity { helper.saveNotificationConfiguration(config); LocalBroadcastManager.getInstance(QHybridAppChoserActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED)); } catch (GBException e) { - e.printStackTrace(); + GB.log("error saving config", GB.ERROR, e); GB.toast("error saving configuration", Toast.LENGTH_SHORT, GB.ERROR, e); } finish(); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java index b44dc444a..f5f5cd9f8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java @@ -195,8 +195,8 @@ public class QHybridSupport extends QHybridBaseSupport { try { helper = new PackageConfigHelper(GBApplication.getContext()); } catch (GBException e) { - e.printStackTrace(); - GB.toast("erroe getting database", Toast.LENGTH_SHORT, GB.ERROR, e); + GB.log("error getting database", GB.ERROR, e); + GB.toast("error getting database", Toast.LENGTH_SHORT, GB.ERROR, e); try { throw e; } catch (GBException ex) { @@ -224,7 +224,7 @@ public class QHybridSupport extends QHybridBaseSupport { PlayNotificationRequest.VibrationType.NO_VIBE )); } catch (Exception e) { - e.printStackTrace(); + GB.log("wrong number format", GB.ERROR, e); logger.debug("trash extra should be number 0.0-1.0"); } break; @@ -300,7 +300,7 @@ public class QHybridSupport extends QHybridBaseSupport { try { config = helper.getNotificationConfiguration(packageName); } catch (GBException e) { - e.printStackTrace(); + GB.log("error getting notification configuration", GB.ERROR, e); GB.toast("error getting notification configuration", Toast.LENGTH_SHORT, GB.ERROR, e); } if (config == null) return; @@ -353,7 +353,8 @@ public class QHybridSupport extends QHybridBaseSupport { configs.put(config, false); } } catch (GBException e) { - e.printStackTrace(); + GB.log("error getting notification configuration", GB.ERROR, e); + GB.toast("error getting notification configs", Toast.LENGTH_SHORT, GB.ERROR, e); } @@ -422,7 +423,7 @@ public class QHybridSupport extends QHybridBaseSupport { try { Thread.sleep(2500); } catch (InterruptedException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); } } } @@ -458,7 +459,7 @@ public class QHybridSupport extends QHybridBaseSupport { //TODO file stuff // queueWrite(new EraseFileRequest((short) request.fileHandle)); } catch (Exception e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); if (request.fileHandle > 257) { // queueWrite(new DownloadFileRequest((short) (request.fileHandle - 1))); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java index bb25b65da..49784d937 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java @@ -208,7 +208,7 @@ public class FossilWatchAdapter extends WatchAdapter { }; queueWrite(fileUploadRequets); } catch (JSONException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); } } @@ -311,7 +311,7 @@ public class FossilWatchAdapter extends WatchAdapter { } }, false); } catch (GBException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); } } @@ -442,7 +442,7 @@ public class FossilWatchAdapter extends WatchAdapter { fossilRequest.handleResponse(characteristic); requestFinished = fossilRequest.isFinished(); } catch (RuntimeException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); getDeviceSupport().notifiyException(e); GB.toast(fossilRequest.getName() + " failed", Toast.LENGTH_SHORT, GB.ERROR); requestFinished = true; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/misfit/MisfitWatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/misfit/MisfitWatchAdapter.java index 9bca5bc16..c3f6f22d2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/misfit/MisfitWatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/misfit/MisfitWatchAdapter.java @@ -170,7 +170,7 @@ public class MisfitWatchAdapter extends WatchAdapter { FileOutputStream fos = new FileOutputStream(charLog, true); fos.write((new Date().toString() + ": " + characteristic.getUuid().toString() + ": " + arrayToString(characteristic.getValue())).getBytes()); } catch (IOException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); } break; } @@ -242,7 +242,7 @@ public class MisfitWatchAdapter extends WatchAdapter { fos.close(); logger.debug("file written."); } catch (Exception e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); } gbDevice.addDeviceInfo(new GenericItem(ITEM_STEP_COUNT, String.valueOf(((GetCurrentStepCountRequest) request).steps))); } else if (request instanceof OTAEnterRequest) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java index cac8cc554..41aa53464 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java @@ -10,6 +10,7 @@ import java.util.HashMap; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileCloseAndPutRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FilePutRequest; +import nodomain.freeyourgadget.gadgetbridge.util.GB; public class ConfigurationPutRequest extends FilePutRequest { private static HashMap> itemsById = new HashMap<>(); @@ -45,7 +46,7 @@ public class ConfigurationPutRequest extends FilePutRequest { try { item = configClass.newInstance(); } catch (IllegalAccessException | InstantiationException e) { - e.printStackTrace(); + GB.log("error", GB.ERROR, e); continue; }