@Override
  public void processProperties(KrollDict d) {
    tableView = new TiTableView(proxy.getTiContext(), (TableViewProxy) proxy);
    tableView.setOnItemClickListener(this);

    if (d.containsKey(TiC.PROPERTY_SEARCH)) {
      RelativeLayout layout = new RelativeLayout(proxy.getTiContext().getActivity());
      layout.setGravity(Gravity.NO_GRAVITY);
      layout.setPadding(0, 0, 0, 0);

      TiViewProxy searchView = (TiViewProxy) d.get(TiC.PROPERTY_SEARCH);
      TiUISearchBar searchBar =
          (TiUISearchBar) searchView.getView(proxy.getTiContext().getActivity());
      searchBar.setOnSearchChangeListener(tableView);
      searchBar.getNativeView().setId(102);

      RelativeLayout.LayoutParams p =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
      p.addRule(RelativeLayout.ALIGN_PARENT_TOP);
      p.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
      p.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
      p.height = 52;

      layout.addView(searchBar.getNativeView(), p);

      p =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
      p.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
      p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      p.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
      p.addRule(RelativeLayout.BELOW, 102);
      layout.addView(tableView, p);
      setNativeView(layout);
    } else {
      setNativeView(tableView);
    }

    if (d.containsKey(TiC.PROPERTY_FILTER_ATTRIBUTE)) {
      tableView.setFilterAttribute(TiConvert.toString(d, TiC.PROPERTY_FILTER_ATTRIBUTE));
    } else {
      // Default to title to match iPhone default.
      proxy.setProperty(TiC.PROPERTY_FILTER_ATTRIBUTE, TiC.PROPERTY_TITLE, false);
      tableView.setFilterAttribute(TiC.PROPERTY_TITLE);
    }

    boolean filterCaseInsensitive = true;
    if (d.containsKey(TiC.PROPERTY_FILTER_CASE_INSENSITIVE)) {
      filterCaseInsensitive = TiConvert.toBoolean(d, TiC.PROPERTY_FILTER_CASE_INSENSITIVE);
    }
    tableView.setFilterCaseInsensitive(filterCaseInsensitive);
    super.processProperties(d);
  }
 @Override
 public void release() {
   if (tableView != null) {
     tableView.release();
     tableView = null;
   }
   nativeView = null;
   super.release();
 }
 @Override
 public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) {
   if (DBG) {
     Log.d(LCAT, "Property: " + key + " old: " + oldValue + " new: " + newValue);
   }
   if (key.equals(TiC.PROPERTY_SEPARATOR_COLOR)) {
     tableView.setSeparatorColor(TiConvert.toString(newValue));
   } else {
     super.propertyChanged(key, oldValue, newValue, proxy);
   }
 }
예제 #4
0
 @Override
 public void release() {
   if (tableView != null) {
     tableView.release();
     tableView = null;
   }
   if (proxy != null && proxy.getTiContext() != null) {
     proxy.getTiContext().removeOnLifecycleEventListener(this);
   }
   nativeView = null;
   super.release();
 }
 public ListView getListView() {
   return tableView.getListView();
 }
 public void scrollToIndex(final int index) {
   tableView.getListView().setSelection(index);
 }
 public void updateView() {
   tableView.dataSetChanged();
 }
 public TableViewModel getModel() {
   return tableView.getTableViewModel();
 }
 public void setModelDirty() {
   tableView.getTableViewModel().setDirty();
 }
예제 #10
0
 public void scrollToTop(final int index) {
   tableView.getListView().setSelectionFromTop(index, 0);
 }
예제 #11
0
 @Override
 public void onResume(Activity activity) {
   if (tableView != null) {
     tableView.dataSetChanged();
   }
 }