Skip to content

Commit

Permalink
updates to support iOS 6 SDK and iPhone 5 layout
Browse files Browse the repository at this point in the history
Note: POC Default image. Must be replaced eventually.
  • Loading branch information
rcarlsen committed Dec 4, 2012
1 parent e0ebb3e commit 75708f0
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 39 deletions.
Binary file added Resources/iphone/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 40 additions & 16 deletions Resources/main_windows/dashboardView.js
Expand Up @@ -33,7 +33,7 @@ var win = Ti.UI.currentWindow;
function setLoggingState(state) {
// set the preferences
// the application should *always* have the loggingState false
// when it launches. otherwise, it may ahve shut down incorrectly.
// when it launches. otherwise, it may have shut down incorrectly.
// if so, perhaps we should prompt to resume logging.
// however, if the auto-resume feature is set, what to do then?
// should the auto-resume only activate in startLogging()?
Expand Down Expand Up @@ -159,6 +159,11 @@ var latLabel = Ti.UI.createLabel({
top:30,left:10
});

// a container so the label positions will be laid out correctly
var compassLabelsView = Ti.UI.createView({
width:200, height:200
});

var headingLabel = Ti.UI.createLabel({
color:'#333',
font:{fontSize:28,fontFamily:'Helvetica Neue',fontWeight:'bold'},
Expand Down Expand Up @@ -194,16 +199,17 @@ var accuracyLabel = Ti.UI.createLabel({
bottom:120
});

// this is cropping the accuracy view on iphone 5
// 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:200,
center:{x:160,y:170},
left:0,top:75
width:320,height:320,
center:{x:160,y:170}
});

var compass = Ti.UI.createImageView({
image: '../images/small-compass-shadow.png',
width:200,height:200,
top:0
width:200,height:200
});

//compassView.borderWidth = 1;
Expand Down Expand Up @@ -278,8 +284,9 @@ var durationUnitLabel = Ti.UI.createLabel({
color:'#333',
font:{fontSize:14,fontFamily:'Helvetica Neue',fontWeight:'bold'}
});
durationUnitLabel.bottom = -15;
durationLabel.add(durationUnitLabel);
durationUnitLabel.bottom = 7;
durationUnitLabel.left = 10;
consoleImage.add(durationUnitLabel);
consoleImage.add(durationLabel);

// add a distance label
Expand All @@ -299,8 +306,9 @@ var distanceUnitLabel = Ti.UI.createLabel({
color:'#333',
font:{fontSize:14,fontFamily:'Helvetica Neue',fontWeight:'bold'}
});
distanceUnitLabel.bottom = -15;
distanceLabel.add(distanceUnitLabel);
distanceUnitLabel.bottom = 7;
distanceUnitLabel.right = 10;
consoleImage.add(distanceUnitLabel);
consoleImage.add(distanceLabel);


Expand Down Expand Up @@ -864,15 +872,22 @@ loggingSwitch.addEventListener('change',function(e) {
//dashboardView.add(accuracyLabel);
dashboardView.add(accLabel);

// initialize the labels.
// core location takes some time to return an initial value
// TODO: put this into some kind of initializer / fallback function
lonLabel.text = "Locating...";
latLabel.text = "";
dashboardView.add(lonLabel);
dashboardView.add(latLabel);

compassView.add(speedlabel);
compassView.add(speedUnitLabel);
compassLabelsView.add(speedlabel);
compassLabelsView.add(speedUnitLabel);

compassView.add(headingLabel);
//compassView.add(headingAccuracyLabel);
compassView.add(cardinalLabel);
compassLabelsView.add(headingLabel);
//compassLabelsView.add(headingAccuracyLabel);
compassLabelsView.add(cardinalLabel);

compassView.add(compassLabelsView);

dashboardView.add(compassView);
dashboardView.add(consoleView);
Expand Down Expand Up @@ -903,6 +918,13 @@ 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 @@ -1297,7 +1319,9 @@ win.addEventListener('open',function() {
// is this the first event to trigger?
// if not, the setup needs to happen first.
// maybe in app.js.
//Ti.API.info('In the window open event. About to setup DB.');
Ti.API.info('In the window open event.');

layoutAutoAdjustment();

// this is done in the app.js file now.
//setupDatabase();
Expand Down
2 changes: 1 addition & 1 deletion Resources/main_windows/logList.js
Expand Up @@ -1079,7 +1079,7 @@ function addLogRow(rowData) // should include title(date), duration, distance, e
text:durationString +' | '+distanceString,
font:{fontSize:13},
color:'#666',
left:10,top:23
left:10,bottom:7
});
row.add(subtitleLabel);
//Ti.API.info('Created (and added) the subtitle label to the row');
Expand Down
6 changes: 4 additions & 2 deletions Resources/main_windows/settings.js
Expand Up @@ -210,9 +210,11 @@ function addAboutRow(label,value)
//borderWidth:1,
//borderColor:'#999',
//borderRadius:10,
height:Ti.UI.FILL,
editable:false,
touchEnabled:false,
font:{fontSize:15}
touchEnabled:true,
font:{fontSize:16},
scrollable:true
});
Ti.API.info('Created about field');
//Ti.API.info('Added about string to about field: '+value);
Expand Down
16 changes: 8 additions & 8 deletions manifest
@@ -1,8 +1,8 @@
#appname: MobileLogger
#publisher: rcarlsen
#url: http://robertcarlsen/net
#image: appicon.png
#appid: net.robertcarlsen.MobileLogger
#desc: undefined
#type: mobile
#guid: 85e942c2-cae5-48e1-8f05-d32621ee71bf
#appname:MobileLogger
#publisher:Robert Carlsen
#url:http://robertcarlsen.net
#image:appicon.png
#appid:net.robertcarlsen.MobileLogger
#desc:Log location, heading, speed, altitude, accelerometer, sound level, trip duration and distance.
#type:mobile
#guid:85e942c2-cae5-48e1-8f05-d32621ee71bf
30 changes: 18 additions & 12 deletions tiapp.xml
@@ -1,20 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>net.robertcarlsen.MobileLogger</id>
<name>MobileLogger</name>
<version>1.2.3</version>
<publisher>Robert Carlsen</publisher>
<url>http://robertcarlsen.net</url>
<description>Log location, heading, speed, altitude, accelerometer, sound level, trip duration and distance.</description>
<copyright>2010 by Robert Carlsen</copyright>
<icon>Icon.png</icon>
<sdk-version>2.1.4.GA</sdk-version>
<deployment-targets>
<target device="mobileweb">false</target>
<target device="iphone">true</target>
<target device="ipad">false</target>
<target device="blackberry">false</target>
<target device="android">false</target>
</deployment-targets>
<id>net.robertcarlsen.MobileLogger</id>
<name>MobileLogger</name>
<version>1.2.4.beta</version>
<publisher>Robert Carlsen</publisher>
<url>http://robertcarlsen.net</url>
<description>Log location, heading, speed, altitude, accelerometer, sound level, trip duration and distance.</description>
<copyright>2012 by Robert Carlsen</copyright>
<icon>Icon.png</icon>
<persistent-wifi>false</persistent-wifi>
<prerendered-icon>false</prerendered-icon>
<statusbar-style>default</statusbar-style>
<statusbar-hidden>false</statusbar-hidden>
<analytics>false</analytics>
<guid>85e942c2-cae5-48e1-8f05-d32621ee71bf</guid>
<modules>
<module version="0.1">CompressionModule</module>
</modules>
<guid>85e942c2-cae5-48e1-8f05-d32621ee71bf</guid>
<modules/>
</ti:app>

0 comments on commit 75708f0

Please sign in to comment.