Created
July 1, 2014 08:31
-
-
Save Amimul100/8e39a3dd32ba20f3517a to your computer and use it in GitHub Desktop.
Android Progress Indicator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Hi, I have tested this issue in Ti SDK 3.3.0.RC. Its working good. | |
Testing Environment: | |
Titanium SDK: 3.3.0.RC, 3.2.3.GA | |
Titanium CLI: 3.2.3 | |
Android device | |
Appcelerator Studio, build: 3.3.0.201406271159 | |
Step to Reproduce | |
Create a sample Ti Classic project from AppC Studio | |
Update app.js file with test code | |
Run on Android device, emulator | |
Click the Button to see Android progress Indicator | |
*/ | |
Ti.UI.backgroundColor = 'white'; | |
var win = Ti.UI.createWindow({ | |
backgroundColor: 'blue' | |
}); | |
var button = Ti.UI.createButton({ | |
title: 'Show Progress Dialog' | |
}); | |
var progressIndicator = Ti.UI.Android.createProgressIndicator({ | |
message: 'Loading...', | |
location: Ti.UI.Android.PROGRESS_INDICATOR_DIALOG, | |
type: Ti.UI.Android.PROGRESS_INDICATOR_DETERMINANT, | |
cancelable: true, | |
min: 0, | |
max: 10 | |
}); | |
button.addEventListener('click', function (e) { | |
progressIndicator.show(); | |
var value = 0; | |
setInterval(function(){ | |
if (value > 10) { | |
return; | |
} | |
progressIndicator.value = value; | |
value ++; | |
}, 200); | |
// do some work that takes 3 seconds | |
// ie. replace the following setTimeout block with your code | |
setTimeout(function(){ | |
progressIndicator.hide(); | |
}, 3000); | |
}); | |
win.add(button); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment