org.appcelerator.kroll.KrollDict Java Examples
The following examples show how to use
org.appcelerator.kroll.KrollDict.
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: CameraViewProxy.java From Ti-Android-CameraView with MIT License | 6 votes |
@Override public void processProperties(KrollDict d) { super.processProperties(d); if(d.containsKey("save_location")){ SAVE = d.getString("save_location"); } if( d.containsKey("useFrontCamera") ){ Log.i(TAG, "Front Camera Property exists!"); FRONT_CAMERA = d.getBoolean("useFrontCamera"); } if( d.containsKey("pictureTimeout")){ PICTURE_TIMEOUT = d.getInt("pictureTimeout"); } if( d.containsKey("resolutionNamed") ){ RESOLUTION_NAME = d.getInt("resolutionNamed"); } }
Example #2
Source File: RealSwitch.java From RealSwitch with MIT License | 6 votes |
@Override public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) { CompoundButton cb = (CompoundButton) getNativeView(); if (key.equals(TiC.PROPERTY_TITLE_OFF)) { ((Switch) cb).setTextOff((String) newValue); } else if (key.equals(TiC.PROPERTY_TITLE_ON)) { ((Switch) cb).setTextOff((String) newValue); } else if (key.equals(TiC.PROPERTY_VALUE)) { cb.setChecked(TiConvert.toBoolean(newValue)); } else if (key.equals(TiC.PROPERTY_COLOR)) { cb.setTextColor(TiConvert.toColor(TiConvert.toString(newValue))); } else if (key.equals(TiC.PROPERTY_FONT)) { TiUIHelper.styleText(cb, (KrollDict) newValue); } else if (key.equals(TiC.PROPERTY_TEXT_ALIGN)) { TiUIHelper.setAlignment(cb, TiConvert.toString(newValue), null); cb.requestLayout(); } else if (key.equals(TiC.PROPERTY_VERTICAL_ALIGN)) { TiUIHelper.setAlignment(cb, null, TiConvert.toString(newValue)); cb.requestLayout(); } else { super.propertyChanged(key, oldValue, newValue, proxy); } }
Example #3
Source File: ImagepickerModule.java From titanium-imagepicker with Apache License 2.0 | 6 votes |
private Intent prepareExtrasForIntent(Intent intent, KrollDict options, boolean openGallery) { Defaults.resetValues(openGallery); checkAndSetParameters(1, Defaults.Params.STATUS_BAR_COLOR, Defaults.STATUS_BAR_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.BAR_COLOR, Defaults.BAR_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.BACKGROUND_COLOR, Defaults.BACKGROUND_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.COVER_VIEW_COLOR, Defaults.COVER_VIEW_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.CHECKMARK_COLOR, Defaults.CHECKMARK_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.TITLE, Defaults.TITLE, options, intent); checkAndSetParameters(1, Defaults.Params.DONE_BTN_TITLE, Defaults.DONE_BTN_TITLE, options, intent); checkAndSetParameters(1, Defaults.Params.MAX_IMAGE_MSG, Defaults.MAX_IMAGE_MSG, options, intent); checkAndSetParameters(1, Defaults.Params.ACTIVITY_THEME, Defaults.ACTIVITY_THEME, options, intent); checkAndSetParameters(2, Defaults.Params.GRID_SIZE, Defaults.GRID_SIZE, options, intent); checkAndSetParameters(2, Defaults.Params.IMAGE_HEIGHT, Defaults.IMAGE_HEIGHT, options, intent); checkAndSetParameters(2, Defaults.Params.SHOW_DIVIDER, Defaults.SHOW_DIVIDER, options, intent); checkAndSetParameters(2, Defaults.Params.DIVIDER_WIDTH, Defaults.DIVIDER_WIDTH, options, intent); checkAndSetParameters(2, Defaults.Params.MAX_IMAGE_SELECTION, Defaults.MAX_IMAGE_SELECTION, options, intent); checkAndSetParameters(2, Defaults.Params.SHAPE, Defaults.SHAPE, options, intent); checkAndSetParameters(2, Defaults.Params.CIRCLE_RADIUS, Defaults.CIRCLE_RADIUS, options, intent); checkAndSetParameters(2, Defaults.Params.CIRCLE_PADDING, Defaults.CIRCLE_PADDING, options, intent); return intent; }
Example #4
Source File: GalleryResultHandler.java From titanium-imagepicker with Apache License 2.0 | 6 votes |
protected void flushResponse(Object... params) { if (null != callback) { ArrayList<Object> args = new ArrayList<Object>(); for (Object a : params) { args.add(a); } int length = args.size(); KrollDict response = new KrollDict(); for (int i=0; i<length; i++) { // double increase i to make key-value pair String key = (String) args.get(i); ++i; response.put(key, args.get(i)); } callback.callAsync(krollObject, response); } }
Example #5
Source File: NovarumbluetoothModule.java From NovarumBluetooth with MIT License | 6 votes |
@Kroll.method public KrollDict getPairedDevices() { Log.d(TAG, "getPairedDevices called"); Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices(); KrollDict result = new KrollDict(); // If there are paired devices if (pairedDevices.size() > 0) { // Loop through paired devices for (BluetoothDevice device : pairedDevices) { //Halilk: for some devices, device name is the same so put some of mac digits String strDigitstoAdd = device.getAddress(); strDigitstoAdd = strDigitstoAdd.replace(":",""); result.put(device.getName()+"_"+strDigitstoAdd, device.getAddress()); } } return result; }
Example #6
Source File: MultiPickerProxy.java From TiDialogs with MIT License | 6 votes |
@Override protected void handleShow(KrollDict options) { super.handleShow(options); // If there's a lock on the UI message queue, there's a good chance // we're in the middle of activity stack transitions. An alert // dialog should occur above the "topmost" activity, so if activity // stack transitions are occurring, try to give them a chance to // "settle" // before determining which Activity should be the context for the // AlertDialog. TiUIHelper.runUiDelayedIfBlock(new Runnable() { @Override public void run() { MultiPicker d = (MultiPicker) getOrCreateView(); d.show(); } }); }
Example #7
Source File: ImagepickerModule.java From titanium-imagepicker with Apache License 2.0 | 6 votes |
private Intent prepareExtrasForIntent(Intent intent, KrollDict options, boolean openGallery) { Defaults.resetValues(openGallery); checkAndSetParameters(1, Defaults.Params.STATUS_BAR_COLOR, Defaults.STATUS_BAR_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.BAR_COLOR, Defaults.BAR_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.BACKGROUND_COLOR, Defaults.BACKGROUND_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.COVER_VIEW_COLOR, Defaults.COVER_VIEW_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.CHECKMARK_COLOR, Defaults.CHECKMARK_COLOR, options, intent); checkAndSetParameters(1, Defaults.Params.TITLE, Defaults.TITLE, options, intent); checkAndSetParameters(1, Defaults.Params.DONE_BTN_TITLE, Defaults.DONE_BTN_TITLE, options, intent); checkAndSetParameters(1, Defaults.Params.MAX_IMAGE_MSG, Defaults.MAX_IMAGE_MSG, options, intent); checkAndSetParameters(1, Defaults.Params.ACTIVITY_THEME, Defaults.ACTIVITY_THEME, options, intent); checkAndSetParameters(2, Defaults.Params.GRID_SIZE, Defaults.GRID_SIZE, options, intent); checkAndSetParameters(2, Defaults.Params.IMAGE_HEIGHT, Defaults.IMAGE_HEIGHT, options, intent); checkAndSetParameters(2, Defaults.Params.SHOW_DIVIDER, Defaults.SHOW_DIVIDER, options, intent); checkAndSetParameters(2, Defaults.Params.DIVIDER_WIDTH, Defaults.DIVIDER_WIDTH, options, intent); checkAndSetParameters(2, Defaults.Params.MAX_IMAGE_SELECTION, Defaults.MAX_IMAGE_SELECTION, options, intent); checkAndSetParameters(2, Defaults.Params.SHAPE, Defaults.SHAPE, options, intent); checkAndSetParameters(2, Defaults.Params.CIRCLE_RADIUS, Defaults.CIRCLE_RADIUS, options, intent); checkAndSetParameters(2, Defaults.Params.CIRCLE_PADDING, Defaults.CIRCLE_PADDING, options, intent); return intent; }
Example #8
Source File: ViewProxy.java From TiTouchImageView with MIT License | 6 votes |
@Override public void processProperties(KrollDict props) { super.processProperties(props); if (props.containsKey("zoom")) { tiv.setZoom(TiConvert.toFloat(proxy.getProperty("zoom"))); } if (props.containsKey("image")) { handleImage(proxy.getProperty("image")); } if (props.containsKey("maxZoom")) { tiv.setMaxZoom(TiConvert.toFloat(proxy.getProperty("maxZoom"))); } if (props.containsKey("minZoom")) { tiv.setMinZoom(TiConvert.toFloat(proxy.getProperty("minZoom"))); } }
Example #9
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 6 votes |
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); } } }
Example #10
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 6 votes |
private CollectionViewTemplate processDefaultTemplate(KrollDict data, int index) { if (builtInTemplate == null){ //Create template and generate default properties builtInTemplate = new DefaultCollectionViewTemplate(UIModule.LIST_ITEM_TEMPLATE_DEFAULT, null, getActivity()); //Each template is treated as an item type, so we can reuse views efficiently. //Section templates are given a type in CollectionView.processSections(). Here we //give default template a type if possible. CollectionView listView = getListView(); if (listView != null) { builtInTemplate.setType(CollectionView.BUILT_IN_TEMPLATE_ITEM_TYPE); builtInTemplate.setRootParent(listView.getProxy()); } } return builtInTemplate; }
Example #11
Source File: CollectionViewTemplate.java From TiCollectionView with MIT License | 6 votes |
public CollectionViewTemplate(String id, KrollDict properties) { //Init our binding hashmaps dataItems = new HashMap<String, DataItem>(); //Set item id. Item binding is always "properties" itemID = TiC.PROPERTY_PROPERTIES; //Init vars. templateID = id; templateType = -1; if (properties != null) { this.properties = properties; processProperties(this.properties); } else { this.properties = new KrollDict(); } }
Example #12
Source File: CollectionViewTemplate.java From TiCollectionView with MIT License | 6 votes |
private void processChildProperties(Object childProperties, DataItem parent) { if (childProperties instanceof Object[]) { Object[] propertiesArray = (Object[])childProperties; for (int i = 0; i < propertiesArray.length; i++) { HashMap<String, Object> properties = (HashMap<String, Object>) propertiesArray[i]; //bind proxies and default properties DataItem item = bindProxiesAndProperties(new KrollDict(properties), false, parent); //Recursively calls for all childTemplates if (properties.containsKey(TiC.PROPERTY_CHILD_TEMPLATES)) { if(item == null) { Log.e(TAG, "Unable to generate valid data from child view", Log.DEBUG_MODE); } processChildProperties(properties.get(TiC.PROPERTY_CHILD_TEMPLATES), item); } } } }
Example #13
Source File: CollectionViewTemplate.java From TiCollectionView with MIT License | 6 votes |
public void updateOrMergeWithDefaultProperties(KrollDict data, boolean update) { for (String binding: data.keySet()) { DataItem dataItem = dataItems.get(binding); if (dataItem == null) continue; KrollDict defaultProps = dataItem.getDefaultProperties(); KrollDict props = new KrollDict((HashMap)data.get(binding)); if (defaultProps != null) { if (update) { //update default properties Set<String> existingKeys = defaultProps.keySet(); for (String key: props.keySet()) { if (!existingKeys.contains(key)) { defaultProps.put(key, null); } } } else { //merge default properties with new properties and update data HashMap<String, Object> newData = ((HashMap<String, Object>)defaultProps.clone()); newData.putAll(props); data.put(binding, newData); } } } }
Example #14
Source File: CollectionViewProxy.java From TiCollectionView with MIT License | 6 votes |
@Kroll.method public void scrollToItem(int sectionIndex, int itemIndex, @SuppressWarnings("rawtypes") @Kroll.argument(optional=true)HashMap options) { boolean animated = true; if ( (options != null) && (options instanceof HashMap<?, ?>) ) { @SuppressWarnings("unchecked") KrollDict animationargs = new KrollDict(options); if (animationargs.containsKeyAndNotNull(TiC.PROPERTY_ANIMATED)) { animated = TiConvert.toBoolean(animationargs.get(TiC.PROPERTY_ANIMATED), true); } } if (TiApplication.isUIThread()) { handleScrollToItem(sectionIndex, itemIndex, animated); } else { KrollDict d = new KrollDict(); d.put("itemIndex", itemIndex); d.put("sectionIndex", sectionIndex); d.put(TiC.PROPERTY_ANIMATED, Boolean.valueOf(animated)); TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SCROLL_TO_ITEM), d); } }
Example #15
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 6 votes |
public CollectionItemData (KrollDict properties, CollectionViewTemplate template) { this.properties = properties; this.template = template; //set searchableText if (properties.containsKey(TiC.PROPERTY_PROPERTIES)) { Object props = properties.get(TiC.PROPERTY_PROPERTIES); if (props instanceof HashMap) { HashMap<String, Object> propsHash = (HashMap<String, Object>) props; Object searchText = propsHash.get(TiC.PROPERTY_SEARCHABLE_TEXT); if (propsHash.containsKey(TiC.PROPERTY_SEARCHABLE_TEXT) && searchText != null) { searchableText = TiConvert.toString(searchText); } } } }
Example #16
Source File: GalleryResultHandler.java From titanium-imagepicker with Apache License 2.0 | 6 votes |
protected void flushResponse(Object... params) { if (null != callback) { ArrayList<Object> args = new ArrayList<Object>(); for (Object a : params) { args.add(a); } int length = args.size(); KrollDict response = new KrollDict(); for (int i=0; i<length; i++) { // double increase i to make key-value pair String key = (String) args.get(i); ++i; response.put(key, args.get(i)); } callback.callAsync(krollObject, response); } }
Example #17
Source File: CollectionItem.java From TiCollectionView with MIT License | 6 votes |
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); } } }
Example #18
Source File: ViewItem.java From TiCollectionView with MIT License | 6 votes |
/** * This method compares applied properties of a view and our data model to * generate a new set of properties we need to set. It is crucial for scrolling performance. * @param properties The properties from our data model * @return The difference set of properties to set */ public KrollDict generateDiffProperties(KrollDict properties) { diffProperties.clear(); for (String appliedProp : this.properties.keySet()) { if (!properties.containsKey(appliedProp)) { applyProperty(appliedProp, null); } } for (String property : properties.keySet()) { Object value = properties.get(property); if (CollectionView.MUST_SET_PROPERTIES.contains(property)) { applyProperty(property, value); continue; } Object existingVal = this.properties.get(property); if (existingVal == null || value == null || !existingVal.equals(value)) { applyProperty(property, value); } } return diffProperties; }
Example #19
Source File: DropdownProxy.java From actionbarextras with MIT License | 5 votes |
@Override public void handleCreationDict(KrollDict options) { final ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar(); final boolean keepTitle; if (options.containsKey("keepTitle")) { keepTitle = options.getBoolean("keepTitle"); }else{ keepTitle = false; } add(keepTitle); if (options.containsKey("titles")) { final String[] dropdownValues = options.getStringArray("titles"); ArrayAdapter<String> adapter = new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_spinner_item, android.R.id.text1, dropdownValues); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionBar.setListNavigationCallbacks(adapter, navigationListener); } if (options.containsKey("index")) { int activeItem = options.getInt("index"); setActiveItem(activeItem); } super.handleCreationDict(options); }
Example #20
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
private CollectionViewTemplate processTemplate(KrollDict itemData, int index) { CollectionView listView = getListView(); String defaultTemplateBinding = null; if (listView != null) { defaultTemplateBinding = listView.getDefaultTemplateBinding(); } //if template is specified in data, we look it up and if one exists, we use it. //Otherwise we check if a default template is specified in ListView. If not, we use builtInTemplate. String binding = TiConvert.toString(itemData.get(TiC.PROPERTY_TEMPLATE)); if (binding != null) { //check if template is default if (binding.equals(UIModule.LIST_ITEM_TEMPLATE_DEFAULT)) { return processDefaultTemplate(itemData, index); } CollectionViewTemplate template = listView.getTemplateByBinding(binding); //if template is successfully retrieved, bind it to the index. This is b/c //each row can have a different template. if (template == null) { Log.e(TAG, "Template undefined"); } return template; } else { //if a valid default template is specify, use that one if (defaultTemplateBinding != null && !defaultTemplateBinding.equals(UIModule.LIST_ITEM_TEMPLATE_DEFAULT)) { CollectionViewTemplate defTemplate = listView.getTemplateByBinding(defaultTemplateBinding); if (defTemplate != null) { return defTemplate; } } return processDefaultTemplate(itemData, index); } }
Example #21
Source File: ExampleProxy.java From NovarumBluetooth with MIT License | 5 votes |
@Override public void handleCreationDict(KrollDict options) { super.handleCreationDict(options); if (options.containsKey("message")) { Log.d(TAG, "example created with message: " + options.get("message")); } }
Example #22
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
/** * This method creates a new cell and fill it with content. getView() calls this method * when a view needs to be created. * @param index Entry's index relative to its section * @return */ public void generateCellContent(int sectionIndex, KrollDict data, CollectionViewTemplate template, BaseCollectionViewItem itemContent, int itemPosition, View item_layout) { //Here we create an item content and populate it with data //Get item proxy TiViewProxy itemProxy = template.getRootItem().getViewProxy(); //Create corresponding TiUIView for item proxy CollectionItem item = new CollectionItem(itemProxy, (TiCompositeLayout.LayoutParams)itemContent.getLayoutParams(), itemContent, item_layout); //Connect native view with TiUIView so we can get it from recycled view. itemContent.setTag(item); if (data != null && template != null) { generateChildContentViews(template.getRootItem(), null, itemContent, true); populateViews(data, itemContent, template, itemPosition, sectionIndex, item_layout); } }
Example #23
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
public KrollDict getCollectionItemData(int position) { if (isFilterOn()) { return listItemData.get(filterIndices.get(position)).getProperties(); } else if (position >= 0 && position < listItemData.size()) { return listItemData.get(position).getProperties(); } return null; }
Example #24
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public void insertItemsAt(int index, Object data) { if (!isIndexValid(index)) { return; } if (TiApplication.isUIThread()) { handleInsertItemsAt(index, data); } else { KrollDict d = new KrollDict(); d.put(TiC.PROPERTY_DATA, data); d.put(TiC.EVENT_PROPERTY_INDEX, index); TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_INSERT_ITEMS_AT), d); } }
Example #25
Source File: CollectionSectionProxy.java From TiCollectionView with MIT License | 5 votes |
@Kroll.method public KrollDict getItemAt(int index) { if (TiApplication.isUIThread()) { return handleGetItemAt(index); } else { return (KrollDict) TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_GET_ITEM_AT), index); } }
Example #26
Source File: DefaultCollectionViewTemplate.java From TiCollectionView with MIT License | 5 votes |
public void updateOrMergeWithDefaultProperties(KrollDict data, boolean update) { if (!data.containsKey(TiC.PROPERTY_PROPERTIES)) { Log.e(TAG, "Please use 'properties' binding for builtInTemplate"); if (!update) { //apply default behavior data.clear(); } return; } parseDefaultData(data); super.updateOrMergeWithDefaultProperties(data, update); }
Example #27
Source File: DatePickerProxy.java From TiDialogs with MIT License | 5 votes |
@Override public void processProperties(KrollDict d) { super.processProperties(d); Calendar c = Calendar.getInstance(); if (d.containsKey("value")) { c.setTime((Date) d.get("value")); year = c.get(Calendar.YEAR); month = c.get(Calendar.MONTH); day = c.get(Calendar.DAY_OF_MONTH); } else { if (d.containsKey("year")) { year = d.getInt("year"); } else { year = c.get(Calendar.YEAR); } if (d.containsKey("month")) { month = d.getInt("month"); } else { month = c.get(Calendar.MONTH); } if (d.containsKey("day")) { day = d.getInt("day"); } else { day = c.get(Calendar.DAY_OF_MONTH); } } if (d.containsKey("okButtonTitle")) { okButtonTitle = d.getString("okButtonTitle"); } else { okButtonTitle = this.proxy.getActivity().getApplication().getResources().getString(R.string.ok); } if (d.containsKey("cancelButtonTitle")) { cancelButtonTitle = d.getString("cancelButtonTitle"); } else { cancelButtonTitle = this.proxy.getActivity().getApplication().getResources().getString(R.string.cancel); } }
Example #28
Source File: CollectionItem.java From TiCollectionView with MIT License | 5 votes |
public void processProperties(KrollDict d) { if (d.containsKey(TiC.PROPERTY_ACCESSORY_TYPE)) { int accessory = TiConvert.toInt(d.get(TiC.PROPERTY_ACCESSORY_TYPE), -1); handleAccessory(accessory); } if (d.containsKey(TiC.PROPERTY_SELECTED_BACKGROUND_COLOR)) { d.put(TiC.PROPERTY_BACKGROUND_SELECTED_COLOR, d.get(TiC.PROPERTY_SELECTED_BACKGROUND_COLOR)); } if (d.containsKey(TiC.PROPERTY_SELECTED_BACKGROUND_IMAGE)) { d.put(TiC.PROPERTY_BACKGROUND_SELECTED_IMAGE, d.get(TiC.PROPERTY_SELECTED_BACKGROUND_IMAGE)); } super.processProperties(d); }
Example #29
Source File: DefaultCollectionViewTemplate.java From TiCollectionView with MIT License | 5 votes |
private void parseDefaultData(KrollDict data) { //for built-in template, we only process 'properties' key Iterator<String> bindings = data.keySet().iterator(); while (bindings.hasNext()) { String binding = bindings.next(); if (!binding.equals(TiC.PROPERTY_PROPERTIES)) { Log.e(TAG, "Please only use 'properties' key for built-in template", Log.DEBUG_MODE); bindings.remove(); } } KrollDict properties = data.getKrollDict(TiC.PROPERTY_PROPERTIES); KrollDict clone_properties = new KrollDict((HashMap)properties); if (clone_properties.containsKey(TiC.PROPERTY_TITLE)) { KrollDict text = new KrollDict(); text.put(TiC.PROPERTY_TEXT, TiConvert.toString(clone_properties, TiC.PROPERTY_TITLE)); data.put(TiC.PROPERTY_TITLE, text); if (clone_properties.containsKey(TiC.PROPERTY_FONT)) { text.put(TiC.PROPERTY_FONT, clone_properties.getKrollDict(TiC.PROPERTY_FONT).clone()); clone_properties.remove(TiC.PROPERTY_FONT); } if (clone_properties.containsKey(TiC.PROPERTY_COLOR)) { text.put(TiC.PROPERTY_COLOR, clone_properties.get(TiC.PROPERTY_COLOR)); clone_properties.remove(TiC.PROPERTY_COLOR); } clone_properties.remove(TiC.PROPERTY_TITLE); } if (clone_properties.containsKey(TiC.PROPERTY_IMAGE)) { KrollDict image = new KrollDict(); image.put(TiC.PROPERTY_IMAGE, TiConvert.toString(clone_properties, TiC.PROPERTY_IMAGE)); data.put(TiC.PROPERTY_IMAGE, image); clone_properties.remove(TiC.PROPERTY_IMAGE); } data.put(TiC.PROPERTY_PROPERTIES, clone_properties); }
Example #30
Source File: TimePickerProxy.java From TiDialogs with MIT License | 5 votes |
@Override protected void handleShow(KrollDict options) { super.handleShow(options); TiUIHelper.runUiDelayedIfBlock(new Runnable() { @Override public void run() { BasicDatePicker d = (BasicDatePicker) getOrCreateView(); d.show(); } }); }