Cleanup toast/logging

This commit is contained in:
cpfeiffer 2020-01-29 17:37:54 +01:00
parent 1c91c037a8
commit 4293db5514
4 changed files with 4 additions and 31 deletions

View File

@ -207,7 +207,6 @@ public class ConfigActivity extends AbstractGBActivity {
helper = new PackageConfigHelper(getApplicationContext());
list = helper.getNotificationConfigurations();
} catch (GBException e) {
GB.log("error getting configurations", GB.ERROR, e);
GB.toast("error getting configurations", Toast.LENGTH_SHORT, GB.ERROR, e);
list = new ArrayList<>();
}
@ -235,8 +234,6 @@ public class ConfigActivity extends AbstractGBActivity {
helper.saveNotificationConfiguration(config);
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));
} catch (GBException e) {
GB.log("error saving configuration", GB.ERROR, e);
GB.toast("error saving notification", Toast.LENGTH_SHORT, GB.ERROR, e);
}
refreshList();
@ -263,7 +260,6 @@ 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) {
GB.log("error deleting configuration", GB.ERROR, e);
GB.toast("error deleting setting", Toast.LENGTH_SHORT, GB.ERROR, e);
}
refreshList();
@ -480,7 +476,6 @@ public class ConfigActivity extends AbstractGBActivity {
buttonLayout.addView(buttonTextView);
}
} catch (JSONException e) {
GB.log("error parsing button config", GB.ERROR, e);
GB.toast("error parsing button config", Toast.LENGTH_LONG, GB.ERROR);
}
}
@ -514,7 +509,6 @@ public class ConfigActivity extends AbstractGBActivity {
try {
list.addAll(helper.getNotificationConfigurations());
} catch (GBException e) {
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

View File

@ -63,7 +63,6 @@ public class QHybridAppChoserActivity extends AbstractGBActivity {
try {
helper = new PackageConfigHelper(getApplicationContext());
} catch (GBException e) {
GB.log("database error", GB.ERROR, e);
GB.toast("error getting database helper", Toast.LENGTH_SHORT, GB.ERROR, e);
finish();
return;
@ -147,7 +146,6 @@ public class QHybridAppChoserActivity extends AbstractGBActivity {
helper.saveNotificationConfiguration(config);
LocalBroadcastManager.getInstance(QHybridAppChoserActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));
} catch (GBException e) {
GB.log("error saving config", GB.ERROR, e);
GB.toast("error saving configuration", Toast.LENGTH_SHORT, GB.ERROR, e);
}
finish();

View File

@ -29,9 +29,10 @@ import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -44,19 +45,12 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID;
import androidx.annotation.RequiresApi;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.HeartRateUtils;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.NotificationConfiguration;
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.PackageConfigHelper;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoMaster;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.externalevents.NotificationListener;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
@ -66,7 +60,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec;
import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes;
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattCallback;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.WatchAdapter;
@ -231,13 +224,7 @@ public class QHybridSupport extends QHybridBaseSupport {
try {
helper = new PackageConfigHelper(GBApplication.getContext());
} catch (GBException 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) {
ex.printStackTrace();
}
}
IntentFilter globalFilter = new IntentFilter();
@ -407,7 +394,6 @@ public class QHybridSupport extends QHybridBaseSupport {
try {
config = helper.getNotificationConfiguration(packageName);
} catch (GBException e) {
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;
@ -460,8 +446,6 @@ public class QHybridSupport extends QHybridBaseSupport {
configs.put(config, false);
}
} catch (GBException e) {
GB.log("error getting notification configuration", GB.ERROR, e);
GB.toast("error getting notification configs", Toast.LENGTH_SHORT, GB.ERROR, e);
}

View File

@ -21,14 +21,12 @@ import android.bluetooth.BluetoothGattCharacteristic;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.json.JSONArray;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DateFormat;
import java.util.ArrayList;
@ -43,7 +41,6 @@ import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.PackageConfigHelper;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
import nodomain.freeyourgadget.gadgetbridge.service.btle.BTLEOperation;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.WatchAdapter;