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


Java TiUIView.getNativeView方法代码示例

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


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

示例1: ViewPropertyAnimator_

import org.appcelerator.titanium.view.TiUIView; //导入方法依赖的package包/类
public ViewPropertyAnimator_(TiViewProxy view) {
	super();

	if (view == null) {
		throw new IllegalStateException(ERR_VIEW_UNAVAILABLE);
	}

	TiUIView tiView = view.peekView();
	if (tiView == null) {
		throw new IllegalStateException(ERR_VIEW_UNAVAILABLE);
	}

	View nativeView = tiView.getNativeView();
	if (nativeView == null) {
		throw new IllegalStateException(ERR_VIEW_UNAVAILABLE);
	}

	mDisplayMetrics = AnimationUtils.getDisplayMetrics(nativeView);

	mAnimator = ViewPropertyAnimator.animate(nativeView);
	mAnimator.setListener(this);
}
 
开发者ID:billdawson,项目名称:ti-android-animation,代码行数:23,代码来源:ViewPropertyAnimator_.java

示例2: toPixels

import org.appcelerator.titanium.view.TiUIView; //导入方法依赖的package包/类
/**
 * Converts dips, sips, etc. into pixels, taking density into account.
 * Useful when animating using the [ObjectAnimator](@ref ObjectAnimator_],
 * which does *not* perform such calculations automatically for you.
 * (The [ViewPropertyAnimator](@ref views.ViewPropertyAnimator_), however,
 * will do these calculations for you, so when using it you will likely
 * not need to be using this function.)
 * 
 * @param view			The view you will eventually be animating, or any view on
 * 						the same window. This is needed to determine the density
 * 						of the hosting screen.
 * @param originalValue A number with a unit specifier, such as "12dp" if you wished
 * 						to convert 12dp to pixels.
 * @param direction		(Optional) "horizontal" (default) or "vertical". Only relevant
 * 						if converting from inches, centimeters or millimeters.
 * @return 				Number of pixels
 * @since				1.0
 */
@Kroll.method
public float toPixels(TiViewProxy view, Object originalValue,
		@Kroll.argument(optional = true) String direction) {
	Axis axis = Axis.X;
	if (direction != null && direction.toLowerCase() == "vertical") {
		axis = Axis.Y;
	}

	TiUIView tiView = view.peekView();
	if (tiView == null) {
		throw new IllegalStateException(
				"The view must be rendered before toPixels() can be called because the density of its host screen must be determined.");
	}

	View nativeView = tiView.getNativeView();
	if (nativeView == null) {
		throw new IllegalStateException(
				"The view must be rendered before toPixels() can be called because the density of its host screen must be determined.");
	}

	return AnimationUtils.toPixels(
			AnimationUtils.getDisplayMetrics(nativeView), originalValue,
			axis);

}
 
开发者ID:billdawson,项目名称:ti-android-animation,代码行数:44,代码来源:AndroidAnimation.java

示例3: addSearchLayout

import org.appcelerator.titanium.view.TiUIView; //导入方法依赖的package包/类
private void addSearchLayout(RelativeLayout layout, TiViewProxy searchView, TiUIView search) {
	RelativeLayout.LayoutParams p = createBasicSearchLayout();
	p.addRule(RelativeLayout.ALIGN_PARENT_TOP);

	TiDimension rawHeight;
	if (searchView.hasProperty(TiC.PROPERTY_HEIGHT)) {
		rawHeight = TiConvert.toTiDimension(searchView.getProperty(TiC.PROPERTY_HEIGHT), 0);
	} else {
		rawHeight = TiConvert.toTiDimension(MIN_SEARCH_HEIGHT, 0);
	}
	p.height = rawHeight.getAsPixels(layout);

	View nativeView = search.getNativeView();
	layout.addView(nativeView, p);

	p = createBasicSearchLayout();
	p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	p.addRule(RelativeLayout.BELOW, nativeView.getId());
	ViewParent parentWrapper = wrapper.getParent();
	if (parentWrapper != null && parentWrapper instanceof ViewGroup) {
		//get the previous layout params so we can reset with new layout
		ViewGroup.LayoutParams lp = wrapper.getLayoutParams();
		ViewGroup parentView = (ViewGroup) parentWrapper;
		//remove view from parent
		parentView.removeView(wrapper);
		//add new layout
		layout.addView(wrapper, p);
		parentView.addView(layout, lp);
		
	} else {
		layout.addView(wrapper, p);
	}
	this.searchLayout = layout;
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:35,代码来源:CollectionView.java

示例4: buildAnimator

import org.appcelerator.titanium.view.TiUIView; //导入方法依赖的package包/类
@Override
protected void buildAnimator() {
	ObjectAnimator animator = (ObjectAnimator) getAnimator();
	if (animator == null) {
		if (mPropertyType == PropertyDataType.UNKNOWN) {
			Log.w(TAG, "Property data type unknown, cannot animate.");
			return;
		}

		Object target = getTarget();
		String propertyName = AnimationUtils.translatePropertyName(target,
				mPropertyName);

		Object actualObject = target;

		if (target instanceof TiViewProxy) {
			TiUIView intermediateObject = ((TiViewProxy) target).peekView();
			if (intermediateObject != null) {
				actualObject = intermediateObject.getNativeView();
				if (actualObject != null
						&& propertyName.equals(PROPERTY_BACKGROUND_COLOR)
						&& mIntValues.length == 1) {
					// There is no "getBackgroundColor" on Android views,
					// so we wrap it.
					actualObject = new ViewWrapper((View) actualObject);
				}
			} else {
				Log.w(TAG, "View not available for animation.");
			}
		}

		if (actualObject == null) {
			Log.w(TAG, "Object not available for animation (null).");
			return;
		}

		switch (mPropertyType) {
			case FLOAT:
				animator = ObjectAnimator.ofFloat(actualObject,
						propertyName, mFloatValues);
				break;
			case INT:
				animator = ObjectAnimator.ofInt(actualObject, propertyName,
						mIntValues);
				break;
			case UNKNOWN:
				break;
		}

	}

	if (mRepeatCount != AndroidAnimation.NO_INT_VALUE) {
		animator.setRepeatCount(mRepeatCount);
	}

	if (mRepeatMode != AndroidAnimation.NO_INT_VALUE) {
		animator.setRepeatMode(mRepeatMode);
	}

	if (mEvaluator != AndroidAnimation.NO_INT_VALUE) {
		switch (mEvaluator) {
			case AndroidAnimation.INT_EVALUATOR:
				animator.setEvaluator(new IntEvaluator());
				break;
			case AndroidAnimation.FLOAT_EVALUATOR:
				animator.setEvaluator(new FloatEvaluator());
				break;
			case AndroidAnimation.ARGB_EVALUATOR:
				animator.setEvaluator(new ArgbEvaluator());
				break;
			default:
				Log.w(TAG, "Evaluator set to unknown value: " + mEvaluator);
		}
	}

	setAnimator(animator);

	super.setCommonAnimatorProperties();

}
 
开发者ID:billdawson,项目名称:ti-android-animation,代码行数:81,代码来源:ObjectAnimator_.java


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