当前位置: 首页>>代码示例>>Java>>正文


Java TiViewProxy.fireEvent方法代码示例

本文整理汇总了Java中org.appcelerator.titanium.proxy.TiViewProxy.fireEvent方法的典型用法代码示例。如果您正苦于以下问题:Java TiViewProxy.fireEvent方法的具体用法?Java TiViewProxy.fireEvent怎么用?Java TiViewProxy.fireEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.appcelerator.titanium.proxy.TiViewProxy的用法示例。


在下文中一共展示了TiViewProxy.fireEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fireItemClick

import org.appcelerator.titanium.proxy.TiViewProxy; //导入方法依赖的package包/类
private void fireItemClick(String event, Object data)
{
	if (event.equals(TiC.EVENT_CLICK) && data instanceof HashMap) {
		KrollDict eventData = new KrollDict((HashMap) data);
		Object source = eventData.get(TiC.EVENT_PROPERTY_SOURCE);
		if (source != null && !source.equals(this) && listProxy != null) {
			TiViewProxy listViewProxy = listProxy.get();
			if (listViewProxy != null) {
				listViewProxy.fireEvent(TiC.EVENT_ITEM_CLICK, eventData);
			}
		}
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:14,代码来源:CollectionItemProxy.java

示例2: onLayout

import org.appcelerator.titanium.proxy.TiViewProxy; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
	// To prevent undesired "focus" and "blur" events during layout caused
	// by ListView temporarily taking focus, we will disable focus events until
	// layout has finished.
	// First check for a quick exit. listView can be null, such as if window closing.
	// Starting with API 18, calling requestFocus() will trigger another layout pass of the listview,
	// resulting in an infinite loop. Here we check if the view is already focused, and stop the loop.
	if (listView == null || (Build.VERSION.SDK_INT >= 18 && listView != null && !changed && viewFocused)) {
		viewFocused = false;
		super.onLayout(changed, left, top, right, bottom);
		return;
	}
	OnFocusChangeListener focusListener = null;
	View focusedView = listView.findFocus();
	int cursorPosition = -1;
	if (focusedView != null) {
		OnFocusChangeListener listener = focusedView.getOnFocusChangeListener();
		if (listener != null && listener instanceof TiUIView) {
			//Before unfocus the current editText, store cursor position so
			//we can restore it later
			if (focusedView instanceof EditText) {
				cursorPosition = ((EditText)focusedView).getSelectionStart();
			}
			focusedView.setOnFocusChangeListener(null);
			focusListener = listener;
		}
	}
	
	//We are temporarily going to block focus to descendants 
	//because LinearLayout on layout will try to find a focusable descendant
	if (focusedView != null) {
		listView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
	}
	super.onLayout(changed, left, top, right, bottom);
	//Now we reset the descendant focusability
	listView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);

	TiViewProxy viewProxy = proxy;
	if (viewProxy != null && viewProxy.hasListeners(TiC.EVENT_POST_LAYOUT)) {
		viewProxy.fireEvent(TiC.EVENT_POST_LAYOUT, null);
	}

	// Layout is finished, re-enable focus events.
	if (focusListener != null) {
		// If the configuration changed, we manually fire the blur event
		if (changed) {
			focusedView.setOnFocusChangeListener(focusListener);
			focusListener.onFocusChange(focusedView, false);
		} else {
			//Ok right now focus is with listView. So set it back to the focusedView
			viewFocused = true;
			focusedView.requestFocus();
			focusedView.setOnFocusChangeListener(focusListener);
			//Restore cursor position
			if (cursorPosition != -1) {
				((EditText)focusedView).setSelection(cursorPosition);
			}
		}
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:62,代码来源:CollectionView.java


注:本文中的org.appcelerator.titanium.proxy.TiViewProxy.fireEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。