本文整理汇总了Java中org.appcelerator.titanium.view.TiUIView类的典型用法代码示例。如果您正苦于以下问题:Java TiUIView类的具体用法?Java TiUIView怎么用?Java TiUIView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TiUIView类属于org.appcelerator.titanium.view包,在下文中一共展示了TiUIView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setHtml
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Kroll.method
public void setHtml(String html, @Kroll.argument(optional = true) KrollDict d)
{
setProperty(TiC.PROPERTY_HTML, html);
setProperty(OPTIONS_IN_SETHTML, d);
// If the web view has not been created yet, don't set html here. It will be set in processProperties() when the
// view is created.
TiUIView v = peekView();
if (v != null) {
if (TiApplication.isUIThread()) {
((TiUIWebView) v).setHtml(html, d);
} else {
getMainHandler().sendEmptyMessage(MSG_SET_HTML);
}
}
}
示例2: createView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Override
public TiUIView createView(Activity activity) {
TiUIView view = new TiView(this);
view.getLayoutParams().autoFillsHeight = true;
view.getLayoutParams().autoFillsWidth = true;
TiUIWebView webView = getWebView();
view.add(webView);
webView.getWebView().requestFocus(View.FOCUS_DOWN);
webView.getWebView().setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent e) {
switch (e.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus())
v.requestFocus();
break;
}
return false;
}
});
add(getProgressBar());
return view;
}
示例3: setSections
import org.appcelerator.titanium.view.TiUIView; //导入依赖的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);
}
}
}
示例4: handleFireItemClick
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
protected void handleFireItemClick (KrollDict data) {
TiViewProxy listViewProxy = ((CollectionItemProxy)proxy).getListProxy();
if (listViewProxy != null) {
TiUIView listView = listViewProxy.peekView();
if (listView != null) {
KrollDict d = listView.getAdditionalEventData();
if (d == null) {
listView.setAdditionalEventData(new KrollDict((HashMap) additionalEventData));
} else {
d.clear();
d.putAll(additionalEventData);
}
listView.fireEvent(TiC.EVENT_ITEM_CLICK, data);
}
}
}
示例5: generateChildContentViews
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
public void generateChildContentViews(DataItem item, TiUIView parentContent, BaseCollectionViewItem rootItem, boolean root) {
ArrayList<DataItem> childrenItem = item.getChildren();
for (int i = 0; i < childrenItem.size(); i++) {
DataItem child = childrenItem.get(i);
TiViewProxy proxy = child.getViewProxy();
TiUIView view = proxy.createView(proxy.getActivity());
view.registerForTouch();
proxy.setView(view);
generateChildContentViews(child, view, rootItem, false);
//Bind view to root.
ViewItem viewItem = new ViewItem(view, new KrollDict());
rootItem.bindView(child.getBindingId(), viewItem);
//Add it to view hierarchy
if (root) {
rootItem.addView(view.getNativeView(), view.getLayoutParams());
} else {
parentContent.add(view);
}
}
}
示例6: getOrCreateView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
private TiUIView getOrCreateView(TiViewProxy viewProxy) {
if (viewProxy == null) {
return null;
}
TiUIView view = viewProxy.getOrCreateView();
if (view != null) {
return view;
}
Log.w(TAG, "getOrCreateView failed. Returned value is null");
TiBaseActivity originalActivity = (TiBaseActivity) viewProxy.getActivity();
if (originalActivity.isDestroyed()) {
Log.w(TAG, "Original viewProxy activity is destroyed.");
}
Activity thisActivity = this.proxy.getActivity();
if (thisActivity != originalActivity) {
viewProxy.attachActivityLifecycle(thisActivity);
}
return viewProxy.getOrCreateView();
}
示例7: 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);
}
示例8: 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);
}
示例9: createView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Override
public TiUIView createView(Activity activity)
{
((TiBaseActivity)activity).addOnLifecycleEventListener(this);
((TiBaseActivity)activity).addInterceptOnBackPressedEventListener(this);
TiUIWebView webView = new TiUIWebView(this);
if (postCreateMessage != null) {
sendPostCreateMessage(webView.getWebView(), postCreateMessage);
postCreateMessage = null;
}
return webView;
}
示例10: onCheckIsTextEditor
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Override
public boolean onCheckIsTextEditor()
{
if (proxy.hasProperty(TiC.PROPERTY_SOFT_KEYBOARD_ON_FOCUS)) {
int value = TiConvert.toInt(proxy.getProperty(TiC.PROPERTY_SOFT_KEYBOARD_ON_FOCUS), TiUIView.SOFT_KEYBOARD_DEFAULT_ON_FOCUS);
if (value == TiUIView.SOFT_KEYBOARD_HIDE_ON_FOCUS) {
return false;
} else if (value == TiUIView.SOFT_KEYBOARD_SHOW_ON_FOCUS) {
return true;
}
}
return super.onCheckIsTextEditor();
}
示例11: createView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Override
public TiUIView createView(Activity activity)
{
TiUIView view = new ExampleView(this);
view.getLayoutParams().autoFillsHeight = true;
view.getLayoutParams().autoFillsWidth = true;
return view;
}
示例12: createView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Override
public TiUIView createView(Activity activity) {
TiUIView flipview = new TiFlipView(this);
flipview.getLayoutParams().autoFillsHeight = true;
flipview.getLayoutParams().autoFillsWidth = true;
return flipview;
}
示例13: getView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
TiViewProxy tiProxy = mViewProxies.get(position);
TiUIView tiView = tiProxy.getOrCreateView();
View view = tiView.getOuterView();
return view;
}
示例14: createView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Override
public TiUIView createView(Activity activity) {
TiUIView view = new ExampleView(this);
// view.getLayoutParams().autoFillsHeight = true;
// view.getLayoutParams().autoFillsWidth = true;
return view;
}
示例15: createView
import org.appcelerator.titanium.view.TiUIView; //导入依赖的package包/类
@Override
public TiUIView createView(Activity activity)
{
view = new CameraView(this);
act = activity;
view.getLayoutParams().autoFillsHeight = true;
view.getLayoutParams().autoFillsWidth = true;
return view;
}