diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8f968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db diff --git a/README b/README index 261b80a..153c666 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -Today we are releasing the beta version of the New York State Senate mobile app. This is the first mobile app released by a State Legislature. This app brings the functionality of the NYSenate.gov site and the Open Legislation service to users on the go, no matter where they are. From finding your Senator using your current GPS location, to searching legislation or session transcripts, to watching Senate session video from just hours ago, citizens of New York State are now just a tap away from their legislature. +Today we are releasing the beta version of the New York State Senate mobile app. This is the first mobile app released by a State Legislature. This app brings the functionality of the NYSenate.gov site and the Open Legislation service to users on the go, no matter where they are. From finding your Senator using your current GPS location, to searching legislation or session transcripts, to watching Senate session video from just hours ago, citizens of New York State are now just a tap away from their legislature. Read the announcement here: http://www.nysenate.gov/blogs/2010/jun/04/android-app-beta-and-mobile-source-code-released @@ -9,37 +9,37 @@ This application was developed using the Appcelerator Titanium framework which c Titanium is a cross-platform Javascript-to-Native binding approach to mobile development, which produces highly usable, well performing native mobile applications from one central Javascript application source source. The Javascript code is fully compliant, standards-based scripting, though the application APIs are proprietary to the Titanium platform. However, Appcelerator has open-sourced their code base, which was sufficient for us to choose their platform on which to build our application. -We are also big supporters of pure HTML5+CSS mobile applications, but for now, this is the approach we have taken, and we hope you find value in our source code. +We are also big supporters of pure HTML5+CSS mobile applications, but for now, this is the approach we have taken, and we hope you find value in our source code. ---------------------------------- Stuff our legal folk make us say: -Appcelerator, Appcelerator Titanium and associated marks and logos are -trademarks of Appcelerator, Inc. +Appcelerator, Appcelerator Titanium and associated marks and logos are +trademarks of Appcelerator, Inc. Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. Titanium is licensed under the Apache Public License (Version 2). Please see the LICENSE file for the full license. -In order to make the Senate's information and software as public as -possible, it is has adopted unique system using two types of licenses - -GNU General Public License as well as the BSD License. This system is -meant to ensure the most public licence is used in each specific case -such that: - -(i) Any Software released containing components with preexisting GPL -copyrights must be released pursuant to a GPL v3 copyright restriction. -(ii) Any Software created independently by the Senate without any -preexisting licensing restrictions on any of its components shall be -released under dual licensing and take one of two forms: (a) a BSD -license, or (b) a GPL v3 license. The ultimate user of such Software -shall choose which form of licensing makes the most sense for his or her -project. -(iii) Regarding Software containing preexisting copyright restrictions -other than GPL, the CIO shall make the determination how he or she -wishes to release such Software. - -GPL v3: http://www.gnu.org/copyleft/gpl.html +In order to make the Senate's information and software as public as +possible, it is has adopted unique system using two types of licenses - +GNU General Public License as well as the BSD License. This system is +meant to ensure the most public licence is used in each specific case +such that: + +(i) Any Software released containing components with preexisting GPL +copyrights must be released pursuant to a GPL v3 copyright restriction. +(ii) Any Software created independently by the Senate without any +preexisting licensing restrictions on any of its components shall be +released under dual licensing and take one of two forms: (a) a BSD +license, or (b) a GPL v3 license. The ultimate user of such Software +shall choose which form of licensing makes the most sense for his or her +project. +(iii) Regarding Software containing preexisting copyright restrictions +other than GPL, the CIO shall make the determination how he or she +wishes to release such Software. + +GPL v3: http://www.gnu.org/copyleft/gpl.html BSD: http://www.opensource.org/licenses/bsd-license.php diff --git a/Resources/app-grid.js b/Resources/app-grid.js index 12f2c35..6085198 100644 --- a/Resources/app-grid.js +++ b/Resources/app-grid.js @@ -19,7 +19,7 @@ var transpColor = '#00ffffff'; function buildWindow () { - var win = Titanium.UI.createWindow({ + var win = Titanium.UI.createWindow({ backgroundImage:'img/bg/bglight.jpg', orientationModes:[Titanium.UI.PORTRAIT], navBarHidden:true @@ -28,7 +28,7 @@ function buildWindow () win.addEventListener('android:back',function(e) { Titanium.API.info("got win android:back event"); - + }); win.open({}); @@ -50,7 +50,7 @@ function buildWindow () }); win.add(imgTitle); - + var tableview = Titanium.UI.createTableView({ separatorColor: transpColor, top:64, @@ -91,7 +91,7 @@ function buildWindow () for (var i = 0; i < gridData.length; i++) { - + if (gridColIdx == -1 || gridColIdx > 2) { gridRow = Ti.UI.createTableViewRow({ @@ -109,8 +109,8 @@ function buildWindow () else if (gridColIdx == 1) imgLeft = xCenter; else if (gridColIdx == 2) - imgLeft = xRight; - + imgLeft = xRight; + var img = Ti.UI.createImageView({ image:gridData[i].image, top:gridIconBuffer, @@ -133,7 +133,7 @@ function buildWindow () modal:true }); - + newWin.close(); newWin.open(); @@ -141,21 +141,21 @@ function buildWindow () { Titanium.API.info("got android BACK key event for new win"); - + }); - + } else if (e.source.tabIdx) { - - + + var tabWin = Titanium.UI.createWindow({ url:"app-tabs.js", orientationModes:[Titanium.UI.LANDSCAPE_LEFT,Titanium.UI.LANDSCAPE_RIGHT,Titanium.UI.PORTRAIT], modal:true }); - + tabWin.open({}); tabWin.addEventListener('close',function(e) @@ -165,9 +165,9 @@ function buildWindow () }); } - + }); - + gridRow.add(img); var imgLabel = Ti.UI.createLabel({ @@ -180,12 +180,12 @@ function buildWindow () color:gridFontColor }); gridRow.add(imgLabel); - + gridColIdx++; - + } - + return win; } @@ -219,14 +219,14 @@ if (!hadWelcome) win.open(winSearch,{animated:true}); } - + Titanium.App.Properties.setString("welcome","done"); - + }); dialog.show(); - - + + } diff --git a/Resources/app-menu.js b/Resources/app-menu.js index cf5d0f1..0f825d7 100644 --- a/Resources/app-menu.js +++ b/Resources/app-menu.js @@ -7,7 +7,7 @@ Titanium.UI.setBackgroundColor(DEFAULT_BAR_COLOR); // var winHome; -winHome = Titanium.UI.createWindow({ +winHome = Titanium.UI.createWindow({ title:'New York State Senate', barColor:DEFAULT_BAR_COLOR, backgroundImage:'img/bg/bglight.jpg', @@ -33,8 +33,8 @@ opacity:.8 for (var c = 0; c < data.length; c++) { - - + + row = Ti.UI.createTableViewRow({height:60}); row.className = 'morerow'; row.color = '#333333'; @@ -45,12 +45,12 @@ for (var c = 0; c < data.length; c++) row.oltype = data[c].oltype; row.hasDetail = data[c].hasDetail; row.leftImage = data[c].icon; - + row.title = data[c].title; - + tableview.appendRow(row); - - + + } @@ -62,17 +62,17 @@ tableview.addEventListener('click', function(e) if (e.rowData.tab) { //Titanium.UI.currentTab.setActiveTab(e.rowData.tab); - } + } else if (e.rowData.ilink) { subWin = Titanium.UI.createWindow({ url:e.rowData.ilink, title:e.rowData.pageTitle - + }); subWin.channel = e.rowData.channel; - + subWin.barColor = DEFAULT_BAR_COLOR; subWin.open({animated:true}); } @@ -133,13 +133,13 @@ if (!hadWelcome) winHome.open(winSearch,{animated:true}); } - + Titanium.App.Properties.setString("welcome","done"); - + }); dialog.show(); - - + + } diff --git a/Resources/app-tabs.js b/Resources/app-tabs.js index d924c94..c4345e8 100644 --- a/Resources/app-tabs.js +++ b/Resources/app-tabs.js @@ -11,13 +11,13 @@ function showTabs (tabIdx) // var winHome; - winHome = Titanium.UI.createWindow({ + winHome = Titanium.UI.createWindow({ title:'New York State Senate', url:'views/newsroom.js', orientationModes:[Titanium.UI.LANDSCAPE_LEFT,Titanium.UI.LANDSCAPE_RIGHT,Titanium.UI.PORTRAIT] }); - var tabHome = Titanium.UI.createTab({ + var tabHome = Titanium.UI.createTab({ icon:'img/tabs/bank.png', title:'Newsroom', window:winHome, @@ -30,15 +30,15 @@ function showTabs (tabIdx) // // create controls tab and root window // - var winToday = Titanium.UI.createWindow({ + var winToday = Titanium.UI.createWindow({ title:'Calendar', url:'views/today.js', - + backgroundImage:"img/bg/Default.png", orientationModes:[Titanium.UI.LANDSCAPE_LEFT,Titanium.UI.LANDSCAPE_RIGHT,Titanium.UI.PORTRAIT] }); - var tabToday = Titanium.UI.createTab({ + var tabToday = Titanium.UI.createTab({ icon:'img/tabs/newspaper.png', title:'Calendar', window:winToday, @@ -51,7 +51,7 @@ function showTabs (tabIdx) var winSenators; - winSenators = Titanium.UI.createWindow({ + winSenators = Titanium.UI.createWindow({ title:'Senators', url:'views/senators.js', barColor:DEFAULT_BAR_COLOR, @@ -60,57 +60,57 @@ function showTabs (tabIdx) }); - var tabSenators = Titanium.UI.createTab({ + var tabSenators = Titanium.UI.createTab({ icon:'img/tabs/man.png', title:'Senators', window:winSenators }); - tabGroup.addTab(tabSenators); + tabGroup.addTab(tabSenators); //fourth tab - var winOpenLeg = Titanium.UI.createWindow({ + var winOpenLeg = Titanium.UI.createWindow({ title:'Legislation', url:'views/legislation.js', barColor:DEFAULT_BAR_COLOR, backgroundImage:"img/bg/Default.png", orientationModes:[Titanium.UI.LANDSCAPE_LEFT,Titanium.UI.LANDSCAPE_RIGHT,Titanium.UI.PORTRAIT] }); - var tabOpenLeg = Titanium.UI.createTab({ + var tabOpenLeg = Titanium.UI.createTab({ icon:'img/tabs/database.png', title:'Legislation', window:winOpenLeg }); - tabGroup.addTab(tabOpenLeg); + tabGroup.addTab(tabOpenLeg); //fifth tab - var winMore = Titanium.UI.createWindow({ + var winMore = Titanium.UI.createWindow({ title:'More', url:'views/more.js', barColor:DEFAULT_BAR_COLOR, backgroundImage:"img/bg/Default.png", orientationModes:[Titanium.UI.LANDSCAPE_LEFT,Titanium.UI.LANDSCAPE_RIGHT,Titanium.UI.PORTRAIT] }); - var tabMore = Titanium.UI.createTab({ + var tabMore = Titanium.UI.createTab({ icon:'img/tabs/preferences.png', title:'More', window:winMore }); - tabGroup.addTab(tabMore); + tabGroup.addTab(tabMore); tabGroup.addEventListener('blur', function(e) { Titanium.API.info("got tab win blur key event!"); - + }); tabGroup.addEventListener('close',function(e) { Titanium.API.info("got tab win close key event!"); - + }); tabGroup.close(); @@ -130,29 +130,29 @@ Ti.UI.currentWindow.addEventListener('focus', function(e) Titanium.API.info("TAB PARENT - got focus; count=" + focusCount); if (focusCount > 1) - { + { Ti.API.info("closing curr window"); Ti.UI.currentWindow.close(); } - + }); Ti.UI.currentWindow.addEventListener('blur', function(e) { Titanium.API.info("TAB PARENT - got blur"); - + }); Ti.UI.currentWindow.addEventListener('close', function(e) { Titanium.API.info("TAB PARENT - got close"); - + }); Ti.UI.currentWindow.addEventListener('android:back', function(e) { Titanium.API.info("TAB PARENT - got android:back!"); - + }); showTabs(0); diff --git a/Resources/app.js b/Resources/app.js index a385b23..6dc4bd1 100644 --- a/Resources/app.js +++ b/Resources/app.js @@ -7,10 +7,10 @@ Titanium.UI.setBackgroundColor(DEFAULT_BAR_COLOR); // var win; -win = Titanium.UI.createWindow({ +win = Titanium.UI.createWindow({ title:'New York State Senate', barColor:DEFAULT_BAR_COLOR, - orientationModes:[Titanium.UI.PORTRAIT], + orientationModes:[Titanium.UI.PORTRAIT], navBarHidden:true }); @@ -39,7 +39,7 @@ var data = [ {title:'Session Calendar', summary:'', hasDetail:true,ilink:'tabs.js',tabIdx:1, icon:'img/icons/calendar.png'}, {title:'Newsroom', summary:'', hasDetail:true,ilink:'tabs.js',tabIdx:2, icon:'img/icons/comments.png'}, {title:'Open Legislation', summary:'', hasDetail:true, ilink:'tabs.js',tabIdx:3, icon:'img/icons/legislation.png'}, - {title:'Latest Videos', summary:'', hasDetail:true, ilink:'inc/youtube.js', icon:'img/icons/videos.png'}, + {title:'Latest Videos', summary:'', hasDetail:true, ilink:'inc/youtube.js', icon:'img/icons/videos.png'}, {title:'Find Your Senator', summary:'', hasDetail:true, ilink:'views/findsenator.js', icon:'img/icons/search.png'}, {title:'More Information', summary:'', hasDetail:true, ilink:'tabs.js',tabIdx:4, icon:'img/icons/more.png'}, {title:'Visit NYSenate.gov', summary:'', hasDetail:true, elink:'http://nysenate.gov', icon:'img/icons/home.png'}, @@ -55,8 +55,8 @@ separatorColor:"#cccccc" for (var c = 0; c < data.length; c++) { - - + + row = Ti.UI.createTableViewRow({height:60, fontSize:'14pt', color:'#333333'}); row.pageTitle = data[c].title; row.link = data[c].link; @@ -85,10 +85,10 @@ for (var c = 0; c < data.length; c++) color:'#333333' }); row.add(labelTitle); - + tableview.appendRow(row); - - + + } @@ -100,7 +100,7 @@ tableview.addEventListener('click', function(e) if (e.rowData.tab) { //Titanium.UI.currentTab.setActiveTab(e.rowData.tab); - } + } else if (e.rowData.ilink) { subWin = Titanium.UI.createWindow({ @@ -115,33 +115,33 @@ tableview.addEventListener('click', function(e) subWin.barColor = DEFAULT_BAR_COLOR; subWin.open({animated:true}); subWin.focusCount = 0; - + subWin.addEventListener('focus', function(e) { Titanium.API.info("TAB PARENT - got focus"); - + subWin.focusCount = subWin.focusCount + 1; if (subWin.focusCount > 1) subWin.close(); - + // Ti.API.info("closing curr window"); // Ti.UI.currentWindow.close(); - - + + }); subWin.addEventListener('blur', function(e) { Titanium.API.info("TAB PARENT - got blur"); - + }); subWin.addEventListener('close', function(e) { Titanium.API.info("TAB PARENT - got close"); - + }); subWin.addEventListener('android:back', function(e) @@ -212,13 +212,13 @@ if (!hadWelcome) win.open(winSearch,{animated:true}); } - + Titanium.App.Properties.setString("welcome","done"); - + }); dialog.show(); - - + + } diff --git a/Resources/globals.js b/Resources/globals.js index 83730d6..71cfd4f 100644 --- a/Resources/globals.js +++ b/Resources/globals.js @@ -13,7 +13,7 @@ var webModal; var webModalView; var toolActInd; var currentLink; - + var btnSearch = Titanium.UI.createButton({ title:'Browser', style:Titanium.UI.iPhone.SystemButtonStyle.PLAIN @@ -22,7 +22,7 @@ var btnSearch = Titanium.UI.createButton({ btnSearch.addEventListener('click',function() { Titanium.Platform.openURL(currentLink); - + }); /* @@ -60,15 +60,15 @@ function getSenatorJSON () if (!senatorJson) { //Titanium.API.info("loading senators json"); - - + + var cachedFeed = getCachedFile("senatorsJson"); //Titanium.API.info("parsing senators json: " + cachedFeed); if (cachedFeed) senatorJson = JSON.parse(cachedFeed.text); - + } return senatorJson; @@ -78,107 +78,107 @@ function processNYSenateHtml (rawHTML) { var respText = rawHTML; var baseHref = "http://nysenate.gov"; - + var contentIdx = respText.indexOf('id="content">'); - + if (contentIdx && contentIdx != -1) { respText = respText.substring(contentIdx+13); - + respText = respText.substring(0, respText.indexOf('