1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

Fossil/Skagen Hybrids: Rewrite configuration of automatic workout detection

Fixes #2514
This commit is contained in:
Arjan Schrijver 2023-02-04 11:55:56 +01:00
parent 14f05a7cf6
commit 5ea68cad3b
7 changed files with 241 additions and 108 deletions

View File

@ -88,11 +88,18 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES = "widget_draw_circles";
public static final String PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES = "save_raw_activity_files";
public static final String PREF_HYBRID_HR_DANGEROUS_EXTERNAL_INTENTS = "dangerous_external_intents";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING = "activity_recognize_running";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING = "activity_recognize_biking";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING = "activity_recognize_walking";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING = "activity_recognize_rowing";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ENABLED = "activity_recognize_running_enabled";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ASK_FIRST = "activity_recognize_running_ask_first";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_MINUTES = "activity_recognize_running_minutes";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ENABLED = "activity_recognize_biking_enabled";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ASK_FIRST = "activity_recognize_biking_ask_first";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_MINUTES = "activity_recognize_biking_minutes";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ENABLED = "activity_recognize_walking_enabled";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ASK_FIRST = "activity_recognize_walking_ask_first";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_MINUTES = "activity_recognize_walking_minutes";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ENABLED = "activity_recognize_rowing_enabled";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ASK_FIRST = "activity_recognize_rowing_ask_first";
public static final String PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_MINUTES = "activity_recognize_rowing_minutes";
public static final String PREF_ACTIVATE_DISPLAY_ON_LIFT = "activate_display_on_lift_wrist";
public static final String PREF_DISPLAY_ON_LIFT_START = "display_on_lift_start";

View File

@ -443,10 +443,18 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp
addPreferenceHandlerFor(PREF_HYBRID_HR_FORCE_WHITE_COLOR);
addPreferenceHandlerFor(PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES);
addPreferenceHandlerFor(PREF_HYBRID_HR_DANGEROUS_EXTERNAL_INTENTS);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ENABLED);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ASK_FIRST);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_MINUTES);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ENABLED);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ASK_FIRST);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_MINUTES);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ENABLED);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ASK_FIRST);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_MINUTES);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ENABLED);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ASK_FIRST);
addPreferenceHandlerFor(PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_MINUTES);
addPreferenceHandlerFor(PREF_SONYSWR12_STAMINA);
addPreferenceHandlerFor(PREF_SONYSWR12_LOW_VIBRATION);

View File

@ -40,7 +40,6 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Message;
@ -75,8 +74,6 @@ import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
@ -1578,20 +1575,41 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
private void setActivityRecognition(){
SharedPreferences prefs = getDeviceSpecificPreferences();
String modeRunning = prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING, "none");
String modeBiking = prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING, "none");
String modeWalking = prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING, "none");
String modeRowing = prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING, "none");
boolean runningEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ENABLED, false);
boolean runningAskFirst = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ASK_FIRST, false);
int runningMinutes = Integer.parseInt(prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_MINUTES, "3"));
boolean bikingEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ENABLED, false);
boolean bikingAskFirst = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ASK_FIRST, false);
int bikingMinutes = Integer.parseInt(prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_MINUTES, "5"));
boolean walkingEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ENABLED, false);
boolean walkingAskFirst = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ASK_FIRST, false);
int walkingMinutes = Integer.parseInt(prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_MINUTES, "10"));
boolean rowingEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ENABLED, false);
boolean rowingAskFirst = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ASK_FIRST, false);
int rowingMinutes = Integer.parseInt(prefs.getString(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_MINUTES, "3"));
if (runningMinutes < 1) runningMinutes = 1;
if (runningMinutes > 255) runningMinutes = 255;
if (bikingMinutes < 1) bikingMinutes = 1;
if (bikingMinutes > 255) bikingMinutes = 255;
if (walkingMinutes < 1) walkingMinutes = 1;
if (walkingMinutes > 255) walkingMinutes = 255;
if (rowingMinutes < 1) rowingMinutes = 1;
if (rowingMinutes > 255) rowingMinutes = 255;
FitnessConfigItem fitnessConfigItem = new FitnessConfigItem(
!modeRunning.equals("none"),
modeRunning.equals("ask"),
!modeBiking.equals("none"),
modeBiking.equals("ask"),
!modeWalking.equals("none"),
modeWalking.equals("ask"),
!modeRowing.equals("none"),
modeRowing.equals("ask")
runningEnabled,
runningAskFirst,
runningMinutes,
bikingEnabled,
bikingAskFirst,
bikingMinutes,
walkingEnabled,
walkingAskFirst,
walkingMinutes,
rowingEnabled,
rowingAskFirst,
rowingMinutes
);
queueWrite((FileEncryptedInterface) new ConfigurationPutRequest(fitnessConfigItem, this));
@ -1628,10 +1646,18 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
case SettingsActivity.PREF_MEASUREMENT_SYSTEM:
setUnitsConfig();
break;
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ENABLED:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_ASK_FIRST:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_RUNNING_MINUTES:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ENABLED:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_ASK_FIRST:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_BIKING_MINUTES:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ENABLED:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_ASK_FIRST:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_WALKING_MINUTES:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ENABLED:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_ASK_FIRST:
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_ACTIVITY_RECOGNITION_ROWING_MINUTES:
setActivityRecognition();
break;
}

View File

@ -16,10 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.configuration;
import static android.content.ContentValues.TAG;
import android.util.Log;
import androidx.annotation.NonNull;
import java.nio.ByteBuffer;
@ -31,7 +27,6 @@ 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.file.FilePutRequest;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
public class ConfigurationPutRequest extends FilePutRequest {
private static final HashMap<Short, Class<? extends ConfigItem>> itemsById = new HashMap<>();
@ -344,32 +339,49 @@ public class ConfigurationPutRequest extends FilePutRequest {
static public class FitnessConfigItem extends ConfigItem {
boolean recognizeRunning = false;
boolean askRunning = false;
int minutesRunning = 3;
boolean recognizeBiking = false;
boolean askBiking = false;
int minutesBiking = 5;
boolean recognizeWalk = false;
boolean askWalk = false;
boolean recognizeWalking = false;
boolean askWalking = false;
int minutesWalking = 10;
boolean recognizeRudder = false;
boolean askRudder = false;
boolean recognizeRowing = false;
boolean askRowing = false;
int minutesRowing = 3;
public FitnessConfigItem(boolean recognizeRunning, boolean askRunning, boolean recognizeBiking, boolean askBiking, boolean recognizeWalk, boolean askWalk, boolean recognizeRudder, boolean askRudder) {
public FitnessConfigItem(boolean recognizeRunning,
boolean askRunning,
int minutesRunning,
boolean recognizeBiking,
boolean askBiking,
int minutesBiking,
boolean recognizeWalking,
boolean askWalking,
int minutesWalking,
boolean recognizeRowing,
boolean askRowing,
int minutesRowing) {
this.recognizeRunning = recognizeRunning;
this.askRunning = askRunning;
this.minutesRunning = minutesRunning;
this.recognizeBiking = recognizeBiking;
this.askBiking = askBiking;
this.recognizeWalk = recognizeWalk;
this.askWalk = askWalk;
this.recognizeRudder = recognizeRudder;
this.askRudder = askRudder;
this.minutesBiking = minutesBiking;
this.recognizeWalking = recognizeWalking;
this.askWalking = askWalking;
this.minutesWalking = minutesWalking;
this.recognizeRowing = recognizeRowing;
this.askRowing = askRowing;
this.minutesRowing = minutesRowing;
}
public FitnessConfigItem() {
}
;
@Override
public int getItemSize() {
return 30;
@ -383,31 +395,44 @@ public class ConfigurationPutRequest extends FilePutRequest {
@Override
public byte[] getContent() {
byte[] data = new byte[]{
(byte) 0x01, (byte) 0x00, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x02, (byte) 0x00, (byte) 0x0A, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x08, (byte) 0x00, (byte) 0x0A, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x09, (byte) 0x00, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0x01
// 2nd byte of each workout type is activation mode
// 3rd byte of each is amount of minutes before asking/activating
// Running
(byte) 0x01, (byte) 0x00, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0x05,
// Biking
(byte) 0x02, (byte) 0x00, (byte) 0x05, (byte) 0x01, (byte) 0x01, (byte) 0x01,
// Walking
(byte) 0x08, (byte) 0x00, (byte) 0x0A, (byte) 0x01, (byte) 0x01, (byte) 0x05,
// Rowing
(byte) 0x09, (byte) 0x00, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0x01
};
if (recognizeRunning) {
data[1] |= 0x01;
if (askRunning) {
data[1] |= 0x02;
}
data[2] = (byte) (minutesRunning & 0xFF);
}
if (recognizeBiking) {
data[7] |= 0x01;
if (askBiking) {
data[7] |= 0x02;
}
data[8] = (byte) (minutesBiking & 0xFF);
}
if (recognizeWalk) {
if (recognizeWalking) {
data[13] |= 0x01;
if (askWalking) {
data[13] |= 0x02;
}
data[14] = (byte) (minutesWalking & 0xFF);
}
if (recognizeRowing) {
data[19] |= 0x01;
if (askWalk) {
if (askRowing) {
data[19] |= 0x02;
}
}
if (recognizeRudder) {
data[25] |= 0x01;
if (askRudder) {
data[25] |= 0x02;
}
data[20] = (byte) (minutesRowing & 0xFF);
}
return data;
}
@ -416,25 +441,29 @@ public class ConfigurationPutRequest extends FilePutRequest {
public void parseData(byte[] data) {
recognizeRunning = (data[1] & 0x01) == 0x01;
askRunning = (data[1] & 0x02) == 0x02;
minutesRunning = data[2] & 0xFF;
recognizeBiking = (data[7] & 0x01) == 0x01;
askBiking = (data[7] & 0x02) == 0x02;
minutesBiking = data[8] & 0xFF;
recognizeWalk = (data[19] & 0x01) == 0x01;
askWalk = (data[19] & 0x02) == 0x02;
recognizeWalking = (data[13] & 0x01) == 0x01;
askWalking = (data[13] & 0x02) == 0x02;
minutesWalking = data[14] & 0xFF;
recognizeRudder = (data[25] & 0x01) == 0x01;
askRudder = (data[25] & 0x02) == 0x02;
recognizeRowing = (data[19] & 0x01) == 0x01;
askRowing = (data[19] & 0x02) == 0x02;
minutesRowing = data[20] & 0xFF;
}
@NonNull
@Override
public String toString() {
return
"recognizeRunning: " + recognizeRunning + " askRunning: " + askRunning + "\n" +
"recognizeBiking: " + recognizeBiking + " askBiking: " + askBiking + "\n" +
"recognizeWalking: " + recognizeWalk + " askWalk: " + askWalk + "\n" +
"recognizeRudder: " + recognizeRudder + " askRudder: " + askRudder;
"recognizeRunning: " + recognizeRunning + " askRunning: " + askRunning + " minutesRunning: " + minutesRunning + "\n" +
"recognizeBiking: " + recognizeBiking + " askBiking: " + askBiking + " minutesBiking: " + minutesBiking + "\n" +
"recognizeWalking: " + recognizeWalking + " askWalking: " + askWalking + " minutesWalking: " + minutesWalking + "\n" +
"recognizeRowing: " + recognizeRowing + " askRowing: " + askRowing + " minutesRowing: " + minutesRowing;
}
}
}

View File

@ -2757,18 +2757,6 @@
<item>as_off</item>
</string-array>
<string-array name="fossil_hr_activity_recognition_modes">
<item>@string/pref_activity_recognition_mode_none</item>
<item>@string/pref_activity_recognition_mode_ask</item>
<item>@string/pref_activity_recognition_mode_auto</item>
</string-array>
<string-array name="fossil_hr_activity_recognition_mode_values">
<item>mode_none</item>
<item>mode_ask</item>
<item>mode_auto</item>
</string-array>
<string-array name="fitness_tracking_apps_package_names">
<item>de.dennisguse.opentracks</item>
<item>de.dennisguse.opentracks.playStore</item>

View File

@ -476,6 +476,12 @@
<string name="pref_workout_detection_alert_title">Alert</string>
<string name="pref_workout_detection_alert_summary">Notify when a workout is detected</string>
<string name="pref_workout_detection_sensitivity">Sensitivity</string>
<string name="pref_workout_detection_enabled">Detection enabled</string>
<string name="pref_workout_detection_enabled_summary">Enable automatic detection of this workout</string>
<string name="pref_workout_detection_ask_first">Ask me first</string>
<string name="pref_workout_detection_ask_first_summary">Require on-watch confirmation when detecting this workout</string>
<string name="pref_workout_detection_time">Active minutes before detection</string>
<string name="pref_workout_detection_time_summary">The amount of minutes the workout must be ongoing before detecting it</string>
<string name="pref_sleep_mode_title">Sleep Mode</string>
<string name="pref_sleep_mode_sleep_screen_title">Sleep Screen</string>
<string name="pref_sleep_mode_sleep_screen_summary">Show the Sleep Screen when waking the screen during sleep mode, to reduce distractions</string>
@ -1112,6 +1118,7 @@
<string name="activity_type_yoga">Yoga</string>
<string name="activity_type_soccer">Soccer</string>
<string name="activity_type_rowing_machine">Rowing Machine</string>
<string name="activity_type_rowing">Rowing</string>
<string name="activity_type_cricket">Cricket</string>
<string name="activity_type_basketball">Basketball</string>
<string name="activity_type_pingpong">Ping Pong</string>
@ -1933,15 +1940,6 @@
<!-- Translators: the ### indicate number of digits, keep intact -->
<string name="distance_format_feet">###ft</string>
<string name="prefs_activity_recognition">Activity recognition settings</string>
<string name="pref_activity_recognize_running">recognize running</string>
<string name="pref_activity_recognize_biking">recognize biking</string>
<string name="pref_activity_recognize_walking">recognize walking</string>
<string name="pref_activity_recognize_rowing">recognize rowing</string>
<string name="pref_activity_recognition_mode_none">none</string>
<string name="pref_activity_recognition_mode_ask">ask</string>
<string name="pref_activity_recognition_mode_auto">auto</string>
<string name="menuitem_menu">Menu</string>
<string name="fossil_hr_button_config_info">Some buttons cannot be configured because their functions are hard-coded in the watch firmware.\n\nWarning: long-pressing the upper button when a watchface from the official Fossil app is installed will also toggle between showing/hiding widgets.</string>
<string name="pref_title_opentracks_packagename">OpenTracks package name</string>

View File

@ -4,36 +4,113 @@
<PreferenceScreen
android:icon="@drawable/ic_activity_unknown_small"
android:title="@string/prefs_activity_recognition"
android:key="activity_recognition_settings">
android:title="@string/pref_workout_detection_title"
android:summary="@string/pref_workout_detection_summary"
android:key="workout_detection_settings">
<ListPreference
android:key="activity_recognize_running"
android:title="@string/pref_activity_recognize_running"
android:icon="@drawable/ic_activity_running"
android:entryValues="@array/fossil_hr_activity_recognition_mode_values"
android:entries="@array/fossil_hr_activity_recognition_modes"/>
<PreferenceCategory
android:key="pref_workout_detection_running"
android:title="@string/activity_type_running">
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_running_enabled"
android:title="@string/pref_workout_detection_enabled"
android:summary="@string/pref_workout_detection_summary"
android:icon="@drawable/ic_activity_running"/>
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_running_ask_first"
android:title="@string/pref_workout_detection_ask_first"
android:summary="@string/pref_workout_detection_ask_first_summary"
android:icon="@drawable/ic_warning_gray"
android:dependency="activity_recognize_running_enabled"/>
<EditTextPreference
android:defaultValue="3"
android:inputType="number"
android:icon="@drawable/ic_timer"
android:key="activity_recognize_running_minutes"
android:title="@string/pref_workout_detection_time"
android:summary="@string/pref_workout_detection_time_summary"
android:dependency="activity_recognize_running_enabled"/>
</PreferenceCategory>
<ListPreference
android:key="activity_recognize_biking"
android:title="@string/pref_activity_recognize_biking"
android:icon="@drawable/ic_activity_biking"
android:entryValues="@array/fossil_hr_activity_recognition_mode_values"
android:entries="@array/fossil_hr_activity_recognition_modes"/>
<PreferenceCategory
android:key="pref_workout_detection_biking"
android:title="@string/activity_type_biking">
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_biking_enabled"
android:title="@string/pref_workout_detection_enabled"
android:summary="@string/pref_workout_detection_summary"
android:icon="@drawable/ic_activity_biking"/>
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_biking_ask_first"
android:title="@string/pref_workout_detection_ask_first"
android:summary="@string/pref_workout_detection_ask_first_summary"
android:icon="@drawable/ic_warning_gray"
android:dependency="activity_recognize_biking_enabled"/>
<EditTextPreference
android:defaultValue="5"
android:inputType="number"
android:icon="@drawable/ic_timer"
android:key="activity_recognize_biking_minutes"
android:title="@string/pref_workout_detection_time"
android:summary="@string/pref_workout_detection_time_summary"
android:dependency="activity_recognize_biking_enabled"/>
</PreferenceCategory>
<ListPreference
android:key="activity_recognize_walking"
android:title="@string/pref_activity_recognize_walking"
android:icon="@drawable/ic_activity_walking"
android:entryValues="@array/fossil_hr_activity_recognition_mode_values"
android:entries="@array/fossil_hr_activity_recognition_modes"/>
<PreferenceCategory
android:key="pref_workout_detection_walking"
android:title="@string/activity_type_walking">
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_walking_enabled"
android:title="@string/pref_workout_detection_enabled"
android:summary="@string/pref_workout_detection_summary"
android:icon="@drawable/ic_activity_walking"/>
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_walking_ask_first"
android:title="@string/pref_workout_detection_ask_first"
android:summary="@string/pref_workout_detection_ask_first_summary"
android:icon="@drawable/ic_warning_gray"
android:dependency="activity_recognize_walking_enabled"/>
<EditTextPreference
android:defaultValue="10"
android:inputType="number"
android:icon="@drawable/ic_timer"
android:key="activity_recognize_walking_minutes"
android:title="@string/pref_workout_detection_time"
android:summary="@string/pref_workout_detection_time_summary"
android:dependency="activity_recognize_walking_enabled"/>
</PreferenceCategory>
<ListPreference
android:key="activity_recognize_rowing"
android:title="@string/pref_activity_recognize_rowing"
android:icon="@drawable/ic_activity_rowing"
android:entryValues="@array/fossil_hr_activity_recognition_mode_values"
android:entries="@array/fossil_hr_activity_recognition_modes"/>
<PreferenceCategory
android:key="pref_workout_detection_rowing"
android:title="@string/activity_type_rowing">
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_rowing_enabled"
android:title="@string/pref_workout_detection_enabled"
android:summary="@string/pref_workout_detection_summary"
android:icon="@drawable/ic_activity_rowing"/>
<SwitchPreference
android:defaultValue="false"
android:key="activity_recognize_rowing_ask_first"
android:title="@string/pref_workout_detection_ask_first"
android:summary="@string/pref_workout_detection_ask_first_summary"
android:icon="@drawable/ic_warning_gray"
android:dependency="activity_recognize_rowing_enabled"/>
<EditTextPreference
android:defaultValue="3"
android:inputType="number"
android:icon="@drawable/ic_timer"
android:key="activity_recognize_rowing_minutes"
android:title="@string/pref_workout_detection_time"
android:summary="@string/pref_workout_detection_time_summary"
android:dependency="activity_recognize_rowing_enabled"/>
</PreferenceCategory>
</PreferenceScreen>