當前位置: 首頁>>代碼示例>>Java>>正文


Java KrollDict.get方法代碼示例

本文整理匯總了Java中org.appcelerator.kroll.KrollDict.get方法的典型用法代碼示例。如果您正苦於以下問題:Java KrollDict.get方法的具體用法?Java KrollDict.get怎麽用?Java KrollDict.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.appcelerator.kroll.KrollDict的用法示例。


在下文中一共展示了KrollDict.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateOrMergeWithDefaultProperties

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
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);
			}
		}
	}

}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:27,代碼來源:CollectionViewTemplate.java

示例2: generateDiffProperties

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
 * 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;
	
}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:31,代碼來源:ViewItem.java

示例3: CollectionItemData

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
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);
			}
		}
	}

}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:17,代碼來源:CollectionSectionProxy.java

示例4: signin

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Kroll.method
public void signin(KrollDict props)
{
	if (props.containsKey("success")) {
		successCallback = (KrollFunction) props.get("success");
	}
	if (props.containsKey("error")) {
		errorCallback = (KrollFunction) props.get("error");
	}
	

	String[] accountTypes = new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE };
	Intent intent = AccountPicker.newChooseAccountIntent(null, null,
			accountTypes, false, null, null, null, null);

	Activity activity = TiApplication.getAppCurrentActivity();
	TiActivitySupport support = (TiActivitySupport) activity;
	requestCode = support.getUniqueResultCode();
	support.launchActivityForResult(intent, requestCode, this);

}
 
開發者ID:Sitata,項目名稱:titanium_google_auth_util,代碼行數:22,代碼來源:TitaniumGoogleAuthUtilModule.java

示例5: createPolyline

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
 * <p>Draws a polyline on the map view.</p>
 * Supported parameters:<br>
 * latlngs Array&lt;Array&lt;Integer&gt;&gt; Like [ [45,12], [45,13] ]<br>
 * color String Supported colors are: black, blue, green, red, transparent, white.<br>
 * strokeWidth Integer
 * @param dict	dictionary with key-value pairs: {key:value}.
 */
@Kroll.method
public HashMap createPolyline(KrollDict dict) {
	containsKey(dict, KEY_COORDINATES);
	
	Object[] coordinates = (Object[]) dict.get(KEY_COORDINATES);
	List<LatLong> geom = coordinatesToList(coordinates);
	Color color = Color.RED;
	float strokeWidth = 0;
	
	if (dict.containsKey(KEY_COLOR)) {
		color = Color.valueOf(dict.get(KEY_COLOR).toString().toUpperCase());
	}
	if (dict.containsKey(KEY_STROKEWIDTH)) {
		strokeWidth = TiConvert.toFloat(dict.get(KEY_STROKEWIDTH));
	}
			
	int id = mView.createPolyline(geom, color, strokeWidth);
	dict.put(KEY_ID, id);
	dict.put(KEY_LAYERTYPE, TYPE_POLYLINE);
	
	return dict;
}
 
開發者ID:snowciety,項目名稱:sc.mapsforge,代碼行數:31,代碼來源:MapsforgeViewProxy.java

示例6: createPolygon

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
 * <p>Draws a polygon on the map view.</p>
 * Supported parameters:<br>
 * latlngs Array&lt;Array&lt;Integer&gt;&gt; Like [ [45,12], [45,13] ]<br>
 * fillColor String Supported colors are: black, blue, green, red, transparent, white.<br>
 * strokeColor String Supported colors are: black, blue, green, red, transparent, white.<br>
 * strokeWidth Integer
 * @param dict	dictionary with key-value pairs: {key:value}.
 */
@Kroll.method
public HashMap createPolygon(KrollDict dict) {
	containsKey(dict, KEY_COORDINATES);
	
	Object[] coordinates = (Object[]) dict.get(KEY_COORDINATES);
	List<LatLong> geom = coordinatesToList(coordinates);
	Color fillColor = Color.TRANSPARENT;
	Color strokeColor = Color.BLACK;
	float strokeWidth = 0;
	if (dict.containsKey(KEY_FILLCOLOR)) {
		fillColor = Color.valueOf(dict.get(KEY_FILLCOLOR).toString().toUpperCase());
	}
	if (dict.containsKey(KEY_STROKECOLOR)) {
		strokeColor = Color.valueOf(dict.get(KEY_STROKECOLOR).toString().toUpperCase());
	}
	if (dict.containsKey(KEY_STROKEWIDTH)) {
		strokeWidth = TiConvert.toFloat(dict.get(KEY_STROKEWIDTH));
	}
	
	int id = mView.createPolygon(geom, fillColor, strokeColor, strokeWidth);
	dict.put(KEY_ID, id);
	dict.put(KEY_LAYERTYPE, TYPE_POLYGON);

	return dict;
}
 
開發者ID:snowciety,項目名稱:sc.mapsforge,代碼行數:35,代碼來源:MapsforgeViewProxy.java

示例7: initBeacon

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Kroll.method
public void initBeacon(HashMap args){
	KrollDict arg = new KrollDict(args);
	success =(KrollFunction) arg.get("success");
	region=(KrollFunction) arg.get("region");
	error =(KrollFunction) arg.get("error");
	found =(KrollFunction) arg.get("found");
	seconds=arg.optInt("interval",60);
}
 
開發者ID:renegaat,項目名稱:LBi_dmexco_android,代碼行數:10,代碼來源:TibeaconModule.java

示例8: bindProxiesAndProperties

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
private DataItem bindProxiesAndProperties(KrollDict properties, boolean isRootTemplate, DataItem parent) {
	Object proxy = null;
	String id = null;
	Object props = null;
	DataItem item = null;
	if (properties.containsKey(TiC.PROPERTY_TI_PROXY)) {
		proxy = properties.get(TiC.PROPERTY_TI_PROXY);
	}

	//Get/generate random bind id
	if (isRootTemplate) {
		id = itemID;	
	} else if (properties.containsKey(TiC.PROPERTY_BIND_ID)) {
		id = TiConvert.toString(properties, TiC.PROPERTY_BIND_ID);
	} else {
		id = GENERATED_BINDING + Math.random();
	}
	

	if (proxy instanceof TiViewProxy) {
		TiViewProxy viewProxy = (TiViewProxy) proxy;
		if (isRootTemplate) {
			rootItem = item = new DataItem(viewProxy, TiC.PROPERTY_PROPERTIES, null);
		} else {
			item = new DataItem(viewProxy, id, parent);
			parent.addChild(item);
		}
		dataItems.put(id, item);
	}

	if (properties.containsKey(TiC.PROPERTY_PROPERTIES)) {
		props = properties.get(TiC.PROPERTY_PROPERTIES);
	}
	
	if (props instanceof HashMap) {
		item.setDefaultProperties(new KrollDict((HashMap)props));
	}

	return item;
}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:41,代碼來源:CollectionViewTemplate.java

示例9: processTemplates

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
protected void processTemplates(KrollDict templates) {
	for (String key : templates.keySet()) {
		//Here we bind each template with a key so we can use it to look up later
		KrollDict properties = new KrollDict((HashMap)templates.get(key));
		CollectionViewTemplate template = new CollectionViewTemplate(key, properties);
		//Set type to template, for recycling purposes.
		template.setType(getItemType());
		templatesByBinding.put(key, template);
		//set parent of root item
		template.setRootParent(proxy);
	}
}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:13,代碼來源:CollectionView.java

示例10: fireItemClick

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
private void fireItemClick(String event, Object data)
{
	if (event.equals(TiC.EVENT_CLICK) && data instanceof HashMap) {
		KrollDict eventData = new KrollDict((HashMap) data);
		Object source = eventData.get(TiC.EVENT_PROPERTY_SOURCE);
		if (source != null && !source.equals(this) && listProxy != null) {
			TiViewProxy listViewProxy = listProxy.get();
			if (listViewProxy != null) {
				listViewProxy.fireEvent(TiC.EVENT_ITEM_CLICK, eventData);
			}
		}
	}
}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:14,代碼來源:CollectionItemProxy.java

示例11: handleCreationDict

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public void handleCreationDict(KrollDict options) {
	super.handleCreationDict(options);
	//Adding sections to preload sections, so we can handle appendSections/insertSection
	//accordingly if user call these before TiListView is instantiated.
	if (options.containsKey(TiC.PROPERTY_SECTIONS)) {
		Object obj = options.get(TiC.PROPERTY_SECTIONS);
		if (obj instanceof Object[]) {
			addPreloadSections((Object[]) obj, -1, true);
		}
	}
}
 
開發者ID:nuno,項目名稱:TiCollectionView,代碼行數:12,代碼來源:CollectionViewProxy.java

示例12: handleCreationDict

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void handleCreationDict(KrollDict dict) {
	super.handleCreationDict(dict);

	String[] options = null;
	View view = null;

	if (dict.containsKey(PROPERTY_OPTIONS)) {
		options = dict.getStringArray(PROPERTY_OPTIONS);
	}
	if (options == null) {
		throw new IllegalArgumentException("'options' is required");
	}

	if (dict.containsKey(PROPERTY_VIEW)) {
		Object v = dict.get(PROPERTY_VIEW);
		if (v instanceof TiViewProxy) {
			TiViewProxy vp = (TiViewProxy) v;
			view = vp.getOrCreateView().getOuterView();
		}

		if (v instanceof MenuItemProxy) {
			view = getActivity().findViewById(((MenuItemProxy) v).getItemId());
		}
	}
	if (view == null) {
		throw new IllegalArgumentException("'view' is required");
	}
	
	mPopupMenu = new PopupMenu(getActivity(), view);
	
	mPopupMenu.setOnMenuItemClickListener(this);
	mPopupMenu.setOnDismissListener(this);
	
	int i = 0;
	for (String option : options) {
		mPopupMenu.getMenu().add(Menu.NONE, Menu.NONE, i++, option);
	}
	
}
 
開發者ID:azwan082,項目名稱:nc_popup_android,代碼行數:41,代碼來源:PopupMenuProxy.java

示例13: initCrittercism

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
private void initCrittercism(KrollDict dict) {

		

			String apiKey = (String) dict.get("apiKey");
			Log.d(TAG, apiKey);
			// Create the CrittercismConfig instance.
			CrittercismConfig config = new CrittercismConfig();
			
			Boolean includeVersionName = (Boolean)dict.get("includeVersionName");
			Boolean includeVersionCode = (Boolean)dict.get("includeVersionCode");
			
			
			if (includeVersionName!=null && includeVersionName) {
				// set the custom version name.
				try {
					config.setCustomVersionName(currentActivity
							.getPackageManager().getPackageInfo(
									currentActivity.getPackageName(), 0).versionName);
				} catch (NameNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}

			if (includeVersionCode!=null && includeVersionCode) {
				// Set the custom version name.
				config.setVersionCodeToBeIncludedInVersionString(true);
			}
			// Initialize.
			Crittercism.initialize(currentActivity.getApplicationContext(),
					apiKey, config);

			
				Crittercism.setUsername((String) dict.get("userName"));
			
		}
 
開發者ID:shivakumars,項目名稱:Titanium-Crittercism-Android,代碼行數:38,代碼來源:CrittercismModule.java

示例14: createCircle

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
 * <p>Draws a circle on the map view.</p>
 * Supported parameters:<br>
 * latlng Array&lt;Integer&gt; Like [45,12]<br>
 * fillColor String Supported colors are: black, blue, green, red, transparent, white.<br>
 * strokeColor String Supported colors are: black, blue, green, red, transparent, white.<br>
 * strokeWidth Integer<br>
 * radius Integer Radius of the circle in meters.
 * @param dict	dictionary with key-value pairs: {key:value}.
 */
@Kroll.method
public HashMap createCircle(KrollDict dict) {
	containsKey(dict, KEY_COORDINATE);
	
	Object[] coordinate = (Object[]) dict.get(KEY_COORDINATE);
	double lat = TiConvert.toDouble(coordinate[0]);
	double lon = TiConvert.toDouble(coordinate[1]);
	LatLong latLong = new LatLong(lat, lon);
	
	Color fillColor = Color.RED;
	Color strokeColor = Color.BLACK;
	float strokeWidth = 0;
	float radius = 0;
	if (dict.containsKey(KEY_FILLCOLOR)) {
		fillColor = Color.valueOf(dict.get(KEY_FILLCOLOR).toString().toUpperCase());
	}
	if (dict.containsKey(KEY_STROKECOLOR)) {
		strokeColor = Color.valueOf(dict.get(KEY_STROKECOLOR).toString().toUpperCase());
	}
	if (dict.containsKey(KEY_STROKEWIDTH)) {
		strokeWidth = TiConvert.toFloat(dict.get(KEY_STROKEWIDTH));
	}
	if (dict.containsKey(KEY_RADIUS)) {
		radius = TiConvert.toFloat(dict.get(KEY_RADIUS));
	}
	
	if (radius < 0) {
		throw new IllegalArgumentException("Parameter 'radius' can not be <0!");
	}
	
	int id = mView.createCircle(latLong, radius, fillColor, strokeColor, strokeWidth);
	dict.put(KEY_ID, id);
	dict.put(KEY_LAYERTYPE, TYPE_CIRCLE);

	return dict;
}
 
開發者ID:snowciety,項目名稱:sc.mapsforge,代碼行數:47,代碼來源:MapsforgeViewProxy.java

示例15: createCustomGallery

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Kroll.method
public void createCustomGallery(KrollDict options) {
	if ( (options != null) && options.containsKeyAndNotNull(Defaults.Params.IMAGES) ) {
		Object[] imageArray = (Object []) options.get(Defaults.Params.IMAGES);
		int size = imageArray.length;
		
		if (size != 0) { 
			ArrayList<ImageViewerInfo> imagesInfo = new ArrayList<ImageViewerInfo>();
			
			for (int i=0; i<size; i++) {
				Object o = imageArray[i];
				KrollDict info = new KrollDict((HashMap<String, Object>) o);
				
				if ( (info != null) && info.containsKeyAndNotNull(Defaults.Params.IMAGE_PATH) ) {
					String path = info.getString(Defaults.Params.IMAGE_PATH);
					String title = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE) ? info.getString(Defaults.Params.IMAGE_TITLE) : "";
					String titleColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_COLOR) : Defaults.IMAGE_TITLE_COLOR;		
					String titleBgColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) : Defaults.IMAGE_TITLE_BACKGROUND_COLOR;		
					
					imagesInfo.add(new ImageViewerInfo(path, title, titleColor, titleBgColor));
				}
			}
			
			if (imagesInfo.size() > 0) {
				Activity activity = TiApplication.getAppCurrentActivity();
				
				Intent intent = new Intent(activity, ImageViewerActivity.class);
				intent = prepareExtrasForIntent(intent, options, false);
				intent.putParcelableArrayListExtra(Defaults.Params.IMAGES, imagesInfo);
				
				activity.startActivity(intent);
			}
			
		} else {
			Log.e(Defaults.LCAT, "No images passed.");
		}
		
	} else {
		Log.e(Defaults.LCAT, "No options passed.");
	}
}
 
開發者ID:prashantsaini1,項目名稱:titanium-android-imagepicker,代碼行數:43,代碼來源:ImagepickerModule.java


注:本文中的org.appcelerator.kroll.KrollDict.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。