Allow adding newly developed UI Components to existing custom layouts.

Fixes #2176.
This commit is contained in:
Jeff Shelley
2025-10-28 09:45:49 -05:00
parent 023a5aa221
commit daa4689f44
2 changed files with 41 additions and 0 deletions
@@ -52,6 +52,7 @@ import de.dennisguse.opentracks.io.file.TrackFileFormat;
import de.dennisguse.opentracks.io.file.TrackFilenameGenerator;
import de.dennisguse.opentracks.sensors.SensorType;
import de.dennisguse.opentracks.ui.customRecordingLayout.CsvLayoutUtils;
import de.dennisguse.opentracks.ui.customRecordingLayout.DataField;
import de.dennisguse.opentracks.ui.customRecordingLayout.RecordingLayout;
import de.dennisguse.opentracks.ui.customRecordingLayout.RecordingLayoutIO;
@@ -850,6 +851,20 @@ public class PreferencesUtils {
return resources.getString(R.string.stats_custom_layout_default_layout);
}
/**
* @return List of all available field keys with their default visibility settings
*/
@SuppressLint("ResourceType")
public static List<DataField> getAllAvailableFields() {
List<TypedArray> fieldsArrays = getLayoutDataFields();
return fieldsArrays.stream()
.map(i -> {
String fieldKey = i.getString(0);
return new DataField(fieldKey, false, false, fieldKey.equals(resources.getString(R.string.stats_custom_layout_coordinates_key)));
})
.toList();
}
/**
* @return custom layout selected or the first one if any has been selected or the one selected is not exists anymore.
*/