Skip to content

Commit

Permalink
UMOBILE-257 Fixed issue in MapProxy on Android, and made map ui autom…
Browse files Browse the repository at this point in the history
…atically responsive to orientation changes.
  • Loading branch information
jeffbcross committed Feb 21, 2012
1 parent b0027ad commit d83664e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
3 changes: 2 additions & 1 deletion Resources/js/models/MapProxy.js
Expand Up @@ -347,7 +347,8 @@ exports.retrieveLocationsByCategory = function (_catName, _numResults, _pageNum)
_resultSet.next();
}

_result.totalResults = parseInt(_db.execute("SELECT COUNT(*) FROM map_locations WHERE categories LIKE ?", _catNameQuery).field(0), 10);
// Not used yet, but was causing errors. totalResults would be useful for paging UI, which hasn't yet been implemented.
// _result.totalResults = parseInt(_db.execute("SELECT COUNT(*) FROM map_locations WHERE categories LIKE ?", _catNameQuery).field(0), 10) || 0;

_resultSet.close();
_db.close();
Expand Down
7 changes: 4 additions & 3 deletions Resources/js/style.js
Expand Up @@ -502,7 +502,8 @@ exports.updateStyles = function () {
// MAP STYLES
exports.mapView= {
top: defaults.TITLEBAR_HEIGHT * 2 + 'dp',
height: deviceProxy.retrieveHeight(true) - (defaults.TITLEBAR_HEIGHT * 2 + defaults.STATUSBAR_HEIGHT + 50) + 'dp',
// height: deviceProxy.retrieveHeight(true) - (defaults.TITLEBAR_HEIGHT * 2 + defaults.STATUSBAR_HEIGHT + 50) + 'dp',
bottom: '50dp',
mapType: Titanium.Map.STANDARD_TYPE,
regionFit: true,
animate: true,
Expand All @@ -513,7 +514,7 @@ exports.updateStyles = function () {
};
exports.mapTableView = {
top: defaults.TITLEBAR_HEIGHT * 2 + 'dp',
height: deviceProxy.retrieveHeight(true) - (defaults.TITLEBAR_HEIGHT + defaults.TITLEBAR_HEIGHT + defaults.STATUSBAR_HEIGHT + 50) + 'dp'
bottom: '50dp'
};
exports.mapCategoryRow= {
font: {
Expand All @@ -535,7 +536,7 @@ exports.updateStyles = function () {
textAlign: 'center'
};
exports.mapNavView= {
top: deviceProxy.retrieveHeight(true) - 50 - defaults.STATUSBAR_HEIGHT + 'dp',
bottom: 0,
height : '50dp',
backgroundGradient : defaults.SECONDARY_BAR_BACKGROUND_GRADIENT
};
Expand Down
16 changes: 4 additions & 12 deletions Resources/js/views/MapWindowView.js
Expand Up @@ -73,11 +73,6 @@ exports.saveActivityIndicatorMessage = function (message) {
};

exports.rotate = function (orientation) {
styles = styles.updateStyles();
if (mapView) mapView.height = styles.mapView.height;
if (bottomNavView) bottomNavView.top = styles.mapNavView.top;

if (categoryBrowsingView) categoryBrowsingView.height = styles.mapTableView.height;
};

exports.resetMapLocation = function () {
Expand All @@ -91,7 +86,7 @@ exports.searchBlur = function (e) {
exports.openCategoryBrowsingView = function (categories) {
_hideAllViews();

if (categories.length === 1) return exports.openCategoryLocationsListView(require('/js/models/MapProxy').retrieveLocationsByCategory(categories[0].name));
if (categories.length === 1) return exports.openCategoryLocationsListView(mapProxy.retrieveLocationsByCategory(categories[0].name));
// If there isn't a categoryNavBar yet, go ahead and create one.
if (!categoryNavBar) _createAndAddCategoryNav();

Expand Down Expand Up @@ -144,11 +139,8 @@ exports.openCategoryBrowsingView = function (categories) {
})(categories);

// Create the view to hold tableviews listing categories and locations.
categoryBrowsingView = Ti.UI.createTableView({
data: _categoryBrowsingData,
height: styles.mapTableView.height,
top: styles.mapTableView.top
});
categoryBrowsingView = Ti.UI.createTableView(styles.mapTableView);
categoryBrowsingView.setData(_categoryBrowsingData);
view.add(categoryBrowsingView);
};

Expand All @@ -167,7 +159,7 @@ exports.openCategoryLocationsListView = function (viewModel) {
if (!categoryNavBar) _createAndAddCategoryNav();
categoryNavBar.view.show();

categoryNavBar.leftButton[require('/js/models/MapProxy').retrieveTotalCategories() > 1 ? 'show' : 'hide']();
categoryNavBar.leftButton[mapProxy.retrieveTotalCategories() > 1 ? 'show' : 'hide']();
categoryNavBar.titleLabel.text = viewModel.categoryName;
categoryNavBar.rightButton.title = localDictionary.map;
categoryNavBar.rightButton.show();
Expand Down

0 comments on commit d83664e

Please sign in to comment.