Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
fevieira27 authored Mar 28, 2021
1 parent 0d8150a commit a1951be
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 187 deletions.
123 changes: 63 additions & 60 deletions source/AnalogSettingsView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ class Menu2TestMenu2Delegate extends WatchUi.Menu2InputDelegate { // Sub-menu De
boolean = true;
}
iconMenu.addItem(new WatchUi.ToggleMenuItem("Location Name", {:enabled=>"ON", :disabled=>"OFF"}, 7, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
// iconMenu.addItem(new WatchUi.IconMenuItem("Icon 2", drawable2.getString(), "right", drawable2, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT}));
// iconMenu.addItem(new WatchUi.IconMenuItem("Icon 3", drawable3.getString(), "default", drawable3, null));
if (Storage.getValue(13) != null ){
boolean = Storage.getValue(13);
} else {
boolean = false;
}
iconMenu.addItem(new WatchUi.ToggleMenuItem("Thicker Hands", {:enabled=>"ON", :disabled=>"OFF"}, 13, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
WatchUi.pushView(iconMenu, new AnalogSettingsView(), WatchUi.SLIDE_UP );
} else if( item.getId().equals("datapoints") ) {
var dataMenu = new WatchUi.Menu2({:title=>"Data"});
Expand All @@ -130,13 +134,13 @@ class Menu2TestMenu2Delegate extends WatchUi.Menu2InputDelegate { // Sub-menu De
boolean = Storage.getValue(6);
} else {
boolean = true;
}
dataMenu.addItem(new WatchUi.ToggleMenuItem("Temperature Type", {:enabled=>"Real Temp.", :disabled=>"Feels Like"}, 6, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
}
dataMenu.addItem(new WatchUi.IconMenuItem("Left Top", drawable2.getString(), 9, drawable2, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
dataMenu.addItem(new WatchUi.IconMenuItem("Left Middle", drawable3.getString(), 10, drawable3, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
dataMenu.addItem(new WatchUi.IconMenuItem("Left Bottom", drawable4.getString(), 11, drawable4, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
dataMenu.addItem(new WatchUi.IconMenuItem("Right Bottom", drawable5.getString(), 12, drawable5, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));

dataMenu.addItem(new WatchUi.ToggleMenuItem("Temp. Type", {:enabled=>"Real Temperature", :disabled=>"Feels Like"}, 6, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));

WatchUi.pushView(dataMenu, new AnalogSettingsView(), WatchUi.SLIDE_UP );
} else {
WatchUi.requestUpdate();
Expand Down Expand Up @@ -250,16 +254,15 @@ class CustomAccent extends WatchUi.Drawable {
class CustomLeftTopDataPoint extends WatchUi.Drawable {

// This constant data stores the color state list.
const mIcons = ["0" /*stepsIcon*/, ";" /*elevationIcon*/, "P" /*windIcon*/, "A" /*humidityIcon*/, "S" /*precipitationIcon*/, "6" /*caloriesIcon*/, "1" /*floorsClimbIcon*/, "@" /*pulseOxIcon*/, "3" /*heartRateIcon*/, "5" /*notificationIcon*/, "R" /*solarIcon*/];
const mIcons = ["0" /*stepsIcon*/, ";" /*elevationIcon*/, "P" /*windIcon*/, "A" /*humidityIcon*/, "S" /*precipitationIcon*/, "6" /*caloriesIcon*/, "1" /*floorsClimbIcon*/, "@" /*pulseOxIcon*/, "3" /*heartRateIcon*/, "5" /*notificationIcon*/, "R" /*solarIcon*/, "" /*none*/];
const mIconStrings = ["Distance", "Elevation", "Wind Speed", "Humidity", "Precipitation", "Calories", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available", "Heart Rate", "Notification",(System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "None"];
var mIndex; // 0=stepsIcon, 1=elevationIcon, 2=humidityIcon, 3=precipitationIcon, 4=caloriesIcon, 5=floorsClimbIcon, 6=pulseOxIcon, 7=heartRateIcon, 8=notificationIcon, 9=solarIcon, 10=none

var mIndex; // 0=stepsIcon, 1=elevationIcon, 2=windSpeed, 3=humidityIcon, 4=precipitationIcon, 5=caloriesIcon, 6=floorsClimbIcon, 7=pulseOxIcon, 8=heartRateIcon, 9=notificationIcon, 10=solarIcon, 11=none
function initialize() {
Drawable.initialize({});
if (Storage.getValue(9) == null){
mIndex = 0;
} else {
mIndex=Storage.getValue(9);
mIndex=Storage.getValue(9);
if (mIndex == null){
mIndex = 11;
}
}

Expand All @@ -268,11 +271,6 @@ class CustomLeftTopDataPoint extends WatchUi.Drawable {
return mIconStrings[mIndex];
}

/* // Return the color code to save in Storage
function getIcon() {
return mIcons[mIndex];
}
*/

// Advance to the next color state for the drawable
function nextState() {
Expand All @@ -288,14 +286,16 @@ class CustomLeftTopDataPoint extends WatchUi.Drawable {
// the drawable area with that color
function draw(dc) {

var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
var icon = mIcons[mIndex];
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT);
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
if (mIndex < mIcons.size()-1){
var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
var icon = mIcons[mIndex];
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
}
}
dc.clear();
}
Expand All @@ -308,16 +308,15 @@ class CustomLeftTopDataPoint extends WatchUi.Drawable {
class CustomLeftMiddleDataPoint extends WatchUi.Drawable {

// This constant data stores the color state list.
const mIcons = ["0" /*stepsIcon*/, ";" /*elevationIcon*/, "P" /*windIcon*/, "A" /*humidityIcon*/, "S" /*precipitationIcon*/, "6" /*caloriesIcon*/, "1" /*floorsClimbIcon*/, "@" /*pulseOxIcon*/, "3" /*heartRateIcon*/, "5" /*notificationIcon*/, "R" /*solarIcon*/];
const mIcons = ["0" /*stepsIcon*/, ";" /*elevationIcon*/, "P" /*windIcon*/, "A" /*humidityIcon*/, "S" /*precipitationIcon*/, "6" /*caloriesIcon*/, "1" /*floorsClimbIcon*/, "@" /*pulseOxIcon*/, "3" /*heartRateIcon*/, "5" /*notificationIcon*/, "R" /*solarIcon*/, "" /*none*/];
const mIconStrings = ["Distance", "Elevation", "Wind Speed", "Humidity", "Precipitation", "Calories", (ActivityMonitor.getInfo() has :floorsClimbed)?"Floors Climbed":"Not Available", (Activity.getActivityInfo() has :currentOxygenSaturation)?"Pulse Ox":"Not available", "Heart Rate", "Notification",(System.getSystemStats() has :solarIntensity and System.getSystemStats().solarIntensity != null) ? "Solar Intensity" : "Not available", "None"];
var mIndex; // 0=stepsIcon, 1=elevationIcon, 2=humidityIcon, 3=precipitationIcon, 4=caloriesIcon, 5=floorsClimbIcon, 6=pulseOxIcon, 7=heartRateIcon, 8=notificationIcon, 9=solarIcon, 10=none
var mIndex; // 0=stepsIcon, 1=elevationIcon, 2=windSpeed, 3=humidityIcon, 4=precipitationIcon, 5=caloriesIcon, 6=floorsClimbIcon, 7=pulseOxIcon, 8=heartRateIcon, 9=notificationIcon, 10=solarIcon, 11=none

function initialize() {
Drawable.initialize({});
if (Storage.getValue(10) == null){
mIndex = 0;
} else {
mIndex=Storage.getValue(10);
mIndex=Storage.getValue(10);
if (mIndex == null){
mIndex = 11;
}
}

Expand All @@ -340,15 +339,17 @@ class CustomLeftMiddleDataPoint extends WatchUi.Drawable {
// the drawable area with that color
function draw(dc) {

var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
var icon = mIcons[mIndex];
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT);
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
}
if (mIndex < mIcons.size()-1){
var icon = mIcons[mIndex];
var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
}
}
dc.clear();
}
}
Expand All @@ -365,10 +366,9 @@ class CustomLeftBottomDataPoint extends WatchUi.Drawable {

function initialize() {
Drawable.initialize({});
if (Storage.getValue(11) == null){
mIndex = 0;
} else {
mIndex=Storage.getValue(11);
mIndex=Storage.getValue(11);
if (mIndex == null){
mIndex = 8;
}
}

Expand All @@ -391,14 +391,16 @@ class CustomLeftBottomDataPoint extends WatchUi.Drawable {
// the drawable area with that color
function draw(dc) {

var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
var icon = mIcons[mIndex];
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT);
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
if (mIndex < mIcons.size()-1){
var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
var icon = mIcons[mIndex];
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
}
}
dc.clear();
}
Expand All @@ -416,10 +418,9 @@ class CustomRightBottomDataPoint extends WatchUi.Drawable {

function initialize() {
Drawable.initialize({});
if (Storage.getValue(12) == null){
mIndex = 0;
} else {
mIndex=Storage.getValue(12);
mIndex=Storage.getValue(12);
if (mIndex == null){
mIndex = 8;
}
}

Expand All @@ -442,14 +443,16 @@ class CustomRightBottomDataPoint extends WatchUi.Drawable {
// the drawable area with that color
function draw(dc) {

var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
var icon = mIcons[mIndex];
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT);
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
if (mIndex < mIcons.size()-1){
var iconsFont = WatchUi.loadResource(Rez.Fonts.IconsFont);
var humidityFont = WatchUi.loadResource(Rez.Fonts.HumidityFont);
var icon = mIcons[mIndex];
if (icon.find("R")!=null or icon.find("S")!=null or icon.find("P")!=null){
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, humidityFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
} else {
dc.drawText( dc.getWidth()/2, dc.getHeight()/3, iconsFont, icon , Graphics.TEXT_JUSTIFY_CENTER);
}
}
dc.clear();
}
Expand Down
69 changes: 26 additions & 43 deletions source/AnalogView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class AnalogView extends WatchUi.WatchFace
var offscreenBuffer;
var dateBuffer;
var fullScreenRefresh;
var offset = 0;
var Xoffset = 0;
var accentColor = 0x55FF00;
var MtbA = null;

Expand Down Expand Up @@ -53,6 +51,13 @@ class AnalogView extends WatchUi.WatchFace
,Graphics.COLOR_BLUE
,Graphics.COLOR_TRANSPARENT
,0xAAFF00 //Vivomove Green
,0x55FF00 //Green
,0xFFFF00 //Yellow
,0x00FFFF //Cyan
,0xAA55FF //Violet
,0xFFAA00 //Orange
,0xFF0000 //Red
,0xFF55FF //Pink
]
});

Expand All @@ -79,6 +84,7 @@ class AnalogView extends WatchUi.WatchFace
var width;
var height;
var targetDc = null;
var Xoffset = 0;

MtbA = new MtbA_functions();

Expand Down Expand Up @@ -148,27 +154,23 @@ class AnalogView extends WatchUi.WatchFace
//Data Points
var dataPoint = Storage.getValue(12);
// (dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset, dataPoint)
MtbA.drawRightBottom(dc, width*0.72, height*0.56, width * 0.765, height * 0.57, accentColor, width, Xoffset, dataPoint);
MtbA.drawRightBottom(dc, width*0.73, height*0.557, width * 0.776, height * 0.57, accentColor, width, Xoffset, dataPoint);

// Xoffset for the 3 left data points: heart rate, steps and floor climb
if (width==390) { // Venu & D2 Air
Xoffset = 22;
} else if (width==240) { // Fenix 6S e Vivoactive 3 Music & MARQ Athlete
Xoffset = 5;
} else if (width==280) { // Fenix 6X e Enduro
Xoffset = 5;
} else if (width==260) { // Vivoactive 4
Xoffset = 5;
} else if (width==218) { // Fenix 6S e Vivoactive 3 Music & MARQ Athlete
Xoffset = 2;
Xoffset = 15;
} else if (width==240) { // Fenix 6S & Vivoactive 3 Music & MARQ Athlete
Xoffset = -2;
} else if (width==218) { // Vivoactive 4S
Xoffset = -4;
}

dataPoint = Storage.getValue(9); //(dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset)
MtbA.drawLeftTop(dc, width/4.7-Xoffset, height/2.921, width/3.71-Xoffset, height/2.9 + 2.5, accentColor, width, Xoffset, dataPoint);
MtbA.drawLeftTop(dc, width/5.3-Xoffset, height/2.988, width/4.127-Xoffset, height/2.86, accentColor, width, dataPoint);
dataPoint = Storage.getValue(10);
MtbA.drawLeftMiddle(dc, width/4.7-Xoffset, height/2.222, width/3.71-Xoffset, height / 2.15, accentColor, width, Xoffset, dataPoint);
MtbA.drawLeftMiddle(dc, width/5.3-Xoffset, height/2.222, width/4.127-Xoffset, height / 2.15, accentColor, width, dataPoint);
dataPoint = Storage.getValue(11);
MtbA.drawLeftBottom(dc, width/4.7-Xoffset, height/1.793, width/3.71-Xoffset, height/1.75, accentColor, width, Xoffset, dataPoint);
MtbA.drawLeftBottom(dc, width/5.3-Xoffset, height/1.793, width/4.127-Xoffset, height/1.75, accentColor, width, dataPoint);

// Notifications (dc, xIcon, yIcon, xText, yText, accentColor, width, Xoffset)
//MtbA.drawNotification(dc, width*0.74, height*0.56, width *0.8, height*0.57, accentColor, width, Xoffset);
Expand Down Expand Up @@ -206,29 +208,6 @@ class AnalogView extends WatchUi.WatchFace
}


// Draw heart rate
//MtbA.drawHeartRate(dc, width / 4.7, height/2.9, width / 3.65, width, Xoffset, accentColor);

// Draw Pulse Ox and return true (if sensor is active) or false (if sensor inactive)
//var pulseBoolean = MtbA.drawPulseOx(dc, width / 4.7 - Xoffset, height * 0.565, width / 3.75 - Xoffset, height * 0.57, width, accentColor);
//if (pulseBoolean==false) {
// Floors Climbed (dc, xIcon, yIcon, xText, yText, width, accentColor)
//MtbA.drawFloorsClimbed(dc, width / 4.7 - Xoffset, height * 0.56, width / 3.65 - Xoffset, height * 0.57, width, accentColor);
//MtbA.drawHumidity(dc, width / 4.6 - Xoffset, height * 0.56, width / 3.75 - Xoffset, height * 0.57, width);
//MtbA.drawSolarIntensity(dc, width / 4.6 - Xoffset, height * 0.56, width / 3.75 - Xoffset, height * 0.57, width, accentColor);
//}

// Draw Distance Traveled / Steps (dc, xIcon, yIcon, xText, yText, width, accentColor)
//MtbA.drawSteps(dc, width / 4.6 - Xoffset, height / 2.25, width / 3.75 - Xoffset, height / 2.18, width, accentColor);
//MtbA.drawWindSpeed(dc, width / 4.6 - Xoffset, height / 2.25, width / 3.75 - Xoffset, height / 2.18, width);

// Draw elevation (dc, xIcon, yIcon, xText, yText, width)
//MtbA.drawElevation(dc, width / 4.6 - Xoffset, height / 2.25, width / 3.75 - Xoffset, height / 2.18, width);

// Calories (dc, xIcon, yIcon, xText, yText, width, accentColor)
//MtbA.drawCalories(dc, width / 4.6 - Xoffset, height * 0.56, width / 3.75 - Xoffset, height * 0.57, width);


// If we have an offscreen buffer that we are using for the date string,
// Draw the date into it. If we do not, the date will get drawn every update
// after blanking the second hand.
Expand All @@ -249,7 +228,11 @@ class AnalogView extends WatchUi.WatchFace
}

//Draw Hour and Minute hands
MtbA.drawHands(dc, width, height, accentColor);
if (Storage.getValue(13) == null or Storage.getValue(13) == false){
MtbA.drawHands(dc, width, height, accentColor, false);
} else {
MtbA.drawHands(dc, width, height, accentColor, true);
}

fullScreenRefresh = false;
}
Expand Down Expand Up @@ -279,14 +262,14 @@ class AnalogView extends WatchUi.WatchFace
}

// Draw the date
offset = 0;
var offset = 0;
if (width==218) { // Vivoactive 4S
offset = -3;
} else if (width==240) { // Vivoactive 4S and MARQ Athlete
} else if (width==240) { // Fenix 6S and MARQ
offset = -2;
} else if (width==390) { // Vivoactive 4S and MARQ Athlete
} else if (width==390) { // Venu
offset = 13;
} else if (width==260) { // Vivoactive 4S and MARQ Athlete
} else if (width==260) { // Vivoactive 4
offset = 1;
}

Expand Down
Loading

0 comments on commit a1951be

Please sign in to comment.