Java Code Examples for org.appcelerator.titanium.TiApplication#isUIThread()
The following examples show how to use
org.appcelerator.titanium.TiApplication#isUIThread() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 6 votes |
@Kroll.method public void scrollToItem(int sectionIndex, int itemIndex, @SuppressWarnings("rawtypes") @Kroll.argument(optional=true)HashMap options) { boolean animated = true; if ( (options != null) && (options instanceof HashMap<?, ?>) ) { @SuppressWarnings("unchecked") KrollDict animationargs = new KrollDict(options); if (animationargs.containsKeyAndNotNull(TiC.PROPERTY_ANIMATED)) { animated = TiConvert.toBoolean(animationargs.get(TiC.PROPERTY_ANIMATED), true); } } if (TiApplication.isUIThread()) { handleScrollToItem(sectionIndex, itemIndex, animated); } else { KrollDict d = new KrollDict(); d.put("itemIndex", itemIndex); d.put("sectionIndex", sectionIndex); d.put(TiC.PROPERTY_ANIMATED, Boolean.valueOf(animated)); TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SCROLL_TO_ITEM), d); } }
Example 2
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 6 votes |
@Kroll.method public void replaceItemsAt(int index, int count, Object data) { if (!isIndexValid(index)) { return; } if (TiApplication.isUIThread()) { handleReplaceItemsAt(index, count, data); } else { KrollDict d = new KrollDict(); d.put(TiC.EVENT_PROPERTY_INDEX, index); d.put(TiC.PROPERTY_COUNT, count); d.put(TiC.PROPERTY_DATA, data); TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_REPLACE_ITEMS_AT), d); } }
Example 3
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 6 votes |
@Kroll.setProperty @Kroll.method public void setSections(Object sections) { if (!(sections instanceof Object[])) { Log.e(TAG, "Invalid argument type to setSection(), needs to be an array", Log.DEBUG_MODE); return; } //Update java and javascript property setProperty(TiC.PROPERTY_SECTIONS, sections); Object[] sectionsArray = (Object[]) sections; TiUIView listView = peekView(); //Preload sections if listView is not opened. if (listView == null) { preload = true; clearPreloadSections(); addPreloadSections(sectionsArray, -1, true); } else { if (TiApplication.isUIThread()) { ((CollectionView)listView).processSectionsAndNotify(sectionsArray); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_SECTIONS), sectionsArray); } } }
Example 4
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void updateItemAt(int index, Object data) { if (!isIndexValid(index) || !(data instanceof HashMap)) { return; } if (TiApplication.isUIThread()) { handleUpdateItemAt(index, new Object[]{data}); } else { KrollDict d = new KrollDict(); d.put(TiC.EVENT_PROPERTY_INDEX, index); d.put(TiC.PROPERTY_DATA, new Object[]{data}); TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_UPDATE_ITEM_AT), d); } }
Example 5
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 5 votes |
@Kroll.method public void openLeftWindow() { if (TiApplication.isUIThread()) { handleOpenLeftView(); return; } Message message = getMainHandler().obtainMessage(MSG_OPEN_LEFT_VIEW); message.sendToTarget(); }
Example 6
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void deleteItemsAt(int index, int count) { if (!isIndexValid(index)) { return; } if (TiApplication.isUIThread()) { handleDeleteItemsAt(index, count); } else { KrollDict d = new KrollDict(); d.put(TiC.EVENT_PROPERTY_INDEX, index); d.put(TiC.PROPERTY_COUNT, count); TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_DELETE_ITEMS_AT), d); } }
Example 7
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void insertItemsAt(int index, Object data) { if (!isIndexValid(index)) { return; } if (TiApplication.isUIThread()) { handleInsertItemsAt(index, data); } else { KrollDict d = new KrollDict(); d.put(TiC.PROPERTY_DATA, data); d.put(TiC.EVENT_PROPERTY_INDEX, index); TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_INSERT_ITEMS_AT), d); } }
Example 8
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void appendItems(Object data) { if (TiApplication.isUIThread()) { handleAppendItems(data); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_APPEND_ITEMS), data); } }
Example 9
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method @Kroll.getProperty public Object[] getItems() { if (itemProperties == null) { return new Object[0]; } else if (TiApplication.isUIThread()) { return itemProperties.toArray(); } else { return (Object[]) TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GET_ITEMS)); } }
Example 10
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 5 votes |
@Kroll.method public void toggleRightWindow(@Kroll.argument(optional = true) Object obj) { if (TiApplication.isUIThread()) { handleToggleRightView(); return; } Message message = getMainHandler().obtainMessage(MSG_TOGGLE_RIGHT_VIEW); message.sendToTarget(); }
Example 11
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@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); } }
Example 12
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method @Kroll.setProperty public void setFooterTitle(String footerTitle) { if (TiApplication.isUIThread()) { handleSetFooterTitle(footerTitle); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_FOOTER_TITLE), footerTitle); } }
Example 13
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 5 votes |
@Kroll.method public void toggleLeftWindow(@Kroll.argument(optional = true) Object obj) { if (TiApplication.isUIThread()) { handleToggleLeftView(); return; } Message message = getMainHandler().obtainMessage(MSG_TOGGLE_LEFT_VIEW); message.sendToTarget(); }
Example 14
Source File: ViewProxy.java From TiTouchImageView with MIT License | 5 votes |
@Kroll.method public void scrollTo(float x, float y) { if (!TiApplication.isUIThread()) { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SCROLL_TO, (int)x, (int)y), getActivity()); } else { handleScrollTo(x,y); } }
Example 15
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method @Kroll.setProperty public void setHeaderView(TiViewProxy headerView) { if (TiApplication.isUIThread()) { handleSetHeaderView(headerView); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_HEADER_VIEW), headerView); } }
Example 16
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method @Kroll.getProperty public CollectionSectionProxy[] getSections() { if (TiApplication.isUIThread()) { return handleSections(); } else { return (CollectionSectionProxy[]) TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GET_SECTIONS)); } }
Example 17
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 5 votes |
@Kroll.method public void closeLeftWindow() { if (TiApplication.isUIThread()) { handleCloseLeftView(); return; } Message message = getMainHandler().obtainMessage(MSG_CLOSE_LEFT_VIEW); message.sendToTarget(); }
Example 18
Source File: DrawerProxy.java From Ti.DrawerLayout with MIT License | 5 votes |
@Kroll.method public void openRightWindow() { if (TiApplication.isUIThread()) { handleOpenRightView(); return; } Message message = getMainHandler().obtainMessage(MSG_OPEN_RIGHT_VIEW); message.sendToTarget(); }
Example 19
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void deleteSectionAt(int index) { if (TiApplication.isUIThread()) { handleDeleteSectionAt(index); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_DELETE_SECTION_AT), index); } }
Example 20
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void appendSection(Object section) { if (TiApplication.isUIThread()) { handleAppendSection(section); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_APPEND_SECTION), section); } }