[TIMOB-16679] Android: Links do not work in ListView (e.g. autoLink)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-05-29T22:25:31.000+0000 |
Affected Version/s | Release 3.2.2 |
Fix Version/s | 2014 Sprint 10, 2014 Sprint 10 SDK, Release 3.3.0 |
Components | Android |
Labels | android, module_listview, qe-closed-3.3.0, qe-testadded |
Reporter | Tan Li Hao |
Assignee | Hieu Pham |
Created | 2014-03-23T12:04:55.000+0000 |
Updated | 2015-06-23T15:45:36.000+0000 |
Description
ListView does not display the links after scrolling out of screen. Both autoLink and html (text) does not work.
Example code below. For the example, the first time the app loads google.com link is clickable, upon scrolling out of screen and scrolling back google.com becomes no longer clickable.
var self = Ti.UI.createWindow({
backgroundColor: 'white'
});
var myTemplate = {
childTemplates: [ //
{ // Title
type: 'Ti.UI.Label', // Use a label for the title
bindId: 'info', // Maps to a custom info property of the item data
properties: { // Sets the label properties
color: 'black',
font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
left: '60dp', top: 0,
autoLink: Ti.UI.AUTOLINK_ALL
}
},
{ // Subtitle
type: 'Ti.UI.Label', // Use a label for the subtitle
bindId: 'es_info', // Maps to a custom es_info property of the item data
properties: { // Sets the label properties
color: 'gray',
font: { fontFamily:'Arial', fontSize: '14dp' },
left: '60dp', top: '25dp',
autoLink: Ti.UI.AUTOLINK_ALL
}
}
]
};
var listView = Ti.UI.createListView({
// Maps myTemplate dictionary to 'template' string
templates: { 'template': myTemplate },
// Use 'template', that is, the myTemplate dict created earlier
// for all items as long as the template property is not defined for an item.
defaultItemTemplate: 'template'
});
var sections = [];
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'});
var fruitDataSet = [
// the text property of info maps to the text property of the title label
// the text property of es_info maps to text property of the subtitle label
// the image property of pic maps to the image property of the image view
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Apple'>Apple</a>"}, es_info: {text: 'Manzana'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Banana'>Banana</a>"}, es_info: {text: 'Banana'}}
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras'});
var vegDataSet = [
{ info: {html: 'Carrot'}, es_info: {text: 'Zanahoria'}},
{ info: {html: 'Potato'}, es_info: {text: 'Patata'}}
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);
var grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos'});
var grainDataSet = [
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Maiz'>Corn</a>"}, es_info: {text: 'Maiz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Rice'>Rice</a>"}, es_info: {text: 'Arroz'}},
{ info: {html: "<a href='http://en.wikipedia.org/wiki/Wheat'>Wheat</a>"}, es_info: {text: 'Trigo'}},
];
grainSection.setItems(grainDataSet);
sections.push(grainSection);
listView.setSections(sections);
self.add(listView);
self.open();
I can run your test case but I cannot test the link functionality because your test is missing the html and png files. Can you please provide the linked files so that we can reproduce the issue?
Hi the example does not require html files (they are inlined). As for png files it is also unnecessary. I edited the example to remove it
Moving this to engineering as I can reproduce this issue on Android Galaxy Nexus device.
Is there any updates?
In my app, mailto: and tel: links work, but http:// and https:// do not. EDIT - this is not the case - links of all kinds work as expected intermittently.
master PR: https://github.com/appcelerator/titanium_mobile/pull/5678
Additional Test Case
Additional Test Case
PR merged
Verified fix with code provided in the comment using below environment: Appc Studio: 3.3.0.201405121247 SDK build: 3.3.0.v20140514163013 acs: 1.0.14 npm: 1.3.2 alloy: 1.4.0-alpha CLI: titanium-3.3.0-dev titanium-code-processor:1.1.1 Xcode: 5.1.1 Osx: Mavericks(10.9.2) Device: LG (4.0.4) Links do work in ListView even after scrolling. Hence closing the issue.
It looks like the issue is still there in one particular case: when one of the links is without the tag. Using the code above, just replace one of the items with:
Or just:
Some links disappear when scrolling or turning off the device screen.
Verified the fix. Now after scrolling out of the screen & scrolling back the links are clickable. Closing. Environment: Appc Studio : 3.3.0.201406111952 Ti SDK : 3.3.0.v20140612101712 Mac OSX : 10.8.5 Alloy : 1.4.0-rc CLI - 3.3.0-rc Code Processor: 1.1.1 Nexus 5 - android 4.4.3
We are getting this issue with iOS 3.5.0 SDK. Do I need to add this as a new JIRA item?
[~pravipravi], The latest release is 4.0.0.GA, please try with 4.0.0.GA first.