本文整理汇总了Java中org.appcelerator.kroll.common.TiMessenger类的典型用法代码示例。如果您正苦于以下问题:Java TiMessenger类的具体用法?Java TiMessenger怎么用?Java TiMessenger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TiMessenger类属于org.appcelerator.kroll.common包,在下文中一共展示了TiMessenger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scrollToItem
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@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);
}
}
示例2: setSections
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@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);
}
}
}
示例3: replaceItemsAt
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@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);
}
}
示例4: reverse
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
/**
* @since 1.0
*/
@Kroll.method
public void reverse() {
buildAnimator();
final ObjectAnimator animator = (ObjectAnimator) getAnimator();
if (animator != null) {
TiMessenger.postOnMain(new Runnable() {
@Override
public void run() {
animator.reverse();
}
});
} else {
Log.w(TAG, WARN_ANIMATOR);
}
}
示例5: getScrollHeight
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.getProperty @Kroll.method
public String getScrollHeight()
{
if (peekView() != null) {
if (TiApplication.isUIThread()) {
return getWebView().getScrollHeight();
} else {
return (String) TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GET_SCROLL_HEIGHT));
}
}
return "0";
}
示例6: getUserAgent
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@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 "";
}
示例7: canGoBack
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method
public boolean canGoBack()
{
if (peekView() != null) {
if (TiApplication.isUIThread()) {
return getWebView().canGoBack();
} else {
return (Boolean) TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_CAN_GO_BACK));
}
}
return false;
}
示例8: canGoForward
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@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;
}
示例9: getSectionCount
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method @Kroll.getProperty
public int getSectionCount() {
if (TiApplication.isUIThread()) {
return handleSectionCount();
} else {
return (Integer) TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SECTION_COUNT));
}
}
示例10: appendSection
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method
public void appendSection(Object section) {
if (TiApplication.isUIThread()) {
handleAppendSection(section);
} else {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_APPEND_SECTION), section);
}
}
示例11: deleteSectionAt
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method
public void deleteSectionAt(int index) {
if (TiApplication.isUIThread()) {
handleDeleteSectionAt(index);
} else {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_DELETE_SECTION_AT), index);
}
}
示例12: getSections
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method @Kroll.getProperty
public CollectionSectionProxy[] getSections()
{
if (TiApplication.isUIThread()) {
return handleSections();
} else {
return (CollectionSectionProxy[]) TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GET_SECTIONS));
}
}
示例13: setHeaderView
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method @Kroll.setProperty
public void setHeaderView(TiViewProxy headerView) {
if (TiApplication.isUIThread()) {
handleSetHeaderView(headerView);
} else {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_HEADER_VIEW), headerView);
}
}
示例14: setFooterView
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method @Kroll.setProperty
public void setFooterView(TiViewProxy footerView) {
if (TiApplication.isUIThread()) {
handleSetFooterView(footerView);
} else {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_FOOTER_VIEW), footerView);
}
}
示例15: setHeaderTitle
import org.appcelerator.kroll.common.TiMessenger; //导入依赖的package包/类
@Kroll.method @Kroll.setProperty
public void setHeaderTitle(String headerTitle) {
if (TiApplication.isUIThread()) {
handleSetHeaderTitle(headerTitle);
} else {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_HEADER_TITLE), headerTitle);
}
}