Permalink
Browse files

Removing custom extension in favour of community API

  • Loading branch information...
1 parent 6939377 commit 34057adcc9c9fb99c632f8da4c5ec2697c9eadbe Jeffrey Heifetz committed Nov 1, 2011
View
@@ -17,7 +17,7 @@ The sample code for this application is Open Source under the [Apache 2.0 Licens
**Dependencies**
-* None
+1. In order to use the spinner on the Input Control Examples [you require the assiciated SpinnerControl extension](https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/SpinnerControl)
**Known Issues**
View
@@ -27,7 +27,7 @@
<feature id="blackberry.invoke.MessageArguments" required="true" version="1.0.0.0"/>
<feature id="blackberry.app.event" required="true" version="1.0.0.0"/>
<feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
- <feature id="sample.ui" required="false" version="1.0.0"/>
+ <feature id="blackberry.ui.Spinner" required="false" version="1.0.0"/>
<feature id="keyInvoker" required="false" version="1.0.0"/>
<access subdomains="true" uri="*"/>
<icon rim:hover="false" src="images/RSS_Icon_EPR_UF.jpg"/>
Binary file not shown.
@@ -62,16 +62,24 @@ function fillElementVariables() {
* a spinner for the user to select a feed
*/
function verifyRss() {
+{
+ var rowHeight,
+ visibleRows,
+ options,
+ checkNumber,
+ channelElements,
+ feedNames = [];
+
if (this.readyState != 4)
return; // No data ready to be processed.
try {
- var checkNumber = ++checkedAmount; // One less feed to check
+ checkNumber = ++checkedAmount; // One less feed to check
// Check for errors.
if (this.status == 200) {
// Make sure we got an XML response.
if (this.responseXML) {
// Check that the XML is a feed
- var channelElements = this.responseXML.getElementsByTagName("channel");
+ channelElements = this.responseXML.getElementsByTagName("channel");
if (channelElements.length > 0) {
// Add to feed list
listOfFeeds[listOfFeeds.length] = {title: this.title, link: this.url};
@@ -85,27 +93,36 @@ function verifyRss() {
alert("Unable to find any Rss feeds for '" + keywordField.value +"'");
clearForm();
} else {
- clearForm();
- var feedNames = new Array();
+ clearForm();
for (var j=0; j<listOfFeeds.length; j++) {
feedNames[j] = listOfFeeds[j].title;
}
- // Configure our spinner
- sample.ui.spinner.title = "Which feed would you like to add?";
- if (screen.height < 480) {
- sample.ui.spinner.rowHeight = 60;
- sample.ui.spinner.visibleRows = 3;
- } else {
- sample.ui.spinner.rowHeight = 75;
- sample.ui.spinner.visibleRows = 4;
- }
+ // Configure our spinner
+ if (screen.height < 480) {
+ rowHeight = 60;
+ visibleRows = 3;
+ } else {
+ rowHeight = 75;
+ visibleRows = 4;
+ }
+ options = {
+ 'title' : "Which feed would you like to add?",
+ 'rowHeight': rowHeight,
+ 'visibleRows': visibleRows,
+ 'selectedIndex': 0,
+ 'items' : feedNames
+ };
// Open the spin dialog
- var choice = sample.ui.spinner.open(feedNames, 0);
- if (choice != undefined) {
- addNewFeed(listOfFeeds[choice].link);
- }
+ blackberry.ui.Spinner.open(options,
+ function (choice) {
+ if (choice != undefined) {
+ addNewFeed(listOfFeeds[choice].link);
+ }
+ }
+ );
+
}
}
} catch(e) {
@@ -265,26 +265,39 @@ function filter() {
* feedList: Feed[] - The current set of feeds.
*/
function processFilter(/*Feed[] feedList*/) {
- var feedNames = new Array();
+ var feedNames = [],
+ rowHeight,
+ visibleRows,
+ options;
+
for (var j=0; j<feedList.length; j++) {
feedNames[j] = feedList[j].name;
}
// Configure our spinner
- sample.ui.spinner.title = "Which feed would you like to view?";
- if (screen.height < 480) {
- sample.ui.spinner.rowHeight = 60;
- sample.ui.spinner.visibleRows = 3;
+ if (screen.height < 480) {
+ rowHeight = 60;
+ visibleRows = 3;
} else {
- sample.ui.spinner.rowHeight = 75;
- sample.ui.spinner.visibleRows = 4;
- }
-
- // Open the spin dialog
- var choice = sample.ui.spinner.open(feedNames, 0);
- if (choice != undefined) {
- useFilter(feedList[choice].id);
- }
+ rowHeight = 75;
+ visibleRows = 4;
+ }
+ options = {
+ 'title' : "Which feed would you like to view?",
+ 'rowHeight': rowHeight,
+ 'visibleRows': visibleRows,
+ 'selectedIndex': defaultChoice,
+ 'items' : feedNames
+ };
+
+ // Open the spin dialog
+ blackberry.ui.Spinner.open(options,
+ function (choice) {
+ if (choice != undefined) {
+ useFilter(feedList[choice].id);
+ }
+ }
+ );
}
/*
@@ -338,12 +338,19 @@ function setProfile(/*Object*/ args) {
* (Menu->Settings->Refresh Rate)
*/
function openRefreshRateDialog() {
- try {
- doSelect('btnRefresh');
- var selectedValue = 0;
- dirty = true;
-
- var elementText = document.getElementById("lblRefresh").innerHTML;
+ var selectedValue = 0,
+ elementText,
+ arrRefreshRates = [],
+ rowHeight,
+ visibleRows,
+ options;
+
+ try {
+ doSelect('btnRefresh');
+
+ dirty = true;
+
+ elementText = document.getElementById("lblRefresh").innerHTML;
if (elementText == "2 hours")
selectedValue = 0;
else if (elementText == "6 hours")
@@ -356,28 +363,38 @@ function openRefreshRateDialog() {
selectedValue = 0;
// Configure our spinner
- sample.ui.spinner.title = "Select a refresh interval :";
- if (screen.height < 480) {
- sample.ui.spinner.rowHeight = 60;
- sample.ui.spinner.visibleRows = 3;
- } else {
- sample.ui.spinner.rowHeight = 75;
- sample.ui.spinner.visibleRows = 4;
- }
-
- var arrRefreshRates = new Array();
arrRefreshRates[0] = "2 hours";
arrRefreshRates[1] = "6 hours";
arrRefreshRates[2] = "12 hours";
arrRefreshRates[3] = "24 hours";
- // Open the spin dialog
- var refreshRateChoice = sample.ui.spinner.open(arrRefreshRates, selectedValue);
- if (refreshRateChoice != undefined) {
- document.getElementById("lblRefresh").innerHTML = arrRefreshRates[refreshRateChoice];
- } else {
- document.getElementById("lblRefresh").innerHTML = arrRefreshRates[selectedValue];
- }
+ if (screen.height < 480) {
+ rowHeight = 60;
+ visibleRows = 3;
+ } else {
+ rowHeight = 75;
+ visibleRows = 4;
+ }
+
+ options = {
+ 'title' : "Select a refresh interval :",
+ 'rowHeight': rowHeight,
+ 'visibleRows': visibleRows,
+ 'selectedIndex': selectedValue,
+ 'items' : arrRefreshRates
+ };
+
+ // Open the spin dialog
+ blackberry.ui.Spinner.open(options,
+ function (refreshRateChoice) {
+ if (refreshRateChoice != undefined) {
+ document.getElementById("lblRefresh").innerHTML = arrRefreshRates[refreshRateChoice];
+ } else {
+ document.getElementById("lblRefresh").innerHTML = arrRefreshRates[selectedValue];
+ }
+ }
+ );
+
} catch (ex) {
errMessage = errMessage + "\n openRefreshRateDialog() : " + ex;
}

0 comments on commit 34057ad

Please sign in to comment.