diff --git a/Resources/app.js b/Resources/app.js index 75a2e55..6c8da82 100644 --- a/Resources/app.js +++ b/Resources/app.js @@ -9,8 +9,7 @@ else { //create a private scope to prevent further polluting the global object (function() { var AppTabGroup = require('ui/AppTabGroup').AppTabGroup, - ListWindow = require('ui/ListWindow').ListWindow, - AddWindow = require('ui/AddWindow').AddWindow; + ListWindow = require('ui/ListWindow').ListWindow; // Initialize local storage require('db').createDb(); @@ -24,17 +23,7 @@ else { title: 'Todo', backgroundColor: '#fff', navBarHidden: false, - isDone: 0, - activity: { - onCreateOptionsMenu: function(e) { - var menu = e.menu; - var menuItem = menu.add({ title: "Add Task" }); - menuItem.setIcon("images/ic_menu_add.png"); - menuItem.addEventListener("click", function(e) { - new AddWindow().open(); - }); - } - } + isDone: 0 }) }, { @@ -51,4 +40,4 @@ else { globals.tabs.open(); })(); -} \ No newline at end of file +} diff --git a/Resources/ui/AddWindow.js b/Resources/ui/AddWindow.js index 9765a2c..34c652a 100644 --- a/Resources/ui/AddWindow.js +++ b/Resources/ui/AddWindow.js @@ -11,7 +11,8 @@ exports.AddWindow = function() { top: '20dp', hintText: 'New Item', borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED, - returnKeyType: Ti.UI.RETURNKEY_DONE + returnKeyType: Ti.UI.RETURNKEY_DONE, + color: '#000' }); itemField.addEventListener('return', function(e) { addTask(itemField.value, self); @@ -53,4 +54,4 @@ var addTask = function(value, win) { require('db').addItem(value); Ti.App.fireEvent('app:updateTables'); win.close(); -}; \ No newline at end of file +}; diff --git a/Resources/ui/AppTabGroup.js b/Resources/ui/AppTabGroup.js index 20c0e0f..79c41a1 100644 --- a/Resources/ui/AppTabGroup.js +++ b/Resources/ui/AppTabGroup.js @@ -1,4 +1,6 @@ exports.AppTabGroup = function() { + + var AddWindow = require('ui/AddWindow').AddWindow; var self = Ti.UI.createTabGroup(); //loop through tab objects and add them to the tab group @@ -14,7 +16,33 @@ exports.AppTabGroup = function() { //track the current tab for the tab group self.addEventListener('focus', function(e) { self.currentTab = e.tab; + // clear the action bar menu when switching between tabs for Android + if (Ti.Platform.name === "android") { + self.getActivity().invalidateOptionsMenu(); + } }); + if (Ti.Platform.name === "android") { + self.addEventListener("open", function(e) { + var activity = self.getActivity(); + activity.onCreateOptionsMenu = function(e) { + var item, menu; + menu = e.menu; + menu.clear(); + // if it is the Todo tab on Android, add menu item to action bar + if (!self.activeTab.window.isDone) { + item = menu.add({ + title : "Add", + icon : "images/images/ic_menu_add.png", + showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM + }); + item.addEventListener("click", function(e) { + new AddWindow().open(); + }); + } // end check for isDone variable + }; // end createOptionsMenu + }); + } + return self; -}; \ No newline at end of file +}; diff --git a/Resources/ui/ListWindow.js b/Resources/ui/ListWindow.js index 6c49d38..6493430 100644 --- a/Resources/ui/ListWindow.js +++ b/Resources/ui/ListWindow.js @@ -60,7 +60,8 @@ var getTableData = function(done) { title: todoItems[i].item, color: '#000', font: { - fontWeight: 'bold' + fontWeight: 'bold', + fontSize: '14dp' } }); data.push(row); diff --git a/tiapp.xml b/tiapp.xml index 6255ba5..a5495df 100644 --- a/tiapp.xml +++ b/tiapp.xml @@ -1,6 +1,6 @@ - 3.5.0.GA + 4.0.0.RC4 true true