Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27110] Android: Progress bar value is not working dynamically

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionNot Our Bug
Resolution Date2019-11-01T16:55:00.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterRakhi Mitro
AssigneeUnknown
Created2019-05-29T12:29:59.000+0000
Updated2019-11-01T16:55:00.000+0000

Description

The customer have a list view which is going to have different items.Each item has some elements including some labels and a progress bar. The main problem is with progress bar. When assign a value to the "value" property of the progress bar in the .tss file, It works properly and shows the value which have assigned.But in this case the value of progress bar is static. to make it dynamic assigned a "bindId" for progress bar. using that "bindId" try to change its value when making an item. but it doesn't work. other properties are accepted like assigning "color", "message" but the "value" property is not accepted. *Test Environment:* Appcelerator Command-Line Interface, version 7.0.11 Operating System Name = Mac OS X Version = 10.13.6 Architecture = 64bit CPUs = 4 Memory = 8589934592 Node.js Node.js Version = 8.9.1 npm Version = 5.5.1 Titanium CLI CLI Version = 5.1.1 Titanium SDK SDK Version = 8.0.1.GA Device: Huawei GR3 2017(Android 7) *Sample code:* *index.js*
$.index.open();

var items = [];
var numbers = [20, 40, 60, 80, 100];

for(i in numbers){
	
	items.push({
		progress: {
			value: numbers[i],
			message: numbers[i].toString()+'%',
		}
	});
	
}

$.section.items = items;


*index.tss*

"#progress":{

	top: '20dp',
	// bottom: 10,
	width: '90%',
	min: 0,
	max: 100,
	color: '#419fd9',
	value:60,
	font: {
		fontSize: 14,
		fontWeight: 'bold'
	}
}


*index.xml*
<Alloy>
	<Window backgroundColor="white" layout="vertical">
		<Label color="#419fd9" top="10dp"> The progress bar does not show the value :( </Label>
		<ListView defaultItemTemplate="template" id="listView">
			<Templates>
				<ItemTemplate name="template">
					<ProgressBar id="progress" bindId="progress"></ProgressBar>
				</ItemTemplate>
			</Templates>
			<ListSection id="section"></ListSection>
		</ListView>
	</Window>
</Alloy>

Attachments

FileDateSize
Screenshot_20190529-161303.png2019-05-29T12:28:59.000+000060495

Comments

  1. Joshua Quick 2019-08-26

    I haven't tested the attached code... but... I do know there is a bug on Google's end where the native view won't always draw the given progress value. Even though Google has claimed to have fixed it, I'm still able to reproduce it in Android 9.0. https://issuetracker.google.com/issues/36923384 https://www.google.com/search?q=android+setProgress+bug+site:stackoverflow.com I've seen this issue happen when setting the progress value before the view gets attached to the activity window, which I suspect is happening in the case of a ListView (or TableView) since rows and their child views are typically pre-configured before being added to the ListView. And this is what will definitely happen when scrolling rows in/out of the window (ie: rows scrolled out of the window are removed and when they're scrolled back in they are re-added). The only known native work-around that I'm aware of is to set the progress value after they're shown on screen. If you have a short list whose rows are never scrolled offscreen, then setting the progress value in your window's "open" even will do the trick. However, if it is a short ListView as shown in the screenshot, then I suggest that you don't use a ListView at all and use a ScrollView instead.

JSON Source