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

View File

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

View File

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