当前位置: 首页>>代码示例>>Java>>正文


Java KrollDict.containsKeyAndNotNull方法代码示例

本文整理汇总了Java中org.appcelerator.kroll.KrollDict.containsKeyAndNotNull方法的典型用法代码示例。如果您正苦于以下问题:Java KrollDict.containsKeyAndNotNull方法的具体用法?Java KrollDict.containsKeyAndNotNull怎么用?Java KrollDict.containsKeyAndNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.appcelerator.kroll.KrollDict的用法示例。


在下文中一共展示了KrollDict.containsKeyAndNotNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openURL

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
@Kroll.method
public boolean openURL(KrollDict options) {
	if ( (options != null) && options.containsKeyAndNotNull(Params.URL)) {
		Context context = TiApplication.getAppCurrentActivity();
		List<ResolveInfo> browsersList = Utils.allBrowsers(context);
		
		if (!browsersList.isEmpty()) {
			List<String> customTabBrowsers = getCustomTabBrowsers(context, browsersList);				
			
			// show supported browsers list or open directly if only 1 supported browser is available
			openCustomTab(context, customTabBrowsers, options);
	        
			return true;
			
		} else {
			Log.i(Params.LCAT, "No browsers available in this device.");
			return false;
		}
	}
	
	Log.i(Params.LCAT, "Check your paramters. URL parameter is mandatory.");
	return false;
}
 
开发者ID:prashantsaini1,项目名称:ti-chrometabs,代码行数:24,代码来源:TichrometabsModule.java

示例2: checkLatestEventInfoProperties

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
protected void checkLatestEventInfoProperties(KrollDict d)
{
    if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)
            || d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT))
    {
        String contentTitle = "";
        String contentText = "";
        PendingIntent contentIntent = null;
        if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)) {
            contentTitle = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TITLE);
        }
        if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT)) {
            contentText = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TEXT);
        }

        Context c = getActivity();
        if (c == null) {
            c = TiApplication.getInstance().getApplicationContext();
        }
        contentIntent = createDefaultIntent(c, d.getKrollDict(TiC.PROPERTY_DATA));

        notification.setLatestEventInfo(c, contentTitle, contentText, contentIntent);
    }
}
 
开发者ID:GregPerez83,项目名称:ti-gcm,代码行数:25,代码来源:GcmNotificationProxy.java

示例3: checkLatestEventInfoProperties

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
protected void checkLatestEventInfoProperties(KrollDict d)
{
	if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)
		|| d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT)) {
		String contentTitle = "";
		String contentText = "";
		if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TITLE)) {
			contentTitle = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TITLE);
			notificationBuilder.setContentTitle(contentTitle);
		}
		if (d.containsKeyAndNotNull(TiC.PROPERTY_CONTENT_TEXT)) {
			contentText = TiConvert.toString(d, TiC.PROPERTY_CONTENT_TEXT);
			notificationBuilder.setContentText(contentText);
		}	
	}
}
 
开发者ID:falkolab,项目名称:Ti.NotificationFactory,代码行数:17,代码来源:NotificationProxy.java

示例4: scrollToItem

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
@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);
	}
}
 
开发者ID:nuno,项目名称:TiCollectionView,代码行数:21,代码来源:CollectionViewProxy.java

示例5: getColor

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
public static int getColor(KrollDict options, String key) {
	if (options.containsKeyAndNotNull(key)) {
		return TiConvert.toColor( (String) options.get(key));
				
	} else {
		return getR("color.colorPrimary");
	}
}
 
开发者ID:prashantsaini1,项目名称:ti-chrometabs,代码行数:9,代码来源:Utils.java

示例6: processProperties

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
@Override
public void processProperties(KrollDict d) {
	super.processProperties(d);
	if(d.containsKeyAndNotNull("maxZoomValue"))
		maxZoom = d.getDouble("maxZoomValue").floatValue();
	if(d.containsKeyAndNotNull("minZoomValue"))
		minZoom = d.getDouble("minZoomValue").floatValue();
	
	Log.d("UIPinchView", minZoom + " " + maxZoom);
}
 
开发者ID:i42locaj,项目名称:titanium-android-pinchview,代码行数:11,代码来源:UIPinchView.java

示例7: 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

示例8: getString

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
public static String getString(KrollDict options, String key) {
	String value = "" + (options.containsKeyAndNotNull(key) ? options.get(key) : "");
	return value.trim();
}
 
开发者ID:prashantsaini1,项目名称:ti-chrometabs,代码行数:5,代码来源:Utils.java

示例9: getBool

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
public static boolean getBool(KrollDict options, String key) {
	return (Boolean) (options.containsKeyAndNotNull(key) ? options.get(key) : false);
}
 
开发者ID:prashantsaini1,项目名称:ti-chrometabs,代码行数:4,代码来源:Utils.java

示例10: getStringValue

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
private String getStringValue(KrollDict options, String key) {
	String value = "" + (options.containsKeyAndNotNull(key) ? options.get(key) : "");
	return value.trim();
}
 
开发者ID:prashantsaini1,项目名称:android-titanium-imagecropper,代码行数:5,代码来源:ImagecropModule.java

示例11: handleCreationDict

import org.appcelerator.kroll.KrollDict; //导入方法依赖的package包/类
@Override
public void handleCreationDict(KrollDict options) {
	super.handleCreationDict(options);

	if (options.containsKeyAndNotNull("color")) {
		color = TiConvert.toColor(options, "color");
	}

	if (options.containsKeyAndNotNull("sectionsCount")) {
		sectionsCount = TiConvert.toInt(options, "sectionsCount");
	}

	if (options.containsKeyAndNotNull("separatorLength")) {
		separatorLength = TiConvert.toInt(options, "separatorLength");
	}

	if (options.containsKeyAndNotNull("mirrorMode")) {
		mirrorMode = TiConvert.toBoolean(options, "mirrorMode");
	}
	if (options.containsKeyAndNotNull("reversed")) {
		reversed = TiConvert.toBoolean(options, "reversed");
	}

	if (options.containsKeyAndNotNull("speed")) {
		speed = TiConvert.toFloat(options, "speed");
	}

	if (options.containsKeyAndNotNull("strokeWidth")) {
		strokeWidth = TiConvert.toFloat(options, "strokeWidth");
	}

	if (options.containsKeyAndNotNull("interpolator")) {
		int i = TiConvert.toInt(options, "interpolator");

		if (i == 0) {
			interpolator = new LinearInterpolator();
		} else if (i == 1) {
			interpolator = new AccelerateInterpolator();
		} else if (i == 2) {
			interpolator = new DecelerateInterpolator();
		} else if (i == 3) {
			interpolator = new AccelerateDecelerateInterpolator();
		}
	}

}
 
开发者ID:artanisdesign,项目名称:ti-smoothprogressbar,代码行数:47,代码来源:SmoothProgressBarProxy.java


注:本文中的org.appcelerator.kroll.KrollDict.containsKeyAndNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。