1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-20 12:00:51 +02:00

Fossil/Skagen Hybrids: Remove activity fetching toasts and add finished signal

This commit is contained in:
Arjan Schrijver 2024-02-27 14:34:59 +01:00
parent ab41adbc7f
commit 08a8b6a8fd
3 changed files with 17 additions and 16 deletions

View File

@ -555,10 +555,11 @@ public class FossilWatchAdapter extends WatchAdapter {
queueWrite(new FileDeleteRequest(getHandle()));
GB.updateTransferNotification(null, "", false, 100, getContext());
if (BuildConfig.DEBUG)
GB.toast(getContext().getString(R.string.fossil_hr_synced_activity_data), Toast.LENGTH_SHORT, GB.INFO);
GB.signalActivityDataFinish();
LOG.debug("Synchronized activity data");
} catch (Exception ex) {
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
LOG.error("Error saving steps data: ", ex);
GB.updateTransferNotification(null, "Data transfer failed", false, 0, getContext());
}
getDeviceSupport().getDevice().unsetBusyTask();
@ -567,8 +568,8 @@ public class FossilWatchAdapter extends WatchAdapter {
@Override
public void handleFileLookupError(FILE_LOOKUP_ERROR error) {
if(error == FILE_LOOKUP_ERROR.FILE_EMPTY && BuildConfig.DEBUG){
GB.toast("No activity data to sync", Toast.LENGTH_SHORT, GB.INFO);
if(error == FILE_LOOKUP_ERROR.FILE_EMPTY){
LOG.debug("No activity data to sync");
}
getDeviceSupport().getDevice().unsetBusyTask();
GB.updateTransferNotification(null, "", false, 100, getContext());

View File

@ -86,7 +86,6 @@ import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
@ -1251,10 +1250,11 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
}
queueWrite(new FileDeleteRequest(fileHandle));
GB.updateTransferNotification(null, "", false, 100, getContext());
if (BuildConfig.DEBUG)
GB.toast(getContext().getString(R.string.fossil_hr_synced_activity_data), Toast.LENGTH_SHORT, GB.INFO);
GB.signalActivityDataFinish();
LOG.debug("Synchronized activity data");
} catch (Exception ex) {
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
LOG.error("Error saving steps data: ", ex);
GB.updateTransferNotification(null, "Data transfer failed", false, 0, getContext());
}
getDeviceSupport().getDevice().unsetBusyTask();
@ -1266,8 +1266,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
@Override
public void handleFileLookupError(FILE_LOOKUP_ERROR error) {
if (error == FILE_LOOKUP_ERROR.FILE_EMPTY) {
if (BuildConfig.DEBUG)
GB.toast("No activity data to sync", Toast.LENGTH_SHORT, GB.INFO);
LOG.debug("No activity data to sync");
} else {
throw new RuntimeException("strange lookup stuff");
}

View File

@ -16,6 +16,13 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.misfit;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_ACTIVITY_POINT;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_STEP_COUNT;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_STEP_GOAL;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_VIBRATION_STRENGTH;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.QHYBRID_EVENT_BUTTON_PRESS;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.QHYBRID_EVENT_FILE_UPLOADED;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.content.Intent;
@ -78,13 +85,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.mis
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_ACTIVITY_POINT;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_STEP_COUNT;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_STEP_GOAL;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.ITEM_VIBRATION_STRENGTH;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.QHYBRID_EVENT_BUTTON_PRESS;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport.QHYBRID_EVENT_FILE_UPLOADED;
public class MisfitWatchAdapter extends WatchAdapter {
private int lastButtonIndex = -1;
private final SparseArray<Request> responseFilters = new SparseArray<>();
@ -470,6 +470,7 @@ public class MisfitWatchAdapter extends WatchAdapter {
getDeviceSupport().getDevice().unsetBusyTask();
GB.updateTransferNotification(null, "", false, 100, getContext());
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext());
GB.signalActivityDataFinish();
}
@Override