protected void refreshControls() {
    ArrayList<TiViewProxy> proxies = getRowProxy().getControls();
    int len = proxies.size();

    if (views == null) {
      views = new ArrayList<TiUIView>(len);
    } else if (views.size() != len) {
      for (TiUIView view : views) {
        View v = view.getNativeView();
        if (v != null && v.getParent().equals(content)) {
          content.removeView(v);
        }
      }
      views = new ArrayList<TiUIView>(len);
    }

    for (int i = 0; i < len; i++) {
      TiUIView view = views.size() > i ? views.get(i) : null;
      TiViewProxy proxy = proxies.get(i);
      if (view != null && view.getProxy() instanceof TableViewRowProxy) {
        proxy = addViewToOldRow(i, view, proxy);
        len++;
      }
      if (view == null) {
        // In some cases the TiUIView for this proxy has been reassigned to another proxy
        // We don't want to actually release it though, just reassign by creating a new view
        view = proxy.forceCreateView(tiContext.getActivity());
        clearChildViews(proxy);
        if (i >= views.size()) {
          views.add(view);
        } else {
          views.set(i, view);
        }
      }

      View v = view.getNativeView();
      view.setProxy(proxy);
      view.processProperties(proxy.getProperties());
      applyChildProxies(proxy, view);
      if (v != null && v.getParent() == null) {
        content.addView(v, view.getLayoutParams());
      }
    }
  }
예제 #2
0
 @Override
 public void removeWindow(View v) {
   layout.removeView(v);
 }