mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-05-01 21:22:40 +00:00
Update ErrorView.mc
Made the view scalable. Odd that it was not before.
This commit is contained in:
@ -53,14 +53,12 @@ class ErrorView extends ScalableView {
|
|||||||
mDelegate = new ErrorDelegate(self);
|
mDelegate = new ErrorDelegate(self);
|
||||||
// Convert the settings from % of screen size to pixels
|
// Convert the settings from % of screen size to pixels
|
||||||
mErrorIconMargin = pixelsForScreen(cSettings.get(:errorIconMargin) as Lang.Float);
|
mErrorIconMargin = pixelsForScreen(cSettings.get(:errorIconMargin) as Lang.Float);
|
||||||
|
mErrorIcon = Application.loadResource(Rez.Drawables.ErrorIcon) as Graphics.BitmapResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load your resources here
|
// Load your resources here
|
||||||
function onLayout(dc as Graphics.Dc) as Void {
|
function onLayout(dc as Graphics.Dc) as Void {
|
||||||
mErrorIcon = Application.loadResource(Rez.Drawables.ErrorIcon) as Graphics.BitmapResource;
|
|
||||||
|
|
||||||
var w = dc.getWidth();
|
var w = dc.getWidth();
|
||||||
var h = dc.getHeight();
|
|
||||||
|
|
||||||
mTextArea = new WatchUi.TextArea({
|
mTextArea = new WatchUi.TextArea({
|
||||||
:text => mText,
|
:text => mText,
|
||||||
@ -68,22 +66,21 @@ class ErrorView extends ScalableView {
|
|||||||
:font => Graphics.FONT_XTINY,
|
:font => Graphics.FONT_XTINY,
|
||||||
:justification => Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER,
|
:justification => Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER,
|
||||||
:locX => 0,
|
:locX => 0,
|
||||||
:locY => 83,
|
:locY => pixelsForScreen(20.0),
|
||||||
:width => w,
|
:width => w,
|
||||||
:height => h - 166
|
:height => pixelsForScreen(60.0)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the view
|
// Update the view
|
||||||
function onUpdate(dc as Graphics.Dc) as Void {
|
function onUpdate(dc as Graphics.Dc) as Void {
|
||||||
var w = dc.getWidth();
|
var w = dc.getWidth();
|
||||||
var hw = w/2;
|
|
||||||
if(dc has :setAntiAlias) {
|
if(dc has :setAntiAlias) {
|
||||||
dc.setAntiAlias(true);
|
dc.setAntiAlias(true);
|
||||||
}
|
}
|
||||||
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLUE);
|
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLUE);
|
||||||
dc.clear();
|
dc.clear();
|
||||||
dc.drawBitmap(hw - mErrorIcon.getWidth()/2, mErrorIconMargin, mErrorIcon);
|
dc.drawBitmap(w/2 - mErrorIcon.getWidth()/2, mErrorIconMargin, mErrorIcon);
|
||||||
mTextArea.draw(dc);
|
mTextArea.draw(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user