Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Toybox.Graphics;
- import Toybox.Lang;
- import Toybox.System;
- import Toybox.WatchUi;
- using Toybox.ActivityMonitor as Act;
- using Toybox.Activity as Acty;
- using Toybox.Time.Gregorian;
- class DigitalElegantView extends WatchUi.WatchFace {
- function initialize() {
- WatchFace.initialize();
- }
- var today = Gregorian.info(Time.now(), Time.FORMAT_MEDIUM);
- var dateString = Lang.format(
- "$1$ $2$ $3$",
- [
- today.day_of_week,
- today.month,
- today.day,
- ]
- ).toUpper();
- function onLayout(dc as Dc) as Void {}
- function onShow() as Void {}
- function onUpdate(dc as Dc) as Void {
- dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
- dc.clear();
- var clockTime = System.getClockTime();
- var hour = clockTime.hour;
- if (!System.getDeviceSettings().is24Hour) {
- hour = hour % 12;
- if (hour == 0) {
- hour = 12;
- }
- }
- // Get and show the current time
- dc.setColor(SelectedColor, Graphics.COLOR_TRANSPARENT);
- dc.drawText(dc.getWidth() / 2.1, dc.getHeight()*0.32452, customFont, Lang.format("$1$", [clockTime.hour.format("%02d")]), Graphics.TEXT_JUSTIFY_RIGHT);
- dc.drawText(dc.getWidth() / 2, dc.getHeight()*0.2284, dateFont, dateString, Graphics.TEXT_JUSTIFY_CENTER);
- if (Application.getApp().getProperty("ShowSeconds") == true) {
- dc.drawText(dc.getWidth() *0.8534, dc.getHeight()*0.46875, secFont, Lang.format("$1$", [clockTime.sec.format("%02d")]), Graphics.TEXT_JUSTIFY_LEFT);}
- dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
- dc.drawText(dc.getWidth() / 2.1, dc.getHeight()*0.32452, customFont, ":" + Lang.format("$1$", [clockTime.min.format("%02d")]), Graphics.TEXT_JUSTIFY_LEFT);
- }
- }
- 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 {}
Advertisement
Add Comment
Please, Sign In to add comment