Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13035] Android: Fix ListView issues

GitHub Issuen/a
TypeEpic
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-04-05T19:05:02.000+0000
Affected Version/sRelease 3.1.0
Fix Version/sRelease 3.1.0, 2013 Sprint 07 API, 2013 Sprint 07
ComponentsAndroid
Labelsn/a
ReporterPing Wang
AssigneeHieu Pham
Created2013-03-12T17:36:46.000+0000
Updated2017-03-16T21:02:31.000+0000

Description

This is a ticket to help keep track of issues found on the list view. If bigger changes should be created as a subtask of this. Update on 3/12/13: -1.- List view does not handle instances where template is set to 'null'. {color:green}*FIXED*{color} -2.- List view does not handle creation without any arguments: Ti.UI.createListView(); {color:green}*FIXED*{color} -3.- List view does not build in studio: Error: No resource found that matches the given name (at 'contentDescription' with value '@string/accessoryType'). {color:green}*FIXED*{color} 4. TIMOB-13053 {color:green}*FIXED*{color} -5.- TIMOB-13054 {color:green}*FIXED*{color} Update on 3/13/13: -6.- The "itemClick" event is not fired correctly. It should be fired from AdapterView.OnItemClickListener(). Otherwise, when the user click on the row (not on the label or image or any child view in the row), the "itemClick" event won't be fired. {color:green}*FIXED*{color} 7. About the crash which fixed in this [commit](https://github.com/hieupham007/Titanium_Mobile/commit/6a099fe4dd0ca9630967a08b98808d51b5b38628), we should think about one way to automaticly update itemCount, eg the getItemCount() method return the size of the data arraylist. So whenever the adapter is trying to notify data change, the data and the itemCount are always sync/consistent. This issue also forces the getSectionCount() method to be called in UI thread. -8.- When using the default template, if the text is too long, it will go under the right image instead of wrap the text. (Test case http://pastebin.com/JiNuhkn5) {color:green}*FIXED*{color} -9.- When using the default template without specify the height of row, if assigning KS_nav_ui.png or KS_nav_views.png to the image, the image will be cut off. Seems something wrong with the layout. (Test case http://pastebin.com/JiNuhkn5) {color:green}*FIXED*{color} -10.- When there are several different images in each row, and after scrolling up and down, the images will not show in the correct row. (TIMOB-13061) {color:green}*FIXED*{color} -11.- When there are switches in each row, clicking on the switch in Row i will not change the state of that switch but will change the state of some other switch which is not in Row i. Happens on 2.x and 3.x but not happens on 4.x. {color:green}*FIXED*{color} -12.- Missing the image for Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE. {color:green}*FIXED*{color} -13.- The "template" property is creation-only on Android, but it can be changed on iOS. Need to document this. {color:green}*FIXED*{color} -14.- The "defaultItemTemplate" property is creation-only right now. It should be editable after creation. {color:green}*FIXED*{color} -15.- In the "Get Item" test attached in TIMOB-13014, clicking the label won't trigger the "itemClick" event. Related to Issue 6. {color:green}*FIXED*{color} -16.- In the test case attached in TIMOB-12176 -> List properties test, "Toggle scrollIndicator" does not work. {color:green}*FIXED*{color} -17.- If there are two sections, calling replaceSectionAt(2, newSection) will append newSection to the end on Android, but will do nothing on iOS. Need to discuss this discrepancy. {color:green}*FIXED*{color} Update on 3/14/13: -18.- itemIndex and sectionIndex from the click event are not correct. {color:green}*FIXED*{color} -19.- If the user does not specify the bindId, it should not return the generated bindId. {color:green}*FIXED*{color} Update on 3/15/13: [Here](https://docs.google.com/spreadsheet/ccc?key=0Ai_iBzK2t1G0dElUQzJ0UW1mSHpsSEFpMkJmVW5DTVE&usp=sharing) is the result for the first pass of the KS->List View test. Below is a summary: -20.- {color:red}*Regression*{color}: Ti.UI.Label should enable wordWrap by default. But it does not now. {color:green}*FIXED*{color} -21.- Font does not work for customized built in templates. {color:green}*FIXED*{color} -22.- When clicking on a row, default highlight color is not showing up. {color:green}*WONT FIX FOR V1*{color} -23.- replaceItems() have different behavior with iOS. {color:green}*FIXED*{color} -24.- KS -> List View -> Delete Items fails. Maybe after deleting items, the properties and proxies are mis-matching. {color:green}*FIXED*{color} -25.- The properties associated with the "itemclick" and "click" events are not correct. {color:green}*FIXED*{color} Update on 3/20/13: -26.- Rename the resource files to avoid name conflict. {color:green}*FIXED*{color} -27.- Remove the block of event bubbling so that the click event will bubble up to the listview - {color:green}*INVALID - listItem is not a view*{color} -28.- Modify the comments for processTemplate() and processChildTemplates() in listview.js because we don't use "type" to store proxy any more. {color:green}*FIXED*{color} Update on 3/22/13: -29.- When a button is clicked, itemclick and click fired on Android, while only itemclick fire on iOS. Parity. {color:green}*WONT FIX FOR V1*{color} -30.- When a text field is clicked, blur event is fired. {color:green}*FIXED*{color} -31.- When appending items with properties not defined in default set properties, sometimes when scrolling, the items won't display correctly {color:green}*FIXED*{color} -32.- Crashes on 4.0+ device when scrolling and modifying items at the same time. {color:green}*FIXED*{color} -33.- When clicking on the section header/footer, it gets highlighted. Header/Footer is not clickable, so it should not be highlighted. {color:green}*FIXED*{color} Update on 3/26/13: [Here](https://docs.google.com/spreadsheet/ccc?key=0Ai_iBzK2t1G0dElUQzJ0UW1mSHpsSEFpMkJmVW5DTVE&usp=sharing) is the results for the KS->List View test. -34.- When using the default template, clicking on the row, the "bindId" returned by the event is "properties". It should be undefined since the user does not define it. {color:green}*FIXED*{color} -35.- scrollToItem() does not work on Galaxy Nexus (4.0.4). It is an Android [bug](https://code.google.com/p/android/issues/detail?id=37278). Should be documented. Android bug: https://code.google.com/p/android/issues/detail?id=37278 {color:green}*DOCUMENTED*{color} -36.- KS->List View->Update Items failed on HTC Sensation 4G (2.3.4) but passed on 4.x devices. {color:green}*FIXED*{color}

Comments

  1. Allen Yeung 2013-03-12

    - List view does not handle instances where template is set to 'null'. - List view does not handle creation without any arguments: Ti.UI.createListView(); - List view does not build in studio: Error: No resource found that matches the given name (at 'contentDescription' with value '@string/accessoryType').
  2. Hieu Pham 2013-03-12

    Ran into an odd issue, turned out to be an Android issue: https://code.google.com/p/android-amazing-listview/issues/detail?id=3. Their suggested fix doesn't work for me. Still working to find a workaround. Edit: Fixed.
  3. Ping Wang 2013-03-20

    PR: https://github.com/appcelerator/titanium_mobile/pull/3972 Here is the result for the KS->List View test https://docs.google.com/spreadsheet/ccc?key=0Ai_iBzK2t1G0dElUQzJ0UW1mSHpsSEFpMkJmVW5DTVE&usp=sharing
  4. Allen Yeung 2013-03-20

    This may have fixed #21 https://github.com/appcelerator/titanium_mobile/pull/3995
  5. Darren Haligas 2013-03-22

    Please add selectedBackgroundColor not showing up on selection
  6. Ping Wang 2013-03-22

    Hi Darren, based on the spec, selectedBackgroundColor is not part of ListView v1. It will be in v2.
  7. Darren Haligas 2013-03-22

    Then there is a disconnect. Here is what is shown the list view spec on the wiki https://wiki.appcelerator.org/display/community/Titanium+ListView+Specification Properties and methods supported in v1: color font indentionLevel selectedBackgroundColor selectedBackgroundImage selectedColor selectionStyle
  8. Ping Wang 2013-03-22

    The wiki is a little bit out of date. The YAML version is up to date (https://gist.github.com/4677555).
  9. Ping Wang 2013-03-22

    PR: https://github.com/appcelerator/titanium_mobile/pull/3998 https://github.com/appcelerator/titanium_mobile/pull/4010 https://github.com/appcelerator/titanium_mobile/pull/4033 https://github.com/appcelerator/titanium_mobile/pull/4042 https://github.com/appcelerator/titanium_mobile/pull/4053
  10. Darren Haligas 2013-03-22

    selectedBackgroundColor seems like a must have for V1. Is that hard to implement?
  11. Hieu Pham 2013-03-24

    Hi Darren, selectedBackgroundColor should be implemented for Android. I've fixed a bug that cause it to not work properly for built-in template. For custom templates, selectedBackgroundColor should work when a row is clicked. Clicking on content of the row won't display selectedBackgroundColor unless the content has "touchEnabled" set to false. However, by doing this, content won't be able to receive any click events. Hope that helps.
  12. Darren Haligas 2013-03-25

    So that the way it is always going to be for custom templates? That way by design?
  13. Darren Haligas 2013-03-25

    I have downloaded the latest SDK and set all views in the custom template to touchEnabled: false. The selectedBackgroundColor is not displayed.
        var template = {
        		properties : {
        			selectedBackgroundColor: "green",
        			accessoryType : Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE, 
        				touchEnabled: false
        		},
        		childTemplates : [{
        			type : 'Ti.UI.ImageView',
        			bindId : 'image',
        			properties : {
        				left : '0',
        				width : '60dp',
        				height : '60dp', 
        				touchEnabled: false
        			},
        		}, {
        			type : 'Ti.UI.Label',
        			bindId : 'title',
        			properties : {
        				color : 'black',
        				font : {
        					fontFamily : 'Arial',
        					fontSize : '13dp',
        					fontWeight : 'bold'
        				},
        				left : '80dp',
        				top : '5dp',
        				width : Ti.UI.SIZE,
        				height : Ti.UI.SIZE, 
        				touchEnabled: false
        			},
        		}]
        	};
        
        
  14. Hieu Pham 2013-03-25

    Hi Darren, My apologies. Android currently supports backgroundSelectedColor, not selectedBackgroundColor. selectedBackgroundColor is a table view row specific property. We'll fix the documentation. Also, you don't need to set touchEnabled to false in "properties" To answer your question, since all Android views are clickable by default, clicking on a view will consume the click event, unless it's not clickable.
  15. Darren Haligas 2013-03-25

    Ok that worked but with the disclosure image in there it didn't highlight that part of the row. Then when tapping on the disclosure icon the background color was navy.
  16. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source