Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
alloy-widget-nl.fokkezb.loading
Advanced tools
This is a widget for the Alloy MVC framework of Appcelerator's Titanium platform.
The widget provides a simple loading mask that can be easily styled and configured.
By default it uses the native ProgressIndicator for Android but you can easily switch to use the same cross-platform version on both iOS and Android.
app.tss
.Use gittio install nl.fokkezb.loading
to install via gitTio or:
Download the latest release of the widget.
Unzip the folder to your project under app/widgets/nl.fokkezb.loading
.
Add the widget as a dependency to your app/config.json
file:
```javascript
"dependencies": {
"nl.fokkezb.loading":"*"
}
```
Create a global instance of the widget in alloy.js
:
Alloy.Globals.loading = Alloy.createWidget("nl.fokkezb.loading");
Show and hide the loading mask when you need it:
function cancel() {
alert('Why?!');
}
function load() {
Alloy.Globals.loading.show('Your message', false);
setTimeout(function(){
Alloy.Globals.loading.hide();
}, 6000);
}
In Titanium 3.3.0 you need to hide the Android Actionbar as described in this blog. If you use Titanium 3.3.1 or later the widget automatically requests for a theme with no actionbar.
The Quick Start shows how to use the global-mode. You only have to create one global widget instance that will (try to) make sure that there's always one loading mask showing. You can also use one of the 3 available types of loading masks directly as a local instance, as we'll see when we look at the types.
The widget exposes different types of loading masks. All types share the same API so you can easily switch between them.
The global default for Android is to use ProgressIndicator. You can disable this by setting the progress
property of the global widget to false
or using one of the 2 other types directly in a local instance. The Native Progress type itself can also be used as a local instance:
var myInstance = Alloy.createWidget('nl.fokkezb.loading', 'progress');
myInstance.show('My message', myCancelCallback);
The only available global mode for iOS is to show a Window. You can also create a local instance:
var myInstance = Alloy.createWidget('nl.fokkezb.loading', 'window');
myInstance.show('My message', myCancelCallback);
You can also create the widget as a local view which you can require in any (composite) layout. The typical use case for this is to display the widget over a modal window since the window-type would open behind such a window and be invisible.
index.xml
<Alloy
<Window>
<Widget src="nl.fokkezb.loading" name="view" id="myInstance" />
</Window>
</Alloy>
index.js
$.myInstance.show('My message', myCancelCallback);
All types share the same public API:
You'll get TRUE
if the loading mask is currently shown. If set to TRUE
or FALSE
it will call show()
or hide()
.
Set to FALSE
to use the cross-platform loading mask for Android instead of the default native ProgressIndicator.
Shows the loading mask or updates the existing, if it's still the top window. If the second argument is a function, the mask is user-cancelable at which event this method would be called.
Updates the existing message and cancelable function. Not available in global-mode, where you'd simply call show()
again.
Updates the existing message or uses the default one (Success
). This will also hide the activity indicator and display a checkmark icon instead.
Hides the loading mask.
You can style all views from your app.tss
. The default styles can be found in window.tss. Be aware that the default styles are applied to classses, but to override from your app.tss
you need to following (identical) IDs:
#progressIndicator
: The native Android ProgressIndicator.#loadingWindow
: The window if using the (default) window mode.#loadingMask
: The full-screen mask.
images
to true
to use the #loadingImages
indicator.#loadingOuter
: The dark box containing the activityIndicator and message.#loadingInner
: Wraps arround the activityIndicator and message to provider padding.#loadingIndicator
: The activityIndicator.#loadingImages
: The indicator variant using images.#loadingMessage
: The message.You can override the default message (Loading..
) by setting the loadingMessage
in your strings.xml
files. Same thing for (Success
) which is using loadingSuccessMessage
in strings.xml
.
view
mode to get the loading mask as a view instead of a window.theme
property to select a theme with no ActionBar.show()
show()
show()
argument now cancelable
, reverse of blocking
(!!)opacity
fix.Ti.UI.Android.ProgressIndicator
for Androidapp.tss
and reset to default message upon show.show
to automatically show loading mask upon creation.Copyright 2013-2014 Fokke Zandbergen Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
FAQs
Displays a simple loading mask.
The npm package alloy-widget-nl.fokkezb.loading receives a total of 39 weekly downloads. As such, alloy-widget-nl.fokkezb.loading popularity was classified as not popular.
We found that alloy-widget-nl.fokkezb.loading demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.