forked from Antvirf/garmin-watch-face-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialized repo and monkeyC project
- Loading branch information
Antti Viitala
committed
Oct 5, 2022
0 parents
commit ea6d87c
Showing
14 changed files
with
464 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"settings":[{"key":"BackgroundColor","valueType":"number","defaultValue":0,"configTitle":"BackgroundColorTitle","configPrompt":null,"configType":"list","configError":null,"configHelpUrl":null,"configReadonly":false,"configRequired":false,"configOptions":[{"display":"ColorBlack","value":0},{"display":"ColorDarkGray","value":5592405},{"display":"ColorLightGray","value":11184810},{"display":"ColorWhite","value":16777215}],"configMin":null,"configMax":null,"configMaxLength":null},{"key":"ForegroundColor","valueType":"number","defaultValue":16711680,"configTitle":"ForegroundColorTitle","configPrompt":null,"configType":"list","configError":null,"configHelpUrl":null,"configReadonly":false,"configRequired":false,"configOptions":[{"display":"ColorBlack","value":0},{"display":"ColorBlue","value":255},{"display":"ColorRed","value":16711680},{"display":"ColorWhite","value":16777215}],"configMin":null,"configMax":null,"configMaxLength":null},{"key":"UseMilitaryFormat","valueType":"boolean","defaultValue":false,"configTitle":"MilitaryFormatTitle","configPrompt":null,"configType":"boolean","configError":null,"configHelpUrl":null,"configReadonly":false,"configRequired":false,"configOptions":null,"configMin":null,"configMax":null,"configMaxLength":null}],"supportsLiveValidation":false,"languages":{"valyrian":{"ColorLightGray":"Light Gray","ColorBlue":"Blue","ColorRed":"Red","ForegroundColorTitle":"Foreground Color","BackgroundColorTitle":"Background Color","ColorDarkGray":"Dark Gray","MilitaryFormatTitle":"Military Format for 24 Hour Time","ColorBlack":"Black","ColorWhite":"White","AppName":"mattermetrics"}}} |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0"?> | ||
<!-- This is a generated file. It is highly recommended that you DO NOT edit this file. --> | ||
<iq:manifest version="3" xmlns:iq="http://www.garmin.com/xml/connectiq"> | ||
<!-- | ||
Use "Monkey C: Edit Application" from the Visual Studio Code command palette | ||
to update the application attributes. | ||
--> | ||
<iq:application id="c5b0c709-5f22-4365-93be-37440458d49e" type="watchface" name="@Strings.AppName" entry="mattermetricsApp" launcherIcon="@Drawables.LauncherIcon" minApiLevel="3.0.0"> | ||
<!-- | ||
Use the following from the Visual Studio Code comand palette to edit | ||
the build targets: | ||
"Monkey C: Set Products by Version" - Lets you add all producs that meet the | ||
minimum SDK version of the application | ||
"Monkey C: Edit Products" - Lets you add or remove any product | ||
--> | ||
<iq:products> | ||
<iq:product id="fenix6pro"/> | ||
</iq:products> | ||
<!-- | ||
Use "Monkey C: Edit Permissions" from the Visual Studio Code command | ||
palette to update permissions. | ||
--> | ||
<iq:permissions/> | ||
<!-- | ||
Use "Monkey C: Edit Languages" from the Visual Studio Code command | ||
palette to edit your compatible language list. | ||
--> | ||
<iq:languages> | ||
<iq:language>eng</iq:language> | ||
</iq:languages> | ||
<!-- | ||
Use "Monkey C: Configure Monkey Barrel" from the Visual Studio Code | ||
command palette to edit the included barrels. | ||
--> | ||
<iq:barrels/> | ||
</iq:application> | ||
</iq:manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
project.manifest = manifest.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<drawables> | ||
<bitmap id="LauncherIcon" filename="launcher_icon.png" /> | ||
</drawables> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<layout id="WatchFace"> | ||
<drawable class="Background" /> | ||
<label id="TimeLabel" x="center" y="center" font="Graphics.FONT_LARGE" justification="Graphics.TEXT_JUSTIFY_CENTER" color="Graphics.COLOR_BLUE" /> | ||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<properties> | ||
|
||
<property id="BackgroundColor" type="number">0x000000</property> | ||
<property id="ForegroundColor" type="number">0xFF0000</property> | ||
<property id="UseMilitaryFormat" type="boolean">false</property> | ||
|
||
</properties> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<settings> | ||
|
||
<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> | ||
</settingConfig> | ||
</setting> | ||
|
||
<setting propertyKey="@Properties.ForegroundColor" title="@Strings.ForegroundColorTitle"> | ||
<settingConfig type="list"> | ||
<listEntry value="0x000000">@Strings.ColorBlack</listEntry> | ||
<listEntry value="0x0000FF">@Strings.ColorBlue</listEntry> | ||
<listEntry value="0xFF0000">@Strings.ColorRed</listEntry> | ||
<listEntry value="0xFFFFFF">@Strings.ColorWhite</listEntry> | ||
</settingConfig> | ||
</setting> | ||
|
||
<setting propertyKey="@Properties.UseMilitaryFormat" title="@Strings.MilitaryFormatTitle"> | ||
<settingConfig type="boolean" /> | ||
</setting> | ||
|
||
</settings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<strings> | ||
|
||
<string id="AppName">mattermetrics</string> | ||
|
||
<string id="BackgroundColorTitle">Background Color</string> | ||
<string id="ForegroundColorTitle">Foreground Color</string> | ||
<string id="MilitaryFormatTitle">Military Format for 24 Hour Time</string> | ||
|
||
<string id="ColorBlack">Black</string> | ||
<string id="ColorDarkGray">Dark Gray</string> | ||
<string id="ColorLightGray">Light Gray</string> | ||
<string id="ColorWhite">White</string> | ||
<string id="ColorBlue">Blue</string> | ||
<string id="ColorRed">Red</string> | ||
|
||
</strings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Toybox.Application; | ||
import Toybox.Lang; | ||
import Toybox.WatchUi; | ||
|
||
class mattermetricsApp extends Application.AppBase { | ||
|
||
function initialize() { | ||
AppBase.initialize(); | ||
} | ||
|
||
// onStart() is called on application start up | ||
function onStart(state as Dictionary?) as Void { | ||
} | ||
|
||
// onStop() is called when your application is exiting | ||
function onStop(state as Dictionary?) as Void { | ||
} | ||
|
||
// Return the initial view of your application here | ||
function getInitialView() as Array<Views or InputDelegates>? { | ||
return [ new mattermetricsView() ] as Array<Views or InputDelegates>; | ||
} | ||
|
||
// New app settings have been received so trigger a UI update | ||
function onSettingsChanged() as Void { | ||
WatchUi.requestUpdate(); | ||
} | ||
|
||
} | ||
|
||
function getApp() as mattermetricsApp { | ||
return Application.getApp() as mattermetricsApp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Toybox.Application; | ||
import Toybox.Graphics; | ||
import Toybox.Lang; | ||
import Toybox.WatchUi; | ||
|
||
class Background extends WatchUi.Drawable { | ||
|
||
function initialize() { | ||
var dictionary = { | ||
:identifier => "Background" | ||
}; | ||
|
||
Drawable.initialize(dictionary); | ||
} | ||
|
||
function draw(dc as Dc) as Void { | ||
// Set the background color then call to clear the screen | ||
dc.setColor(Graphics.COLOR_TRANSPARENT, getApp().getProperty("BackgroundColor") as Number); | ||
dc.clear(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import Toybox.Application; | ||
import Toybox.Graphics; | ||
import Toybox.Lang; | ||
import Toybox.System; | ||
import Toybox.WatchUi; | ||
|
||
class mattermetricsView extends WatchUi.WatchFace { | ||
|
||
function initialize() { | ||
WatchFace.initialize(); | ||
} | ||
|
||
// Load your resources here | ||
function onLayout(dc as Dc) as Void { | ||
setLayout(Rez.Layouts.WatchFace(dc)); | ||
} | ||
|
||
// Called when this View is brought to the foreground. Restore | ||
// the state of this View and prepare it to be shown. This includes | ||
// loading resources into memory. | ||
function onShow() as Void { | ||
} | ||
|
||
// Update the view | ||
function onUpdate(dc as Dc) as Void { | ||
// Get the current time and format it correctly | ||
var timeFormat = "$1$:$2$"; | ||
var clockTime = System.getClockTime(); | ||
var hours = clockTime.hour; | ||
if (!System.getDeviceSettings().is24Hour) { | ||
if (hours > 12) { | ||
hours = hours - 12; | ||
} | ||
} else { | ||
if (getApp().getProperty("UseMilitaryFormat")) { | ||
timeFormat = "$1$$2$"; | ||
hours = hours.format("%02d"); | ||
} | ||
} | ||
var timeString = Lang.format(timeFormat, [hours, clockTime.min.format("%02d")]); | ||
|
||
// Update the view | ||
var view = View.findDrawableById("TimeLabel") as Text; | ||
view.setColor(getApp().getProperty("ForegroundColor") as Number); | ||
view.setText(timeString); | ||
|
||
// Call the parent onUpdate function to redraw the layout | ||
View.onUpdate(dc); | ||
} | ||
|
||
// Called when this View is removed from the screen. Save the | ||
// state of this View here. This includes freeing resources from | ||
// memory. | ||
function onHide() as Void { | ||
} | ||
|
||
// The user has just looked at their watch. Timers and animations may be started here. | ||
function onExitSleep() as Void { | ||
} | ||
|
||
// Terminate any active timers and prepare for slow updates. | ||
function onEnterSleep() as Void { | ||
} | ||
|
||
} |