Skip to content

Commit

Permalink
[TIMOB-17729] Android: Add CanceledOnTouchOutside property to Titaniu…
Browse files Browse the repository at this point in the history
…m.UI.Android.ProgressIndicator
  • Loading branch information
Ashraf A. S committed Jan 7, 2015
1 parent 9b02f63 commit 49acb79
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
TiC.PROPERTY_TYPE,
TiC.PROPERTY_MIN,
TiC.PROPERTY_MAX,
TiC.PROPERTY_CANCELABLE
TiC.PROPERTY_CANCELABLE,
TiC.PROPERTY_CANCELED_ON_TOUCH_OUTSIDE
})
@Kroll.dynamicApis(methods = {
"hide", "show"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP
progressDialog.setCancelable(TiConvert.toBoolean(newValue));
}

} else if (key.equals(TiC.PROPERTY_CANCELED_ON_TOUCH_OUTSIDE) && progressDialog != null) {
progressDialog.setCanceledOnTouchOutside(TiConvert.toBoolean(newValue));
} else {
super.propertyChanged(key, oldValue, newValue, proxy);
}
Expand Down Expand Up @@ -207,6 +209,7 @@ protected void handleShow()

progressDialog.setMessage(message);
progressDialog.setCancelable(proxy.getProperties().optBoolean(TiC.PROPERTY_CANCELABLE, false));
progressDialog.setCanceledOnTouchOutside(proxy.getProperties().optBoolean(TiC.PROPERTY_CANCELED_ON_TOUCH_OUTSIDE, true));

if (type == INDETERMINANT) {
progressDialog.setIndeterminate(true);
Expand Down
5 changes: 5 additions & 0 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,11 @@ public class TiC
*/
public static final String PROPERTY_CANCELABLE = "cancelable";

/**
* @module.api
*/
public static final String PROPERTY_CANCELED_ON_TOUCH_OUTSIDE = "canceledOnTouchOutside";

/**
* @module.api
*/
Expand Down
8 changes: 8 additions & 0 deletions apidoc/Titanium/UI/Android/ProgressIndicator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ properties:
type: Boolean
platforms: [android]

- name: canceledOnTouchOutside
summary: |
Sets whether this dialog is canceled when touched outside the window's bounds.
type: Boolean
default: true
platforms: [android]
since: "3.6.0"

- name: message
summary: Message text.
type: String
Expand Down

0 comments on commit 49acb79

Please sign in to comment.