本文整理匯總了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;
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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");
}
}
示例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);
}
示例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.");
}
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
}
}