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 Sep 24, 2023
1 parent 7e801bf commit 9d2670c
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 17 deletions.
4 changes: 4 additions & 0 deletions resources-venu3s/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>
Binary file added resources-venu3s/images/MoveToBeActive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources-venu3s/images/garmin5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions resources-venu3s/jsonData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<resources>
<!-- <ata id="mPosition">[189, 106, 168, 246, 154, 58, 317, 82, 298, 142, 322, 147, 62, 86, 232, 237, 187, 192, 213, 208, 241, 208, 237, 274]</jsonData> -->
<!-- Venu 0 1 2 3 4 5 6 7 8 9 10 11 , 12, 13, 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 -->
<jsonData id="mPosition">[177, 100, 157, 231, 141, 54, 297, 260, 280, 129, 298, 133, 66, 84, 216, 221, 174, 179, 187, 185, 222, 191, 259, 257]</jsonData> <!-- default for Venu 2s or 360x360 -->
<!--
0= DnD Icon X
1= DnD, Bluetooth and Alarm Icons Y
2= Bluetooth Icon X
3= Alarm Icon X
4= Garmin Logo X
5= Garmin Logo Y
6= Date Y with Logo / Location Y no Logo
7= Temperature Y no Logo
8= Right icon X
9= Top icon Y
10= Right text X
11= Top text Y
12= Left icon X
13= Left text X
14= Bottom icon Y
15= Bottom text Y
16= Middle icon Y
17= Middle text Y
18= Weather icon X
19= Weather icon X2 // used by some bigger weather icons (eg. partly cloudy day)
20= Weather icon Y + Temperature Y
21= Temperature X
22= Weather icon Y no Logo
23= Location Y with Logo
-->
</resources>
4 changes: 4 additions & 0 deletions resources-vivoactive5/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>
Binary file added resources-vivoactive5/images/MoveToBeActive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources-vivoactive5/images/garmin5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 24 additions & 7 deletions settings/AnalogSettingsView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AnalogSettingsViewTest extends WatchUi.Menu2 {
function initialize() {
Menu2.initialize(null);

var currentVersion=430;
var currentVersion=431;
if (Storage.getValue(23)==null or Storage.getValue(23)<currentVersion){
Storage.setValue(23,currentVersion);

Expand Down Expand Up @@ -203,7 +203,7 @@ class DrawableMenuTitle extends WatchUi.Drawable {

// Draw the application icon and main menu title
function draw(dc) {
var mIndex;
var mIndex, width=dc.getWidth();

if (Storage.getValue(2) == false or Storage.getValue(2) == null){
mIndex = 0;
Expand All @@ -213,15 +213,24 @@ class DrawableMenuTitle extends WatchUi.Drawable {

var appIcon = Application.loadResource(Rez.Drawables.LauncherIcon);
var bitmapWidth = appIcon.getWidth();
var labelWidth = dc.getTextWidthInPixels("Config", Graphics.FONT_SMALL); // Aqui pra corrigir background?
var labelWidth = dc.getTextWidthInPixels("Config", Graphics.FONT_SMALL);

var bitmapX = (dc.getWidth() - (bitmapWidth + 2 + labelWidth)) / 3; // 2 = spacing
if(labelWidth==117 and dc has :drawScaledBitmap){ // Venu 3s
bitmapWidth=55;
}

if (width>=390) { // Venu 3 watch allows full width to menu header, as opposed to all other watches which is half width. This condition corrects it.
width = width*1.25;
}
var bitmapX = (width - (bitmapWidth + 2 + labelWidth)) / 3; // 2 = spacing between logo and text
var bitmapY = (dc.getHeight() - appIcon.getHeight()) / 2;
var labelX = bitmapX + bitmapWidth + 2; // 2 = spacing
var labelX = bitmapX + bitmapWidth + 2; // 2 = spacing between logo and text
var labelY = dc.getHeight() / 2;

//var color = mColors[mIndex];
//dc.setColor(color, color);
//System.println(width);
//System.println(labelWidth);

var mColors = Application.loadResource(Rez.JsonData.mColors);

Expand All @@ -230,9 +239,16 @@ class DrawableMenuTitle extends WatchUi.Drawable {

//dc.clearClip(); //clear instead?
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK); // removing the background color and all the data points from the background, leaving just the hour hands and hashmarks
dc.fillRectangle(0, 0, dc.getWidth(), dc.getHeight()); //width & height?
dc.fillRectangle(0, 0, width, dc.getHeight()); //width & height?

dc.drawBitmap(bitmapX, bitmapY, appIcon);
if(labelWidth==117 and dc has :drawScaledBitmap){ // Venu 3s
dc.drawScaledBitmap(bitmapX, bitmapY, 55, 55, appIcon); // making icon smaller on this watch, since dc width on top of the screen is quite small constrasting to the big default icon size (70x70)
} else if (labelWidth==117){ // Vivoactive 5, which doesn't have ScaledBitmap and icon is too big. Removing it and showing only text.
labelX = (width - (labelWidth)) / 2;
} else {
dc.drawBitmap(bitmapX, bitmapY, appIcon);
}

dc.setColor(mColors[mIndex], Graphics.COLOR_TRANSPARENT);
dc.drawText(labelX, labelY, Graphics.FONT_SMALL, "Config", Graphics.TEXT_JUSTIFY_LEFT | Graphics.TEXT_JUSTIFY_VCENTER);
}
Expand Down Expand Up @@ -311,6 +327,7 @@ class CustomDataPoint extends WatchUi.Drawable {
}



// Advance to the next color state for the drawable, or return the icon string for the menu to use as its label if id=-1
function nextState(id, size) {
var checkWeather = Storage.getValue(21)[2];
Expand Down
7 changes: 4 additions & 3 deletions source/AnalogView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class AnalogView extends WatchUi.WatchFace
}
}

var currentVersion=430;
var currentVersion=431;

if (Storage.getValue(23)==null or Storage.getValue(23)<currentVersion){
//Storage.setValue(23,currentVersion);
Storage.setValue(23,currentVersion);
var checks = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
if (System.getSystemStats() has :batteryInDays){
checks[0]=true;
Expand Down Expand Up @@ -114,6 +114,7 @@ class AnalogView extends WatchUi.WatchFace
}*/

// If this device supports BufferedBitmap, allocate the buffers we use for drawing
//if(Graphics has :BufferedBitmap or :BufferedBitmapReference) {
if(Toybox.Graphics has :BufferedBitmap or Toybox.Graphics has :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
Expand Down Expand Up @@ -172,7 +173,7 @@ class AnalogView extends WatchUi.WatchFace

var labels=Storage.getValue(5);

if(inLowPower and canBurnIn) {
if(inLowPower and canBurnIn) { // aod on
if (dc has :setAntiAlias) {
dc.setAntiAlias(false);
}
Expand Down
19 changes: 12 additions & 7 deletions source/MtbA_functions.mc
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,16 @@ class MtbA_functions {
battery = Math.ceil(System.getSystemStats().battery);
}

//System.println(dc.getTextDimensions("100",0)[1]);
//System.println(width);

var offset = 0, offsetLED = 0;
if (width==390) { // Venu & D2 Air
offset = -2;
if (dc.getTextDimensions("100",0)[1]==33){ // Venu, D2 Air & Approach S70 42mm
offset = -2;
} else { // epix Pro Gen 2 42mm & MARQ Gen 2
offset = -1;
}
} else if (width==280) { // Enduro & Fenix 6X Pro
offset = 0.75;
} else if (width==218 or width==240) { // Vivoactive 4S & Fenix 6S & Vivoactive 3 Music
Expand All @@ -793,7 +800,9 @@ class MtbA_functions {
} else if (width==360) { // Venu 2 & 2s
offset = -1;
} else if (width>=416) {
offset = -1;
if (width==454 and dc.getTextDimensions("100",0)[1]==35){ // Venu 3
offset = 1;
}
offsetLED = -1;
}

Expand Down Expand Up @@ -1170,7 +1179,7 @@ class MtbA_functions {
//var IconsFont = Application.loadResource(Rez.Fonts.IconsFont);
var calories=0;

if (type==2){ // Active Calories formula by markdotai and topcaser (https://forums.garmin.com/developer/connect-iq/f/discussion/208338/active-calories/979052), with small adjustments
if (type==2){ // Active Calories formula by markdotai and topcaser (https://forums.garmin.com/developer/connect-iq/f/discussion/208338/active-calories/979052), with small adjustments by MtbA

var today = Gregorian.info(Time.now(), Time.FORMAT_MEDIUM);
var profile = UserProfile.getProfile();
Expand Down Expand Up @@ -2018,19 +2027,15 @@ function drawSunriseSunset(dc, xIcon, yIcon, xText, yText, width) {

var icon, time;
if (myTime.hour > sunrise.hour and myTime.hour < sunset.hour){
//System.println("sunset ?");
icon = "?";
time = sunset;
} else if (myTime.hour == sunrise.hour and myTime.min > sunrise.min){
//System.println("sunset ?");
icon = "?";
time = sunset;
} else if (myTime.hour == sunset.hour and myTime.min > sunset.min){
//System.println("sunrise >");
icon = ">";
time = sunrise;
} else {
//System.println("sunrise >");
icon = ">";
time = sunrise;
}
Expand Down

0 comments on commit 9d2670c

Please sign in to comment.