本文整理匯總了Java中org.appcelerator.kroll.KrollDict.containsKey方法的典型用法代碼示例。如果您正苦於以下問題:Java KrollDict.containsKey方法的具體用法?Java KrollDict.containsKey怎麽用?Java KrollDict.containsKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.appcelerator.kroll.KrollDict
的用法示例。
在下文中一共展示了KrollDict.containsKey方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleCreationDict
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void handleCreationDict(KrollDict dict) {
super.handleCreationDict(dict);
if (dict.containsKey(PROPERTY_ID)) {
setId(TiConvert.toInt(dict, PROPERTY_ID));
} else {
throw new IllegalArgumentException("property 'id' is required");
}
if (dict.containsKey(PROPERTY_TITLE)) {
setTitle(TiConvert.toString(dict, PROPERTY_TITLE));
}
if (dict.containsKey(PROPERTY_TEXT)) {
setText(TiConvert.toString(dict, PROPERTY_TEXT));
}
if (dict.containsKey(PROPERTY_ICON)) {
setIcon(TiConvert.toInt(dict, PROPERTY_ICON));
}
if (dict.containsKey(PROPERTY_PENDING_INTENT)) {
setPendingIntent((PendingIntentProxy) dict.get(PROPERTY_PENDING_INTENT));
}
if (dict.containsKey(PROPERTY_NUMBER)) {
setNumber(TiConvert.toInt(dict, PROPERTY_NUMBER));
}
}
示例2: handleCreationDict
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void handleCreationDict(KrollDict options) {
super.handleCreationDict(options);
if (options.containsKey(TiC.PROPERTY_URL)) {
setProperty(TiC.PROPERTY_URL, resolveUrl(null, TiConvert.toString(options, TiC.PROPERTY_URL)));
}
if (options.containsKey(TiC.PROPERTY_ALLOW_BACKGROUND)) {
setProperty(TiC.PROPERTY_ALLOW_BACKGROUND, options.get(TiC.PROPERTY_ALLOW_BACKGROUND));
}
if(options.containsKey("speakerphone")) {
setProperty("speakerphone", TiConvert.toBoolean(options.get("speakerphone")));
}
if (DBG) {
Log.i(LCAT, "Creating audio player proxy for url: " + TiConvert.toString(getProperty("url")));
}
}
示例3: handleCreationDict
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void handleCreationDict(KrollDict d)
{
super.handleCreationDict(d);
if (d == null) {
return;
}
if (d.containsKey(NotificationfactoryModule.PROPERTY_BIG_TEXT)) {
setBigText(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_BIG_TEXT)));
}
if (d.containsKey(NotificationfactoryModule.PROPERTY_BIG_CONTENT_TITLE)) {
setBigContentTitle(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_BIG_CONTENT_TITLE)));
}
if (d.containsKey(NotificationfactoryModule.PROPERTY_SUMMARY_TEXT)) {
setSummaryText(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_SUMMARY_TEXT)));
}
}
示例4: handleCreationDict
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void handleCreationDict(KrollDict d)
{
super.handleCreationDict(d);
if (d == null) {
return;
}
if (d.containsKey(NotificationfactoryModule.PROPERTY_BIG_LARGE_ICON)) {
setBigLargeIcon(d.get(NotificationfactoryModule.PROPERTY_BIG_LARGE_ICON));
}
if (d.containsKey(NotificationfactoryModule.PROPERTY_BIG_PICTURE)) {
setBigPicture(d.get(NotificationfactoryModule.PROPERTY_BIG_PICTURE));
}
if (d.containsKey(NotificationfactoryModule.PROPERTY_BIG_CONTENT_TITLE)) {
setBigContentTitle(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_BIG_CONTENT_TITLE)));
}
if (d.containsKey(NotificationfactoryModule.PROPERTY_SUMMARY_TEXT)) {
setSummaryText(TiConvert.toString(d.get(NotificationfactoryModule.PROPERTY_SUMMARY_TEXT)));
}
}
示例5: 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);
}
示例6: processProperties
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@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");
}
}
示例7: processProperties
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@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")));
}
}
示例8: 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);
}
}
}
}
示例9: createPolyline
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
* <p>Draws a polyline on the map view.</p>
* Supported parameters:<br>
* latlngs Array<Array<Integer>> 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;
}
示例10: createPolygon
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
* <p>Draws a polygon on the map view.</p>
* Supported parameters:<br>
* latlngs Array<Array<Integer>> 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;
}
示例11: discoveryFinished
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
* @event bluetooth:discovery
* @param devices {object} Keys are device names and values are hardware addresses. Currently, only the name is used by this module.
* @since 1.0
*/
public void discoveryFinished(BluetoothDevice[] devices)
{
KrollDict allDevices = new KrollDict();
//Set<BluetoothDevice> bondedDevices = mBluetooth.findBondedDevices();
// add discovered devices to availableDevices
for(Integer j = 0; j < devices.length; j++)
{
if(devices[j] != null && !allDevices.containsKey(devices[j]))
{
try{
mBluetooth.startSdp(devices[j]);
}
catch(Exception e){
e.printStackTrace();
sendError(e.getMessage());
}
allDevices.put(devices[j].getName(), devices[j].getAddress());
}
}
// make sure it's a new Dict every time discovery occurs
mDevices = allDevices;
KrollDict props = new KrollDict();
props.put("devices", mDevices);
fireEvent(DISCOVERY_FINISHED, props);
}
示例12: handleCreationDict
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void handleCreationDict(KrollDict options)
{
super.handleCreationDict(options);
if (options.containsKey("message")) {
Log.d(LCAT, "example created with message: " + options.get("message"));
}
}
示例13: processProperties
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void processProperties(KrollDict d)
{
if (d.containsKey(PROPERTY_VOLUME)) {
setVolume(TiConvert.toFloat(d, PROPERTY_VOLUME));
} else {
setVolume(0.5f);
}
if (d.containsKey(TiC.PROPERTY_TIME)) {
setTime(TiConvert.toInt(d, TiC.PROPERTY_TIME));
}
}
示例14: initialize
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Kroll.method
public void initialize(KrollDict props) {
Log.d(LCAT, "TiIntercom : initialize()");
if (props.containsKey("api_key") && props.containsKey("app_id")) {
Intercom.initialize(theApp, props.getString("api_key"), props.getString("app_id"));
initialized = true;
} else {
Log.d(LCAT, "Intercom : intialize() requies api_key and app_id to be set");
}
}
示例15: processProperties
import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void processProperties(KrollDict d)
{
if (d.containsKey(TiC.PROPERTY_VIEWS)) {
setViews(d.get(TiC.PROPERTY_VIEWS));
}
if (d.containsKey(TiC.PROPERTY_CURRENT_PAGE)) {
int page = TiConvert.toInt(d, TiC.PROPERTY_CURRENT_PAGE);
if (page > 0) {
setCurrentPage(page);
}
}
if (d.containsKey(PROPERTY_ORIENTATION)) {
mFlipView.setOrientation((String) d.get(PROPERTY_ORIENTATION));
}
if (d.containsKey(PROPERTY_OVERFLIPMODE)) {
int mode = TiConvert.toInt(d, PROPERTY_OVERFLIPMODE);
if (mode == AndroidflipModule.OVERFLIPMODE_GLOW) {
mFlipView.setOverFlipMode(OverFlipMode.GLOW);
}
if (mode == AndroidflipModule.OVERFLIPMODE_RUBBER_BAND) {
mFlipView.setOverFlipMode(OverFlipMode.RUBBER_BAND);
}
}
setNativeView(mFlipView);
super.processProperties(d);
}