Example usage for com.facebook.react.bridge JSApplicationIllegalArgumentException JSApplicationIllegalArgumentException

List of usage examples for com.facebook.react.bridge JSApplicationIllegalArgumentException JSApplicationIllegalArgumentException

Introduction

In this page you can find the example usage for com.facebook.react.bridge JSApplicationIllegalArgumentException JSApplicationIllegalArgumentException.

Prototype

public JSApplicationIllegalArgumentException(String detailMessage) 

Source Link

Usage

From source file:com.bottomsheetbehavior.ReactNestedScrollViewHelper.java

License:Open Source License

public static int parseOverScrollMode(String jsOverScrollMode) {
    if (jsOverScrollMode == null || jsOverScrollMode.equals(AUTO)) {
        return View.OVER_SCROLL_IF_CONTENT_SCROLLS;
    } else if (jsOverScrollMode.equals(OVER_SCROLL_ALWAYS)) {
        return View.OVER_SCROLL_ALWAYS;
    } else if (jsOverScrollMode.equals(OVER_SCROLL_NEVER)) {
        return View.OVER_SCROLL_NEVER;
    } else {/*from   www . j  a  va2  s .co  m*/
        throw new JSApplicationIllegalArgumentException("wrong overScrollMode: " + jsOverScrollMode);
    }
}

From source file:com.dylanvann.cameraroll.CameraRollManager.java

License:Open Source License

/**
 * Get photos from {@link MediaStore.Images}, most recent first.
 *
 * @param params a map containing the following keys:
 *        <ul>/*  w w  w .  jav a  2s.c o  m*/
 *          <li>first (mandatory): a number representing the number of photos to fetch</li>
 *          <li>
 *            after (optional): a cursor that matches page_info[end_cursor] returned by a
 *            previous call to {@link #getPhotos}
 *          </li>
 *          <li>groupName (optional): an album name</li>
 *          <li>
 *            mimeType (optional): restrict returned images to a specific mimetype (e.g.
 *            image/jpeg)
 *          </li>
 *        </ul>
 * @param promise the Promise to be resolved when the photos are loaded; for a format of the
 *        parameters passed to this callback, see {@code getPhotosReturnChecker} in CameraRoll.js
 */
@ReactMethod
public void getPhotos(final ReadableMap params, final Promise promise) {
    int first = params.getInt("first");
    String after = params.hasKey("after") ? params.getString("after") : null;
    String albumId = params.hasKey("albumId") ? params.getString("albumId") : null;
    ReadableArray mimeTypes = params.hasKey("mimeTypes") ? params.getArray("mimeTypes") : null;
    if (params.hasKey("groupTypes")) {
        throw new JSApplicationIllegalArgumentException("groupTypes is not supported on Android");
    }

    new GetPhotosTask(getReactApplicationContext(), first, after, albumId, mimeTypes, promise)
            .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

From source file:com.dylanvann.cameraroll.ImageEditingManager.java

License:Open Source License

/**
 * Crop an image. If all goes well, the success callback will be called with the file:// URI of
 * the new image as the only argument. This is a temporary file - consider using
 * CameraRollManager.saveImageWithTag to save it in the gallery.
 *
 * @param uri the MediaStore URI of the image to crop
 * @param options crop parameters specified as {@code {offset: {x, y}, size: {width, height}}}.
 *        Optionally this also contains  {@code {targetSize: {width, height}}}. If this is
 *        specified, the cropped image will be resized to that size.
 *        All units are in pixels (not DPs).
 * @param success callback to be invoked when the image has been cropped; the only argument that
 *        is passed to this callback is the file:// URI of the new image
 * @param error callback to be invoked when an error occurs (e.g. can't create file etc.)
 *///from   www  . ja va  2s .co  m
@ReactMethod
public void cropImage(String uri, ReadableMap options, final Callback success, final Callback error) {
    ReadableMap offset = options.hasKey("offset") ? options.getMap("offset") : null;
    ReadableMap size = options.hasKey("size") ? options.getMap("size") : null;
    if (offset == null || size == null || !offset.hasKey("x") || !offset.hasKey("y") || !size.hasKey("width")
            || !size.hasKey("height")) {
        throw new JSApplicationIllegalArgumentException("Please specify offset and size");
    }
    if (uri == null || uri.isEmpty()) {
        throw new JSApplicationIllegalArgumentException("Please specify a URI");
    }

    CropTask cropTask = new CropTask(getReactApplicationContext(), uri, (int) offset.getDouble("x"),
            (int) offset.getDouble("y"), (int) size.getDouble("width"), (int) size.getDouble("height"), success,
            error);
    if (options.hasKey("displaySize")) {
        ReadableMap targetSize = options.getMap("displaySize");
        cropTask.setTargetSize(targetSize.getInt("width"), targetSize.getInt("height"));
    }
    cropTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

From source file:com.horcrux.svg.RenderableShadowNode.java

License:Open Source License

@ReactProp(name = "fillRule", defaultInt = FILL_RULE_NONZERO)
public void setFillRule(int fillRule) {
    switch (fillRule) {
    case FILL_RULE_EVENODD:
        mFillRule = Path.FillType.EVEN_ODD;
        break;// www  .  j ava  2  s. c o  m
    case FILL_RULE_NONZERO:
        break;
    default:
        throw new JSApplicationIllegalArgumentException("fillRule " + mFillRule + " unrecognized");
    }

    mPath = null;
    markUpdated();
}

From source file:com.horcrux.svg.RenderableShadowNode.java

License:Open Source License

@ReactProp(name = "strokeLinecap", defaultInt = CAP_ROUND)
public void setStrokeLinecap(int strokeLinecap) {
    switch (strokeLinecap) {
    case CAP_BUTT:
        mStrokeLinecap = Paint.Cap.BUTT;
        break;//from   ww  w.j a v a2 s  . c  o m
    case CAP_SQUARE:
        mStrokeLinecap = Paint.Cap.SQUARE;
        break;
    case CAP_ROUND:
        mStrokeLinecap = Paint.Cap.ROUND;
        break;
    default:
        throw new JSApplicationIllegalArgumentException("strokeLinecap " + mStrokeLinecap + " unrecognized");
    }
    markUpdated();
}

From source file:com.horcrux.svg.RenderableShadowNode.java

License:Open Source License

@ReactProp(name = "strokeLinejoin", defaultInt = JOIN_ROUND)
public void setStrokeLinejoin(int strokeLinejoin) {
    switch (strokeLinejoin) {
    case JOIN_MITER:
        mStrokeLinejoin = Paint.Join.MITER;
        break;/* w  w w. j a  v  a2  s.  co  m*/
    case JOIN_BEVEL:
        mStrokeLinejoin = Paint.Join.BEVEL;
        break;
    case JOIN_ROUND:
        mStrokeLinejoin = Paint.Join.ROUND;
        break;
    default:
        throw new JSApplicationIllegalArgumentException("strokeLinejoin " + mStrokeLinejoin + " unrecognized");
    }
    markUpdated();
}

From source file:com.horcrux.svg.RenderableView.java

License:Open Source License

@ReactProp(name = "fillRule", defaultInt = FILL_RULE_NONZERO)
public void setFillRule(int fillRule) {
    switch (fillRule) {
    case FILL_RULE_EVENODD:
        this.fillRule = Path.FillType.EVEN_ODD;
        break;/*w w  w  .  ja  v a  2s.com*/
    case FILL_RULE_NONZERO:
        break;
    default:
        throw new JSApplicationIllegalArgumentException("fillRule " + this.fillRule + " unrecognized");
    }

    invalidate();
}

From source file:com.horcrux.svg.RenderableView.java

License:Open Source License

@ReactProp(name = "strokeLinecap", defaultInt = CAP_ROUND)
public void setStrokeLinecap(int strokeLinecap) {
    switch (strokeLinecap) {
    case CAP_BUTT:
        this.strokeLinecap = Paint.Cap.BUTT;
        break;//  w w  w.j  av a2 s .c o  m
    case CAP_SQUARE:
        this.strokeLinecap = Paint.Cap.SQUARE;
        break;
    case CAP_ROUND:
        this.strokeLinecap = Paint.Cap.ROUND;
        break;
    default:
        throw new JSApplicationIllegalArgumentException(
                "strokeLinecap " + this.strokeLinecap + " unrecognized");
    }
    invalidate();
}

From source file:com.horcrux.svg.RenderableView.java

License:Open Source License

@ReactProp(name = "strokeLinejoin", defaultInt = JOIN_ROUND)
public void setStrokeLinejoin(int strokeLinejoin) {
    switch (strokeLinejoin) {
    case JOIN_MITER:
        this.strokeLinejoin = Paint.Join.MITER;
        break;/*from  w  w w.java2 s  .  c om*/
    case JOIN_BEVEL:
        this.strokeLinejoin = Paint.Join.BEVEL;
        break;
    case JOIN_ROUND:
        this.strokeLinejoin = Paint.Join.ROUND;
        break;
    default:
        throw new JSApplicationIllegalArgumentException(
                "strokeLinejoin " + this.strokeLinejoin + " unrecognized");
    }
    invalidate();
}

From source file:com.horcrux.svg.RNSVGPathShadowNode.java

License:Open Source License

@ReactProp(name = "fillRule", defaultInt = FILL_RULE_NONZERO)
public void setFillRule(int fillRule) {
    switch (fillRule) {
    case FILL_RULE_EVENODD:
        mFillRule = Path.FillType.EVEN_ODD;
        break;//from   w w w.j ava 2  s . c om
    case FILL_RULE_NONZERO:
        break;
    default:
        throw new JSApplicationIllegalArgumentException("fillRule " + mFillRule + " unrecognized");
    }

    mFillRuleSet = true;
    setupPath();
    markUpdated();
}