Skip to content

Commit

Permalink
Merge pull request tidev#5557 from hieupham007/timob-16498
Browse files Browse the repository at this point in the history
timob-16498: add support for footerDividersEnabled and headerDividersEna...
  • Loading branch information
vishalduggal committed Mar 31, 2014
2 parents 6b5dcde + 27f2d95 commit f675117
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
TiC.PROPERTY_SEARCH,
TiC.PROPERTY_SEPARATOR_COLOR,
TiC.PROPERTY_OVER_SCROLL_MODE,
TiC.PROPERTY_MIN_ROW_HEIGHT
TiC.PROPERTY_MIN_ROW_HEIGHT,
TiC.PROPERTY_HEADER_DIVIDERS_ENABLED,
TiC.PROPERTY_FOOTER_DIVIDERS_ENABLED
})
public class TableViewProxy extends TiViewProxy
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,22 @@ public void processProperties(KrollDict d)
tableView.setOnItemLongClickListener(this);

}


ListView list = getListView();
if (d.containsKey(TiC.PROPERTY_FOOTER_DIVIDERS_ENABLED)) {
boolean enabled = TiConvert.toBoolean(d, TiC.PROPERTY_FOOTER_DIVIDERS_ENABLED, false);
list.setFooterDividersEnabled(enabled);
} else {
list.setFooterDividersEnabled(false);
}

if (d.containsKey(TiC.PROPERTY_HEADER_DIVIDERS_ENABLED)) {
boolean enabled = TiConvert.toBoolean(d, TiC.PROPERTY_HEADER_DIVIDERS_ENABLED, false);
list.setHeaderDividersEnabled(enabled);
} else {
list.setHeaderDividersEnabled(false);
}

if (d.containsKey(TiC.PROPERTY_SEARCH)) {
TiViewProxy searchView = (TiViewProxy) d.get(TiC.PROPERTY_SEARCH);
TiUIView search = searchView.getOrCreateView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
TiC.PROPERTY_SEPARATOR_COLOR,
TiC.PROPERTY_SEARCH_TEXT,
TiC.PROPERTY_SEARCH_VIEW,
TiC.PROPERTY_CASE_INSENSITIVE_SEARCH
TiC.PROPERTY_CASE_INSENSITIVE_SEARCH,
TiC.PROPERTY_HEADER_DIVIDERS_ENABLED,
TiC.PROPERTY_FOOTER_DIVIDERS_ENABLED
})
public class ListViewProxy extends TiViewProxy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,20 @@ public void processProperties(KrollDict d) {
setSeparatorColor(color);
}

if (d.containsKey(TiC.PROPERTY_FOOTER_DIVIDERS_ENABLED)) {
boolean enabled = TiConvert.toBoolean(d, TiC.PROPERTY_FOOTER_DIVIDERS_ENABLED, false);
listView.setFooterDividersEnabled(enabled);
} else {
listView.setFooterDividersEnabled(false);
}

if (d.containsKey(TiC.PROPERTY_HEADER_DIVIDERS_ENABLED)) {
boolean enabled = TiConvert.toBoolean(d, TiC.PROPERTY_HEADER_DIVIDERS_ENABLED, false);
listView.setHeaderDividersEnabled(enabled);
} else {
listView.setHeaderDividersEnabled(false);
}

if (d.containsKey(TiC.PROPERTY_SHOW_VERTICAL_SCROLL_INDICATOR)) {
listView.setVerticalScrollBarEnabled(TiConvert.toBoolean(d, TiC.PROPERTY_SHOW_VERTICAL_SCROLL_INDICATOR, true));
}
Expand Down Expand Up @@ -450,11 +464,10 @@ public void processProperties(KrollDict d) {
}

//Have to add header and footer before setting adapter
listView.addHeaderView(headerView);
listView.addFooterView(footerView);
listView.addHeaderView(headerView, null, false);
listView.addFooterView(footerView, null, false);

listView.setAdapter(adapter);

super.processProperties(d);

}
Expand Down
10 changes: 10 additions & 0 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,11 @@ public class TiC
*/
public static final String PROPERTY_FONT_SIZE = "font-size";

/**
* @module.api
*/
public static final String PROPERTY_FOOTER_DIVIDERS_ENABLED = "footerDividersEnabled";

/**
* @module.api
*/
Expand Down Expand Up @@ -1239,6 +1244,11 @@ public class TiC
* @module.api
*/
public static final String PROPERTY_HEADER = "header";

/**
* @module.api
*/
public static final String PROPERTY_HEADER_DIVIDERS_ENABLED = "headerDividersEnabled";

/**
* @module.api
Expand Down
16 changes: 16 additions & 0 deletions apidoc/Titanium/UI/ListView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,14 @@ properties:
type: [String, Number]
default: Titanium.UI.LIST_ITEM_TEMPLATE_DEFAULT

- name: footerDividersEnabled
summary: When set to false, the ListView will not draw the divider before the footer view.
type: Boolean
availability: creation
default: undefined but behaves as false
platforms: [android]
since: "3.3.0"

- name: footerTitle
summary: List view footer title.
type: String
Expand All @@ -430,6 +438,14 @@ properties:
since: 3.2.0
platforms: [android, iphone, ipad]

- name: headerDividersEnabled
summary: When set to false, the ListView will not draw the divider after the header view.
type: Boolean
availability: creation
default: undefined but behaves as false
platforms: [android]
since: "3.3.0"

- name: headerTitle
summary: List view header title.
type: String
Expand Down
18 changes: 17 additions & 1 deletion apidoc/Titanium/UI/TableView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,15 @@ properties:
type: Boolean
default: true
platforms: [android, iphone, ipad]


- name: footerDividersEnabled
summary: When set to false, the ListView will not draw the divider before the footer view.
type: Boolean
availability: creation
default: undefined but behaves as false
platforms: [android]
since: "3.3.0"

- name: footerTitle
summary: Table view footer title.
type: String
Expand Down Expand Up @@ -1198,6 +1206,14 @@ properties:
type: Titanium.UI.View
exclude-platforms: [blackberry]

- name: headerDividersEnabled
summary: When set to false, the ListView will not draw the divider after the header view.
type: Boolean
availability: creation
default: undefined but behaves as false
platforms: [android]
since: "3.3.0"

- name: headerTitle
summary: Table view header title.
type: String
Expand Down

0 comments on commit f675117

Please sign in to comment.