public void deleteSectionAt(int index) { if (index >= 0 && index < sections.size()) { sections.remove(index); adapter.notifyDataSetChanged(); } else { Log.e(TAG, "Invalid index to delete section"); } }
public void appendSection(Object section) { if (section instanceof Object[]) { Object[] secs = (Object[]) section; for (int i = 0; i < secs.length; i++) { processSection(secs[i], -1); } } else { processSection(section, -1); } adapter.notifyDataSetChanged(); }
private void reFilter(String searchText) { if (searchText != null) { for (int i = 0; i < sections.size(); ++i) { ListSectionProxy section = sections.get(i); section.applyFilter(searchText); } } if (adapter != null) { adapter.notifyDataSetChanged(); } }
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) { if (key.equals(TiC.PROPERTY_HEADER_TITLE)) { setHeaderTitle(TiConvert.toString(newValue)); } else if (key.equals(TiC.PROPERTY_FOOTER_TITLE)) { setFooterTitle(TiConvert.toString(newValue)); } else if (key.equals(TiC.PROPERTY_SECTIONS) && newValue instanceof Object[]) { processSections((Object[]) newValue); if (adapter != null) { adapter.notifyDataSetChanged(); } } else if (key.equals(TiC.PROPERTY_SEARCH_TEXT)) { this.searchText = TiConvert.toString(newValue); if (this.searchText != null) { reFilter(this.searchText); } } else if (key.equals(TiC.PROPERTY_CASE_INSENSITIVE_SEARCH)) { this.caseInsensitive = TiConvert.toBoolean(newValue, true); if (this.searchText != null) { reFilter(this.searchText); } } else if (key.equals(TiC.PROPERTY_SEARCH_VIEW)) { TiViewProxy searchView = (TiViewProxy) newValue; if (isSearchViewValid(searchView)) { TiUIView search = searchView.getOrCreateView(); setSearchListener(searchView, search); if (searchLayout != null) { searchLayout.removeAllViews(); addSearchLayout(searchLayout, searchView, search); } else { layoutSearchView(searchView); } } else { Log.e(TAG, "Searchview type is invalid"); } } else if (key.equals(TiC.PROPERTY_SHOW_VERTICAL_SCROLL_INDICATOR) && newValue != null) { listView.setVerticalScrollBarEnabled(TiConvert.toBoolean(newValue)); } else if (key.equals(TiC.PROPERTY_DEFAULT_ITEM_TEMPLATE) && newValue != null) { defaultTemplateBinding = TiConvert.toString(newValue); refreshItems(); } else if (key.equals(TiC.PROPERTY_SEPARATOR_COLOR)) { String color = TiConvert.toString(newValue); setSeparatorColor(color); } else { super.propertyChanged(key, oldValue, newValue, proxy); } }
public void insertSectionAt(int index, Object section) { if (index > sections.size()) { Log.e(TAG, "Invalid index to insert/replace section"); return; } if (section instanceof Object[]) { Object[] secs = (Object[]) section; for (int i = 0; i < secs.length; i++) { processSection(secs[i], index); index++; } } else { processSection(section, index); } adapter.notifyDataSetChanged(); }