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


Java KrollDict.getString方法代碼示例

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


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

示例1: 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");
	}
}
 
開發者ID:brownemint,項目名稱:Ti-Android-CameraView,代碼行數:23,代碼來源:CameraViewProxy.java

示例2: openCustomTab

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
private void openCustomTab(Context context, List<String> customTabBrowsers, KrollDict options) {
	String URL = options.getString(Params.URL);
	URL = URL.toLowerCase();
	
	if (!URL.startsWith("http")) {
		URL = "http://" + URL;
	}
	
	CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
	builder.setShowTitle(Utils.getBool(options, Params.SHOW_TITLE));
	
	int color = Utils.getColor(options, Params.TOOLBAR_COLOR);
	if (color != -1) {
		builder.setToolbarColor(color);
	}
	
	// set start and exit animations
	if (Utils.getBool(options, Params.FADE_TRANSITION)) {
        builder.setStartAnimations(context, android.R.anim.fade_in, android.R.anim.fade_out);
        builder.setExitAnimations(context, android.R.anim.fade_in, android.R.anim.fade_out);
	}

       CustomTabsIntent tabIntent = builder.build();
       
       for(String s:customTabBrowsers) {
       	tabIntent.intent.setPackage(s);
       }
       
       tabIntent.launchUrl(context, Uri.parse(URL));
}
 
開發者ID:prashantsaini1,項目名稱:ti-chrometabs,代碼行數:31,代碼來源:TichrometabsModule.java

示例3: call

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public static void call(final KrollProxy proxy, HashMap args) {

		KrollDict argsDict = new KrollDict(args);
		int objectId = argsDict.getInt("objectId");
		Boolean isFolder = argsDict.getBoolean("isFolder");
		String message = argsDict.getString("message");
		
		final KrollFunction success = (KrollFunction)args.get("success");
		final KrollFunction error = (KrollFunction)args.get("error");
		
		final Box box = Box.getInstance(Constants.API_KEY);
	    box.addComment(Constants.getAuthToken(), isFolder?"folder":"file", objectId, message, new AddCommentListener() {
			
			@Override
			public void onIOException(IOException ex) {
				Util.handleIOException(proxy, ex, error);
			}
			
			@Override
			public void onComplete(Comment comment, String status) {
				if (status.equals("add_comment_ok")) {
					if (success != null)
						success.callAsync(proxy.getKrollObject(), new Object[] {});
				}
				else if (status.equals("add_comment_error")) {
					Util.handleError(proxy, "An error happened while we were adding your comment. Try again?", status, error);
				}
				else {
					Util.handleCommonStatuses(proxy, status, error);
				}
			}
		});
	}
 
開發者ID:appcelerator-archive,項目名稱:ti.box,代碼行數:34,代碼來源:AddComment.java

示例4: call

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public static void call(final KrollProxy proxy, HashMap args) {
	
	KrollDict argsDict = new KrollDict(args);
	int objectId = argsDict.getInt("objectId");
	Boolean isFolder = argsDict.getBoolean("isFolder");
	String password = argsDict.getString("password");
	String[] emailAddresses = argsDict.getStringArray("emailAddresses");
	String message = argsDict.getString("message");
	
    final KrollFunction success = (KrollFunction)args.get("success");
   	final KrollFunction error = (KrollFunction)args.get("error");
	
	final Box box = Box.getInstance(Constants.API_KEY);
    box.publicShare(Constants.getAuthToken(), isFolder?"folder":"file", objectId, password, message, emailAddresses, new PublicShareListener() {
		
		@Override
		public void onIOException(IOException ex) {
			Util.handleIOException(proxy, ex, error);
		}
		
		@Override
		public void onComplete(String publicName, String status) {
			if (status.equals("share_ok")) {
				if (success != null)
					success.callAsync(proxy.getKrollObject(), new Object[] {});
			}
			else if (status.equals("wrong_node")) {
				Util.handleError(proxy, "We weren't able to find what you tried to share in your account!", status, error);
			}
			else if (status.equals("share_error")) {
				Util.handleError(proxy, "An error happened while we were sharing your file. Try again?", status, error);
			}
			else {
				Util.handleCommonStatuses(proxy, status, error);
			}
		}
	});
}
 
開發者ID:appcelerator-archive,項目名稱:ti.box,代碼行數:39,代碼來源:PublicShare.java

示例5: call

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public static void call(final KrollProxy proxy, HashMap args) {

		KrollDict argsDict = new KrollDict(args);
		int objectId = argsDict.getInt("objectId");
		String fileURL = argsDict.getString("fileURL");
		TiBaseFile file = TiFileFactory.createTitaniumFile(fileURL, false);
		
	    final KrollFunction success = (KrollFunction)args.get("success");
    	final KrollFunction error = (KrollFunction)args.get("error");
		
		final Box box = Box.getInstance(Constants.API_KEY);
		box.download(Constants.getAuthToken(), objectId, file.getNativeFile(), null, new FileDownloadListener() {

			@Override
			public void onIOException(IOException e) {
				Util.handleIOException(proxy, e, error);
			}
			
			@Override
			public void onProgress(long percent) {
				// TODO We won't do anything with this quite yet. We can expose it in the future, though!
			}

			@Override
			public void onComplete(String status) {
				if (status.equals("download_ok"))
					if (success != null)
						success.callAsync(proxy.getKrollObject(), new Object[] {});
				if (status.equals("wrong auth token"))
					Util.handleError(proxy, "Your token has expired; please login again!", status, error);
				else if (status.equals("restricted"))
					Util.handleError(proxy, "You cannot access that file!", status, error);
				else
					Util.handleCommonStatuses(proxy, status, error);
			}
		});
	}
 
開發者ID:appcelerator-archive,項目名稱:ti.box,代碼行數:38,代碼來源:Download.java

示例6: call

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public static void call(final KrollProxy proxy, HashMap args) {
	
	KrollDict argsDict = new KrollDict(args);
	int objectId = argsDict.getInt("objectId");
	Boolean isFolder = argsDict.getBoolean("isFolder");
	String newName = argsDict.getString("newName");

    final KrollFunction success = (KrollFunction)args.get("success");
   	final KrollFunction error = (KrollFunction)args.get("error");
	
	final Box box = Box.getInstance(Constants.API_KEY);
    box.rename(Constants.getAuthToken(), isFolder?"folder":"file", objectId, newName, new RenameListener() {
		
		@Override
		public void onIOException(IOException ex) {
			Util.handleIOException(proxy, ex, error);
		}
		
		@Override
		public void onComplete(String status) {
			if (status.equals("s_rename_node")) {
				if (success != null)
					success.callAsync(proxy.getKrollObject(), new Object[] {});
			}
			else if (status.equals("e_rename_node")) {
				Util.handleError(proxy, "The name you specified may contain invalid characters. Please check it, and try again.", status, error);
			}
			else {
				Util.handleCommonStatuses(proxy, status, error);
			}
		}
	});
}
 
開發者ID:appcelerator-archive,項目名稱:ti.box,代碼行數:34,代碼來源:Rename.java

示例7: call

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public static void call(final KrollProxy proxy, HashMap args) {
	KrollDict argsDict = new KrollDict(args);
	String username = argsDict.getString("username");
	String password = argsDict.getString("password");

    final KrollFunction success = (KrollFunction)args.get("success");
   	final KrollFunction error = (KrollFunction)args.get("error");
    final Box box = Box.getInstance(Constants.API_KEY);
	box.registerNewUser(username, password, new RegisterNewUserListener() {

		@Override
		public void onIOException(IOException ex) {
			Util.handleIOException(proxy, ex, error);
		}
		
		@Override
		public void onComplete(User user, String status) {
			if (status.equals("successful_register")) {
				Util.saveAuthToken(user.getAuthToken());
				success.callAsync(proxy.getKrollObject(), new Object[] {});
			}
			else if (status.equals("email_invalid")) {
				Util.handleError(proxy, "The username you specified is not valid!", status, error);
			}
			else if (status.equals("email_already_registered")) {
				Util.handleError(proxy, "That username is already registered!", status, error);
			}
			else if (status.equals("e_register")) {
				Util.handleError(proxy, "The username or password you specified was not valid!", status, error);
			}
			else {
				Util.handleCommonStatuses(proxy, status, error);
			}
		}
	});
}
 
開發者ID:appcelerator-archive,項目名稱:ti.box,代碼行數:37,代碼來源:RegisterUser.java

示例8: call

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public static void call(final KrollProxy proxy, HashMap args) {
	
	KrollDict argsDict = new KrollDict(args);
	int objectId = argsDict.getInt("objectId");
	Boolean isFolder = argsDict.getBoolean("isFolder");
	String[] emailAddresses = argsDict.getStringArray("emailAddresses");
	String message = argsDict.getString("message");
	Boolean notifyWhenViewed = argsDict.getBoolean("notifyWhenViewed");
	
    final KrollFunction success = (KrollFunction)args.get("success");
   	final KrollFunction error = (KrollFunction)args.get("error");
	
	final Box box = Box.getInstance(Constants.API_KEY);
    box.privateShare(Constants.getAuthToken(), isFolder?"folder":"file", objectId, message, emailAddresses, notifyWhenViewed, new PrivateShareListener() {
		
		@Override
		public void onIOException(IOException ex) {
			Util.handleIOException(proxy, ex, error);
		}
		
		@Override
		public void onComplete(String status) {
			if (status.equals("private_share_ok")) {
				if (success != null)
					success.callAsync(proxy.getKrollObject(), new Object[] {});
			}
			else if (status.equals("wrong_node")) {
				Util.handleError(proxy, "We weren't able to find what you tried to share in your account!", status, error);
			}
			else if (status.equals("private_share_error")) {
				Util.handleError(proxy, "An error happened while we were sharing your file. Try again?", status, error);
			}
			else {
				Util.handleCommonStatuses(proxy, status, error);
			}
		}
	});
}
 
開發者ID:appcelerator-archive,項目名稱:ti.box,代碼行數:39,代碼來源:PrivateShare.java

示例9: updateButton

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
protected void updateButton(CompoundButton cb, KrollDict d) {
	if (d.containsKey(TiC.PROPERTY_TITLE_OFF)) {
		((Switch) cb).setTextOff(TiConvert.toString(d,
				TiC.PROPERTY_TITLE_OFF));
	}
	if (d.containsKey(TiC.PROPERTY_TITLE_ON)) {
		((Switch) cb).setTextOn(TiConvert.toString(d,
				TiC.PROPERTY_TITLE_ON));
	}
	if (d.containsKey(TiC.PROPERTY_VALUE)) {
		cb.setChecked(TiConvert.toBoolean(d, TiC.PROPERTY_VALUE));
	}
	if (d.containsKey(TiC.PROPERTY_COLOR)) {
		cb.setTextColor(TiConvert.toColor(d, TiC.PROPERTY_COLOR));
	}
	if (d.containsKey(TiC.PROPERTY_FONT)) {
		TiUIHelper.styleText(cb, d.getKrollDict(TiC.PROPERTY_FONT));
	}
	if (d.containsKey(TiC.PROPERTY_TEXT_ALIGN)) {
		String textAlign = d.getString(TiC.PROPERTY_TEXT_ALIGN);
		TiUIHelper.setAlignment(cb, textAlign, null);
	}
	if (d.containsKey(TiC.PROPERTY_VERTICAL_ALIGN)) {
		String verticalAlign = d.getString(TiC.PROPERTY_VERTICAL_ALIGN);
		TiUIHelper.setAlignment(cb, null, verticalAlign);
	}
	cb.invalidate();
}
 
開發者ID:dbankier,項目名稱:RealSwitch,代碼行數:29,代碼來源:RealSwitch.java

示例10: handleCreationDict

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void handleCreationDict(KrollDict options)
{
	super.handleCreationDict(options);
	
	if (options.containsKey("save_location")) {
		SAVE = options.getString("save_location");
	}
}
 
開發者ID:brownemint,項目名稱:Ti-Android-CameraView,代碼行數:10,代碼來源:CameraViewProxy.java

示例11: processProperties

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

	Calendar c = Calendar.getInstance();
	if (d.containsKey("value")) {
		c.setTime((Date) d.get("value"));
		hour = c.get(Calendar.HOUR_OF_DAY);
		minute = c.get(Calendar.MINUTE);
	} else {
		if (d.containsKey("hour")) {
			hour = d.getInt("hour");
		} else {
			hour = c.get(Calendar.HOUR_OF_DAY);
		}
		if (d.containsKey("minute")) {
			minute = d.getInt("minute");
		} else {
			minute = c.get(Calendar.MINUTE);
		}
	}

	if (d.containsKey("okButtonTitle")) {
		okButtonTitle = d.getString("okButtonTitle");
	} else {
		okButtonTitle =  this.proxy.getActivity().getApplication().getResources().getString(R.string.ok);
	}
	if (d.containsKey("cancelButtonTitle")) {
		cancelButtonTitle = d.getString("cancelButtonTitle");
	} else {
		cancelButtonTitle = this.proxy.getActivity().getApplication().getResources().getString(R.string.cancel);
	}
}
 
開發者ID:dbankier,項目名稱:TiDialogs,代碼行數:34,代碼來源:TimePickerProxy.java

示例12: processProperties

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
@Override
public void processProperties(KrollDict d) {
	super.processProperties(d);
	Calendar c = Calendar.getInstance();
	if (d.containsKey("value")) {
		c.setTime((Date) d.get("value"));
		year = c.get(Calendar.YEAR);
		month = c.get(Calendar.MONTH);
		day = c.get(Calendar.DAY_OF_MONTH);
	} else {
		if (d.containsKey("year")) {
			year = d.getInt("year");
		} else {
			year = c.get(Calendar.YEAR);
		}
		if (d.containsKey("month")) {
			month = d.getInt("month");
		} else {
			month = c.get(Calendar.MONTH);
		}
		if (d.containsKey("day")) {
			day = d.getInt("day");
		} else {
			day = c.get(Calendar.DAY_OF_MONTH);
		}
	}

	if (d.containsKey("okButtonTitle")) {
		okButtonTitle = d.getString("okButtonTitle");
	} else {
		okButtonTitle =  this.proxy.getActivity().getApplication().getResources().getString(R.string.ok);
	}
	if (d.containsKey("cancelButtonTitle")) {
		cancelButtonTitle = d.getString("cancelButtonTitle");
	} else {
		cancelButtonTitle = this.proxy.getActivity().getApplication().getResources().getString(R.string.cancel);
	}
}
 
開發者ID:dbankier,項目名稱:TiDialogs,代碼行數:39,代碼來源:DatePickerProxy.java

示例13: updateLayer

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
/**
 * <p>Update a layer currently in the LayerManager.</p>
 * This method removes the current layer and replaces it with
 *  a new one.
 * <p>Note! The old object is now useless and you need to update your
 * reference with the return value from this method!</p>
 * <p>Note! Only supports layers such as Polyline, Polygon etc.</p>
 * @param dict	the layer as returned on creation.
 */
@Kroll.method
public HashMap updateLayer(KrollDict dict) {
	debugMsg("updateLayer dict contains " + dict.toString());
	if (!dict.containsKey(KEY_ID)) {
		Log.e(TAG, "Could not find the layer ID!");
		return null;
	}
	if (!dict.containsKey(KEY_LAYERTYPE)) {
		Log.e(TAG, "Could not find the layer type!");
		return null;
	}
	int id = TiConvert.toInt(dict.get(KEY_ID));
	//First remove the old one
	if (!removeLayer(id)) {
		Log.e(TAG, "Could not update layer, does it exist?");
		return null;
	}
	//Create a new layer using the parameters supplied in
	//the argument (dict).
	String type = TiConvert.toString(dict.get(KEY_LAYERTYPE));
	if (type.equals(TYPE_CIRCLE)) {
		return createCircle(dict);
	} else if (type.equals(TYPE_MARKER)) {
		return createMarker(dict);
	} else if (type.equals(TYPE_POLYGON)) {
		return createPolygon(dict);
	} else if (type.equals(TYPE_POLYLINE)) {
		return createPolyline(dict);

	} else {
		throw new UnknownError("The layer type " + dict.getString(KEY_LAYERTYPE) + " is not defined!");
	}
}
 
開發者ID:snowciety,項目名稱:sc.mapsforge,代碼行數:43,代碼來源:MapsforgeViewProxy.java

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

示例15: call

import org.appcelerator.kroll.KrollDict; //導入方法依賴的package包/類
public static void call(final KrollProxy proxy, HashMap args) {

		KrollDict argsDict = new KrollDict(args);
		String name = argsDict.getString("name");
		int parentFolderId = argsDict.getInt("parentFolderId");

	    final KrollFunction success = (KrollFunction)args.get("success");
    	final KrollFunction error = (KrollFunction)args.get("error");
		
		final Box box = Box.getInstance(Constants.API_KEY);
	    box.createFolder(Constants.getAuthToken(), parentFolderId, name, false, new CreateFolderListener() {
			
			@Override
			public void onIOException(IOException ex) {
				Util.handleIOException(proxy, ex, error);
			}
			
			@Override
			public void onComplete(BoxFolder folder, String status) {
				if (status.equals("create_ok")) {
					if (success != null)
						success.callAsync(proxy.getKrollObject(), new Object[] {});
				}
				else if (status.equals("no_parent")) {
					Util.handleError(proxy, "The folder_id provided is not a valid folder_id for the user's account.", status, error);
				}
				else if (status.equals("s_folder_exists")) {
					Util.handleError(proxy, "A folder with the same name already exists in that location.", status, error);
				}
				else if (status.equals("invalid_folder_name")) {
					Util.handleError(proxy, "The name provided for the new folder contained invalid characters or too many characters.", status, error);
				}
				else if (status.equals("e_no_folder_name")) {
					Util.handleError(proxy, "Please provide a folder name.", status, error);
				}
				else if (status.equals("folder_name_too_big")) {
					Util.handleError(proxy, "The folder name you specified was too long! Please shorten it, and try again.", status, error);
				}
				else if (status.equals("e_input_params")) {
					Util.handleError(proxy, "An error happened while we were creating your folder. Please try again.", status, error);
				}
				else {
					Util.handleCommonStatuses(proxy, status, error);
				}
			}
		});
	}
 
開發者ID:appcelerator-archive,項目名稱:ti.box,代碼行數:48,代碼來源:CreateFolder.java


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