Slider type progress-bar in Xamarin or Windows phone - xaml

I am developing a Xamarin form application. I want to create a custom progress bar. A slider which increments it's according to the progress. Initially the slider value should be minimum and should increment it's value according to the progress. When the task is finished the slider should have maximum value. How can I achieve this? is there any windows phone custom progress bar like this? please help me?

var progressBar = new ProgressBar();
You can change progress manually:
progressBar.Progress = 0.2f;
Or bind it to your ViewModel:
progressBar.SetBinding<YourViewModel>(ProgressBar.ProgressProperty, v => v.YourProgressProperty);
// Then:
YourViewModel.YourProgressProperty = 0.4f;
Or you could do some animations:
await progressBar.ProgressTo(0.95f, 250, Easing.Linear);
https://developer.xamarin.com/api/type/Xamarin.Forms.ProgressBar/

Related

How to customize Pull-To-Refresh indicator style in NativeScript/Vue?

I am trying to customize the style of Pull-To-Refresh indicator in NativeScript/Vue app. There seems to be no example code for Vue. I tried to place the following code adapted from Angular into , got errors when running the app.
<RadListView.pullToRefreshStyle>
<PullToRefreshStyle indicatorColor="white" indicatorBackgroundColor="blue"/>
</RadListView.pullToRefreshStyle>
Can anybody offer a working example or update the following page?
https://docs.nativescript.org/vuejs/ns-ui/ListView/pull-to-refresh
On a side note, according to doc here:
https://docs.nativescript.org/ns-ui-api-reference/classes/pulltorefreshstyle
Only color and background color can be customized. Is there anyway to get around this change size of indicator?
The only way I can think of is to set both foreground and background of indicator to transparent then use page level activityIndicator.
Just set the attributes on pullToRefreshStyle property
HTML
<RadListView :pullToRefreshStyle="pullToRefreshStyle">
Script
import * as colorModule from "tns-core-modules/color";
data() {
return {
pullToRefreshStyle: {
indicatorColor: new colorModule.Color("red"),
indicatorBackgroundColor: new colorModule.Color("green")
}
};
}

Setting UI Button width and height in cocos2d js android application

In my Cocos2d js android app i have a UI button as
var button=new ccui.Button();
button.loadTextures(res.play_png,res.play_png);
button.setAnchorPoint(cc.p(0,0));
button.x=size.width/2;
button.y=size.height/2;
this.addChild(button);
The button loads and i am able to set it at any position on the screen.
But i am unable to change its width and height to specified number of pixels.
I want something like
button.width=100;
button.height=100;
I did not find any method to do that...
Any help how to accomplish this would be greatful.
Thanks.
The buttons i use are options like play,how to play,share etc..
So i have to position them in such a way that they dont overlap or get distorted for various screen resolutions...
How can i use the setScale method in this context???
We can make a call to a function that can scale the size of the UIButton by performing an action. In this case, the following code might help:
performScaleAction : function()
{
var duration = 0; // duration in seconds for performing this action
var scaleX = 0.5; // scale factor for X-axis
var scaleY = 0.5; // scale factor for Y-axis
var scaleAction = new cc.ScaleTo(duration , scaleX , scaleY );
this.runAction(scaleAction);
}
Now, call the above function in the following way:
this.performScaleAction();
this.addChild(button);
So, if the actual height of the image used for creating the UIButton is h, in this case, the new size as displayed on the screen would be h times scaleX . Same for the width of the UIButton.
Hope this helps!

Slider doesn't draw (CodeName One) with Windows phone skin

I am trying to create a slider in codename one, but for some reason the slider isn't drawn, other components however, are. The code I have so far
public void start()
{
if (current != null)
{
current.show();
return;
}
mainForm = new Form("Slider and buttons");
c = mainForm.getContentPane();
c.setLayout(new FlowLayout());
Slider jSlider = new Slider();
jSlider.setMaxValue(360);
jSlider.setMinValue(0);
jSlider.setProgress(50);
jSlider.setEditable(true);
jSlider.setPreferredSize(new Dimension(300,50));
c.addComponent(jSlider);
c.repaint();
c.invalidate();
c.revalidate();
mainForm.show();
}
I'm not sure what I could have forgotten, probably just overlooking something..
Thanks in advance
EDIT: It actually does draw the slider if I choose the iPhone skin, but it doesn't do so under "lumia", anyone know why that is?
Its just missing styles under the default Windows Phone theme. Just define the style SliderFull & Slider for both selected/unselected states. We fixed this for the next update.

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 :)

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.