This is a long post/question and I apologise for asking too much, so don't feel compelled to answer. :-D
I am going to attempt to create a watch face with settings. Basically, the only thing I want the user to be able to configure is the choice of data displayed (eg: steps, floors climbed, active minutes, heart rate, calories, etc) while date and time format is fixed more or less. How do I go about this?
jim_m_58 advised me to look at the ObjectStore sample in the SDK but the example went right over my head but the Programmer's Guide did help a bit. So I was wondering if someone could point me in the right direction.
When I created a brand new watch face with settings project, I noticed that there are a few new files that weren't there in the basic watch face project and I am guessing their role.
bin/watchface-settings.json (Configuration with the choices?)
resources/settings/properties.xml (The default choice?)
resources/settings/settings.xml (The choices available to the users?)
resources/strings/strings.xml (listEntry in settings.xml mapped to string id here?)
source/watchfaceBackground.mc (I am guessing the background at initiation?)
1) Is my guess about their roles right and what files I should edit if I want to create the requirements I set above?
2) Are there fixed terms to use in properties.xml, settings.xml and string.xml or can I used my own terms?
For example, in settings.xml:
<setting propertyKey="@Properties.BackgroundColor" title="@Strings.BackgroundColorTitle">
<settingConfig type="list">
<listEntry value="0x000000">@Strings.ColorBlack</listEntry>
<listEntry value="0x555555">@Strings.ColorDarkGray</listEntry>
<listEntry value="0xAAAAAA">@Strings.ColorLightGray</listEntry>
<listEntry value="0xFFFFFF">@Strings.ColorWhite</listEntry>
Can I use say....
<setting propertyKey="@Properties.DataChoice" title="@Strings.BackgroundColorTitle">
<settingConfig type="list">
<listEntry value="S">@Strings.Steps</listEntry>
<listEntry value="F">@Strings.FloorsClimbed</listEntry>
<listEntry value="A">@Strings.ActiveMinutes</listEntry>
<listEntry value="H">@Strings.HeartRate</listEntry>
I guess I need to map the above choices in string.xml too.
3) Lastly, where do I set the code to pull the data (eg: steps, floors climbed, active minutes, heart rate, etc.) in? watchfaceView.mc? What method would you use in such a scenario? My only guess for this would be a sort of "if" thing.
var data = App.getApp().getProperty("DataChoice")
if data = S {
var activityInfo = Act.getInfo();
var steps = View.findDrawableById("DataLabel");
steps.setText(activityInfo.steps.toString());}
Of course if someone can share their source code for a very simple example of a watch face with settings for me to pick apart and understand, I would be grateful. :-)
Thanks!