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 May 1, 2022
1 parent b5b6c24 commit a6638cc
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 58 deletions.
4 changes: 4 additions & 0 deletions resources-legacyherofirstavenger/bitmaps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<bitmap id="LauncherIcon" filename="images/MoveToBeActive.png"
dithering="none" />
</resources>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources-legacysagadarthvader/bitmaps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<bitmap id="LauncherIcon" filename="images/MoveToBeActive.png"
dithering="none" />
</resources>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 38 additions & 35 deletions source/AnalogSettingsView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class Menu2TestMenu2Delegate extends WatchUi.Menu2InputDelegate { // Sub-menu De
}

function onSelect(item) {

var boolean;

if( item.getId().equals("design") ) {
Expand Down Expand Up @@ -165,46 +164,50 @@ class Menu2TestMenu2Delegate extends WatchUi.Menu2InputDelegate { // Sub-menu De
} else if( item.getId().equals("units") ) {
var checkWeather=Storage.getValue(21)[1]; // has :Weather
var unitsMenu = new WatchUi.Menu2({:title=>"Units"});
if (checkWeather or System.getSystemStats() has :batteryInDays){
if (System.getSystemStats() has :batteryInDays){
if (Storage.getValue(19) != null ){
boolean = Storage.getValue(19);
if (System.getSystemStats() has :batteryInDays){
if (Storage.getValue(19) != null ){
boolean = Storage.getValue(19);
} else {
boolean = false;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Battery Estimate", {:enabled=>"ON", :disabled=>"OFF"}, 19, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
}
if (checkWeather){
if (Storage.getValue(6) != null ){
boolean = Storage.getValue(6);
} else {
boolean = true;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Temp. Type", {:enabled=>"Real Temperature", :disabled=>"Feels Like"}, 6, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
if (Storage.getValue(16) != null ){
boolean = Storage.getValue(16);
} else {
boolean = false;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Temp. Unit", {:enabled=>"Always Celsius", :disabled=>"User Settings"}, 16, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
if (Storage.getValue(15) != null ){
boolean = Storage.getValue(15);
} else {
boolean = true;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Wind Speed Unit", {:enabled=>"km/h or mph", :disabled=>"m/s"}, 15, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
if (Storage.getValue(21)[19]){
if (Storage.getValue(20) != null ){
boolean = Storage.getValue(20);
} else {
boolean = false;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Battery Estimate", {:enabled=>"ON", :disabled=>"OFF"}, 19, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
}
if (checkWeather){
if (Storage.getValue(6) != null ){
boolean = Storage.getValue(6);
} else {
boolean = true;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Temp. Type", {:enabled=>"Real Temperature", :disabled=>"Feels Like"}, 6, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
if (Storage.getValue(16) != null ){
boolean = Storage.getValue(16);
} else {
boolean = false;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Temp. Unit", {:enabled=>"Always Celsius", :disabled=>"User Settings"}, 16, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
if (Storage.getValue(15) != null ){
boolean = Storage.getValue(15);
} else {
boolean = true;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Wind Speed Unit", {:enabled=>"km/h or mph", :disabled=>"m/s"}, 15, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
if (Storage.getValue(21)[19]){
if (Storage.getValue(20) != null ){
boolean = Storage.getValue(20);
} else {
boolean = true;
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Atm. Pres. Type", {:enabled=>"Mean Sea-Level", :disabled=>"Standard"}, 20, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
}
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Atm. Pres. Type", {:enabled=>"Mean Sea Level", :disabled=>"Local Pressure"}, 20, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
}
}
if (Storage.getValue(24) != null ){
boolean = Storage.getValue(24);
} else {
unitsMenu.addItem(new WatchUi.ToggleMenuItem("None available", {:enabled=>"None", :disabled=>"None"}, null, null, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));
boolean = false;
}
var info = Time.Gregorian.info(Time.now(), Time.FORMAT_LONG);
unitsMenu.addItem(new WatchUi.ToggleMenuItem("Date Format", {:enabled=>Lang.format("$2$ $1$", [info.month, info.day]), :disabled=>Lang.format("$1$ $2$", [info.month, info.day])}, 24, boolean, {:alignment=>WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT}));

WatchUi.pushView(unitsMenu, new AnalogSettingsViewTest(), WatchUi.SLIDE_BLINK );
} else {
WatchUi.requestUpdate();
Expand Down
20 changes: 9 additions & 11 deletions source/AnalogView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ class AnalogView extends WatchUi.WatchFace
function initialize() {

WatchFace.initialize();
var currentVersion=401;

//var checks as Array<Boolean> = Storage.getValue(21);
//if (checks==null or checks.size()<20) {
if (Storage.getValue(21)==null or Storage.getValue(21).size()<20) {
var checks as Array<Boolean> = Storage.getValue(21);
if (Storage.getValue(23)==null or Storage.getValue(23)<currentVersion){
Storage.setValue(23,currentVersion);
// if (Storage.getValue(21)==null or Storage.getValue(21).size()<20) {
//var checks as Array<Boolean> = Storage.getValue(21);
var checks as Array<Boolean>;
checks = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
if (System.getDeviceSettings() has :requiresBurnInProtection){
checks[0]=System.getDeviceSettings().requiresBurnInProtection;
Expand All @@ -56,7 +58,7 @@ class AnalogView extends WatchUi.WatchFace
if (Activity.getActivityInfo() has :currentOxygenSaturation){ checks[11]=true; }
if (Activity.getActivityInfo() has :altitude) { checks[16]=true; }
if (Activity.getActivityInfo() has :meanSeaLevelPressure) { checks[18]=true; }
if (Activity.getActivityInfo() has :ambientPressure) { checks[19]=true; }
if (Activity.getActivityInfo() has :rawAmbientPressure) { checks[19]=true; }
}
if (ActivityMonitor has :getHeartRateHistory) { checks[10]=true; }
if ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory)) { checks[15]=true; }
Expand Down Expand Up @@ -100,7 +102,7 @@ class AnalogView extends WatchUi.WatchFace
var accentColor = Storage.getValue(1);

// If this device supports BufferedBitmap, allocate the buffers we use for drawing
if(Toybox.Graphics has :BufferedBitmap or :BufferedBitmapReference) {
if(Graphics has :BufferedBitmap or :BufferedBitmapReference) {
// Allocate a full screen size buffer with a palette of only 4 colors to draw
// the background image of the watchface. This is used to facilitate blanking
// the second hand during partial updates of the display
Expand Down Expand Up @@ -131,7 +133,7 @@ class AnalogView extends WatchUi.WatchFace


// Handle the update event
function onUpdate(dc) {
function onUpdate(dc as Dc) as Void {
var targetDc = null;
var width;
var height;
Expand Down Expand Up @@ -242,10 +244,6 @@ class AnalogView extends WatchUi.WatchFace
MtbA.drawBatteryIcon(dc, width*0.69, height / 2.11, width*0.82, height / 2.06+(width==218 ? 1 : 0), width, height, accentColor);
MtbA.drawBatteryText(dc, width*0.76, height / 2.14 - 1, width);

System.println(width);
System.println(dc.getFontHeight(Graphics.FONT_TINY)); //29-19 F6 / 27-19 VA4 /
System.println(dc.getFontHeight(Graphics.FONT_XTINY));

//Data Points
var FontAdj= 0;
if (Storage.getValue(14)==true){
Expand Down
31 changes: 19 additions & 12 deletions source/MtbA_functions.mc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,13 @@ class MtbA_functions {
// Draw the date string into the provided buffer at the specified location
function drawDateString( dc, x, y ) {
var info = Time.Gregorian.info(Time.now(), Time.FORMAT_LONG);
var dateStr = Lang.format("$1$, $2$ $3$", [info.day_of_week, info.month, info.day]);
var dateStr;

if (Storage.getValue(24)==true){
dateStr = Lang.format("$1$, $3$ $2$", [info.day_of_week, info.month, info.day]);
} else {
dateStr = Lang.format("$1$, $2$ $3$", [info.day_of_week, info.month, info.day]);
}

if (x*2 == 260){
y = y + 3;
Expand Down Expand Up @@ -489,8 +495,9 @@ class MtbA_functions {
else {
formattedNotificationAmount = notificationAmount.format("%d");
}
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);

// Text
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.drawText( xText, yText, fontSize, formattedNotificationAmount, Graphics.TEXT_JUSTIFY_LEFT);

if(width==280 or width==240){ //Fenix 6X & Enduro
Expand Down Expand Up @@ -718,13 +725,13 @@ class MtbA_functions {
var estimateFlag = Storage.getValue(19);
var battery;

if (estimateFlag == true and System.getSystemStats().batteryInDays!=null){
battery = Math.ceil(System.getSystemStats().batteryInDays);
} else {
battery = Math.ceil(System.getSystemStats().battery);
battery = Math.ceil(System.getSystemStats().battery);
if (estimateFlag == true){
if (System.getSystemStats().batteryInDays!=null and System.getSystemStats().batteryInDays!=0){ //trying to make sure that we don't get an error if batteryInDays not supported by watch
battery = System.getSystemStats().batteryInDays;
}
}


var offset = 0, offsetLED = 0;
if (width==390) { // Venu & D2 Air
offset = -2;
Expand Down Expand Up @@ -943,7 +950,7 @@ class MtbA_functions {
unit = "?";
}

if (stepDistance >= 10) {
if (stepDistance >= 100) {
distStr = stepDistance.format("%.0f");
} else { //(stepDistance <10)
distStr = stepDistance.format("%.1f");
Expand Down Expand Up @@ -1231,9 +1238,9 @@ class MtbA_functions {
} else {
if (check[19]) {
//elevation = Activity.getActivityInfo().altitude;
if(Activity.getActivityInfo().ambientPressure!=null){
//System.println(Activity.getActivityInfo().ambientPressure);
//System.println(Activity.getActivityInfo().meanSeaLevelPressure );
if(Activity.getActivityInfo().rawAmbientPressure!=null){
pressure = Activity.getActivityInfo().rawAmbientPressure;
} else if (Activity.getActivityInfo().ambientPressure!=null){
pressure = Activity.getActivityInfo().ambientPressure;
}
}
Expand Down Expand Up @@ -1266,7 +1273,7 @@ class MtbA_functions {
}

dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.drawText(xText, yText, fontSize, pressure /*+ unit*/, Graphics.TEXT_JUSTIFY_LEFT); // pressure in hPa
dc.drawText(xText, yText, fontSize, pressure, Graphics.TEXT_JUSTIFY_LEFT); // pressure in hPa
}


Expand Down

0 comments on commit a6638cc

Please sign in to comment.