Hi All,
Here is the code for adding an activity indicator in Blackberry 10 like Android Progress Indicator.
This will disable all the components in the UI and show the indicator. This can be used for http requets
here is the code
Activity.qml page
Here is the code for adding an activity indicator in Blackberry 10 like Android Progress Indicator.
This will disable all the components in the UI and show the indicator. This can be used for http requets
here is the code
Activity.qml page
import bb.cascades 1.0
Container {
background: Color.Transparent
layout: DockLayout {
}
minWidth: 720 // width of the screen
minHeight: 1280 // height of the screen
Container {
minWidth: 650
maxWidth: 650
minHeight: 100
maxHeight: 100
background: Color.create("#a6c8e0")
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
layout: DockLayout {
}
Container {
background: Color.Gray
minWidth: 646
maxWidth: 646
minHeight: 96
maxHeight: 96
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
leftPadding: 50
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
ActivityIndicator {
minWidth: 80
minHeight: 80
objectName: "customActivityIndicator"
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
running: true
}
Label {
verticalAlignment: VerticalAlignment.Center
text: qsTr("Loading please wait...")
textStyle.fontSize: FontSize.Small
textStyle.color: Color.create("#1F2E56")
}
}
}
attachedObjects:[ ImagePaintDefinition {
id: receiveItem
imageSource: "asset:///images/info_bg_common.amd"
}]
}
Following is the method for adding add removing activity indicator in the screen
This is the CPP code
void DialogueUtils::addActivityDialogue()
{
activityDialogue = new Dialog;
QmlDocument *qmlacitivity = QmlDocument::create("asset:///Activity.qml");
activityRootContainer = qmlacitivity->createRootObject<Container>();
customActivityIndicator = activityRootContainer->findChild<ActivityIndicator*>(
"customActivityIndicator");
customActivityIndicator->start();
activityDialogue->setContent(activityRootContainer);
activityDialogue->open();
}
void DialogueUtils::removeActivityDialogue()
{
customActivityIndicator->stop();
activityDialogue->close();
}
To use this indicator in a page
dialogueUtils-> addActivityDialogue();
To remove this
dialogueUtils-> removeActivityDialogue();
No comments:
Post a Comment