IBM Worklight 6.0 - Does WL.BusyIndicator support text wrapping for iOS? - ibm-mobilefirst

Attached is the code for we have implemented for the busy indicator on iOS. But this does not wrap the busyText on iOS.
$.r.setBusyIndicator(new WL.BusyIndicator('content', {
opacity : 0.65,
fullScreen : false,
text : busyText
}));

Wrapping is not available.
You can use a different busy indicator altogether: a native busy implementation by you, or an indicator provided by a 3rd party library (jQuery Mobile, ...), etc.
Otherwise, you need to use the boxLength property which controls the height and width of the busy square holding the text, like this:
var busy = new WL.BusyIndicator(null, {
text: "Ouverture de session",
boxLength: 170 // Play with this value.
});
busy.show();
Related question: IBM Worklight 6.1 - How to customize WL.BusyIndicator's height and width?

Related

Dojo unmovable stencil

I am drawing stencils using Dojo and I need to make some of the stencils "unmovable" - that is, when a user clicks on the stencil, it is not able to be dragged around the screen.
I guess there's not a lot of code to post here as I'm struggling with the Dojo docs to see if this is possible. I'm adding my stencil using the following line of code:
dojoDrawing.addStencil("rect", {
x : someXVal,
y : someYVal,
width : someWidth,
height : someHeight
});
Any guidance is much appreciated.
Although it doesn't seem ideal, I was able to accomplish what I wanted by making the stencil disabled:
var stencil = dojoDrawing.addStencil("rect", {
x : someXVal,
y : someYVal,
width : someWidth,
height : someHeight
});
stencil.disable();
This changes the stencil colors to the disabled state and makes it not selectable and therefore not movable.

How do I dynamically change the height of a TableViewRow?

Application Type: mobile
Titanium SDK: 3.1.0.GA
Platform & version: iOS 6.1
Device: iOS Simulator
Host Operating System: OSX 10.8.3
Titanium Studio: 3.1.0.201304151600
I'd like to conditionally show/hide a textfield in a TableViewRow. In order to do this I need to expand the height of the row. The following code doesn't work, though. The TableViewRow is actually an Alloy controller. I first tried animating it before I realized that it can't be animated. Now I'm just trying to change the height and that isn't even working. I've tried using the setHeight method along with just setting the height property directly to no avail.
Any ideas?
var notesVisible = false;
function notes_click() {
if(notesVisible == false) {
Ti.API.info('expanding');
$.row.height = 200;
// $.notes_container.setHeight(124);
notesVisible = true;
} else {
Ti.API.info('contracting');
$.row.height = 75;
$.notes_container.setHeight(0);
notesVisible = false;
}
};
There are two good ways of doing this, both should be done from the click event listener.
Method 1) One way is to directly change the "height" variable of the row
Method 2) The second is to create a new row and replace the current row with the new row
Method 1 is more straightforward but I found it to be glitchy depending on what version of the SDK you are using, but with 3.1.0 it should work. Both methods should be called from the 'click' eventListener as its easier to tell Titanium which row to act on based on the click
So here is an example
currentTableview.addEventListener('click',function(e)
{
// DO whatever your row is supposed to do when clicked
// Now lets change the height of the row to a new height, 200 in this example
e.row.height = 200
}
With Method two, it involves creating a new row and then replacing the current row with this call
currentTableview.updateRow(e.index,newlyCreatedUpdatedRow);
I know its an old question asked by some one but the solution provided will not work and i think best solution for this is by making a recursive function and changes the height of your row and need to play with the visibility of views inside that row hopefully will help someone :)

Getting custom annotations (Ti.Map) pixelated

I've tried with different images in several resolutions (50x30, 70x50, 100x70). All of them are good enough out of titanium app, but I cannot get custom pins without pixel effect into the app.
I'm using Titatnium 3.0.
How can I make my custom images to obtain a best visual result?
Images source: http://imgur.com/a/glhIy#6ceV2Vk
Code:
var annot = Titanium.Map.createAnnotation({
longitude : franchise.direction.loc[0],
latitude : franchise.direction.loc[1],
title : franchise.name,
subtitle : franchise.direction.address,
image : "testing_pin.png",
animate : false,
draggable : false
});
$.mapView.addAnnotation(annot);
These are the Pin icon sizes I use, and they look sharp on my maps.
pin#2x.png: 80px x 80px #72 dpi
pin.png: 40px x 40px

ActivityIndicator without dialog box on android?

Im new to titanium and i'm trying to create an a indeterminate preloader (or activity indicator as it is called in titanum). The problem is that on android, the activty indicator is automatically placed in a dialog box, preventing users from interacting with the app until the dialog is dismissed.
Is there any way to just add a simple indetermindate preloader without using a dialog box in android?
Thanks.
According to Appcelerator Docs
Activity indicators must be used differently on Android and iOS:
On Android, the activity indicator is a modal dialog that blocks the UI. Calling show displays the indicator, and calling hide removes it.
One option that you can use is setting cancelable property to true which let the user to cancel the activity indicator dialog by pressing the BACK button.
Appcelerator docs says :
An activity indicator can be used to show the progress of an operation
in the UI to let the user know that some action is taking place. An
activity indicator consists of a spinning animation and an optional
text message, and is used to indicate an ongoing activity of
indeterminate length. To show progress, use Titanium.UI.ProgressBar
instead.
Titanium.App.addEventListener('show_indicator', function(e) {
showIndicator(e.title_msg, e.sub_msg);
});
function showIndicator(title_msg, sub_msg) {
var actIndG = Titanium.UI.createActivityIndicator({
style : Titanium.UI.iPhone.ActivityIndicatorStyle.BIG,
top :10
left : 130,
height : 60,
width : 60,
height : screenheigth,
width : screenwidth
});
indView.add(actIndG);
indWin.open();
}
Up vote or Mark best if it helps you.

Acitvity Indicator doesnt show up in ios 5 but it is visible in ios 4

I am using Titanium studio for development, acitvity indicator doesnt show up in ios 5 but it is visible in ios 4...please help
Code:-
var activityIndicator = Ti.UI.createActivityIndicator
({
style:Ti.UI.iPhone.ActivityIndicatorStyle.BIG,
top:45,
left:128,
font:{ fontSize:14, fontFamily:'Helvetica Neue', fontWeight:'bold'},
message:'loading..'
});
window.add(activityIndicator);
First a link to the docs. Now some explanation: once you add an activity indicator to a window or view, you also have to show it like this:
activityIndicator.show();
Then when youre done with it you can hide it like this:
activityIndicator.hide();
Also note that the BIG style is white and cant be seen on a white background.
As an addendum, this is bad javascript practice :
var activityIndicator = Ti.UI.createActivityIndicator
({ <----------- Never do this
.....
});
var activityIndicator = Ti.UI.createActivityIndicator({ <-- Thats better
.....
});
This may cause the interpreter to put a semi-colon after the first line, causing problems, and it just looks awful (this is not Obj-C, this is javascript). Refer to this talk by Kevin Whinnery on "Best Practices for Javascript."