當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。