diff --git a/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java.orig b/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java.orig
deleted file mode 100644
index ea1897d5d..000000000
--- a/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java.orig
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Copyright (C) 2011 Markus Junginger, greenrobot (http://greenrobot.de)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package nodomain.freeyourgadget.gadgetbridge.daogen;
-
-import java.util.Date;
-
-import de.greenrobot.daogenerator.DaoGenerator;
-import de.greenrobot.daogenerator.Entity;
-import de.greenrobot.daogenerator.Index;
-import de.greenrobot.daogenerator.Property;
-import de.greenrobot.daogenerator.Schema;
-
-/**
- * Generates entities and DAOs for the example project DaoExample.
- * Automatically run during build.
- */
-public class GBDaoGenerator {
-
- private static final String VALID_FROM_UTC = "validFromUTC";
- private static final String VALID_TO_UTC = "validToUTC";
- private static final String MAIN_PACKAGE = "nodomain.freeyourgadget.gadgetbridge";
- private static final String MODEL_PACKAGE = MAIN_PACKAGE + ".model";
- private static final String VALID_BY_DATE = MODEL_PACKAGE + ".ValidByDate";
- private static final String ACTIVITY_SUMMARY = MODEL_PACKAGE + ".ActivitySummary";
- private static final String OVERRIDE = "@Override";
- private static final String SAMPLE_RAW_INTENSITY = "rawIntensity";
- private static final String SAMPLE_STEPS = "steps";
- private static final String SAMPLE_RAW_KIND = "rawKind";
- private static final String SAMPLE_HEART_RATE = "heartRate";
- private static final String TIMESTAMP_FROM = "timestampFrom";
- private static final String TIMESTAMP_TO = "timestampTo";
-
-
- public static void main(String[] args) throws Exception {
- Schema schema = new Schema(18, MAIN_PACKAGE + ".entities");
-
- Entity userAttributes = addUserAttributes(schema);
- Entity user = addUserInfo(schema, userAttributes);
-
- Entity deviceAttributes = addDeviceAttributes(schema);
- Entity device = addDevice(schema, deviceAttributes);
-
- // yeah deep shit, has to be here (after device) for db upgrade and column order
- // because addDevice adds a property to deviceAttributes also....
- deviceAttributes.addStringProperty("volatileIdentifier");
-
- Entity tag = addTag(schema);
- Entity userDefinedActivityOverlay = addActivityDescription(schema, tag, user);
-
- addMiBandActivitySample(schema, user, device);
- addPebbleHealthActivitySample(schema, user, device);
- addPebbleHealthActivityKindOverlay(schema, user, device);
- addPebbleMisfitActivitySample(schema, user, device);
- addPebbleMorpheuzActivitySample(schema, user, device);
- addHPlusHealthActivityKindOverlay(schema, user, device);
- addHPlusHealthActivitySample(schema, user, device);
- addNo1F1ActivitySample(schema, user, device);
-<<<<<<< HEAD
- addZeTimeActivitySample(schema, user, device);
-=======
- addXWatchActivitySample(schema, user, device);
->>>>>>> master
-
- addCalendarSyncState(schema, device);
-
- addBipActivitySummary(schema, user, device);
-
- new DaoGenerator().generateAll(schema, "app/src/main/java");
- }
-
- private static Entity addTag(Schema schema) {
- Entity tag = addEntity(schema, "Tag");
- tag.addIdProperty();
- tag.addStringProperty("name").notNull();
- tag.addStringProperty("description").javaDocGetterAndSetter("An optional description of this tag.");
- tag.addLongProperty("userId").notNull();
-
- return tag;
- }
-
- private static Entity addActivityDescription(Schema schema, Entity tag, Entity user) {
- Entity activityDesc = addEntity(schema, "ActivityDescription");
- activityDesc.setJavaDoc("A user may further specify his activity with a detailed description and the help of tags.\nOne or more tags can be added to a given activity range.");
- activityDesc.addIdProperty();
- activityDesc.addIntProperty(TIMESTAMP_FROM).notNull();
- activityDesc.addIntProperty(TIMESTAMP_TO).notNull();
- activityDesc.addStringProperty("details").javaDocGetterAndSetter("An optional detailed description, specific to this very activity occurrence.");
-
- Property userId = activityDesc.addLongProperty("userId").notNull().getProperty();
- activityDesc.addToOne(user, userId);
-
- Entity activityDescTagLink = addEntity(schema, "ActivityDescTagLink");
- activityDescTagLink.addIdProperty();
- Property sourceId = activityDescTagLink.addLongProperty("activityDescriptionId").notNull().getProperty();
- Property targetId = activityDescTagLink.addLongProperty("tagId").notNull().getProperty();
-
- activityDesc.addToMany(tag, activityDescTagLink, sourceId, targetId);
-
- return activityDesc;
- }
-
- private static Entity addUserInfo(Schema schema, Entity userAttributes) {
- Entity user = addEntity(schema, "User");
- user.addIdProperty();
- user.addStringProperty("name").notNull();
- user.addDateProperty("birthday").notNull();
- user.addIntProperty("gender").notNull();
- Property userId = userAttributes.addLongProperty("userId").notNull().getProperty();
-
- // sorted by the from-date, newest first
- Property userAttributesSortProperty = getPropertyByName(userAttributes, VALID_FROM_UTC);
- user.addToMany(userAttributes, userId).orderDesc(userAttributesSortProperty);
-
- return user;
- }
-
- private static Property getPropertyByName(Entity entity, String propertyName) {
- for (Property prop : entity.getProperties()) {
- if (propertyName.equals(prop.getPropertyName())) {
- return prop;
- }
- }
- throw new IllegalStateException("Could not find property " + propertyName + " in entity " + entity.getClassName());
- }
-
- private static Entity addUserAttributes(Schema schema) {
- // additional properties of a user, which may change during the lifetime of a user
- // this allows changing attributes while preserving user identity
- Entity userAttributes = addEntity(schema, "UserAttributes");
- userAttributes.addIdProperty();
- userAttributes.addIntProperty("heightCM").notNull();
- userAttributes.addIntProperty("weightKG").notNull();
- userAttributes.addIntProperty("sleepGoalHPD").javaDocGetterAndSetter("Desired number of hours of sleep per day.");
- userAttributes.addIntProperty("stepsGoalSPD").javaDocGetterAndSetter("Desired number of steps per day.");
- addDateValidityTo(userAttributes);
-
- return userAttributes;
- }
-
- private static void addDateValidityTo(Entity entity) {
- entity.addDateProperty(VALID_FROM_UTC).codeBeforeGetter(OVERRIDE);
- entity.addDateProperty(VALID_TO_UTC).codeBeforeGetter(OVERRIDE);
-
- entity.implementsInterface(VALID_BY_DATE);
- }
-
- private static Entity addDevice(Schema schema, Entity deviceAttributes) {
- Entity device = addEntity(schema, "Device");
- device.addIdProperty();
- device.addStringProperty("name").notNull();
- device.addStringProperty("manufacturer").notNull();
- device.addStringProperty("identifier").notNull().unique().javaDocGetterAndSetter("The fixed identifier, i.e. MAC address of the device.");
- device.addIntProperty("type").notNull().javaDocGetterAndSetter("The DeviceType key, i.e. the GBDevice's type.");
- device.addStringProperty("model").javaDocGetterAndSetter("An optional model, further specifying the kind of device-");
- Property deviceId = deviceAttributes.addLongProperty("deviceId").notNull().getProperty();
- // sorted by the from-date, newest first
- Property deviceAttributesSortProperty = getPropertyByName(deviceAttributes, VALID_FROM_UTC);
- device.addToMany(deviceAttributes, deviceId).orderDesc(deviceAttributesSortProperty);
-
- return device;
- }
-
- private static Entity addDeviceAttributes(Schema schema) {
- Entity deviceAttributes = addEntity(schema, "DeviceAttributes");
- deviceAttributes.addIdProperty();
- deviceAttributes.addStringProperty("firmwareVersion1").notNull();
- deviceAttributes.addStringProperty("firmwareVersion2");
- addDateValidityTo(deviceAttributes);
-
- return deviceAttributes;
- }
-
- private static Entity addMiBandActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "MiBandActivitySample");
- activitySample.implementsSerializable();
- addCommonActivitySampleProperties("AbstractActivitySample", activitySample, user, device);
- activitySample.addIntProperty(SAMPLE_RAW_INTENSITY).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_STEPS).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_RAW_KIND).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- addHeartRateProperties(activitySample);
- return activitySample;
- }
-
- private static void addHeartRateProperties(Entity activitySample) {
- activitySample.addIntProperty(SAMPLE_HEART_RATE).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- }
-
- private static Entity addPebbleHealthActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "PebbleHealthActivitySample");
- addCommonActivitySampleProperties("AbstractPebbleHealthActivitySample", activitySample, user, device);
- activitySample.addByteArrayProperty("rawPebbleHealthData").codeBeforeGetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_RAW_INTENSITY).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_STEPS).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- addHeartRateProperties(activitySample);
- return activitySample;
- }
-
- private static Entity addPebbleHealthActivityKindOverlay(Schema schema, Entity user, Entity device) {
- Entity activityOverlay = addEntity(schema, "PebbleHealthActivityOverlay");
-
- activityOverlay.addIntProperty(TIMESTAMP_FROM).notNull().primaryKey();
- activityOverlay.addIntProperty(TIMESTAMP_TO).notNull().primaryKey();
- activityOverlay.addIntProperty(SAMPLE_RAW_KIND).notNull().primaryKey();
- Property deviceId = activityOverlay.addLongProperty("deviceId").primaryKey().notNull().getProperty();
- activityOverlay.addToOne(device, deviceId);
-
- Property userId = activityOverlay.addLongProperty("userId").notNull().getProperty();
- activityOverlay.addToOne(user, userId);
- activityOverlay.addByteArrayProperty("rawPebbleHealthData");
-
- return activityOverlay;
- }
-
- private static Entity addPebbleMisfitActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "PebbleMisfitSample");
- addCommonActivitySampleProperties("AbstractPebbleMisfitActivitySample", activitySample, user, device);
- activitySample.addIntProperty("rawPebbleMisfitSample").notNull().codeBeforeGetter(OVERRIDE);
- return activitySample;
- }
-
- private static Entity addPebbleMorpheuzActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "PebbleMorpheuzSample");
- addCommonActivitySampleProperties("AbstractPebbleMorpheuzActivitySample", activitySample, user, device);
- activitySample.addIntProperty(SAMPLE_RAW_INTENSITY).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- return activitySample;
- }
-
- private static Entity addHPlusHealthActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "HPlusHealthActivitySample");
- activitySample.implementsSerializable();
- addCommonActivitySampleProperties("AbstractActivitySample", activitySample, user, device);
- activitySample.addByteArrayProperty("rawHPlusHealthData");
- activitySample.addIntProperty(SAMPLE_RAW_KIND).notNull().primaryKey();
- activitySample.addIntProperty(SAMPLE_RAW_INTENSITY).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_STEPS).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- addHeartRateProperties(activitySample);
- activitySample.addIntProperty("distance");
- activitySample.addIntProperty("calories");
-
- return activitySample;
- }
-
- private static Entity addHPlusHealthActivityKindOverlay(Schema schema, Entity user, Entity device) {
- Entity activityOverlay = addEntity(schema, "HPlusHealthActivityOverlay");
-
- activityOverlay.addIntProperty(TIMESTAMP_FROM).notNull().primaryKey();
- activityOverlay.addIntProperty(TIMESTAMP_TO).notNull().primaryKey();
- activityOverlay.addIntProperty(SAMPLE_RAW_KIND).notNull().primaryKey();
- Property deviceId = activityOverlay.addLongProperty("deviceId").primaryKey().notNull().getProperty();
- activityOverlay.addToOne(device, deviceId);
-
- Property userId = activityOverlay.addLongProperty("userId").notNull().getProperty();
- activityOverlay.addToOne(user, userId);
- activityOverlay.addByteArrayProperty("rawHPlusHealthData");
- return activityOverlay;
- }
-
- private static Entity addNo1F1ActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "No1F1ActivitySample");
- activitySample.implementsSerializable();
- addCommonActivitySampleProperties("AbstractActivitySample", activitySample, user, device);
- activitySample.addIntProperty(SAMPLE_STEPS).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_RAW_KIND).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_RAW_INTENSITY).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- addHeartRateProperties(activitySample);
- return activitySample;
- }
-
-<<<<<<< HEAD
- private static Entity addZeTimeActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "ZeTimeActivitySample");
-=======
- private static Entity addXWatchActivitySample(Schema schema, Entity user, Entity device) {
- Entity activitySample = addEntity(schema, "XWatchActivitySample");
->>>>>>> master
- activitySample.implementsSerializable();
- addCommonActivitySampleProperties("AbstractActivitySample", activitySample, user, device);
- activitySample.addIntProperty(SAMPLE_STEPS).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_RAW_KIND).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- activitySample.addIntProperty(SAMPLE_RAW_INTENSITY).notNull().codeBeforeGetterAndSetter(OVERRIDE);
- addHeartRateProperties(activitySample);
- return activitySample;
- }
-
- private static void addCommonActivitySampleProperties(String superClass, Entity activitySample, Entity user, Entity device) {
- activitySample.setSuperclass(superClass);
- activitySample.addImport(MAIN_PACKAGE + ".devices.SampleProvider");
- activitySample.setJavaDoc(
- "This class represents a sample specific to the device. Values like activity kind or\n" +
- "intensity, are device specific. Normalized values can be retrieved through the\n" +
- "corresponding {@link SampleProvider}.");
- activitySample.addIntProperty("timestamp").notNull().codeBeforeGetterAndSetter(OVERRIDE).primaryKey();
- Property deviceId = activitySample.addLongProperty("deviceId").primaryKey().notNull().codeBeforeGetterAndSetter(OVERRIDE).getProperty();
- activitySample.addToOne(device, deviceId);
- Property userId = activitySample.addLongProperty("userId").notNull().codeBeforeGetterAndSetter(OVERRIDE).getProperty();
- activitySample.addToOne(user, userId);
- }
-
- private static void addCalendarSyncState(Schema schema, Entity device) {
- Entity calendarSyncState = addEntity(schema, "CalendarSyncState");
- calendarSyncState.addIdProperty();
- Property deviceId = calendarSyncState.addLongProperty("deviceId").notNull().getProperty();
- Property calendarEntryId = calendarSyncState.addLongProperty("calendarEntryId").notNull().getProperty();
- Index indexUnique = new Index();
- indexUnique.addProperty(deviceId);
- indexUnique.addProperty(calendarEntryId);
- indexUnique.makeUnique();
- calendarSyncState.addIndex(indexUnique);
- calendarSyncState.addToOne(device, deviceId);
- calendarSyncState.addIntProperty("hash").notNull();
- }
-
- private static void addBipActivitySummary(Schema schema, Entity user, Entity device) {
- Entity summary = addEntity(schema, "BaseActivitySummary");
- summary.implementsInterface(ACTIVITY_SUMMARY);
- summary.addIdProperty();
-
- summary.setJavaDoc(
- "This class represents the summary of a user's activity event. I.e. a walk, hike, a bicycle tour, etc.");
-
- summary.addStringProperty("name").codeBeforeGetter(OVERRIDE);
- summary.addDateProperty("startTime").notNull().codeBeforeGetter(OVERRIDE);
- summary.addDateProperty("endTime").notNull().codeBeforeGetter(OVERRIDE);
- summary.addIntProperty("activityKind").notNull().codeBeforeGetter(OVERRIDE);
-
- summary.addIntProperty("baseLongitude").javaDocGetterAndSetter("Temporary, bip-specific");
- summary.addIntProperty("baseLatitude").javaDocGetterAndSetter("Temporary, bip-specific");
- summary.addIntProperty("baseAltitude").javaDocGetterAndSetter("Temporary, bip-specific");
-
- summary.addStringProperty("gpxTrack").codeBeforeGetter(OVERRIDE);
-
- Property deviceId = summary.addLongProperty("deviceId").notNull().codeBeforeGetter(OVERRIDE).getProperty();
- summary.addToOne(device, deviceId);
- Property userId = summary.addLongProperty("userId").notNull().codeBeforeGetter(OVERRIDE).getProperty();
- summary.addToOne(user, userId);
- }
-
- private static Property findProperty(Entity entity, String propertyName) {
- for (Property prop : entity.getProperties()) {
- if (propertyName.equals(prop.getPropertyName())) {
- return prop;
- }
- }
- throw new IllegalArgumentException("Property " + propertyName + " not found in Entity " + entity.getClassName());
- }
-
- private static Entity addEntity(Schema schema, String className) {
- Entity entity = schema.addEntity(className);
- entity.addImport("de.greenrobot.dao.AbstractDao");
- return entity;
- }
-}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java.orig b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java.orig
deleted file mode 100644
index 4acceeab6..000000000
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java.orig
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (C) 2015-2018 Andreas Shimokawa, Carsten Pfeiffer, Daniele
- Gobbetti, João Paulo Barraca, ladbsoft, protomors, Quallenauge, Sami
- Alaoui, tiparega
-
- This file is part of Gadgetbridge.
-
- Gadgetbridge is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Gadgetbridge is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see . */
-package nodomain.freeyourgadget.gadgetbridge.model;
-
-import android.support.annotation.DrawableRes;
-import android.support.annotation.StringRes;
-
-import nodomain.freeyourgadget.gadgetbridge.R;
-
-/**
- * For every supported device, a device type constant must exist.
- *
- * Note: they key of every constant is stored in the DB, so it is fixed forever,
- * and may not be changed.
- */
-public enum DeviceType {
- UNKNOWN(-1, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_unknown),
- PEBBLE(1, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_pebble),
- MIBAND(10, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled, R.string.devicetype_miband),
- MIBAND2(11, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled, R.string.devicetype_miband2),
- AMAZFITBIP(12, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_amazfit_bip),
- AMAZFITCOR(13, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor),
- MIBAND3(14, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled, R.string.devicetype_miband3),
- VIBRATISSIMO(20, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled, R.string.devicetype_vibratissimo),
- LIVEVIEW(30, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_liveview),
- HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_hplus),
- MAKIBESF68(41, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_makibes_f68),
- EXRIZUK8(42, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_exrizu_k8),
- Q8(43, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_q8),
- NO1F1(50, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_no1_f1),
- TECLASTH30(60, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_teclast_h30),
-<<<<<<< HEAD
- ZETIME(70, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_mykronoz_zetime),
-=======
- XWATCH(70, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_xwatch),
->>>>>>> master
- TEST(1000, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_test);
-
- private final int key;
- @DrawableRes
- private final int defaultIcon;
- @DrawableRes
- private final int disabledIcon;
- @StringRes
- private final int name;
-
- DeviceType(int key, int defaultIcon, int disabledIcon, int name) {
- this.key = key;
- this.defaultIcon = defaultIcon;
- this.disabledIcon = disabledIcon;
- this.name = name;
- }
-
- public int getKey() {
- return key;
- }
-
- public boolean isSupported() {
- return this != UNKNOWN;
- }
-
- public static DeviceType fromKey(int key) {
- for (DeviceType type : values()) {
- if (type.key == key) {
- return type;
- }
- }
- return DeviceType.UNKNOWN;
- }
-
- @StringRes
- public int getName() {
- return name;
- }
-
- @DrawableRes
- public int getIcon() {
- return defaultIcon;
- }
-
- @DrawableRes
- public int getDisabledIcon() {
- return disabledIcon;
- }
-}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java.orig b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java.orig
deleted file mode 100644
index cccd267a4..000000000
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java.orig
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Copyright (C) 2015-2018 0nse, Andreas Shimokawa, Carsten Pfeiffer,
- Daniele Gobbetti, João Paulo Barraca, ladbsoft, protomors, Quallenauge,
- Sami Alaoui, Sergey Trofimov, tiparega
-
- This file is part of Gadgetbridge.
-
- Gadgetbridge is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Gadgetbridge is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see . */
-package nodomain.freeyourgadget.gadgetbridge.service;
-
-import android.bluetooth.BluetoothAdapter;
-import android.content.Context;
-import android.widget.Toast;
-
-import java.lang.reflect.Constructor;
-import java.util.EnumSet;
-
-import nodomain.freeyourgadget.gadgetbridge.GBException;
-import nodomain.freeyourgadget.gadgetbridge.R;
-import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
-import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor.AmazfitCorSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.liveview.LiveviewSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband2.MiBand2Support;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.MiBandSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.no1f1.No1F1Support;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.PebbleSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.vibratissimo.VibratissimoSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.hplus.HPlusSupport;
-import nodomain.freeyourgadget.gadgetbridge.service.devices.jyou.TeclastH30Support;
-<<<<<<< HEAD
-import nodomain.freeyourgadget.gadgetbridge.service.devices.zetime.ZeTimeDeviceSupport;
-=======
-import nodomain.freeyourgadget.gadgetbridge.service.devices.xwatch.XWatchSupport;
->>>>>>> master
-import nodomain.freeyourgadget.gadgetbridge.util.GB;
-
-public class DeviceSupportFactory {
- private final BluetoothAdapter mBtAdapter;
- private final Context mContext;
-
- public DeviceSupportFactory(Context context) {
- mContext = context;
- mBtAdapter = BluetoothAdapter.getDefaultAdapter();
- }
-
- public synchronized DeviceSupport createDeviceSupport(GBDevice device) throws GBException {
- DeviceSupport deviceSupport = null;
- String deviceAddress = device.getAddress();
- int indexFirstColon = deviceAddress.indexOf(":");
- if (indexFirstColon > 0) {
- if (indexFirstColon == deviceAddress.lastIndexOf(":")) { // only one colon
- deviceSupport = createTCPDeviceSupport(device);
- } else {
- // multiple colons -- bt?
- deviceSupport = createBTDeviceSupport(device);
- }
- } else {
- // no colon at all, maybe a class name?
- deviceSupport = createClassNameDeviceSupport(device);
- }
-
- if (deviceSupport != null) {
- return deviceSupport;
- }
-
- // no device found, check transport availability and warn
- checkBtAvailability();
- return null;
- }
-
- private DeviceSupport createClassNameDeviceSupport(GBDevice device) throws GBException {
- String className = device.getAddress();
- try {
- Class> deviceSupportClass = Class.forName(className);
- Constructor> constructor = deviceSupportClass.getConstructor();
- DeviceSupport support = (DeviceSupport) constructor.newInstance();
- // has to create the device itself
- support.setContext(device, null, mContext);
- return support;
- } catch (ClassNotFoundException e) {
- return null; // not a class, or not known at least
- } catch (Exception e) {
- throw new GBException("Error creating DeviceSupport instance for " + className, e);
- }
- }
-
- private void checkBtAvailability() {
- if (mBtAdapter == null) {
- GB.toast(mContext.getString(R.string.bluetooth_is_not_supported_), Toast.LENGTH_SHORT, GB.WARN);
- } else if (!mBtAdapter.isEnabled()) {
- GB.toast(mContext.getString(R.string.bluetooth_is_disabled_), Toast.LENGTH_SHORT, GB.WARN);
- }
- }
-
- private DeviceSupport createBTDeviceSupport(GBDevice gbDevice) throws GBException {
- if (mBtAdapter != null && mBtAdapter.isEnabled()) {
- DeviceSupport deviceSupport = null;
-
- try {
- switch (gbDevice.getType()) {
- case PEBBLE:
- deviceSupport = new ServiceDeviceSupport(new PebbleSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case MIBAND:
- deviceSupport = new ServiceDeviceSupport(new MiBandSupport(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case MIBAND2:
- deviceSupport = new ServiceDeviceSupport(new MiBand2Support(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case MIBAND3:
- deviceSupport = new ServiceDeviceSupport(new MiBand3Support(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case AMAZFITBIP:
- deviceSupport = new ServiceDeviceSupport(new AmazfitBipSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case AMAZFITCOR:
- deviceSupport = new ServiceDeviceSupport(new AmazfitCorSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case VIBRATISSIMO:
- deviceSupport = new ServiceDeviceSupport(new VibratissimoSupport(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case LIVEVIEW:
- deviceSupport = new ServiceDeviceSupport(new LiveviewSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case HPLUS:
- deviceSupport = new ServiceDeviceSupport(new HPlusSupport(DeviceType.HPLUS), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case MAKIBESF68:
- deviceSupport = new ServiceDeviceSupport(new HPlusSupport(DeviceType.MAKIBESF68), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case EXRIZUK8:
- deviceSupport = new ServiceDeviceSupport(new HPlusSupport(DeviceType.EXRIZUK8), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case Q8:
- deviceSupport = new ServiceDeviceSupport(new HPlusSupport(DeviceType.Q8), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case NO1F1:
- deviceSupport = new ServiceDeviceSupport(new No1F1Support(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
- case TECLASTH30:
- deviceSupport = new ServiceDeviceSupport(new TeclastH30Support(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
-<<<<<<< HEAD
- case ZETIME:
- deviceSupport = new ServiceDeviceSupport(new ZeTimeDeviceSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- break;
-=======
- case XWATCH:
- deviceSupport = new ServiceDeviceSupport(new XWatchSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
->>>>>>> master
- }
- if (deviceSupport != null) {
- deviceSupport.setContext(gbDevice, mBtAdapter, mContext);
- return deviceSupport;
- }
- } catch (Exception e) {
- throw new GBException(mContext.getString(R.string.cannot_connect_bt_address_invalid_), e);
- }
- }
- return null;
- }
-
- private DeviceSupport createTCPDeviceSupport(GBDevice gbDevice) throws GBException {
- try {
- DeviceSupport deviceSupport = new ServiceDeviceSupport(new PebbleSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
- deviceSupport.setContext(gbDevice, mBtAdapter, mContext);
- return deviceSupport;
- } catch (Exception e) {
- throw new GBException("cannot connect to " + gbDevice, e); // FIXME: localize
- }
- }
-
-}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java
index ba78296bb..c2b093536 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java
@@ -170,7 +170,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
}
@Override
- public void onFetchActivityData() {
+ public void onFetchRecordedData(int dataTypes) {
try {
TransactionBuilder builder = performInitialized("fetchActivityData");
requestActivityInfo(builder);
@@ -515,15 +515,15 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
provider.addGBActivitySample(sample);
} catch (Exception ex) {
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
- GB.updateTransferNotification("Data transfer failed", false, 0, getContext());
+ GB.updateTransferNotification(null,"Data transfer failed", false, 0, getContext());
}
progressSteps = msg[5] + msg[6] * 256;
- GB.updateTransferNotification(getContext().getString(R.string.busy_task_fetch_activity_data), true, (int) (progressSteps *100 / availableStepsData), getContext());
+ GB.updateTransferNotification(null, getContext().getString(R.string.busy_task_fetch_activity_data), true, (int) (progressSteps *100 / availableStepsData), getContext());
if (progressSteps == availableStepsData) {
progressSteps = 0;
availableStepsData = 0;
- GB.updateTransferNotification("", false, 100, getContext());
+ GB.updateTransferNotification(null,"", false, 100, getContext());
if (getDevice().isBusy()) {
getDevice().unsetBusyTask();
getDevice().sendDeviceUpdateIntent(getContext());
@@ -558,15 +558,15 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
provider.addGBActivitySample(sample);
} catch (Exception ex) {
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
- GB.updateTransferNotification("Data transfer failed", false, 0, getContext());
+ GB.updateTransferNotification(null,"Data transfer failed", false, 0, getContext());
}
progressSteps = msg[5] + msg[6] * 256;
- GB.updateTransferNotification(getContext().getString(R.string.busy_task_fetch_activity_data), true, (int) (progressSteps *100 / availableSleepData), getContext());
+ GB.updateTransferNotification(null, getContext().getString(R.string.busy_task_fetch_activity_data), true, (int) (progressSteps *100 / availableSleepData), getContext());
if (progressSteps == availableStepsData) {
progressSteps = 0;
availableSleepData = 0;
- GB.updateTransferNotification("", false, 100, getContext());
+ GB.updateTransferNotification(null,"", false, 100, getContext());
if (getDevice().isBusy()) {
getDevice().unsetBusyTask();
getDevice().sendDeviceUpdateIntent(getContext());
@@ -587,15 +587,15 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
provider.addGBActivitySample(sample);
} catch (Exception ex) {
GB.toast(getContext(), "Error saving steps data: " + ex.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
- GB.updateTransferNotification("Data transfer failed", false, 0, getContext());
+ GB.updateTransferNotification(null,"Data transfer failed", false, 0, getContext());
}
progressSteps = msg[5] + msg[6] * 256;
- GB.updateTransferNotification(getContext().getString(R.string.busy_task_fetch_activity_data), true, (int) (progressSteps *100 / availableHeartRateData), getContext());
+ GB.updateTransferNotification(null, getContext().getString(R.string.busy_task_fetch_activity_data), true, (int) (progressSteps *100 / availableHeartRateData), getContext());
if (progressSteps == availableStepsData) {
progressSteps = 0;
availableHeartRateData = 0;
- GB.updateTransferNotification("", false, 100, getContext());
+ GB.updateTransferNotification(null,"", false, 100, getContext());
if (getDevice().isBusy()) {
getDevice().unsetBusyTask();
getDevice().sendDeviceUpdateIntent(getContext());
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java.orig b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java.orig
deleted file mode 100644
index fca5bd1d5..000000000
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java.orig
+++ /dev/null
@@ -1,311 +0,0 @@
-/* Copyright (C) 2015-2018 0nse, Andreas Shimokawa, Carsten Pfeiffer,
- Daniele Gobbetti, João Paulo Barraca, ladbsoft, protomors, Quallenauge,
- Sami Alaoui, tiparega
-
- This file is part of Gadgetbridge.
-
- Gadgetbridge is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Gadgetbridge is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see . */
-package nodomain.freeyourgadget.gadgetbridge.util;
-
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.content.Context;
-import android.support.annotation.NonNull;
-import android.widget.Toast;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import nodomain.freeyourgadget.gadgetbridge.GBApplication;
-import nodomain.freeyourgadget.gadgetbridge.GBException;
-import nodomain.freeyourgadget.gadgetbridge.R;
-import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
-import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
-import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.UnknownDeviceCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.hplus.EXRIZUK8Coordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.hplus.MakibesF68Coordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.hplus.Q8Coordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor.AmazfitCorCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2Coordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30Coordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.liveview.LiveviewCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
-import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.no1f1.No1F1Coordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebbleCoordinator;
-import nodomain.freeyourgadget.gadgetbridge.devices.vibratissimo.VibratissimoCoordinator;
-<<<<<<< HEAD
-import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeCoordinator;
-=======
-import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator;
->>>>>>> master
-import nodomain.freeyourgadget.gadgetbridge.entities.Device;
-import nodomain.freeyourgadget.gadgetbridge.entities.DeviceAttributes;
-import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
-import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
-import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
-
-public class DeviceHelper {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceHelper.class);
-
- private static final DeviceHelper instance = new DeviceHelper();
-
- public static DeviceHelper getInstance() {
- return instance;
- }
-
- // lazily created
- private List coordinators;
-
- public DeviceType getSupportedType(GBDeviceCandidate candidate) {
- for (DeviceCoordinator coordinator : getAllCoordinators()) {
- DeviceType deviceType = coordinator.getSupportedType(candidate);
- if (deviceType.isSupported()) {
- return deviceType;
- }
- }
- return DeviceType.UNKNOWN;
- }
-
- public boolean getSupportedType(GBDevice device) {
- for (DeviceCoordinator coordinator : getAllCoordinators()) {
- if (coordinator.supports(device)) {
- return true;
- }
- }
- return false;
- }
-
- public GBDevice findAvailableDevice(String deviceAddress, Context context) {
- Set availableDevices = getAvailableDevices(context);
- for (GBDevice availableDevice : availableDevices) {
- if (deviceAddress.equals(availableDevice.getAddress())) {
- return availableDevice;
- }
- }
- return null;
- }
-
- /**
- * Returns the list of all available devices that are supported by Gadgetbridge.
- * Note that no state is known about the returned devices. Even if one of those
- * devices is connected, it will report the default not-connected state.
- *
- * Clients interested in the "live" devices being managed should use the class
- * DeviceManager.
- * @param context
- * @return
- */
- public Set getAvailableDevices(Context context) {
- BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
-
- Set availableDevices = new LinkedHashSet();
-
- if (btAdapter == null) {
- GB.toast(context, context.getString(R.string.bluetooth_is_not_supported_), Toast.LENGTH_SHORT, GB.WARN);
- } else if (!btAdapter.isEnabled()) {
- GB.toast(context, context.getString(R.string.bluetooth_is_disabled_), Toast.LENGTH_SHORT, GB.WARN);
- }
- List dbDevices = getDatabaseDevices();
- // these come first, as they have the most information already
- availableDevices.addAll(dbDevices);
- if (btAdapter != null) {
- List bondedDevices = getBondedDevices(btAdapter);
- availableDevices.addAll(bondedDevices);
- }
-
- Prefs prefs = GBApplication.getPrefs();
- String miAddr = prefs.getString(MiBandConst.PREF_MIBAND_ADDRESS, "");
- if (miAddr.length() > 0) {
- GBDevice miDevice = new GBDevice(miAddr, "MI", DeviceType.MIBAND);
- availableDevices.add(miDevice);
- }
-
- String pebbleEmuAddr = prefs.getString("pebble_emu_addr", "");
- String pebbleEmuPort = prefs.getString("pebble_emu_port", "");
- if (pebbleEmuAddr.length() >= 7 && pebbleEmuPort.length() > 0) {
- GBDevice pebbleEmuDevice = new GBDevice(pebbleEmuAddr + ":" + pebbleEmuPort, "Pebble qemu", DeviceType.PEBBLE);
- availableDevices.add(pebbleEmuDevice);
- }
- return availableDevices;
- }
-
- public GBDevice toSupportedDevice(BluetoothDevice device) {
- GBDeviceCandidate candidate = new GBDeviceCandidate(device, GBDevice.RSSI_UNKNOWN, device.getUuids());
- return toSupportedDevice(candidate);
- }
-
- public GBDevice toSupportedDevice(GBDeviceCandidate candidate) {
- for (DeviceCoordinator coordinator : getAllCoordinators()) {
- if (coordinator.supports(candidate)) {
- return coordinator.createDevice(candidate);
- }
- }
- return null;
- }
-
- public DeviceCoordinator getCoordinator(GBDeviceCandidate device) {
- synchronized (this) {
- for (DeviceCoordinator coord : getAllCoordinators()) {
- if (coord.supports(device)) {
- return coord;
- }
- }
- }
- return new UnknownDeviceCoordinator();
- }
-
- public DeviceCoordinator getCoordinator(GBDevice device) {
- synchronized (this) {
- for (DeviceCoordinator coord : getAllCoordinators()) {
- if (coord.supports(device)) {
- return coord;
- }
- }
- }
- return new UnknownDeviceCoordinator();
- }
-
- public synchronized List getAllCoordinators() {
- if (coordinators == null) {
- coordinators = createCoordinators();
- }
- return coordinators;
- }
-
- private List createCoordinators() {
- List result = new ArrayList<>();
- result.add(new AmazfitBipCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
- result.add(new AmazfitCorCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
- result.add(new MiBand3Coordinator()); // Note: must come before MiBand2 because detection is hacky, atm
- result.add(new MiBand2HRXCoordinator()); // Note: must come before MiBand2 because detection is hacky, atm
- result.add(new MiBand2Coordinator()); // Note: MiBand2 must come before MiBand because detection is hacky, atm
- result.add(new MiBandCoordinator());
- result.add(new PebbleCoordinator());
- result.add(new VibratissimoCoordinator());
- result.add(new LiveviewCoordinator());
- result.add(new HPlusCoordinator());
- result.add(new No1F1Coordinator());
- result.add(new MakibesF68Coordinator());
- result.add(new Q8Coordinator());
- result.add(new EXRIZUK8Coordinator());
- result.add(new TeclastH30Coordinator());
-<<<<<<< HEAD
- result.add(new ZeTimeCoordinator());
-=======
- result.add(new XWatchCoordinator());
->>>>>>> master
-
- return result;
- }
-
- private List getDatabaseDevices() {
- List result = new ArrayList<>();
- try (DBHandler lockHandler = GBApplication.acquireDB()) {
- List activeDevices = DBHelper.getActiveDevices(lockHandler.getDaoSession());
- for (Device dbDevice : activeDevices) {
- GBDevice gbDevice = toGBDevice(dbDevice);
- if (gbDevice != null && DeviceHelper.getInstance().getSupportedType(gbDevice)) {
- result.add(gbDevice);
- }
- }
- return result;
-
- } catch (Exception e) {
- GB.toast("Error retrieving devices from database", Toast.LENGTH_SHORT, GB.ERROR);
- return Collections.emptyList();
- }
- }
-
- /**
- * Converts a known device from the database to a GBDevice.
- * Note: The device might not be supported anymore, so callers should verify that.
- * @param dbDevice
- * @return
- */
- public GBDevice toGBDevice(Device dbDevice) {
- DeviceType deviceType = DeviceType.fromKey(dbDevice.getType());
- GBDevice gbDevice = new GBDevice(dbDevice.getIdentifier(), dbDevice.getName(), deviceType);
- List deviceAttributesList = dbDevice.getDeviceAttributesList();
- if (deviceAttributesList.size() > 0) {
- gbDevice.setModel(dbDevice.getModel());
- DeviceAttributes attrs = deviceAttributesList.get(0);
- gbDevice.setFirmwareVersion(attrs.getFirmwareVersion1());
- gbDevice.setFirmwareVersion2(attrs.getFirmwareVersion2());
- gbDevice.setVolatileAddress(attrs.getVolatileIdentifier());
- }
-
- return gbDevice;
- }
-
- private @NonNull List getBondedDevices(@NonNull BluetoothAdapter btAdapter) {
- Set pairedDevices = btAdapter.getBondedDevices();
- if (pairedDevices == null) {
- return Collections.emptyList();
- }
-
- List result = new ArrayList<>(pairedDevices.size());
- DeviceHelper deviceHelper = DeviceHelper.getInstance();
- for (BluetoothDevice pairedDevice : pairedDevices) {
- if (pairedDevice == null) {
- continue; // just to be safe, see https://github.com/Freeyourgadget/Gadgetbridge/pull/1052
- }
- if (pairedDevice.getName() != null && (pairedDevice.getName().startsWith("Pebble-LE ") || pairedDevice.getName().startsWith("Pebble Time LE "))) {
- continue; // ignore LE Pebble (this is part of the main device now (volatileAddress)
- }
- GBDevice device = deviceHelper.toSupportedDevice(pairedDevice);
- if (device != null) {
- result.add(device);
- }
- }
- return result;
- }
-
- /**
- * Attempts to removing the bonding with the given device. Returns true
- * if bonding was supposedly successful and false if anything went wrong
- * @param device
- * @return
- */
- public boolean removeBond(GBDevice device) throws GBException {
- BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
- if (defaultAdapter != null) {
- BluetoothDevice remoteDevice = defaultAdapter.getRemoteDevice(device.getAddress());
- if (remoteDevice != null) {
- try {
- Method method = BluetoothDevice.class.getMethod("removeBond", (Class[]) null);
- Object result = method.invoke(remoteDevice, (Object[]) null);
- return Boolean.TRUE.equals(result);
- } catch (Exception e) {
- throw new GBException("Error removing bond to device: " + device, e);
- }
- }
- }
- return false;
- }
-
-}
diff --git a/app/src/main/res/values/strings.xml.orig b/app/src/main/res/values/strings.xml.orig
deleted file mode 100644
index 96256130e..000000000
--- a/app/src/main/res/values/strings.xml.orig
+++ /dev/null
@@ -1,585 +0,0 @@
-
-
- Gadgetbridge
-
- Gadgetbridge
- Settings
- Debug
- Quit
- Donate
- Synchronize
- Find lost Device
- Take Screenshot
- Connect
- Disconnect
- Delete Device
- Delete %1$s
- This will delete the device and all associated data!
- Open navigation drawer
- Close navigation drawer
- Long press the card to disconnect
- Disconnecting
- Connecting
- Taking a screenshot of the device
-
-
- Debug
-
-
- App Manager
- Apps in cache
- Installed apps
- Installed watchfaces
- Delete
- Delete and remove from cache
- Reinstall
- Search in Pebble appstore
- Activate
- Deactivate
- Activate HRM
- Deactivate HRM
- Activate system weather app
- Deactivate system weather app
- Install the weather notification app
- Configure
- Move to top
-
-
- Notification blacklist
- Blacklist all for notifications
- Whitelist all for notifications
-
-
-
- Blacklisted Calendars
-
-
- FW/App installer
- You are about to install firmware %s instead of the one currently on your Mi Band.
- You are about to install the %s firmware on your Amazfit Bip.\n\nPlease make sure to install the .fw file, then the .res file, and finally the .gps file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res and .gps if these files are exactly the same as the ones previously installed.\n\nPROCEED AT YOUR OWN RISK!
- You are about to install the %s firmware on your Amazfit Cor.\n\nPlease make sure to install the .fw file, and after that the .res file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!
- You are about to install the %s firmware on your Mi Band 3.\n\nPlease make sure to install the .fw file, and after that the .res file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nUNTESTED, MAY BRICK YOUR DEVICE, PROCEED AT YOUR OWN RISK!
- You are about to install the %1$s and %2$s firmware, instead of the ones currently on your Mi Band.
- This firmware has been tested and is known to be compatible with Gadgetbridge.
- "This firmware is untested and may not be compatible with Gadgetbridge.\n\nYou are DISCOURAGED from flashing it onto your Mi Band!"
- If you still want to proceed and things continue to work properly afterwards, please tell the Gadgetbridge developers to whitelist the %s firmware version
-
-
- Settings
-
- General settings
- Connect to device when Bluetooth turned on
- Start automatically
- Reconnect automatically
- Preferred Audioplayer
- Default
- Enable left/right swipe in the charts activity
-
- Date and Time
- Sync time
- Sync time to device when connecting, and when time or time zone changes on Android
-
- Theme
- Light
- Dark
-
- Language
-
- Hide the Gadgetbridge notification
- The icon in the status bar and the notification in the lockscreen are shown
- The icon in the status bar and the notification in the lockscreen are hidden
-
- Notifications
- Repetitions
- Phone Calls
- SMS
- Pebble Messages
- Support for applications which send notifications to the Pebble via PebbleKit.
- Generic notification support
- …also when screen is on
- Do Not Disturb
- Stop unwanted notifications from being sent in Do Not Disturb mode
- Transliteration
- Enable this if your device has no support for your language\'s font
-
- Always
- When screen is off
- Never
-
- Privacy
- Call privacy mode
- Display name and number
- Hide name but display number
- Hide number but display name
- Hide name and number
-
- Weather
- Weather location (CM/LOS)
-
- Blacklist Apps
- Blacklist Calendars
-
- Canned messages
- Replies
- Common suffix
- Call Dismissal
- Update on Pebble
-
- Developer options
- Mi Band address
-
- Pebble settings
-
- Activity trackers
- Preferred activity tracker
- Sync Pebble Health
- Sync Misfit
- Sync Morpheuz
-
- Support outgoing calls
- Disabling this will also stop the Pebble 2/LE to vibrate on outgoing calls
-
- Allow 3rd party Android App access
- Enable experimental support for Android Apps using PebbleKit
-
- Pebble timeline
- Sunrise and sunset
- Send sunrise and sunset times based on the location to the Pebble timeline
- Sync calendar
- Send calendar events to the timeline
-
- Autoremove dismissed notifications
- Notifications are automatically removed from the Pebble when dismissed from the Android device
-
- Privacy mode
- Normal notifications
- Shift the notification text off-screen
- Show only the notification icon
-
- Location
- Acquire location
- Latitude
- Longitude
- Keep location updated
- Try to get the current location at runtime, use the stored location as fallback
-
- Please enable network location
- location acquired
-
- Force notification protocol
- This option forces using the latest notification protocol depending on the firmware version. ENABLE ONLY IF YOU KNOW WHAT YOU ARE DOING!
- Enable untested features
- Enable features that are untested. ENABLE ONLY IF YOU KNOW WHAT YOU ARE DOING!
- Always prefer BLE
- Use experimental Pebble LE support for all Pebbles, instead of BT classic. This requires pairing to non LE first, and then Pebble LE
- Pebble 2/LE GATT MTU limit
- If your Pebble 2/Pebble LE does not work as expected, try this setting to limit the MTU (valid range 20–512)
- GATT client only
- This is for Pebble 2 only and experimental, try this if you have connectivity problems
- Enable watch App logging
- Will cause logs from watch apps to be logged by Gadgetbridge (requires reconnect)
- Prematurely ACK PebbleKit
- Will cause messages that are sent to external 3rd party apps to be acknowledged always and immediately
- Enable background JS
- When enabled, allows watchfaces to show weather, battery info etc.
-
- Reconnection attempts
-
-
- Units
- Time format
- Screen on duration
- All day heart rate measurement
- HPlus/Makibes settings
-
-
- Auto export
- Auto export enabled
- Export location
- Export interval
- Export every %d hour
-
-
- Auto fetch activity data
- Fetch happens upon screen unlock. Only works if a lock mechanism is set!
-
- Not connected
- Connecting
- Connected
- Unknown state
- (unknown)
- Test
- Test notification
- This is a test notification from Gadgetbridge
- Bluetooth is not supported.
- Bluetooth is disabled.
- Tap connected device for App manager
- Tap connected device for activity
- Tap connected device for vibration
- Tap a device to connect
- Cannot connect. Bluetooth address invalid?
- Gadgetbridge running
- Installing binary %1$d/%2$d
- Installation failed
- Installed
- YOU ARE TRYING TO INSTALL A FIRMWARE, PROCEED AT YOUR OWN RISK.\n\n\n This firmware is for HW Revision: %s
- You are about to install the following app:\n\n\n%1$s Version %2$s by %3$s\n
- N/A
- initialized
- %1$s by %2$s
- Device discovery
-
- Stop scanning
- Start discovery
- Connect new device
- %1$s (%2$s)
- Pair device
- Use the Android Bluetooth pairing dialog to pair the device.
- Pair your Mi Band
- Pairing with %s…
- "Creating bond with %1$s (%2$s)"
- "Unable to pair with %1$s (%2$s)"
- Bonding in progress: %1$s (%2$s)
- "Already bonded with %1$s (%2$s), connecting…"
- No MAC address passed, cannot pair.
- Device specific settings
- Mi Band / Amazfit settings
- Amazfit Bip settings
- Male
- Female
- Other
- Left
- Right
- No valid user data given, using dummy user data for now.
- When your Mi Band vibrates and blinks, tap it a few times in a row.
- Install
- Make your device discoverable. Currently connected devices will likely not be discovered. Activate location (e.g. GPS) on Android 6+. Disable Privacy Guard for Gadgetbridge, because it may crash and reboot your phone. If no device is found after a few minutes, try again after rebooting your mobile device.
- Note:
- Device image
- Name/Alias
- Vibration count
-
- Sleep monitor
- Write log files
- Initializing
- Fetching activity data
- From %1$s to %2$s
- Wearing left or right?
- Vibration profile
-
- Staccato
- Short
- Medium
- Long
- Waterdrop
- Ring
- Alarm clock
- Vibration
-
- Try
- SMS notification
- Vibration settings
- Generic notification
- Email notification
- Incoming call notification
- Chat
- Navigation
- Social network
-
- Whole day HR measurement
- once a minute
- every 5 minutes
- every 10 minutes
- every 30 minutes
- once an hour
-
- Speed zones
- Total minutes
- Steps per minute
-
- Find lost device
- Cancel to stop vibration.
- Your activity
- Configure alarms
- Configure alarms
- Alarm details
- Sun
- Mon
- Tue
- Wed
- Thu
- Fri
- Sat
- Smart wakeup
- There was an error setting the alarms, please try again!
- Alarms sent to device!
- No data. Synchronize device?
- About to transfer %1$s of data starting from %2$s
- Daily step target
- Error executing \'%1$s\'
- Your activity (ALPHA)
- Cannot connect: %1$s
- Unable to find a handler to install this file.
- Unable to install the given file: %1$s
- Unable to install the given firmware: It doesn\'t match your Pebble\'s hardware revision.
- Please wait while determining the installation status…
- Gadget battery Low!
- %1$s battery left: %2$s%%
- Last charge: %s \n
- Number of charges: %s
- Export database failed! Please check your settings.
- Your sleep
- Sleep per week
- Sleep today, target: %1$s
- Steps per week
- Your activity and sleep
- Flashing firmware…
- File cannot be installed, device not ready.
- %1$s: %2$s %3$s
- Compatible version
- Untested version!
- Connection to device: %1$s
- Pebble Firmware %1$s
- Correct hardware revision
- Hardware revision mismatch!
- %1$s (%2$s)
- Problem with the firmware transfer. DO NOT REBOOT your Mi Band!
- Problem with the firmware metadata transfer
- Firmware installation complete
- Firmware installation complete, rebooting device…
- Firmware flashing failed
- Steps
- Calories
- Distance
- Clock
- Heart rate
- Battery
-
-
- Live activity
- Steps today, target: %1$s
- Do not ACK activity data transfer
- If the activity data are not acked to the band, they will not be cleared. Useful if GB is used together with other apps.
- Will keep activity data on the Mi Band even after synchronization. Useful if GB is used together with other apps.
- Use low-latency mode for firmware flashing
- This might help on devices where firmware flashing fails
-
- Steps history
- Current steps/min
- Total steps
- Steps per minute history
- Start your activity
- Activity
- Light sleep
- Deep sleep
- Not worn
- Not connected.
- All alarms disabled
- Keep activity data on device
- Incompatible firmware
- This firmware is not compatible with the device
- Alarms to reserve for upcoming events
- Use heart rate sensor to improve sleep detection
- Device time offset in hours (for detecting sleep of shift workers)
- Mi2: Date format
- Time
-
- Button actions
- Specify actions on Mi Band 2 button press
- Button press count
- Number of button presses to trigger message broadcast
- Broadcast message to send
- Broadcast message on defined number of button presses reached
- nodomain.freeyourgadget.gadgetbridge.mibandButtonPressed
- Enable button action
- Enable action on specified number of button presses
- Enable band vibration
- Enable band vibration on button action triggered
- Maximum delay between presses
- Maximum delay between button presses in milliseconds
- Delay after button action
- Delay after one button action match (number is in button_id intent extra) or 0 for immediately
- Goal notification
- The band will vibrate when the daily steps goal is reached
- Display items
- Choose the items displayed on the band screen
- Activate display upon lift
- Rotate wrist to switch info
- Do Not Disturb
- The band won\'t receive notifications while active
- Inactivity warnings
- The band will vibrate when you have been inactive for a while
- Inactivity threshold (in minutes)
- Disable the inactivity warnings for a time interval
- Start time
- End time
-
- Automatic
- Simplified Chinese
- Traditional Chinese
- English
- Spanish
-
- About to transfer data since %1$s
-
- Waiting for reconnect
-
- About you
- Year of birth
- Gender
- Height in cm
- Weight in kg
-
- Authenticating
- Authentication required
-
- Zzz
- Add widget
- Preferred sleep duration in hours
- An alarm was set for %1$02d:%2$02d
- Hardware revision: %1$s
- Firmware version: %1$s
- Error creating directory for log files: %1$s
- "HR: "
- Flashing firmware
- Firmware not sent
- Heart rate
- Heart rate
-
- Store raw record in the database
- If checked the data is stored \"as is\" and is available for later interpretation. NB: the database will be bigger in this case!
- Database management
- Database management
- The database operations use the following path on your device. \nThis path is accessible to other Android applications and your computer. \nExpect to find your exported database (or place the database you want to import) there:
- Legacy database delete
- Cannot access export path. Please contact the developers.
- Exported to: %1$s
- "Error exporting DB: %1$s"
- "Error exporting preference: %1$s"
- Import Data?
- Really overwrite the current database? All your current activity data (if any) will be lost.
- Imported.
- "Error importing DB: %1$s"
- "Error importing preference: %1$s"
- Delete Activity Data?
- Really delete the entire database? All your activity data and information about your devices will be lost.
- Data deleted.
- Database deletion failed.
- Delete old Activity Database?
- Really delete the old activity database? Activity data that was not imported will be lost.
- Old activity data deleted.
- Old Activity database deletion failed.
- Overwrite
- Cancel
- Delete
-
-
- Vibration
-
-
- Pebble pairing
- A pairing dialog will pop up on your Android device. If not, look in the notification drawer and accept the pairing request. Also accept it on your Pebble afterwards
-
- Make sure that this skin is enabled in the Weather Notification app to get weather information on your Pebble.\n\nNo configuration is needed here.\n\nYou can enable the system weather app of your Pebble from the app management.\n\nSupported watchfaces will show the weather automatically.
- Enable Bluetooth pairing
- Deactivate this if you have trouble connecting
-
- Metric
- Imperial
-
- 24H
- AM/PM
-
- Alarm clock
-
- Web View Activity
-
- (%1$s)
- You found it!
- Mi2: Time format
- You need to install version %1$s before installing this firmware!
- Text notifications
- = 1.0.1.28 and Mili_pro.ft* installed.]]>
- On
- Off
- Off
- Automatic (sleep detection)
- Scheduled (time interval)
- Attempting to pair with %1$s
- Bonding with %1$s failed immediately.
- Trying to connect to: %1$s
- Enable Bluetooth to discover devices.
- Bound to %1$s.
- Pair with %1$s?
- Select Pair to pair your devices. If this fails, try again without pairing.
- Pair
- Don\'t Pair
-
-
- Open on phone
- Mute
- Reply
-
- Your activity tracks
- Not measured
- Activity
- Light sleep
- Deep sleep
- Device not worn
- Running
- Walking
- Swimming
- Unknown activity
- Activities
- Biking
- Treadmill
- Select all
- Share
- Reset fetch date
-
- Firmware
- Invalid data
- Font
- GPS Firmware
- GPS Almanac
- GPS Error Correction
- Resources
- Watchface
-
- Unknown Device
- Test Device
- Pebble
- Mi Band
- Mi Band 2
- Mi Band 3
- Amazfit Bip
- Amazfit Cor
- Vibratissimo
- LiveView
- HPlus
- Makibes F68
- Exrizu K8
- Q8
- No.1 F1
- Teclast H30
-<<<<<<< HEAD
- MyKronoz ZeTime
-=======
- XWatch
->>>>>>> master
-
- Choose export location
- Gadgetbridge notifications
-
-
- Alipay (Shortcut)
- Weather (Shortcut)
- Status
- Activity
- Weather
- Alarm
- Timer
- Compass
- Settings
- Alipay
-