コード例 #1
0
  @Kroll.method
  public void remove(TiViewProxy child) {
    if (child == null) {
      Log.w(LCAT, "add called with null child");

      return;
    }

    if (peekView() != null) {
      if (TiApplication.isUIThread()) {
        handleRemove(child);
        return;
      }

      TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_REMOVE_CHILD), child);

    } else {
      if (children != null) {
        children.remove(child);
        if (child.parent != null && child.parent.get() == this) {
          child.parent = null;
        }
      }
    }
  }
コード例 #2
0
 private void setImage(final Bitmap bitmap) {
   if (!TiApplication.isUIThread()) {
     TiMessenger.sendBlockingMainMessage(handler.obtainMessage(SET_IMAGE), bitmap);
   } else {
     handleSetImage(bitmap);
   }
 }
コード例 #3
0
  @Kroll.method
  public void add(TiViewProxy child) {
    if (child == null) {
      Log.w(LCAT, "add called with null child");
      return;
    }

    if (children == null) {
      children = new ArrayList<TiViewProxy>();
    }

    if (peekView() != null) {
      if (TiApplication.isUIThread()) {
        handleAdd(child);
        return;
      }

      TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_ADD_CHILD), child);

    } else {
      children.add(child);
      child.parent = new WeakReference<TiViewProxy>(this);
    }
    // TODO zOrder
  }
コード例 #4
0
 @Kroll.method
 public void release() {
   if (TiApplication.isUIThread()) {
     super.releaseViews();
   } else {
     getMainHandler().sendEmptyMessage(MSG_RELEASE);
   }
 }
コード例 #5
0
 public void stop() {
   if (!TiApplication.isUIThread()) {
     Message message = handler.obtainMessage(STOP);
     message.sendToTarget();
   } else {
     handleStop();
   }
 }
コード例 #6
0
 @Kroll.method
 public void show() {
   if (TiApplication.isUIThread()) {
     handleShow();
   } else {
     getMainHandler().obtainMessage(MSG_SHOW).sendToTarget();
   }
 }
コード例 #7
0
 @Kroll.method
 public void hide() {
   if (TiApplication.isUIThread()) {
     handleHide();
   } else {
     getMainHandler().obtainMessage(MSG_HIDE).sendToTarget();
   }
 }
コード例 #8
0
 @Kroll.method
 public void focus() {
   if (TiApplication.isUIThread()) {
     handleFocus();
   } else {
     getMainHandler().sendEmptyMessage(MSG_FOCUS);
   }
 }
コード例 #9
0
 @Kroll.method
 public void blur() {
   if (TiApplication.isUIThread()) {
     handleBlur();
   } else {
     getMainHandler().sendEmptyMessage(MSG_BLUR);
   }
 }
コード例 #10
0
 @Kroll.method
 public void hide(@Kroll.argument(optional = true) KrollDict options) {
   if (TiApplication.isUIThread()) {
     handleHide(options);
   } else {
     getMainHandler().obtainMessage(MSG_HIDE, options).sendToTarget();
   }
 }
コード例 #11
0
 @Kroll.method
 public void appendItems(Object data) {
   if (TiApplication.isUIThread()) {
     handleAppendItems(data);
   } else {
     TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_APPEND_ITEMS), data);
   }
 }
コード例 #12
0
 @Kroll.method
 @Kroll.setProperty
 public void setItems(Object data) {
   if (TiApplication.isUIThread()) {
     handleSetItems(data);
   } else {
     TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_ITEMS), data);
   }
 }
コード例 #13
0
 public void handlePendingAnimation(boolean forceQueue) {
   if (pendingAnimation != null && peekView() != null) {
     if (forceQueue || !(TiApplication.isUIThread())) {
       getMainHandler().obtainMessage(MSG_ANIMATE).sendToTarget();
     } else {
       handleAnimate();
     }
   }
 }
コード例 #14
0
  @Kroll.method
  public void removeRoute(KrollDict route) {
    // This needs to run on main thread.
    if (TiApplication.isUIThread()) {
      handleRemoveRoute(route);
      return;
    }

    getMainHandler().obtainMessage(MSG_REMOVE_ROUTE, route).sendToTarget();
  }
コード例 #15
0
 @Kroll.method
 public void pause() {
   if (peekView() != null) {
     if (TiApplication.isUIThread()) {
       getWebView().pauseWebView();
     } else {
       getMainHandler().sendEmptyMessage(MSG_PAUSE);
     }
   }
 }
コード例 #16
0
 @Kroll.method
 public void resume() {
   if (peekView() != null) {
     if (TiApplication.isUIThread()) {
       getWebView().resumeWebView();
     } else {
       getMainHandler().sendEmptyMessage(MSG_RESUME);
     }
   }
 }
コード例 #17
0
 @Kroll.method
 public KrollDict getItemAt(int index) {
   if (TiApplication.isUIThread()) {
     return handleGetItemAt(index);
   } else {
     return (KrollDict)
         TiMessenger.sendBlockingMainMessage(
             getMainHandler().obtainMessage(MSG_GET_ITEM_AT), index);
   }
 }
コード例 #18
0
 @Kroll.method
 @Kroll.getProperty
 public Object[] getItems() {
   if (TiApplication.isUIThread()) {
     return itemProperties.toArray();
   } else {
     return (Object[])
         TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GET_ITEMS));
   }
 }
コード例 #19
0
  @Kroll.method
  public void addRoute(KrollDict routeMap) {
    // This needs to run on main thread.
    if (TiApplication.isUIThread()) {
      handleAddRoute(routeMap);
      return;
    }

    getMainHandler().obtainMessage(MSG_ADD_ROUTE, routeMap).sendToTarget();
  }
コード例 #20
0
 @Kroll.method
 @Kroll.setProperty
 public void setBackgroundImage(String url) {
   if (TiApplication.isUIThread()) {
     handleSetBackgroundImage(url);
   } else {
     Message message = getMainHandler().obtainMessage(MSG_SET_BACKGROUND_IMAGE, url);
     message.getData().putString(BACKGROUND_IMAGE, url);
     message.sendToTarget();
   }
 }
コード例 #21
0
 @Kroll.method
 @Kroll.setProperty
 public void setTitle(String title) {
   if (TiApplication.isUIThread()) {
     handleSetTitle(title);
   } else {
     Message message = getMainHandler().obtainMessage(MSG_SET_TITLE, title);
     message.getData().putString(TITLE, title);
     message.sendToTarget();
   }
 }
コード例 #22
0
 @Kroll.method
 @Kroll.setProperty
 public void setDisplayHomeAsUp(boolean showHomeAsUp) {
   if (TiApplication.isUIThread()) {
     handlesetDisplayHomeAsUp(showHomeAsUp);
   } else {
     Message message = getMainHandler().obtainMessage(MSG_DISPLAY_HOME_AS_UP, showHomeAsUp);
     message.getData().putBoolean(SHOW_HOME_AS_UP, showHomeAsUp);
     message.sendToTarget();
   }
 }
コード例 #23
0
 @Kroll.method
 @Kroll.setProperty
 public void setNavigationMode(int navigationMode) {
   if (TiApplication.isUIThread()) {
     handlesetNavigationMode(navigationMode);
   } else {
     Message message = getMainHandler().obtainMessage(MSG_SET_NAVIGATION_MODE, navigationMode);
     message.getData().putInt(NAVIGATION_MODE, navigationMode);
     message.sendToTarget();
   }
 }
コード例 #24
0
  @Kroll.method
  public KrollDict toImage() {
    if (TiApplication.isUIThread()) {
      return handleToImage();

    } else {
      return (KrollDict)
          TiMessenger.sendBlockingMainMessage(
              getMainHandler().obtainMessage(MSG_TOIMAGE), getActivity());
    }
  }
コード例 #25
0
 @Kroll.method
 public boolean canGoForward() {
   if (peekView() != null) {
     if (TiApplication.isUIThread()) {
       return getWebView().canGoForward();
     } else {
       return (Boolean)
           TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_CAN_GO_FORWARD));
     }
   }
   return false;
 }
コード例 #26
0
  public TiUIView getOrCreateView() {
    if (activity == null || view != null) {
      return view;
    }

    if (TiApplication.isUIThread()) {
      return handleGetView();
    }

    return (TiUIView)
        TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GETVIEW), 0);
  }
コード例 #27
0
 @Kroll.method
 @Kroll.setProperty
 public void setIcon(String url) {
   if (Build.VERSION.SDK_INT >= TiC.API_LEVEL_ICE_CREAM_SANDWICH) {
     if (TiApplication.isUIThread()) {
       handleSetIcon(url);
     } else {
       Message message = getMainHandler().obtainMessage(MSG_SET_ICON, url);
       message.getData().putString(ICON, url);
       message.sendToTarget();
     }
   }
 }
コード例 #28
0
 @Kroll.method
 @Kroll.setProperty
 public void setUserAgent(String userAgent) {
   TiUIWebView currWebView = getWebView();
   if (currWebView != null) {
     if (TiApplication.isUIThread()) {
       currWebView.setUserAgentString(userAgent);
     } else {
       Message message = getMainHandler().obtainMessage(MSG_SET_USER_AGENT);
       message.obj = userAgent;
       message.sendToTarget();
     }
   }
 }
コード例 #29
0
 @Kroll.method
 @Kroll.getProperty
 public String getUserAgent() {
   TiUIWebView currWebView = getWebView();
   if (currWebView != null) {
     if (TiApplication.isUIThread()) {
       return currWebView.getUserAgentString();
     } else {
       return (String)
           TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GET_USER_AGENT));
     }
   }
   return "";
 }
コード例 #30
0
 @Override
 public void onPropertyChanged(String name, Object value) {
   if (Build.VERSION.SDK_INT >= TiC.API_LEVEL_ICE_CREAM_SANDWICH
       && TiC.PROPERTY_ON_HOME_ICON_ITEM_SELECTED.equals(name)) {
     // If we have a listener on the home icon item, then enable the home button (we need to do
     // this for ICS and
     // above)
     if (TiApplication.isUIThread()) {
       actionBar.setHomeButtonEnabled(true);
     } else {
       getMainHandler().obtainMessage(MSG_SET_HOME_BUTTON_ENABLED).sendToTarget();
     }
   }
   super.onPropertyChanged(name, value);
 }