Java Code Examples for org.appcelerator.titanium.proxy.TiViewProxy#hasProperty()

The following examples show how to use org.appcelerator.titanium.proxy.TiViewProxy#hasProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollectionView.java    From TiCollectionView with MIT License 5 votes vote down vote up
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;
}
 
Example 2
Source File: ExampleProxy.java    From TiCollectionView with MIT License 5 votes vote down vote up
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));
}
 
Example 3
Source File: ExampleProxy.java    From NovarumBluetooth with MIT License 5 votes vote down vote up
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));
}