[TIMOB-3378] Android: ScrollView.remove() doesn't really remove on android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-01-03T18:04:40.000+0000 |
Affected Version/s | Release 1.6.2 |
Fix Version/s | Sprint 2011-43, Release 1.8.0.1 |
Components | Android |
Labels | module_scrollview, qe-testadded |
Reporter | Alberto Berti |
Assignee | Ping Wang |
Created | 2011-04-15T03:43:31.000+0000 |
Updated | 2013-11-19T06:14:22.000+0000 |
Description
It seems to me that the remove() method on ScrollView doesn't do its job on Android (build 1.6.0+ from continous builds). Here is a test code where a button should be removed from the view when it's clicked:
var win = Titanium.UI.createWindow({
title:'Scrollview test window',
backgroundColor:'#fff'
});
var scrollview = Ti.UI.createScrollView({layout: 'vertical'});
win.add(scrollview);
function onButtonClick(event){
var button = event.source;
var n = Ti.UI.createNotification({message: 'Removed button "' + button.title + '"'});
n.duration = Ti.UI.NOTIFICATION_DURATION_LONG;
button.removeEventListener('click', onButtonClick);
scrollview.remove(button);
n.show();
}
var i, button;
for (i = 0; i < 30; i++) {
button = Ti.UI.createButton({title: String.format('Click to remove #%d', i)});
button.addEventListener('click', onButtonClick);
scrollview.add(button);
}
win.open();
I've attached a test project containing this code for you to enjoy.
Attachments
File | Date | Size |
---|---|---|
Screen shot 2011-10-31 at 5.38.42 PM.png | 2011-10-31T16:50:30.000+0000 | 1136601 |
scrollviewtest.tgz | 2011-04-15T03:43:32.000+0000 | 740522 |
I can confirm this on Titanium 1.7.1 (2011/06/17 00:13 293a6d...). Below is a simplified testcase:
Workaround is to add components to "View" component, add that "View" component to "ScrollView" component and then remove components from "View" component. Anyway, I would really appreciate if this would be fixed soon. Thanks. :)
Just found another issue, maybe related to this bug. I ran the same test code on both iphone and android, and they have very different looks (see attachment [^Screen shot 2011-10-31 at 5.38.42 PM.png]).
Fixed the ScrollView.remove() issue. The pull request is https://github.com/appcelerator/titanium_mobile/pull/616 . The issue that one code generates two different looks on iphone and android is not related to the remove() issue.
Pull request accepted.
Doesn't work with latest 1.8.0 build: Titanium SDK version: 1.8.0 (11/14/11 10:39 1012866...), using Rhino engine.
@Ivan, notice the fixVersion says it was committed to "Release 1.8.0.1" that's on master. It was not committed to the 1_8_X ("Release 1.8.0") branch. Try it on 1.8.0.1 please.
Verified fixed with SDK 1.8.0.1.v20111207112258 in both Rhino and V8 on Nexus S 2.3.6 and Droid 3 2.3.4 using Titanium Studio, build: 1.0.7.201112061404.
Reopening/closing to add labels
anvil test case added PR Link: https://github.com/appcelerator/titanium_mobile/pull/4958