Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11184] Android: Cancelable ActivityIndicator

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-10-10T19:50:14.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2012 Sprint 21 API, 2012 Sprint 21
ComponentsAndroid
Labelsapi, module_activityindicator, qe-and100112, qe-testadded, regression
ReporterOlga Romero
AssigneePing Wang
Created2012-09-27T00:36:03.000+0000
Updated2013-03-13T18:55:48.000+0000

Description

Description: Feature Allow ActivityIndicator dialogs on Android to be cancelable by the user. Note: this is an Android only feature and doesn't require parity with iOS and MobileWeb since they don't use modal dialogs. API Changes New property: cancelable When true the indicator can be canceled by the user. New event: cancel Fired when the user has canceled the indicator. This is called after the indicator dialog has been hidden, so the developer does not need to call hide() manually. * IT IS A REGRESSION* it is not occurs on 2.1.3.v20120926141610 Test case:

var hideIndicatorTimeout = null;
 
var win = Ti.UI.createWindow({
    backgroundColor: "red",
    layout: 'vertical'
});
 
var indicator = Ti.UI.createActivityIndicator({
  message: "Processing...",
  cancelable: true  // Indicator will be cancelable by setting this to true.
});
indicator.addEventListener('cancel', function() {
    // Fired when the user has canceled this indicator.
    clearTimeout(hideIndicatorTimeout);
    alert("Aborted processing");
});
 
var cancelableSwitch = Titanium.UI.createSwitch({
    title: 'Cancelable',
    style: Ti.UI.Android.SWITCH_STYLE_CHECKBOX,
    value: true
});
cancelableSwitch.addEventListener('change',function(e)
{
    indicator.cancelable = e.value;
});
win.add(cancelableSwitch);
 
var showIndicatorButton = Ti.UI.createButton({
    title: "Show Indicator"
});
showIndicatorButton.addEventListener('click', function() {
    indicator.show();
    hideIndicatorTimeout = setTimeout(function() {
        indicator.hide();
    }, 5000);
});
win.add(showIndicatorButton);
 
win.open();
1. Start up the application. 2. Click "Show Indicator". 3. Wait for it to go away (~5 seconds). 4. Click "Show Indicator" again. 5. Press the BACK button, the dialog should go away. You should also see an alert popup. 6. Uncheck "Cancelable" and click "Show Indicator" again. 7. Try hitting the BACK button, nothing should happen. Dialog should disappear in 5 seconds. 8. Check "Cancelable" and click "Show Indicator". 9. Try hitting the BACK button, the dialog should go away and alert popup (same as step 5).

Attachments

FileDateSize
device-2012-09-26-171422.png2012-09-27T00:36:03.000+000035215

Comments

  1. Ping Wang 2012-10-10

    The Android ActivityIndicator is totally new in 3.0.0 (see TIMOB-6092). It is a view, so it has to be added to the window/view before the show() method is called. The new ActivityIndicator does not have the property "cancelable" any more. Mark the ticket as invalid.
  2. Tamila Smolich 2012-10-18

    Closing the bug as invalid.

JSON Source