コード例 #1
0
  public TiUIScrollableView(ScrollableViewProxy proxy, TiBaseActivity activity) {
    super(proxy);
    //		activity.addConfigurationChangedListener(this);

    mViews = new ArrayList<TiViewProxy>();
    viewsLock = new Object();
    buildViewPager(activity);
    TiCompositeLayout.LayoutParams params = new LayoutParams();
    params.optionWidth = new TiDimension("100%", TiDimension.TYPE_WIDTH);
    params.optionHeight = new TiDimension("100%", TiDimension.TYPE_HEIGHT);
    mPager.setLayoutParams(params);
    mContainer =
        new TiViewPagerLayout(activity) {
          @Override
          public boolean dispatchTouchEvent(MotionEvent event) {
            if (touchPassThrough == true) return false;
            return super.dispatchTouchEvent(event);
          }
        };
    mContainer.addView((View) mPager, params);
    mPagingControl = buildPagingControl(activity);
    mContainer.addView(mPagingControl, buildFillLayoutParams());

    setNativeView(mContainer);
  }
コード例 #2
0
 @Override
 public Object instantiateItem(View container, int position) {
   synchronized (viewsLock) {
     ViewGroup pager = (ViewGroup) container;
     TiViewProxy tiProxy = mViews.get(position);
     TiUIView tiView = tiProxy.getOrCreateView();
     View view = tiView.getOuterView();
     ViewGroup.LayoutParams params =
         new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
     TiCompositeLayout layout = new TiCompositeLayout(tiProxy.getActivity());
     ViewParent parent = view.getParent();
     if (parent instanceof ViewGroup) {
       pager.removeView((View) parent);
       ViewGroup group = (ViewGroup) parent;
       group.removeView(view);
     }
     layout.addView(view, tiView.getLayoutParams());
     if (position < pager.getChildCount()) {
       pager.addView(layout, position, params);
     } else {
       pager.addView(layout, params);
     }
     return tiProxy;
   }
 }
コード例 #3
0
 public View layoutHeaderOrFooterView(TiViewProxy viewProxy) {
   TiUIView tiView = viewProxy.peekView();
   if (tiView != null) {
     TiViewProxy parentProxy = viewProxy.getParent();
     // Remove parent view if possible
     if (parentProxy != null) {
       TiUIView parentView = parentProxy.peekView();
       if (parentView != null) {
         parentView.remove(tiView);
       }
     }
   } else {
     tiView = viewProxy.forceCreateView();
   }
   View outerView = tiView.getOuterView();
   ViewGroup parentView = (ViewGroup) outerView.getParent();
   if (parentView != null && parentView.getId() == HEADER_FOOTER_WRAP_ID) {
     return parentView;
   } else {
     // add a wrapper so layout params such as height, width takes in effect.
     TiCompositeLayout wrapper =
         new TiCompositeLayout(viewProxy.getActivity(), LayoutArrangement.DEFAULT, null);
     AbsListView.LayoutParams params =
         new AbsListView.LayoutParams(
             AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT);
     wrapper.setLayoutParams(params);
     outerView = tiView.getOuterView();
     wrapper.addView(outerView, tiView.getLayoutParams());
     wrapper.setId(HEADER_FOOTER_WRAP_ID);
     return wrapper;
   }
 }
コード例 #4
0
  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());
      }
    }
  }
コード例 #5
0
 protected void refreshOldStyleRow() {
   TableViewRowProxy rp = getRowProxy();
   if (!rp.hasProperty(TiC.PROPERTY_TOUCH_ENABLED)) {
     rp.setProperty(TiC.PROPERTY_TOUCH_ENABLED, false);
   }
   if (views == null) {
     views = new ArrayList<TiUIView>();
     views.add(new TiUILabel(rp));
   }
   TiUILabel t = (TiUILabel) views.get(0);
   t.setProxy(rp);
   t.processProperties(filterProperties(rp.getProperties()));
   View v = t.getNativeView();
   if (v.getParent() == null) {
     TiCompositeLayout.LayoutParams params = (TiCompositeLayout.LayoutParams) t.getLayoutParams();
     params.optionLeft = new TiDimension(5, TiDimension.TYPE_LEFT);
     params.optionRight = new TiDimension(5, TiDimension.TYPE_RIGHT);
     params.autoFillsWidth = true;
     content.addView(v, params);
   }
 }
コード例 #6
0
 @Override
 public void addWindow(View v, TiCompositeLayout.LayoutParams params) {
   layout.addView(v, params);
 }