2017-03-10 14:53:19 +01:00
|
|
|
/* Copyright (C) 2015-2017 Andreas Shimokawa, Carsten Pfeiffer, Daniele
|
2017-09-12 12:39:15 +02:00
|
|
|
Gobbetti, João Paulo Barraca, protomors, Quallenauge, Sami Alaoui
|
2017-03-10 14:53:19 +01:00
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>. */
|
2015-08-03 23:09:49 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.model;
|
2015-05-05 00:48:02 +02:00
|
|
|
|
2017-02-26 22:46:49 +01:00
|
|
|
import android.support.annotation.DrawableRes;
|
|
|
|
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
|
|
|
2015-10-26 23:32:03 +01:00
|
|
|
/**
|
|
|
|
* For every supported device, a device type constant must exist.
|
2016-08-17 00:34:19 +02:00
|
|
|
*
|
|
|
|
* Note: they key of every constant is stored in the DB, so it is fixed forever,
|
|
|
|
* and may not be changed.
|
2015-10-26 23:32:03 +01:00
|
|
|
*/
|
2015-05-05 00:48:02 +02:00
|
|
|
public enum DeviceType {
|
2017-08-13 16:31:11 +02:00
|
|
|
UNKNOWN(-1, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled),
|
2017-02-26 22:46:49 +01:00
|
|
|
PEBBLE(1, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled),
|
|
|
|
MIBAND(10, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled),
|
|
|
|
MIBAND2(11, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled),
|
2017-08-13 16:31:11 +02:00
|
|
|
AMAZFITBIP(12, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
2017-10-23 11:28:51 +02:00
|
|
|
AMAZFITCOR(13, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled),
|
2017-02-26 22:46:49 +01:00
|
|
|
VIBRATISSIMO(20, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled),
|
2017-08-13 16:31:11 +02:00
|
|
|
LIVEVIEW(30, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled),
|
2017-02-26 22:46:49 +01:00
|
|
|
HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
|
|
|
MAKIBESF68(41, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
2017-09-10 20:40:10 +02:00
|
|
|
EXRIZUK8(42, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
2017-08-29 17:28:30 +02:00
|
|
|
NO1F1(50, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled),
|
2017-09-04 08:43:34 +02:00
|
|
|
TECLASTH30(60, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled),
|
2017-08-13 16:31:11 +02:00
|
|
|
TEST(1000, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled);
|
2016-08-17 00:34:19 +02:00
|
|
|
|
|
|
|
private final int key;
|
2017-02-26 22:46:49 +01:00
|
|
|
@DrawableRes
|
|
|
|
private final int defaultIcon;
|
|
|
|
@DrawableRes
|
|
|
|
private final int disabledIcon;
|
2016-08-17 00:34:19 +02:00
|
|
|
|
2017-02-26 22:46:49 +01:00
|
|
|
DeviceType(int key, int defaultIcon, int disabledIcon) {
|
2016-08-17 00:34:19 +02:00
|
|
|
this.key = key;
|
2017-02-26 22:46:49 +01:00
|
|
|
this.defaultIcon = defaultIcon;
|
|
|
|
this.disabledIcon = disabledIcon;
|
2016-08-17 00:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getKey() {
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
2016-11-27 01:09:20 +01:00
|
|
|
public boolean isSupported() {
|
|
|
|
return this != UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2016-08-17 00:34:19 +02:00
|
|
|
public static DeviceType fromKey(int key) {
|
|
|
|
for (DeviceType type : values()) {
|
|
|
|
if (type.key == key) {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DeviceType.UNKNOWN;
|
|
|
|
}
|
2017-02-26 22:46:49 +01:00
|
|
|
|
|
|
|
@DrawableRes
|
|
|
|
public int getIcon() {
|
|
|
|
return defaultIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
@DrawableRes
|
|
|
|
public int getDisabledIcon() {
|
|
|
|
return disabledIcon;
|
|
|
|
}
|
2015-05-05 00:48:02 +02:00
|
|
|
}
|