Skip to content

Commit

Permalink
layout updates. refs #17
Browse files Browse the repository at this point in the history
some changes for Titanium SDK v2.0 differences.
fixed the compass repositioning issue on iPhone 5
  • Loading branch information
rcarlsen committed Dec 12, 2012
1 parent f61f2b8 commit d7db2ac
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions Resources/main_windows/dashboardView.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,21 @@ var speedUnitValue;
// end instance vars //

var dashboardView = Ti.UI.createView({
size:{width:320,height:win.getHeight()},
width:Ti.UI.FILL,
height:Ti.UI.FILL,
backgroundColor:'#ccc',
top:0,bottom:0
});


// load images:
var consoleImage = Ti.UI.createImageView({
image:'../images/bottom.png',
width:320,height:82,
bottom:0
});


// toggle switch for enabling logging
var loggingSwitch = Titanium.UI.createSwitch({
top:30,right:10,
Expand Down Expand Up @@ -198,8 +207,8 @@ var accuracyLabel = Ti.UI.createLabel({
// the container view should fill the window, but then we'll need
// to be able to reposition the compass / accuracy view within.
var compassView = Ti.UI.createView({
width:320,height:320,
center:{x:160,y:170}
width:Ti.UI.FILL, // the height will be determined by the top/bottom pins later
top:0, bottom:(consoleImage.height-10)
});

var compass = Ti.UI.createImageView({
Expand Down Expand Up @@ -231,21 +240,16 @@ var locationView = Ti.UI.createView({

compassView.add(compass);
compassView.add(accuracyView);

// doesn't really help right now.
//compassView.add(locationView);


var consoleView = Ti.UI.createView({
width:320,height:'auto',
width:320,height:Ti.UI.FILL,
left:0,bottom:0
});

var consoleImage = Ti.UI.createImageView({
image:'../images/bottom.png',
width:320,height:82,
bottom:0
});

var forceImage = Ti.UI.createImageView({
image:'../images/blue-circle.png',
width:62,height:62,
Expand Down Expand Up @@ -862,7 +866,6 @@ dashboardView.visible = true;
Ti.UI.currentWindow.add(dashboardView);



var reminderLabel = Ti.UI.createLabel({
height:'auto',
text:'Dashboard hidden.\nDouble-tap to display',
Expand All @@ -875,13 +878,6 @@ reminderLabel.hide();
win.add(reminderLabel);


// adjust compass center for iPhone 4/5
function layoutAutoAdjustment() {
Ti.API.info("layout auto-adjustment");
compassView.setCenter({x:160,y:((win.size.height > 480) ? 220 : 170)});
};


// toggle the dashboard view transparency
// trying to save a bit of the battery by disabling the screen
// TODO: what about the tab bar?
Expand Down Expand Up @@ -1273,9 +1269,7 @@ win.addEventListener('open',function() {
// if not, the setup needs to happen first.
// maybe in app.js.
Ti.API.info('In the window open event.');

layoutAutoAdjustment();


// this is done in the app.js file now.
//setupDatabase();

Expand Down

0 comments on commit d7db2ac

Please sign in to comment.