Skip to content

Commit

Permalink
Merge pull request #6024 from hieupham007/timob-17633-3_3_X
Browse files Browse the repository at this point in the history
[TIMOB-17633]: Update java sections properly
  • Loading branch information
pec1985 committed Sep 5, 2014
2 parents 4fd479b + ca41581 commit 9949832
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,15 @@ public ArrayList<ListSectionProxy> getPreloadSections() {
return preloadSections;
}

public boolean isPreload() {
public boolean getPreload() {
return preload;
}

public void setPreload(boolean pload)
{
preload = pload;
}

public HashMap<String, Integer> getPreloadMarker()
{
return preloadMarker;
Expand Down Expand Up @@ -379,6 +384,9 @@ public void setSections(Object sections)
Log.e(TAG, "Invalid argument type to setSection(), needs to be an array", Log.DEBUG_MODE);
return;
}
//Update java and javascript property
setProperty(TiC.PROPERTY_SECTIONS, sections);

Object[] sectionsArray = (Object[]) sections;
TiUIView listView = peekView();
//Preload sections if listView is not opened.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,19 @@ public void processProperties(KrollDict d) {
//if user didn't append/modify/delete sections before this is called, we process sections
//as usual. Otherwise, we process the preloadSections, which should also contain the section(s)
//from this dictionary as well as other sections that user append/insert/deleted prior to this.
if (!listProxy.isPreload()) {
if (!listProxy.getPreload()) {
processSections((Object[])d.get(TiC.PROPERTY_SECTIONS));
} else {
processSections(listProxy.getPreloadSections().toArray());
}
} else if (listProxy.isPreload()) {
} else if (listProxy.getPreload()) {
//if user didn't specify 'sections' property upon creation of listview but append/insert it afterwards
//we process them instead.
processSections(listProxy.getPreloadSections().toArray());
}

listProxy.clearPreloadSections();
listProxy.setPreload(false);

if (d.containsKey(TiC.PROPERTY_HEADER_VIEW)) {
Object viewObj = d.get(TiC.PROPERTY_HEADER_VIEW);
Expand Down

0 comments on commit 9949832

Please sign in to comment.