Skip to content

Commit

Permalink
Merge pull request #5949 from hieupham007/timob-17456
Browse files Browse the repository at this point in the history
[TIMOB-17456]: Treat 'null' values as '' for searchableText
  • Loading branch information
pingwang2011 committed Aug 21, 2014
2 parents a5bd22d + 481b61e commit 434fb36
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class ListSectionProxy extends ViewProxy{
public class ListItemData {
private KrollDict properties;
private TiListViewTemplate template;
private String searchableText;
private String searchableText = "";
public ListItemData (KrollDict properties, TiListViewTemplate template) {
this.properties = properties;
this.template = template;
Expand All @@ -79,8 +79,9 @@ public ListItemData (KrollDict properties, TiListViewTemplate template) {
Object props = properties.get(TiC.PROPERTY_PROPERTIES);
if (props instanceof HashMap) {
HashMap<String, Object> propsHash = (HashMap<String, Object>) props;
if (propsHash.containsKey(TiC.PROPERTY_SEARCHABLE_TEXT)) {
searchableText = TiConvert.toString(propsHash, TiC.PROPERTY_SEARCHABLE_TEXT);
Object searchText = propsHash.get(TiC.PROPERTY_SEARCHABLE_TEXT);
if (propsHash.containsKey(TiC.PROPERTY_SEARCHABLE_TEXT) && searchText != null) {
searchableText = TiConvert.toString(searchText);
}
}
}
Expand Down Expand Up @@ -939,7 +940,7 @@ public void applyFilter(String searchText) {
searchableText = searchableText.toLowerCase();
}
//String comparison
if (searchableText != null && searchableText.contains(searchText)) {
if (searchableText.contains(searchText)) {
filterIndices.add(i);
}
}
Expand Down

0 comments on commit 434fb36

Please sign in to comment.