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