protected TiViewProxy addViewToOldRow(int index, TiUIView titleView, TiViewProxy newViewProxy) { if (DBG) { Log.w(LCAT, newViewProxy + " was added an old style row, reusing the title TiUILabel"); } LabelProxy label = new LabelProxy(tiContext); label.handleCreationDict(titleView.getProxy().getProperties()); label.setView(titleView); label.setModelListener(titleView); titleView.setProxy(label); getRowProxy().getControls().add(index, label); views.add(newViewProxy.getView(tiContext.getActivity())); return label; }
protected TiUIView handleGetView() { if (view == null) { Log.d(TAG, "getView: " + getClass().getSimpleName(), Log.DEBUG_MODE); Activity activity = getActivity(); view = createView(activity); if (isDecorView) { if (activity != null) { ((TiBaseActivity) activity).setViewProxy(view.getProxy()); } else { Log.w(TAG, "Activity is null", Log.DEBUG_MODE); } } realizeViews(view); view.registerForTouch(); } return view; }
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()); } } }