diff --git a/README.md b/README.md index c429ce6..db53436 100755 --- a/README.md +++ b/README.md @@ -4,17 +4,13 @@ This is a widget for the [Alloy](http://projects.appcelerator.com/alloy/docs/All The widget provides a simple loading mask that can be easily styled and configured. -### Android -On Android HeavyWeight windows don't support a backgroundColor with an alpha-channel. Before 1.5 this meant the loading mask had a solid grey background. Since 1.5 the widget falls back to `Ti.UI.Android.ProgressIndicator`, waiting for [this issue](https://jira.appcelerator.org/browse/TC-2774) to be solved. - ## Screenshot -![Loading Mask](https://raw.github.com/FokkeZB/nl.fokkezb.loading/master/docs/screenshot.png) ![Android](https://raw.github.com/FokkeZB/nl.fokkezb.loading/master/docs/android.png) +![Loading Mask](https://raw.github.com/FokkeZB/nl.fokkezb.loading/master/docs/screenshot.png) ## Features * Fully stylable via your `app.tss`. * If enabled, hides and sends a `cancelled` event when tapped on by the user. * Message and ability to be cancelled can be set any time, also in one call. -* Falls back on the new `Ti.UI.Android.ProgressIndicator` for Android. ## Quick Start * Download the latest [release](https://github.com/FokkeZB/nl.fokkezb.loading/releases) of the widget. @@ -23,7 +19,7 @@ On Android HeavyWeight windows don't support a backgroundColor with an alpha-cha ```javascript "dependencies": { - "nl.fokkezb.loading":"1.5" + "nl.fokkezb.loading":"1.5.1" } ``` @@ -64,7 +60,7 @@ The following parameters can be set either through `XML` or `TSS`: | message | `string` | Loading | Sets the message to show | | blocking | `boolean` | TRUE | Prevents users from cancelling by clicking on the mask | | show | `boolean` | FALSE | Calls show() directly after init | -| images | `boolean` or `array` | FALSE | Shows default or given array of images as indicator (not for Android) | +| images | `boolean` or `array` | FALSE | Shows default or given array of images as indicator | ## Public properties @@ -93,7 +89,7 @@ Shows default or given array of images as indicator instead of an ActivityIndica ### cancel Fires when the loading mask was hidden by the user by either tapping the mask or using the Android hardware back-button. -## Styling (not for Android) +## Styling You can style all views from your `app.tss`. The default styles can be found in [loading.tss](https://github.com/FokkeZB/nl.fokkezb.loading/blob/master/styles/loading.tss). Be aware that the default styles are applied to classses, but to override from your `app.tss` you need to following (identical) IDs: * `#loadingMask`: The full-screen mask. @@ -106,6 +102,7 @@ You can style all views from your `app.tss`. The default styles can be found in You can override the default message (`Loading..`) by setting the `loadingMessage` in your `strings.xml` files. ## Changelog +* 1.5.1: Reverted 1.5 change thanks to `opacity` fix. * 1.5: Falls back to `Ti.UI.Android.ProgressIndicator` for Android * 1.4: Support for image indicator * 1.3: Fully override widget style from `app.tss` and reset to default message upon show. diff --git a/controllers/loading.js b/controllers/loading.js index 7eef66e..715a46c 100755 --- a/controllers/loading.js +++ b/controllers/loading.js @@ -18,14 +18,9 @@ function show(_message, _blocking) { return; } - if (OS_ANDROID) { - $.loadingProgressIndicator.show(); + $.loadingMask.open(); - } else { - $.loadingMask.open(); - - hasImages ? $.loadingImages.start() : $.loadingIndicator.show(); - } + hasImages ? $.loadingImages.start() : $.loadingIndicator.show(); isShowing = true; @@ -38,14 +33,9 @@ function hide() { return; } - if (OS_ANDROID) { - $.loadingProgressIndicator.hide(); + hasImages ? $.loadingImages.stop() : $.loadingIndicator.hide(); - } else { - hasImages ? $.loadingImages.stop() : $.loadingIndicator.hide(); - - $.loadingMask.close(); - } + $.loadingMask.close(); isShowing = false; @@ -60,9 +50,7 @@ function cancel() { if (args.blocking === false) { - if (!OS_ANDROID) { - hide(); - } + hide(); $.trigger('cancel'); } @@ -74,13 +62,8 @@ function setMessage(_message) { if (_message === false) { - if (hasMessage) { - - if (OS_ANDROID) { - $.loadingProgressIndicator.message = null; - } else { - $.loadingInner.remove($.loadingMessage); - } + if (hasMessage) { + $.loadingInner.remove($.loadingMessage); hasMessage = false; } @@ -88,14 +71,10 @@ function setMessage(_message) { } else { var message = (_message === true) ? L('loadingMessage', 'Loading..') : _message; - if (OS_ANDROID) { - $.loadingProgressIndicator.message = message; - } else { - $.loadingMessage.text = message; - } + $.loadingMessage.text = message; if (!hasMessage) { - OS_ANDROID || $.loadingInner.add($.loadingMessage); + $.loadingInner.add($.loadingMessage); hasMessage = true; } @@ -106,19 +85,9 @@ function setMessage(_message) { function setBlocking(_blocking) { args.blocking = (_blocking !== false); - - if (OS_ANDROID) { - $.loadingProgressIndicator.cancelable = !args.blocking; - } } function setImages(_images) { - - if (OS_ANDROID) { - Ti.API.info('[LOADING] No image indicator on Android'); - return; - } - var _newImages = _.isArray(_images); if (_images === true || _newImages) { @@ -158,9 +127,7 @@ function setImages(_images) { return; } -if (!OS_ANDROID) { - setImages(args.images); -} +setImages(args.images); show(args.message, args.blocking); diff --git a/docs/android.png b/docs/android.png deleted file mode 100644 index b0ec853..0000000 Binary files a/docs/android.png and /dev/null differ diff --git a/styles/loading.tss b/styles/loading.tss index 3bce094..59d9b70 100755 --- a/styles/loading.tss +++ b/styles/loading.tss @@ -1,6 +1,7 @@ ".loadingMask": { backgroundColor: "#5000", - backgroundImage: null // Prevent a app-wide Window-background to take over + backgroundImage: null, // Prevent a app-wide Window-background to take over + opacity: 1.0 // Or alpha channel in backgroundColor won't work } ".loadingOuter": { diff --git a/views/loading.xml b/views/loading.xml index 9f75101..f99f52f 100755 --- a/views/loading.xml +++ b/views/loading.xml @@ -1,5 +1,5 @@ - + @@ -9,6 +9,5 @@ - - + \ No newline at end of file diff --git a/widget.json b/widget.json index a48e84e..f9a5b08 100755 --- a/widget.json +++ b/widget.json @@ -3,7 +3,7 @@ "name": "nl.fokkezb.loading", "description" : "Displays a simple loading mask.", "author": "Fokke Zandbergen", - "version": "1.5", + "version": "1.5.1", "copyright":"Copyright (c) 2013", "license":"Apache License, Version 2.0", "min-alloy-version": "1.0",