org.appcelerator.titanium.TiDimension Java Examples
The following examples show how to use
org.appcelerator.titanium.TiDimension.
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 |
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: BaseCollectionViewItem.java From TiCollectionView with MIT License | 5 votes |
public BaseCollectionViewItem(Context context, AttributeSet set) { super(context, set); setId(CollectionView.listContentId); TiDimension heightDimension = new TiDimension(CollectionView.MIN_ROW_HEIGHT, TiDimension.TYPE_UNDEFINED); minHeight = heightDimension.getAsPixels(this); setMinimumHeight(minHeight); viewsMap = new HashMap<String, ViewItem>(); viewItem = new ViewItem(null, new KrollDict()); }
Example #3
Source File: Drawer.java From Ti.DrawerLayout with MIT License | 4 votes |
/** * Helpers */ public int getDevicePixels(Object value) { return TiConvert.toTiDimension(TiConvert.toString(value), TiDimension.TYPE_WIDTH).getAsPixels(layout); }