本文整理汇总了Java中org.appcelerator.titanium.proxy.TiViewProxy类的典型用法代码示例。如果您正苦于以下问题:Java TiViewProxy类的具体用法?Java TiViewProxy怎么用?Java TiViewProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TiViewProxy类属于org.appcelerator.titanium.proxy包,在下文中一共展示了TiViewProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setViews
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public void setViews(Object viewsObject)
{
boolean changed = false;
clearViewsList();
if (viewsObject instanceof Object[]) {
Object[] views = (Object[])viewsObject;
Activity activity = this.proxy.getActivity();
for (int i = 0; i < views.length; i++) {
if (views[i] instanceof TiViewProxy) {
TiViewProxy tv = (TiViewProxy)views[i];
tv.setActivity(activity);
tv.setParent(this.proxy);
mViews.add(tv);
changed = true;
}
}
}
if (changed) {
mAdapter.notifyDataSetChanged();
}
}
示例2: handleFireItemClick
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的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);
}
}
}
示例3: generateChildContentViews
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的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);
}
}
}
示例4: getOrCreateView
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的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();
}
示例5: TiUIProgressBar
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public TiUIProgressBar(final TiViewProxy proxy) {
super(proxy);
view = new LinearLayout(proxy.getActivity()) {
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
TiUIHelper.firePostLayoutEvent(proxy);
}
};
view.setOrientation(LinearLayout.VERTICAL);
label = new TextView(proxy.getActivity());
label.setGravity(Gravity.TOP | Gravity.LEFT);
label.setPadding(0, 0, 0, 0);
label.setSingleLine(false);
progress = new ProgressBar(proxy.getActivity(), null, android.R.attr.progressBarStyleHorizontal);
progress.setIndeterminate(false);
progress.setMax(1000);
view.addView(label);
view.addView(progress);
setNativeView(view);
}
示例6: ViewPropertyAnimator_
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的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);
}
示例7: toPixels
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的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);
}
示例8: translatePropertyName
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public static String translatePropertyName(Object object,
String tiPropertyName) {
ObjectType objType = ObjectType.GENERAL;
// Currently we only have property name maps for mapping from Titanium
// views to Android native views.
if (object instanceof TiViewProxy) {
objType = ObjectType.VIEW;
}
String newName = mPropertyMap.get(objType).get(tiPropertyName);
if (newName == null) {
newName = tiPropertyName;
}
return newName;
}
示例9: ExampleView
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public ExampleView(TiViewProxy proxy) {
super(proxy);
LayoutArrangement arrangement = LayoutArrangement.DEFAULT;
if (proxy.hasProperty(TiC.PROPERTY_LAYOUT)) {
String layoutProperty = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_LAYOUT));
if (layoutProperty.equals(TiC.LAYOUT_HORIZONTAL)) {
arrangement = LayoutArrangement.HORIZONTAL;
} else if (layoutProperty.equals(TiC.LAYOUT_VERTICAL)) {
arrangement = LayoutArrangement.VERTICAL;
}
}
setNativeView(new TiCompositeLayout(proxy.getActivity(), arrangement));
}
示例10: TiFlipView
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public TiFlipView(TiViewProxy proxy) {
super(proxy);
Activity activity = proxy.getActivity();
mViews = new ArrayList<TiViewProxy>();
mAdapter = new FlipViewAdapter(activity, mViews);
mFlipView = new FlipView(activity);
mFlipView.setAdapter(mAdapter);
mFlipView.setOnFlipListener(this);
}
示例11: clearViewsList
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
private void clearViewsList()
{
if (mViews == null || mViews.size() == 0) {
return;
}
for (TiViewProxy viewProxy : mViews) {
viewProxy.releaseViews();
viewProxy.setParent(null);
}
mViews.clear();
}
示例12: addView
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public void addView(TiViewProxy proxy)
{
if (!mViews.contains(proxy)) {
proxy.setActivity(this.proxy.getActivity());
proxy.setParent(this.proxy);
mViews.add(proxy);
getProxy().setProperty(TiC.PROPERTY_VIEWS, mViews.toArray());
mAdapter.notifyDataSetChanged();
}
}
示例13: removeView
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public void removeView(TiViewProxy proxy)
{
if (mViews.contains(proxy)) {
mViews.remove(proxy);
proxy.setParent(null);
getProxy().setProperty(TiC.PROPERTY_VIEWS, mViews.toArray());
mAdapter.notifyDataSetChanged();
}
}
示例14: flipTo
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的package包/类
public void flipTo(Object view)
{
if (view instanceof Number) {
move(((Number) view).intValue(), true);
} else if (view instanceof TiViewProxy) {
move(mViews.indexOf(view), true);
}
}
示例15: getView
import org.appcelerator.titanium.proxy.TiViewProxy; //导入依赖的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;
}