Fossil Hybrid: use GB.toast()

This commit is contained in:
Daniel Dakhno 2020-10-27 23:51:35 +01:00 committed by Gitea
parent d14687388b
commit f11977597b
3 changed files with 6 additions and 6 deletions

View File

@ -140,8 +140,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
try {
getSecretKey();
} catch (IllegalAccessException e) {
e.printStackTrace();
toast(e.getMessage());
GB.toast("erro getting key: " + e.getMessage(), Toast.LENGTH_LONG, GB.ERROR, e);
new TransactionBuilder("init fail")
.add(new SetDeviceStateAction(getDeviceSupport().getDevice(), GBDevice.State.AUTHENTICATION_REQUIRED, getContext()))
.queue(getDeviceSupport().getQueue());
@ -593,8 +592,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
this
));
} catch (IllegalAccessException e) {
e.printStackTrace();
toast(e.getMessage());
GB.toast("error getting key: " + e.getMessage(), Toast.LENGTH_LONG, GB.ERROR, e);
getDeviceSupport().getDevice().setState(GBDevice.State.AUTHENTICATION_REQUIRED);
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
getDeviceSupport().getQueue().clear();

View File

@ -17,6 +17,7 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.file;
import android.bluetooth.BluetoothGattCharacteristic;
import android.widget.Toast;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@ -38,6 +39,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.foss
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.file.FileHandle;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.FossilRequest;
import nodomain.freeyourgadget.gadgetbridge.util.CRC32C;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public abstract class FileEncryptedGetRequest extends FossilRequest {
private short handle;
@ -75,7 +77,7 @@ public abstract class FileEncryptedGetRequest extends FossilRequest {
try {
keySpec = new SecretKeySpec(this.adapter.getSecretKey(), "AES");
} catch (IllegalAccessException e) {
e.printStackTrace();
GB.toast("error getting key: " + e.getMessage(), Toast.LENGTH_LONG, GB.ERROR, e);
return;
}

View File

@ -95,7 +95,7 @@ public class FileEncryptedPutRequest extends FossilRequest {
try {
keySpec = new SecretKeySpec(this.adapter.getSecretKey(), "AES");
} catch (IllegalAccessException e) {
e.printStackTrace();
GB.toast("error getting key: " + e.getMessage(), Toast.LENGTH_LONG, GB.ERROR, e);
return;
}
try {