Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18874] Android: Add missing option cacheSize for scrollableViews

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-05-12T04:05:52.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.1.0
ComponentsAndroid
Labelsn/a
ReporterChee Kiat Ng
AssigneeAshraf Abu
Created2015-05-07T04:19:58.000+0000
Updated2015-06-01T22:14:07.000+0000

Description

On iOS, the cacheSize argument is present, but on Android this is missing. This leads to empty views in some cases that don't get rebuilt correctly after scrolling. Code is tested on SDK 3.5.1.GA Multiple Android versions and works. PR here for review: https://github.com/appcelerator/titanium_mobile/pull/6767 Thanks to skoften.

Comments

  1. Ashraf Abu 2015-05-12

    For the test code, test it with cache 1 and cache 5. Note that when set to 5, the image is not recreated. Test code for reference for this pr:-
       var win = Ti.UI.createWindow();
       
       var view1 = Ti.UI.createView({ backgroundColor:'#123' });
       var view2 = Ti.UI.createView({ backgroundColor:'#246' });
       var view3 = Ti.UI.createView({ backgroundColor:'#48b' });
       var view4 = Ti.UI.createView({ backgroundColor:'#123' });
       var view5 = Ti.UI.createView({ backgroundColor:'#246' });
       var view6 = Ti.UI.createView({ backgroundColor:'#48b' });
       var view7 = Ti.UI.createView({ backgroundColor:'#123' });
       var view8 = Ti.UI.createView({ backgroundColor:'#246' });
       var view9 = Ti.UI.createView({ backgroundColor:'#48b' });
       
       var win = Ti.UI.createWindow();
       var image = Ti.UI.createImageView({
         image:'Earth.jpg'
       });
       view4.add(image);
       
       var scrollableView = Ti.UI.createScrollableView({
         views:[view1,view2,view3,view4,view5,view6,view7,view8,view9],
         showPagingControl:true,
         cacheSize: 5
       });
       
       win.add(scrollableView);
       win.open();
       
  2. Ashraf Abu 2015-05-12

    Will be doing a separate PR for apidocs.
  3. Ashraf Abu 2015-05-12

    PR for docs: https://github.com/appcelerator/titanium_mobile/pull/6838
  4. Lokesh Choudhary 2015-06-01

    Verified. CacheSize is added to android. Checked it using the test case above. Closing. Environment: Appc Studio : 4.1.0.201505071004 Ti SDK : 4.1.0.v20150529013634 CLI : 4.0.1 Alloy : 1.6.0 MAC Yosemite : 10.10.3 Appc npm : 4.0.0 Appc CLI : 4.0.1 Node: v0.10.37

JSON Source