GVKun编程网logo

reactjs – React Helmet:Facebook Open Graph

11

在本文中,我们将详细介绍reactjs–ReactHelmet:FacebookOpenGraph的各个方面,同时,我们也将为您带来关于com.facebook.model.OpenGraphActi

在本文中,我们将详细介绍reactjs – React Helmet:Facebook Open Graph的各个方面,同时,我们也将为您带来关于com.facebook.model.OpenGraphAction的实例源码、com.facebook.react.bridge.ReactMarker的实例源码、com.facebook.react.bridge.ReactMethod的实例源码、com.facebook.react.bridge.ReactTestHelper的实例源码的有用知识。

本文目录一览:

reactjs – React Helmet:Facebook Open Graph

reactjs – React Helmet:Facebook Open Graph

所以我已经在我的客户端应用程序上运行了反应头盔,根据应用程序中哪个页面处于活动状态,将facebook og标签重新渲染到头部.

但是facebook调试器和facebook本身并没有选择任何一个.我错过了什么吗?这只能用于服务器端渲染页面吗?

我希望不要因为我必须学习node.js!

<Helmet>
    <title>{props.title}</title>
    <Meta property="og:url" content={ogUrl} />
    <Meta property="og:type" content={props.type} />
    <Meta property="og:title" content={props.title} />
    <Meta property="og:description" content={props.desc} />
    <Meta property="og:image" content={ogImg} />
 </Helmet>
大多数搜索引擎和抓取工具直接使用服务器的响应,不允许您使用javascript更改它.所以是的,你需要的是服务器端渲染.

或者,您可以使用像gatsbyjs,react-static这样的工具.基本上,它们会事先将您的组件渲染为HTML文件.

com.facebook.model.OpenGraphAction的实例源码

com.facebook.model.OpenGraphAction的实例源码

项目:yelo-android    文件:FacebookDialog.java   
/**
 * Constructor.
 * @param activity the Activity which is presenting the native Open Graph action publish dialog;
 *                 must not be null
 * @param action the Open Graph action to be published,which must contain a reference to at least one
 *               Open Graph object with the property name specified by setPreviewPropertyName; the action
 *               must have had its type specified via the {@link OpenGraphAction#setType(String)} method
 * @param actionType the type of the Open Graph action to be published,which should be the namespace-qualified
 *                   name of the action type (e.g.,"myappnamespace:myactiontype"); this will override the type
 *                   of the action passed in.
 * @param previewPropertyName the name of a property on the Open Graph action that contains the
 *                            Open Graph object which will be displayed as a preview to the user
 */
@Deprecated
public OpenGraphActionDialogBuilder(Activity activity,OpenGraphAction action,String actionType,String previewPropertyName) {
    super(activity);

    Validate.notNull(action,"action");
    Validate.notNullOrEmpty(actionType,"actionType");
    Validate.notNullOrEmpty(previewPropertyName,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }
    String typeOnAction = action.getType();
    if (!Utility.isNullOrEmpty(typeOnAction) && !typeOnAction.equals(actionType)) {
        throw new IllegalArgumentException("'actionType' must match the type of 'action' if it is specified. " +
                "Consider using OpenGraphActionDialogBuilder(Activity activity," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:yelo-android    文件:FacebookDialog.java   
/**
 * Constructor.
 * @param activity the Activity which is presenting the native Open Graph action publish dialog;
 *                 must not be null
 * @param action the Open Graph action to be published,which must contain a reference to at least one
 *               Open Graph object with the property name specified by setPreviewPropertyName; the action
 *               must have had its type specified via the {@link OpenGraphAction#setType(String)} method
 * @param previewPropertyName the name of a property on the Open Graph action that contains the
 *                            Open Graph object which will be displayed as a preview to the user
 */
public OpenGraphActionDialogBuilder(Activity activity,"action");
    Validate.notNullOrEmpty(action.getType(),"action.getType()");
    Validate.notNullOrEmpty(previewPropertyName,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:BrillaMXAndroid    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,which must contain a reference to at least one
 *                            Open Graph object with the property name specified by setPreviewPropertyName; the action
 *                            must have had its type specified via the {@link OpenGraphAction#setType(String)} method
 * @param actionType          the type of the Open Graph action to be published,which should be the namespace-qualified
 *                            name of the action type (e.g.,"myappnamespace:myactiontype"); this will override the type
 *                            of the action passed in.
 * @param previewPropertyName the name of a property on the Open Graph action that contains the
 *                            Open Graph object which will be displayed as a preview to the user
 */
@Deprecated
public OpenGraphDialogBuilderBase(Activity activity,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }
    String typeOnAction = action.getType();
    if (!Utility.isNullOrEmpty(typeOnAction) && !typeOnAction.equals(actionType)) {
        throw new IllegalArgumentException("'actionType' must match the type of 'action' if it is specified. " +
                "Consider using OpenGraphDialogBuilderBase(Activity activity," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:BrillaMXAndroid    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,which must contain a reference to at least one
 *                            Open Graph object with the property name specified by setPreviewPropertyName; the action
 *                            must have had its type specified via the {@link OpenGraphAction#setType(String)} method
 * @param previewPropertyName the name of a property on the Open Graph action that contains the
 *                            Open Graph object which will be displayed as a preview to the user
 */
public OpenGraphDialogBuilderBase(Activity activity,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:TP-Formation-Android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:TP-Formation-Android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:AutoTimeHelper    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:AutoTimeHelper    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:BrainStudio    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:BrainStudio    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:QuizUpWinner    文件:FacebookDialog.java   
@Deprecated
public OpenGraphDialogBuilderBase(Activity paramActivity,OpenGraphAction paramOpenGraphAction,String paramString1,String paramString2)
{
  super();
  Validate.notNull(paramOpenGraphAction,"action");
  Validate.notNullOrEmpty(paramString1,"actionType");
  Validate.notNullOrEmpty(paramString2,"previewPropertyName");
  if (paramOpenGraphAction.getProperty(paramString2) == null)
    throw new IllegalArgumentException("A property named \"" + paramString2 + "\" was not found on the action.  The name of the preview property must match the name of an action property.");
  String str = paramOpenGraphAction.getType();
  if ((!Utility.isNullOrEmpty(str)) && (!str.equals(paramString1)))
    throw new IllegalArgumentException("'actionType' must match the type of 'action' if it is specified. Consider using OpenGraphDialogBuilderBase(Activity activity,String previewPropertyName) instead.");
  this.action = paramOpenGraphAction;
  this.actionType = paramString1;
  this.previewPropertyName = paramString2;
}
项目:Qtino.SharingKit    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:Qtino.SharingKit    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:smartenit    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:smartenit    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:ExerciseMe    文件:BadgeDialogFragment.java   
private void sharetoFB(Context context,String badgeName) {
    String description = context.getResources().getText(context.getResources()
            .getIdentifier(badgeName + "FB","string",context.getPackageName())).toString();

    String imgurL = context.getResources().getText(context.getResources()
            .getIdentifier(badgeName + "imgurL",context.getPackageName())).toString();

    if (FacebookDialog.canPresentOpenGraphActionDialog(context.getApplicationContext(),FacebookDialog.OpenGraphActionDialogFeature.OG_ACTION_DIALOG)) {
        OpenGraphObject badge = OpenGraphObject.Factory.createForPost
                (OpenGraphObject.class,"exercisemeapp:badge","I earned a new badge!",imgurL,null,description);
        OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
        action.setProperty("badge",badge);
        action.setType("exercisemeapp:earn");

        FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(getActivity(),action,"badge")
                .build();
        uiHelper.trackPendingDialogCall(shareDialog.present());
    } else {
        Toast.makeText(getActivity(),"Facebook not available",Toast.LENGTH_SHORT).show();
    }
}
项目:DualRunner    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:DualRunner    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:MeNextAndroid    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:MeNextAndroid    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:Classparticipation2    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:Classparticipation2    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:LostAndFound    文件:FacebookDialogTests.java   
public void testOpenGraphActionImageAttachments() throws JSONException {
    OpenGraphAction action = OpenGraphAction.Factory.createForPost("foo");
    action.setProperty("foo","bar");

    FacebookDialog.OpenGraphActionDialogBuilder builder =
            new FacebookDialog.OpenGraphActionDialogBuilder(getActivity(),"foo");

    Bitmap bitmap = Bitmap.createBitmap(20,20,Bitmap.Config.ALPHA_8);

    builder.setimageAttachmentsForAction(Arrays.asList(bitmap));

    List<JSONObject> images = action.getimage();
    assertNotNull(images);
    assertTrue(images.size() == 1);

    List<String> attachmentNames = builder.getimageAttachmentNames();
    assertNotNull(attachmentNames);
    assertTrue(attachmentNames.size() == 1);

    String attachmentName = getAttachmentNameFromContentUri(images.get(0).getString("url"));
    assertEquals(attachmentNames.get(0),attachmentName);
}
项目:LostAndFound    文件:FacebookDialogTests.java   
public void testOpenGraphObjectimageAttachments() throws JSONException {
    OpenGraphAction action = OpenGraphAction.Factory.createForPost("foo");
    OpenGraphObject object = OpenGraphObject.Factory.createForPost("bar");
    action.setProperty("foo",object);

    FacebookDialog.OpenGraphActionDialogBuilder builder =
            new FacebookDialog.OpenGraphActionDialogBuilder(getActivity(),Bitmap.Config.ALPHA_8);

    builder.setimageAttachmentsForObject("foo",Arrays.asList(bitmap));

    List<GraphObject> images = object.getimage();
    assertNotNull(images);
    assertTrue(images.size() == 1);

    List<String> attachmentNames = builder.getimageAttachmentNames();
    assertNotNull(attachmentNames);
    assertTrue(attachmentNames.size() == 1);

    String attachmentName = getAttachmentNameFromContentUri((String) images.get(0).getProperty("url"));
    assertEquals(attachmentNames.get(0),attachmentName);
}
项目:PetTinder    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:PetTinder    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:StoryTeller    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:StoryTeller    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:HereAStory-Android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:HereAStory-Android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:FacebookImageShareIntent    文件:FacebookDialogTests.java   
public void testOpenGraphActionImageAttachments() throws JSONException {
    OpenGraphAction action = OpenGraphAction.Factory.createForPost("foo");
    action.setProperty("foo",attachmentName);
}
项目:FacebookImageShareIntent    文件:FacebookDialogTests.java   
public void testOpenGraphObjectimageAttachments() throws JSONException {
    OpenGraphAction action = OpenGraphAction.Factory.createForPost("foo");
    OpenGraphObject object = OpenGraphObject.Factory.createForPost("bar");
    action.setProperty("foo",attachmentName);
}
项目:QuotesSocial    文件:MainPagelistFragment.java   
public static void sharetoFB(Activity activity,String quoteText,UiLifecycleHelper uiHelper) {
    if (FacebookDialog.canPresentOpenGraphActionDialog(activity.getApplicationContext(),FacebookDialog.OpenGraphActionDialogFeature.OG_ACTION_DIALOG)) {
        OpenGraphObject quote = OpenGraphObject.Factory.createForPost
                (OpenGraphObject.class,"speakeasydevfest:post","I loved this quote!","http://i.imgur.com/ec9p33P.jpg","\"" + quoteText + "\"");
        OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
        action.setProperty("quote",quote);
        action.setType("speakeasydevfest:love");
        FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(activity,"quote")
                .build();
        uiHelper.trackPendingDialogCall(shareDialog.present());
    } else {
        Toast.makeText(activity,Toast.LENGTH_SHORT).show();
    }
}
项目:Abelana-Android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:Abelana-Android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:localhost-android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:localhost-android    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:facebook-api-android-maven    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published," +
                "String previewPropertyName) instead.");
    }
    this.action = action;
    this.actionType = actionType;
    this.previewPropertyName = previewPropertyName;
}
项目:facebook-api-android-maven    文件:FacebookDialog.java   
/**
 * Constructor.
 *
 * @param activity            the Activity which is presenting the native Open Graph action publish dialog;
 *                            must not be null
 * @param action              the Open Graph action to be published,"previewPropertyName");
    if (action.getProperty(previewPropertyName) == null) {
        throw new IllegalArgumentException(
                "A property named \"" + previewPropertyName + "\" was not found on the action.  The name of " +
                        "the preview property must match the name of an action property.");
    }

    this.action = action;
    this.actionType = action.getType();
    this.previewPropertyName = previewPropertyName;
}
项目:yelo-android    文件:Request.java   
/**
 * Creates a new Request configured to publish an Open Graph action.
 *
 * @param session
 *            the Session to use,or null; if non-null,the session must be in an opened state
 * @param openGraphAction
 *            the Open Graph object to create; must not be null,and must have a non-empty 'type'
 * @param callback
 *            a callback that will be called when the request is completed to handle success or error conditions
 * @return a Request that is ready to execute
 */
public static Request newPostOpenGraphActionRequest(Session session,OpenGraphAction openGraphAction,Callback callback) {
    if (openGraphAction == null) {
        throw new FacebookException("openGraphAction cannot be null");
    }
    if (Utility.isNullOrEmpty(openGraphAction.getType())) {
        throw new FacebookException("openGraphAction must have non-null 'type' property");
    }

    String path = String.format(MY_ACTION_FORMAT,openGraphAction.getType());
    return newPostRequest(session,path,openGraphAction,callback);
}

com.facebook.react.bridge.ReactMarker的实例源码

com.facebook.react.bridge.ReactMarker的实例源码

项目:RNLearn_Project1    文件:LazyReactPackage.java   
@Override
public final List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  for (ModuleSpec holder : getNativeModules(reactContext)) {
    NativeModule nativeModule;
    SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"createNativeModule")
      .arg("module",holder.getType())
      .flush();
    try {
      ReactMarker.logMarker(
        ReactMarkerConstants.CREATE_MODULE_START,holder.getType().getSimpleName());
      nativeModule = holder.getProvider().get();
      ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_END);
    } finally {
      Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    }
    modules.add(nativeModule);
  }
  return modules;
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
@Override
protected Result<ReactApplicationContext> doInBackground(ReactContextinitParams... params) {
  // Todo(t11687218): Look over all threading
  // Default priority is Process.THREAD_PRIORITY_BACKGROUND which means we'll be put in a cgroup
  // that only has access to a small fraction of cpu time. The priority will be reset after
  // this task finishes: https://android.googlesource.com/platform/frameworks/base/+/d630f105e8bc0021541aacb4dc6498a49048ecea/core/java/android/os/AsyncTask.java#256
  Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);

  Assertions.assertCondition(params != null && params.length > 0 && params[0] != null);
  try {
    JavaScriptExecutor jsExecutor = params[0].getJsExecutorFactory().create();
    ReactApplicationContext reactApplicationContext =
      createReactContext(jsExecutor,params[0].getJsBundleLoader());
    ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_START);
    return Result.of(reactApplicationContext);
  } catch (Exception e) {
    // Pass exception to onPostExecute() so it can be handled on the main thread
    return Result.of(e);
  }
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
/**
 * Uses configured {@link ReactPackage} instances to create all view managers.
 */
public List<ViewManager> createallViewManagers(
    ReactApplicationContext catalystApplicationContext) {
  ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"createallViewManagers");
  try {
    List<ViewManager> allViewManagers = new ArrayList<>();
    for (ReactPackage reactPackage : mPackages) {
      allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
    }
    return allViewManagers;
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);
  }
}
项目:RNLearn_Project1    文件:ModuleHolder.java   
private NativeModule create() {
  SoftAssertions.assertCondition(mModule == null,"Creating an already created module.");
  ReactMarker.logMarker(CREATE_MODULE_START,mName);
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"createModule")
    .arg("name",mName)
    .flush();
  NativeModule module = assertNotNull(mProvider).get();
  mProvider = null;
  if (mInitializeNeeded) {
    doInitialize(module);
    mInitializeNeeded = false;
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  ReactMarker.logMarker(CREATE_MODULE_END);
  return module;
}
项目:RNLearn_Project1    文件:NativeModuleRegistry.java   
void notifyJSInstanceInitialized() {
  mReactApplicationContext.assertOnNativeModulesQueueThread("From version React Native v0.44," +
    "native modules are explicitly not initialized on the UI thread. See " +
    "https://github.com/facebook/react-native/wiki/Breaking-Changes#d4611211-reactnativeandroidbreaking-move-nativemodule-initialization-off-ui-thread---aaachiuuu " +
    " for more details.");
  ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START);
  Systrace.beginSection(
      Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,"NativeModuleRegistry_notifyJSInstanceInitialized");
  try {
    for (ModuleHolder module : mModules.values()) {
      module.initialize();
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_END);
  }
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
private UIManagerModule createUIManager(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_START);
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,"createUIManagerModule");
  try {
    List<ViewManager> viewManagersList = mReactInstanceManager.createallViewManagers(
      reactContext);
    return new UIManagerModule(
      reactContext,viewManagersList,mUIImplementationProvider,mLazyViewManagersEnabled);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_END);
  }
}
项目:RNLearn_Project1    文件:JavaModuleWrapper.java   
@DoNotStrip
public NativeArray getConstants() {
  BaseJavaModule baseJavaModule = getModule();
  ReactMarker.logMarker(GET_CONSTANTS_START,getName());
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"Map constants")
    .arg("moduleName",getName())
    .flush();
  Map<String,Object> map = baseJavaModule.getConstants();
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);

  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"WritableNativeMap constants")
    .arg("moduleName",getName())
    .flush();
  ReactMarker.logMarker(CONVERT_CONSTANTS_START,getName());
  WritableNativeMap writableNativeMap;
  try {
    writableNativeMap = Arguments.makeNativeMap(map);
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  }
  WritableNativeArray array = new WritableNativeArray();
  array.pushMap(writableNativeMap);
  ReactMarker.logMarker(CONVERT_CONSTANTS_END);
  ReactMarker.logMarker(GET_CONSTANTS_END);
  return array;
}
项目:Ironman    文件:XReactInstanceManagerImpl.java   
/**
 * Uses configured {@link ReactPackage} instances to create all view managers
 */
@Override
public List<ViewManager> createallViewManagers(
    ReactApplicationContext catalystApplicationContext) {
  ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"createallViewManagers");
  try {
    List<ViewManager> allViewManagers = new ArrayList<>();
    for (ReactPackage reactPackage : mPackages) {
      allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
    }
    return allViewManagers;
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);
  }
}
项目:Ironman    文件:ModuleHolder.java   
private NativeModule create() {
  boolean isEagerModule = mInfo instanceof LegacyModuleInfo;
  String name = isEagerModule ? ((LegacyModuleInfo) mInfo).mType.getSimpleName() : mInfo.name();
  if (!isEagerModule) {
    ReactMarker.logMarker(CREATE_MODULE_START);
  }
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,name)
    .flush();
  NativeModule module = assertNotNull(mProvider).get();
  if (mInitializeNeeded) {
    doInitialize(module);
    mInitializeNeeded = false;
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  if (!isEagerModule) {
    ReactMarker.logMarker(CREATE_MODULE_END);
  }
  return module;
}
项目:Ironman    文件:NativeModuleRegistry.java   
void notifyCatalystInstanceInitialized() {
  UiThreadUtil.assertOnUiThread();

  ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START);
  Systrace.beginSection(
      Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,"NativeModuleRegistry_notifyCatalystInstanceInitialized");
  try {
    for (ModuleHolder module : mModules.values()) {
      module.initialize();
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_END);
  }
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
private void runcreateReactContextOnNewThread(final ReactContextinitParams initParams) {
  if (mCurrentReactContext != null) {
    tearDownReactContext(mCurrentReactContext);
    mCurrentReactContext = null;
  }

  mCreateReactContextThread = new Thread(new Runnable() {
    @Override
    public void run() {
      try {
        final ReactApplicationContext reactApplicationContext = createReactContext(
          initParams.getJsExecutorFactory().create(),initParams.getJsBundleLoader());
        ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_START);
        UiThreadUtil.runOnUiThread(new Runnable() {
          @Override
          public void run() {
            mCreateReactContextThread = null;
            try {
              setupReactContext(reactApplicationContext);
            } catch (Exception e) {
              mDevSupportManager.handleException(e);
            }

            if (mPendingReactContextinitParams != null) {
              runcreateReactContextOnNewThread(mPendingReactContextinitParams);
              mPendingReactContextinitParams = null;
            }
          }
        });
      } catch (Exception e) {
        mDevSupportManager.handleException(e);
      }
    }
  });
  mCreateReactContextThread.setPriority(Thread.MAX_PRIORITY);
  mCreateReactContextThread.start();
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
private void setupReactContext(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_END);
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"setupReactContext");
  UiThreadUtil.assertOnUiThread();
  Assertions.assertCondition(mCurrentReactContext == null);
  mCurrentReactContext = Assertions.assertNotNull(reactContext);
  CatalystInstance catalystInstance =
      Assertions.assertNotNull(reactContext.getCatalystInstance());

  catalystInstance.initialize();
  mDevSupportManager.onNewReactContextCreated(reactContext);
  mMemoryPressureRouter.addMemoryPressureListener(catalystInstance);
  moveReactContextToCurrentLifecycleState();

  for (ReactRootView rootView : mAttachedRootViews) {
    attachMeasuredRootViewToInstance(rootView,catalystInstance);
  }

  ReactInstanceEventListener[] listeners =
    new ReactInstanceEventListener[mReactInstanceEventListeners.size()];
  listeners = mReactInstanceEventListeners.toArray(listeners);

  for (ReactInstanceEventListener listener : listeners) {
    listener.onReactContextinitialized(reactContext);
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_END);
}
项目:RNLearn_Project1    文件:UIManagerModule.java   
private static Map<String,Object> createConstants(
  List<ViewManager> viewManagerList,boolean lazyViewManagersEnabled) {
  ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_START);
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,"CreateUIManagerConstants");
  try {
    return UIManagerModuleConstantsHelper.createConstants(
      viewManagerList,lazyViewManagersEnabled);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_END);
  }
}
项目:RNLearn_Project1    文件:ModuleHolder.java   
private void doInitialize(NativeModule module) {
  SystraceMessage.Builder section =
    SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,"initialize");
  if (module instanceof CxxModuleWrapper) {
    section.arg("className",module.getClass().getSimpleName());
  } else {
    section.arg("name",mName);
  }
  section.flush();
  ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START,mName);
  module.initialize();
  ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_END);
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
项目:RNLearn_Project1    文件:JavaModuleWrapper.java   
@DoNotStrip
public @Nullable NativeArray getConstants() {
  if (!mModuleHolder.getHasConstants()) {
    return null;
  }
  BaseJavaModule baseJavaModule = getModule();
  ReactMarker.logMarker(GET_CONSTANTS_START,getName());
  WritableNativeMap writableNativeMap;
  try {
    writableNativeMap = Arguments.makeNativeMap(map);
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  }
  WritableNativeArray array = new WritableNativeArray();
  array.pushMap(writableNativeMap);
  ReactMarker.logMarker(CONVERT_CONSTANTS_END);
  ReactMarker.logMarker(GET_CONSTANTS_END);
  return array;
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public ReactModuleInfoProvider getReactModuleInfoProvider() {
  ReactMarker.logMarker(
    ReactMarkerConstants.CORE_REACT_PACKAGE_GET_REACT_MODULE_INFO_PROVIDER_START);
  // This has to be done via reflection or we break open source.
  ReactModuleInfoProvider reactModuleInfoProvider =
    LazyReactPackage.getReactModuleInfoProviderViaReflection(this);
  ReactMarker.logMarker(
    ReactMarkerConstants.CORE_REACT_PACKAGE_GET_REACT_MODULE_INFO_PROVIDER_END);
  return reactModuleInfoProvider;
}
项目:Ironman    文件:UIManagerModule.java   
private static Map<String,Object> createConstants(List<ViewManager> viewManagerList) {
  ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_START);
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,"CreateUIManagerConstants");
  try {
    return UIManagerModuleConstantsHelper.createConstants(viewManagerList);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_CONSTANTS_END);
  }
}
项目:Ironman    文件:XReactInstanceManagerImpl.java   
private void setupReactContext(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE,catalystInstance);
  }

  ReactInstanceEventListener[] listeners =
    new ReactInstanceEventListener[mReactInstanceEventListeners.size()];
  listeners = mReactInstanceEventListeners.toArray(listeners);

  for (ReactInstanceEventListener listener : listeners) {
    listener.onReactContextinitialized(reactContext);
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_END);
}
项目:Ironman    文件:CoreModulesPackage.java   
private UIManagerModule createUIManager(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_START);
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,mUIImplementationProvider);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_END);
  }
}
项目:RNLearn_Project1    文件:NativeModuleRegistryBuilder.java   
public void processpackage(ReactPackage reactPackage) {
  if (mLazyNativeModulesEnabled) {
    if (!(reactPackage instanceof LazyReactPackage)) {
      throw new IllegalStateException("Lazy native modules requires all ReactPackage to " +
        "inherit from LazyReactPackage");
    }

    LazyReactPackage lazyReactPackage = (LazyReactPackage) reactPackage;
    List<ModuleSpec> moduleSpecs = lazyReactPackage.getNativeModules(mReactApplicationContext);
    Map<Class,ReactModuleInfo> reactModuleInfoMap = lazyReactPackage.getReactModuleInfoProvider()
      .getReactModuleInfos();

    for (ModuleSpec moduleSpec : moduleSpecs) {
      Class<? extends NativeModule> type = moduleSpec.getType();
      ReactModuleInfo reactModuleInfo = reactModuleInfoMap.get(type);
      ModuleHolder moduleHolder;
      if (reactModuleInfo == null) {
        if (BaseJavaModule.class.isAssignableFrom(type)) {
          throw new IllegalStateException("Native Java module " + type.getSimpleName() +
            " should be annotated with @ReactModule and added to a @ReactModuleList.");
        }
        ReactMarker.logMarker(
          ReactMarkerConstants.CREATE_MODULE_START,moduleSpec.getType().getName());
        NativeModule module = moduleSpec.getProvider().get();
        ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_END);
        moduleHolder = new ModuleHolder(module);
      } else {
        moduleHolder = new ModuleHolder(
          reactModuleInfo.name(),reactModuleInfo.canOverrideExistingModule(),reactModuleInfo.supportsWebWorkers(),reactModuleInfo.needsEagerInit(),reactModuleInfo.hasConstants(),moduleSpec.getProvider());
      }

      String name = moduleHolder.getName();
      if (namesToType.containsKey(name)) {
        Class<? extends NativeModule> existingNativeModule = namesToType.get(name);
        if (!moduleHolder.getCanOverrideExistingModule()) {
          throw new IllegalStateException("Native module " + type.getSimpleName() +
            " tried to override " + existingNativeModule.getSimpleName() + " for module name " +
            name + ". If this was your intention,set canOverrideExistingModule=true");
        }

        mModules.remove(existingNativeModule);
      }

      namesToType.put(name,type);
      mModules.put(type,moduleHolder);
    }
  } else {
    FLog.d(
      ReactConstants.TAG,reactPackage.getClass().getSimpleName() +
        " is not a LazyReactPackage,falling back to old version.");
    List<NativeModule> nativeModules;
    if (reactPackage instanceof ReactInstancePackage) {
      ReactInstancePackage reactInstancePackage = (ReactInstancePackage) reactPackage;
      nativeModules = reactInstancePackage.createNativeModules(
          mReactApplicationContext,mReactInstanceManager);
    } else {
      nativeModules = reactPackage.createNativeModules(mReactApplicationContext);
    }
    for (NativeModule nativeModule : nativeModules) {
      addNativeModule(nativeModule);
    }
  }
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public void startProcesspackage() {
  ReactMarker.logMarker(PROCESS_CORE_REACT_PACKAGE_START);
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public void endProcesspackage() {
  ReactMarker.logMarker(PROCESS_CORE_REACT_PACKAGE_END);
}
项目:RNLearn_Project1    文件:NativeModuleRegistryBuilder.java   
public void processpackage(ReactPackage reactPackage) {
  if (mLazyNativeModulesEnabled) {
    if (!(reactPackage instanceof LazyReactPackage)) {
      throw new IllegalStateException("Lazy native modules requires all ReactPackage to " +
        "inherit from LazyReactPackage");
    }

    LazyReactPackage lazyReactPackage = (LazyReactPackage) reactPackage;
    List<ModuleSpec> moduleSpecs = lazyReactPackage.getNativeModules(mReactApplicationContext);
    Map<Class,mReactInstanceManager);
    } else {
      nativeModules = reactPackage.createNativeModules(mReactApplicationContext);
    }
    for (NativeModule nativeModule : nativeModules) {
      addNativeModule(nativeModule);
    }
  }
}

com.facebook.react.bridge.ReactMethod的实例源码

com.facebook.react.bridge.ReactMethod的实例源码

项目:react-native-android-text-to-speech    文件:RNAndroidTextToSpeechModule.java   
@ReactMethod 
public void getAvailableLocales(Promise promise) {
    if(notReady(promise)) return;

    try {
        WritableArray localeList = Arguments.createArray();
        Locale[] localesArray = Locale.getAvailableLocales();
        for(Locale locale: localesArray) {
            int isAvailable = tts.isLanguageAvailable(locale);
            if(isAvailable == TextToSpeech.LANG_COUNTRY_AVAILABLE) {
                WritableMap newLocale = returnMapForLocale(locale);
                localeList.pushMap(newLocale);
            }
        }

        promise.resolve(localeList);
    } catch(Exception e) {
        promise.reject("error","Unable to retrieve locales for getAvailableLocales()",e);
    }
}
项目:react-native-webrtc    文件:WebRTCModule.java   
@ReactMethod
public void mediaStreamTrackStop(final String id) {
    // Is this functionality equivalent to `mediaStreamTrackRelease()` ?
    // if so,we should merge this two and remove track from stream as well.
    MediaStreamTrack track = mMediaStreamTracks.get(id);
    if (track == null) {
        Log.d(TAG,"mediaStreamTrackStop() track is null");
        return;
    }
    track.setEnabled(false);
    if (track.kind().equals("video")) {
        removeVideoCapturer(id);
    }
    mMediaStreamTracks.remove(id);
    // What exactly does `detached` mean in doc?
    // see: https://www.w3.org/TR/mediacapture-streams/#track-detached
}
项目:react-native-webrtc    文件:WebRTCModule.java   
@ReactMethod
public void mediaStreamTrackRelease(final String streamId,final String _trackId) {
    MediaStream stream = mMediaStreams.get(streamId);
    if (stream == null) {
        Log.d(TAG,"mediaStreamTrackRelease() stream is null");
        return;
    }
    MediaStreamTrack track = mMediaStreamTracks.get(_trackId);
    if (track == null) {
        Log.d(TAG,"mediaStreamTrackRelease() track is null");
        return;
    }
    track.setEnabled(false); // should we do this?
    mMediaStreamTracks.remove(_trackId);
    if (track.kind().equals("audio")) {
        stream.removeTrack((AudioTrack)track);
    } else if (track.kind().equals("video")) {
        stream.removeTrack((VideoTrack)track);
        removeVideoCapturer(_trackId);
    }
    imagePorcessingHandler.removeCallbacksAndMessages(null);
    imageProcessingThread.quit();
}
项目:react-native-datecs-printer    文件:RNDatecsPrinterModule.java   
/**
 * Get list of paired devices
 *
 * @param promise
 */
@ReactMethod
public void getPairedDevices(Promise promise){
    Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
    // it might need to be an react.bridge.WritableArray
    ArrayList list = new ArrayList();
    for(BluetoothDevice device : pairedDevices){
        list.add(device);
    }

    if(list.size() > 0){
        promise.resolve(list);
    }else{
        promise.reject("Nenhum dispositivo pareado.");
    }
}
项目:react-native-ethereum    文件:TestNative.java   
@ReactMethod
public void test(String message,Callback cb) {
    try {
        android.util.Log.d("before","yay");
        NodeHolder nh = NodeHolder.getInstance();
        Node node = nh.getNode();
        Context ctx = new Context();
        if (node != null) {
            NodeInfo info = node.getNodeInfo();
            EthereumClient ethereumClient = node.getEthereumClient();
            Account newAcc = nh.getAcc();
            BigInt balanceAt = ethereumClient.getBalanceAt(ctx,new Address("0x22B84d5FFeA8b801C0422AFe752377A64Aa738c2"),-1);
            cb.invoke(balanceAt.toString() + " ether found address:" + newAcc.getAddress().getHex());
            return;
        }
        cb.invoke("node was null");
    } catch (Exception e) {
        android.util.Log.d("",e.getMessage());
        e.printstacktrace();
    }
}
项目:react-native-sync-adapter    文件:SyncAdapterModule.java   
@ReactMethod
public void syncImmediately(int syncInterval,int syncFlexTime) {
    boolean allowForeground = Boolean.valueOf(getReactApplicationContext().getString(R.string.rnsb_allow_foreground));

    if (!allowForeground && HeadlessService.isAppOnForeground(getReactApplicationContext())) {
        if (getCurrentActivity() != null) {
            Toast.makeText(
                    getCurrentActivity(),"This sync task has not been configured to run on the foreground!",Toast.LENGTH_SHORT)
                    .show();
        }
        return;
    }

    SyncAdapter.syncImmediately(getReactApplicationContext(),syncInterval,syncFlexTime);
}
项目:RNLearn_Project1    文件:LocationModule.java   
/**
 * Get the current position. This can return almost immediately if the location is cached or
 * request an update,which might take a while.
 *
 * @param options map containing optional arguments: timeout (millis),maximumAge (millis) and
 *        highAccuracy (boolean)
 */
@ReactMethod
public void getCurrentPosition(
    ReadableMap options,final Callback success,Callback error) {
  Locationoptions locationoptions = Locationoptions.fromreactMap(options);

  try {
    LocationManager locationManager =
        (LocationManager) getReactApplicationContext().getSystemService(Context.LOCATION_SERVICE);
    String provider = getValidProvider(locationManager,locationoptions.highAccuracy);
    if (provider == null) {
      error.invoke(PositionError.buildError(
              PositionError.PERMISSION_DENIED,"No location provider available."));
      return;
    }
    Location location = locationManager.getLastKNownLocation(provider);
    if (location != null &&
        SystemClock.currentTimeMillis() - location.getTime() < locationoptions.maximumAge) {
      success.invoke(locationToMap(location));
      return;
    }
    new SingleUpdateRequest(locationManager,provider,locationoptions.timeout,success,error)
        .invoke();
  } catch (SecurityException e) {
    throwLocationPermissionMissing(e);
  }
}
项目:react-native-apptentive-module    文件:RNApptentiveModule.java   
@ReactMethod
public void register(final String appKey,final String signature,final Promise promise)
{
    if (_initialised)
    {
        promise.reject(APPTENTIVE,"Apptentive is already initialised");
        return;
    }
    if (appKey == null || appKey.isEmpty())
    {
        promise.reject(APPTENTIVE,"Your appKey is empty");

        return;
    }
    if (signature == null || signature.isEmpty())
    {
        promise.reject(APPTENTIVE,"Your signature is empty");
        return;
    }

    Handler handler = new Handler(_application.getMainLooper());
    Runnable runnable = new Runnable()
    {
        @Override
        public void run()
        {
            Apptentive.register(_application,appKey,signature);
            promise.resolve(true);
            _initialised = true;
        }
    };
    handler.post(runnable);
}
项目:react-native-twilio-chat    文件:RCTTwilioChatPaginator.java   
@ReactMethod
public void requestNextPageChannelDescriptors(String sid,final Promise promise) {
    final RCTTwilioChatPaginator tmp = RCTTwilioChatPaginator.getInstance();
    Paginator<ChannelDescriptor> _paginator = (Paginator<ChannelDescriptor>)tmp.paginators.get(sid);

    _paginator.requestNextPage(new CallbackListener<Paginator<ChannelDescriptor>>() {
        @Override
        public void onError(ErrorInfo errorInfo) {
            super.onError(errorInfo);
            promise.reject("request-next-page","Error occurred while attempting to request the next page. Error Message: " + errorInfo.getErrorText());
        }

        @Override
        public void onSuccess(Paginator<ChannelDescriptor> paginator) {
            String uuid = RCTTwilioChatPaginator.setPaginator(paginator);
            promise.resolve(RCTConvert.Paginator(paginator,uuid,"ChannelDescriptor"));
        }
    });
}
项目:react-native-sunmi-inner-printer    文件:sunmiInnerPrinterModule.java   
/**
 * 退出缓冲模式
 *
 * @param commit: 是否打印出缓冲区内容
 */
@ReactMethod
public void exitPrinterBuffer(boolean commit) {
    final IWoyouService ss = woyouService;
    Log.i(TAG,"come: " + commit + " ss:" + ss);
    final boolean com = commit;
    ThreadPoolManager.getInstance().executeTask(new Runnable() {
        @Override
        public void run() {
            try {
                ss.exitPrinterBuffer(com);
            } catch (Exception e) {
                e.printstacktrace();
                Log.i(TAG,"ERROR: " + e.getMessage());
            }
        }
    });
}
项目:react-native-datecs-printer    文件:RNDatecsPrinterModule.java   
/**
    * Feed paper to the printer (roll out blank paper)
    *
    * @param linesQuantity
    * @param promise
    */
@ReactMethod
public void FeedPaper(int linesQuantity,Promise promise) {
    if (linesQuantity < 0 || linesQuantity > 255) {
        promise.reject("AMOUNT_LInes_0_255");
        return;
    }
    try {
        mPrinter.FeedPaper(linesQuantity);
        mPrinter.flush();

        promise.resolve("PAPER_FED");
    } catch (Exception e) {
        promise.reject("Erro: " + e.getMessage());
    }
}
项目:react-native-geth    文件:RNGethModule.java   
/**
 * Create and send transaction.
 *
 * @param passphrase Passphrase
 * @param nonce      Account nonce (use -1 to use last kNown nonce)
 * @param toAddress  Address destination
 * @param amount     Amount
 * @param gasLimit   Gas limit
 * @param gasPrice   Gas price
 * @param data
 * @param promise    Promise
 * @return Return String transaction
 */
@ReactMethod
public void createAndSendTransaction(String passphrase,double nonce,String toAddress,double amount,double gasLimit,double gasPrice,String data,Promise promise) {
    try {
        Account acc = GethHolder.getAccount();
        Address fromAddress = acc.getAddress();
        BigInt chain = new BigInt(GethHolder.getNodeConfig().getEthereumNetworkID());
        Context ctx = new Context();

        if (nonce == -1) {
          nonce = GethHolder.getNode().getEthereumClient().getPendingNonceAt(ctx,fromAddress);
        }

        Transaction tx = new Transaction(
                (long) nonce,new Address(toAddress),new BigInt((long) amount),new BigInt((long) gasLimit),new BigInt((long) gasPrice),data.getBytes("UTF8"));

        // Sign a transaction with a single authorization
        Transaction signed = GethHolder.getKeyStore().signTxPassphrase(acc,passphrase,tx,chain);
        // Send it out to the network.
        GethHolder.getNode().getEthereumClient().sendTransaction(ctx,signed);
        promise.resolve(tx.toString());
    } catch (Exception e) {
        promise.reject(NEW_TRANSACTION_ERROR,e);
    }
}
项目:FingerPrint-Authentication-With-react-native-android    文件:BiometricModule.java   
@ReactMethod
public void retrieveCredentials(Callback errorCallbackCred,Callback successCallbackCred) {

    //Read encrypted JSON from file system
    String encryptedJSONFromFile = readFromFile();

    //decrypt data from file system
    String decryptedJSON = decryptText(encryptedJSONFromFile);

    if (null != decryptedJSON) {
        try {
            JSONObject decryptedJSONObject = new JSONObject(decryptedJSON);
            successCallbackCred.invoke(decryptedJSONObject.toString());
        } catch (JSONException e) {
            e.printstacktrace();
            errorCallbackCred.invoke("Failed to retrieve Credentials");
        }
    } else {
        errorCallbackCred.invoke("Failed to retrieve Credentials");
    }
}
项目:react-native-touch-id-android    文件:FingerprintModule.java   
@ReactMethod
public void isSensorAvailable(final Promise promise) {

    response = Arguments.createMap();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (ActivityCompat.checkSelfPermission(mReactContext,Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
            sendResponse("Failed","You haven't allow this app to use your fingerprint sensor",promise);
            return;
        }

        if (mReactContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) ||
            ((FingerprintManager) mReactContext.getSystemService(Context.FINGERPRINT_SERVICE)).isHardwareDetected()) {
            if (((FingerprintManager) mReactContext.getSystemService(Context.FINGERPRINT_SERVICE)).hasEnrolledFingerprints()) {
                sendResponse("ok",null,promise);
            } else {
                sendResponse("Failed","You have fingerprint sensor,but you should set it enabled in your settings to use with this app",promise);
            }
        } else {
            sendResponse("Failed","You don\'t have appropriate hardware",promise);
        }
    } else {
        sendResponse("Failed",promise);
    }
}
项目:RNLearn_Project1    文件:CameraRollManager.java   
/**
 * Get photos from {@link MediaStore.Images},most recent first.
 *
 * @param params a map containing the following keys:
 *        <ul>
 *          <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 groupName = params.hasKey("groupName") ? params.getString("groupName") : 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,groupName,mimeTypes,promise)
        .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
项目:react-native-system-setting    文件:SystemSetting.java   
@ReactMethod
public void getAppBrightness(Promise promise) {
    final Activity curActivity = getCurrentActivity();
    if(curActivity == null) {
        return;
    }
    try {
        float result = curActivity.getwindow().getAttributes().screenBrightness;
        if(result < 0){
            int val = Settings.System.getInt(getReactApplicationContext().getContentResolver(),Settings.System.SCREEN_BRIGHTnesS);
            promise.resolve(val * 1.0f / 255);
        }else{
            promise.resolve(result);
        }
    } catch (Exception e) {
        e.printstacktrace();
        promise.reject("-1","get app's brightness fail",e);
    }
}
项目:react-native-andorid-shadow    文件:RNReactNativeAndoridShadowModule.java   
@ReactMethod
    public void applyShadowForView(final Integer tag,final ReadableMap param) {
        Log.d(TAG,"AndroidShadowManager applyShadowForView! tag: " + tag);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            return;
        }
        UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
        uiManager.addUIBlock(new UIBlock() {

            @Override
            public void execute(NativeViewHierarchyManager nvhm) {
                ReactViewGroup targetView = (ReactViewGroup) nvhm.resolveView(tag);
                Log.d(TAG,"AndroidShadowManager view w = " + targetView.getWidth() + " h = " + targetView.getHeight());
//                targetView.setBackgroundColor(Color.CYAN);
                targetView.getViewTreeObserver().addOnGlobalLayoutListener(new OutlineAdjuster(targetView,param));

            }
        });
    }
项目:react-native-pgp    文件:Module.java   
@ReactMethod
public void signData(final String privKeyData,final String password,final String data,Promise promise) {
  try {
    // region Decode Private Key
    PGPSecretKey secKey = PGPUtils.getSecretKey(privKeyData);
    PGPPrivateKey privKey = PGPUtils.decryptArmoredPrivateKey(secKey,password);
    // endregion
    // region Sign Data
    String signature = PGPUtils.signArmoredAscii(privKey,data,signatureAlgo);
    WritableMap resultMap = Arguments.createMap();
    resultMap.putString("asciiArmoredSignature",signature);
    resultMap.putString("hashingalgo",PGPUtils.hashAlgoToString(signatureAlgo));
    resultMap.putString("fingerPrint",Utils.bytesToHex(secKey.getPublicKey().getFingerprint()));
    promise.resolve(resultMap);
    // endregion
  } catch (Exception e) {
    promise.reject(e);
  }
}
项目:react-native-sunmi-inner-printer    文件:sunmiInnerPrinterModule.java   
/**
 * 进入缓冲模式,所有打印调用将缓存,调用commitPrinterBuffe()后打印
 *
 * @param clean: 是否清除缓冲区内容
 */
@ReactMethod
public void enterPrinterBuffer(boolean clean) {
    final IWoyouService ss = woyouService;
    Log.i(TAG,"come: " + clean + " ss:" + ss);
    final boolean c = clean;
    ThreadPoolManager.getInstance().executeTask(new Runnable() {
        @Override
        public void run() {
            try {
                ss.enterPrinterBuffer(c);
            } catch (Exception e) {
                e.printstacktrace();
                Log.i(TAG,"ERROR: " + e.getMessage());
            }
        }
    });
}
项目:react-native-stt    文件:RNSpeechToText.java   
@ReactMethod
public void createSpeechRecognizer(final Promise promise) {
  if (reactContext == null)
    throw new IllegalArgumentException("ReactApplicationContext must be defined!");

  if (mSpeechRecognizer != null) {
    mSpeechRecognizer.destroy();
    mSpeechRecognizer = null;
  }

  if (SpeechRecognizer.isRecognitionAvailable(reactContext)) {
    mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(reactContext);
    mSpeechRecognizer.setRecognitionListener(new SpeechRecognitionListener(
        this.reactContext.getJSModule(RCTNativeAppEventEmitter.class)
    ));
    promise.resolve(null);
  } else{
    promise.reject("error","SpeechRecognizer not available");
  }
}
项目:react-native-android-text-to-speech    文件:RNAndroidTextToSpeechModule.java   
@ReactMethod
public void setDefaultSpeechRate(float speechRate,Promise promise) {
    if(notReady(promise)) return;

    int result = tts.setSpeechRate(speechRate);
    if(result == TextToSpeech.SUCCESS) {
        WritableMap map = Arguments.createMap();
        map.putString("status","Success");
        map.putDouble("speechRate",(double)speechRate);
        promise.resolve(map);
    } else {
        promise.reject("error","Unable to set speech rate");
    }
}
项目:RNLearn_Project1    文件:NativeAnimatedModule.java   
@ReactMethod
public void extractAnimatednodeOffset(final int tag) {
  mOperations.add(new UIThreadOperation() {
    @Override
    public void execute(NativeAnimatednodesManager animatednodesManager) {
      animatednodesManager.extractAnimatednodeOffset(tag);
    }
  });
}
项目:ReactNativeAndroidAudioConverter    文件:ReactNativeAndroidAudioConverterModule.java   
/**
 * Function to convert a given audio file to MP3 format
 *
 * @param fileName        - input file name
 * @param errorCallback   - function called if the file Could not be converted
 * @param successCallback - function called if the conversion was successful
 */
@ReactMethod
public void convertAudioFile(String fileName,final Callback errorCallback,final Callback successCallback) {
    File flacFile = new File(Environment.getExternalStorageDirectory(),fileName);
    Log.d("Output file location",Environment.getExternalStorageDirectory().toString() + fileName);


    IConvertCallback callback = new IConvertCallback() {
        @Override
        public void onSuccess(File convertedFile) {
            // So fast? love it!
            Log.d("rnaac notice","convert success");
            successCallback.invoke("convert success");
        }

        @Override
        public void onFailure(Exception error) {
            // Oops! Something went wrong
            errorCallback.invoke("convert failure: " + error.toString());
            Log.d("rnaac notice",error.toString());
            error.printstacktrace();
        }
    };
    AndroidAudioConverter.with(this.getReactApplicationContext())
            // Your current audio file
            .setFile(flacFile)

            // Your desired audio format
            .setFormat(AudioFormat.MP3)

            // An callback to kNow when conversion is finished
            .setCallback(callback)

            // Start conversion
            .convert();
}
项目:react-native-webrtc    文件:WebRTCModule.java   
@ReactMethod
public void mediaStreamTrackSwitchCamera(final String id) {
    MediaStreamTrack track = mMediaStreamTracks.get(id);
    if (track != null) {
        VideoCapturer videoCapturer = mVideoCapturers.get(id);
        if (videoCapturer != null) {
            CameravideoCapturer cameravideoCapturer
                = (CameravideoCapturer) videoCapturer;
            cameravideoCapturer.switchCamera(null);
        }
    }
}
项目:react-native-get-sms-android    文件:SmsModule.java   
@ReactMethod
public void delete(Integer id,final Callback successCallback) {
    try {
        int res = context.getContentResolver().delete(Uri.parse("content://sms/" + id),null);
        if (res > 0) {
            successCallback.invoke("OK");
        } else {
            errorCallback.invoke("SMS not found");
        }
        return;
    } catch (Exception e) {
        errorCallback.invoke(e.getMessage());
        return;
    }
}
项目:react-native-ble-quick-sdk    文件:CommAdminBleRNI.java   
@ReactMethod
public void native_connect(String peripheralUUID,Callback successCallback,Callback failCallback) {
    //NSLog(@"native_connect entered");
    Log.d(LOG_TAG,"native_connect entered");

    //[mBleAdmin connect:peripheralUUID  successCallback: successCallback failCallback: failCallback];
    mBleAdmin.connect(peripheralUUID,successCallback,failCallback);
}
项目:RNLearn_Project1    文件:NativeAnimatedModule.java   
@ReactMethod
public void setAnimatednodeOffset(final int tag,final double value) {
  mOperations.add(new UIThreadOperation() {
    @Override
    public void execute(NativeAnimatednodesManager animatednodesManager) {
      animatednodesManager.setAnimatednodeOffset(tag,value);
    }
  });
}
项目:react-native-webrtc    文件:WebRTCModule.java   
@ReactMethod
public void createDataChannel(final int peerConnectionId,String label,ReadableMap config) {
    // Forward to PeerConnectionObserver which deals with DataChannels
    // because DataChannel is owned by PeerConnection.
    PeerConnectionObserver pco
        = mPeerConnectionObservers.get(peerConnectionId);
    if (pco == null || pco.getPeerConnection() == null) {
        Log.d(TAG,"createDataChannel() peerConnection is null");
    } else {
        pco.createDataChannel(label,config);
    }
}
项目:react-native-orientation-locker    文件:OrientationModule.java   
@ReactMethod
public void lockToLandscapeLeft() {
    final Activity activity = getCurrentActivity();
    if (activity == null) return;
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    this.isLocked = true;
}
项目:react-native-audio    文件:RCTAudio.java   
@ReactMethod
public void stop(final Integer key) {
  MediaPlayer player = this.playerPool.get(key);
  if (player != null && player.isPlaying()) {
    player.stop();
  }
}
项目:react-native-leancloud-sdk    文件:RNPushNotificationModule.java   
@ReactMethod
/**
 * Cancel scheduled notifications,and removes notifications from the notification centre.
 *
 * Note - as we are trying to achieve feature parity with iOS,this method cannot be used
 * to remove specific alerts from the notification centre.
 *
 * @see <a href="https://facebook.github.io/react-native/docs/pushnotificationios.html">RN docs</a>
 */
public void cancellocalnotifications(ReadableMap userInfo) {
    mRNPushNotificationHelper.cancelSchedulednotification(userInfo);
}
项目:react-native-android-text-to-speech    文件:RNAndroidTextToSpeechModule.java   
@ReactMethod
public void setDefaultPitch(float pitch,Promise promise) {
    if(notReady(promise)) return;

    int result = tts.setPitch(pitch);
    if(result == TextToSpeech.SUCCESS) {
        WritableMap map = Arguments.createMap();
        map.putString("status","Success");
        map.putDouble("pitch",(double)pitch);
        promise.resolve(map);
    } else {
        promise.reject("error","Unable to set pitch");
    }
}
项目:react-native-geth    文件:RNGethModule.java   
/**
 * Sets the default account at the given index in the listAccounts.
 *
 * @param accID   index in the listAccounts
 * @param promise Promise
 * @return Return true if sets.
 */
@ReactMethod
public void setAccount(Integer accID,Promise promise) {
    try {
        Account acc = GethHolder.getKeyStore().getAccounts().get(accID);
        GethHolder.setAccount(acc);
        //accounts.set(0,acc);
        promise.resolve(true);
    } catch (Exception e) {
        promise.reject(SET_ACCOUNT_ERROR,e);
    }
}
项目:react-native-app-settings    文件:OpenAppSettingsModule.java   
@ReactMethod
public void open() {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package",reactContext.getPackageName(),null);
    intent.setData(uri);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    reactContext.startActivity(intent);
}
项目:react-native-sunmi-inner-printer    文件:sunmiInnerPrinterModule.java   
/**
 * 打印机自检,打印机会打印自检页
 *
 * @param callback 回调
 */
@ReactMethod
public void printerSelfChecking(final Promise p) {
    final IWoyouService printerService = woyouService;
    ThreadPoolManager.getInstance().executeTask(new Runnable() {
        @Override
        public void run() {
            try {
                printerService.printerSelfChecking(new ICallback.Stub() {
                    @Override
                    public void onRunResult(boolean isSuccess) {
                        if (isSuccess) {
                            p.resolve(null);
                        } else {
                            p.reject("0",isSuccess + "");
                        }
                    }

                    @Override
                    public void onReturnString(String result) {
                        p.resolve(result);
                    }

                    @Override
                    public void onRaiseException(int code,String msg) {
                        p.reject("" + code,msg);
                    }
                });
            } catch (Exception e) {
                e.printstacktrace();
                Log.i(TAG,"ERROR: " + e.getMessage());
                p.reject("" + 0,e.getMessage());
            }
        }
    });
}
项目:react-native-geth    文件:RNGethModule.java   
/**
 * Exports as a JSON key,encrypted with new passphrase.
 *
 * @param creationPassphrase Passphrase
 * @param exportPassphrase   New passphrase
 * @param promise            Promise
 * @return Return key string
 */
@ReactMethod
public void exportKey(String creationPassphrase,String exportPassphrase,Promise promise) {
    try {
        Account acc = GethHolder.getAccount();
        if (acc != null) {
            byte[] key = GethHolder.getKeyStore().exportKey(acc,creationPassphrase,exportPassphrase);
            promise.resolve(key);
        } else {
            promise.reject(EXPORT_KEY_ERROR,"call method setAccount('accountId') before");
        }
    } catch (Exception e) {
        promise.reject(EXPORT_KEY_ERROR,e);
    }
}
项目:RNLearn_Project1    文件:UIManagerModule.java   
/**
 * Interface for adding/removing/moving views within a parent view from JS.
 *
 * @param viewTag the view tag of the parent view
 * @param moveFrom a list of indices in the parent view to move views from
 * @param moveto parallel to moveFrom,a list of indices in the parent view to move views to
 * @param addChildTags a list of tags of views to add to the parent
 * @param addAtIndices parallel to addChildTags,a list of indices to insert those children at
 * @param removeFrom a list of indices of views to permanently remove. The memory for the
 *        corresponding views and data structures should be reclaimed.
 */
@ReactMethod
public void manageChildren(
    int viewTag,@Nullable ReadableArray moveFrom,@Nullable ReadableArray moveto,@Nullable ReadableArray addChildTags,@Nullable ReadableArray addAtIndices,@Nullable ReadableArray removeFrom) {
  if (DEBUG) {
    FLog.d(
        ReactConstants.TAG,"(UIManager.manageChildren) tag: " + viewTag +
        ",moveFrom: " + moveFrom +
        ",moveto: " + moveto +
        ",addTags: " + addChildTags +
        ",atIndices: " + addAtIndices +
        ",removeFrom: " + removeFrom);
  }
  mUIImplementation.manageChildren(
      viewTag,moveFrom,moveto,addChildTags,addAtIndices,removeFrom);
}
项目:RNLearn_Project1    文件:LocationModule.java   
/**
 * Stop listening for location updates.
 *
 * NB: this is not balanced with {@link #startObserving}: any number of calls to that method will
 * be canceled by just one call to this one.
 */
@ReactMethod
public void stopObserving() {
  LocationManager locationManager =
      (LocationManager) getReactApplicationContext().getSystemService(Context.LOCATION_SERVICE);
  locationManager.removeUpdates(mLocationListener);
  mWatchedProvider = null;
}
项目:react-native-udesk    文件:UdeskModule.java   
@ReactMethod
public void initSDK(String appDomain,String appKey,String appId) {
    this.appDomain = appDomain;
    this.appKey = appKey;
    this.appId = appId;
    Udesksdkmanager.getInstance().initApiKey(mReactContext.getApplicationContext(),this.appDomain,this.appKey,this.appId);
    UdeskConfig.udeskTitlebarBgResId = cn.udesk.R.color.udesk_titlebar_bg;
}
项目:react-native-system-setting    文件:SystemSetting.java   
@ReactMethod
public void setVolume(float val,String type) {
    mContext.unregisterReceiver(volumeBR);
    int volType = getVolType(type);
    am.setStreamVolume(volType,(int) (val * am.getStreamMaxVolume(volType)),AudioManager.FLAG_PLAY_SOUND);
    mContext.registerReceiver(volumeBR,filter);
}

com.facebook.react.bridge.ReactTestHelper的实例源码

com.facebook.react.bridge.ReactTestHelper的实例源码

项目:ReactNativeSignatureExample    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),});
  displayMetrics displayMetrics = reactContext.getResources().getdisplayMetrics();
  displayMetricsHolder.setwindowdisplayMetrics(displayMetrics);
  displayMetricsHolder.setScreendisplayMetrics(displayMetrics);
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,viewManagers,new UIImplementation(reactContext,viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:ReactNativeSignatureExample    文件:ReactTextTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  displayMetrics displayMetrics = reactContext.getResources().getdisplayMetrics();
  displayMetricsHolder.setwindowdisplayMetrics(displayMetrics);
  displayMetricsHolder.setScreendisplayMetrics(displayMetrics);
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),new ReactRawTextManager(),});
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:react-native-ibeacon-android    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:react-native-ibeacon-android    文件:ReactTextTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  displayMetrics displayMetrics = reactContext.getResources().getdisplayMetrics();
  displayMetricsHolder.setwindowdisplayMetrics(displayMetrics);
  displayMetricsHolder.setScreendisplayMetrics(displayMetrics);
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:react-native-Box-loaders    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:react-native-Box-loaders    文件:ReactTextTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  displayMetrics displayMetrics = reactContext.getResources().getdisplayMetrics();
  displayMetricsHolder.setwindowdisplayMetrics(displayMetrics);
  displayMetricsHolder.setScreendisplayMetrics(displayMetrics);
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:RNLearn_Project1    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),new UIImplementationProvider(),false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:RNLearn_Project1    文件:ReactTextInputPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ReactTextInputManager();
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:RNLearn_Project1    文件:ReactSliderPropertyTest.java   
@Before
public void setup() {
  ReactApplicationContext mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  CatalystInstance mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ReactSliderManager();
}
项目:RNLearn_Project1    文件:ReactTextTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:RNLearn_Project1    文件:ReactimagePropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext,mContext);
  Fresco.initialize(mContext);
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:RNLearn_Project1    文件:ShareModuleTest.java   
@Before
public void prepareModules() throws Exception {
  powermockito.mockStatic(Arguments.class);
  Mockito.when(Arguments.createMap()).thenAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      return new JavaOnlyMap();
    }
  });

  mShareModule = new ShareModule(ReactTestHelper.createCatalystContextFortest());
}
项目:RNLearn_Project1    文件:SimpleViewPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ConcreteViewManager();
}
项目:ReactNativeSignatureExample    文件:ReactTextInputPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ReactTextInputManager();
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:ReactNativeSignatureExample    文件:ReactimagePropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext,mContext);
  Fresco.initialize(mContext);
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:ReactNativeSignatureExample    文件:SimpleViewPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ConcreteViewManager();
}
项目:react-native-ibeacon-android    文件:ReactTextInputPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ReactTextInputManager();
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:react-native-ibeacon-android    文件:ReactimagePropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext,mContext);
  Fresco.initialize(mContext);
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:react-native-ibeacon-android    文件:SimpleViewPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ConcreteViewManager();
}
项目:react-native-Box-loaders    文件:ReactTextInputPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ReactTextInputManager();
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:react-native-Box-loaders    文件:ReactimagePropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext,mContext);
  Fresco.initialize(mContext);
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:react-native-Box-loaders    文件:SimpleViewPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ConcreteViewManager();
}
项目:Ironman    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),new UIImplementationProvider());
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:Ironman    文件:ReactTextInputPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ReactTextInputManager();
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:Ironman    文件:ReactTextTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextFortest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),new UIImplementationProvider());
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:Ironman    文件:ReactimagePropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext,mContext);
  Fresco.initialize(mContext);
  displayMetricsHolder.setwindowdisplayMetrics(new displayMetrics());
}
项目:Ironman    文件:ShareModuleTest.java   
@Before
public void prepareModules() throws Exception {
  powermockito.mockStatic(Arguments.class);
  Mockito.when(Arguments.createMap()).thenAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      return new JavaOnlyMap();
    }
  });

  mShareModule = new ShareModule(ReactTestHelper.createCatalystContextFortest());
}
项目:Ironman    文件:SimpleViewPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext,mContext);
  mManager = new ConcreteViewManager();
}
项目:ReactNativeSignatureExample    文件:ClipboardModuleTest.java   
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextFortest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}
项目:react-native-ibeacon-android    文件:ClipboardModuleTest.java   
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextFortest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}
项目:react-native-Box-loaders    文件:ClipboardModuleTest.java   
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextFortest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}
项目:Ironman    文件:ClipboardModuleTest.java   
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextFortest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}

关于reactjs – React Helmet:Facebook Open Graph的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于com.facebook.model.OpenGraphAction的实例源码、com.facebook.react.bridge.ReactMarker的实例源码、com.facebook.react.bridge.ReactMethod的实例源码、com.facebook.react.bridge.ReactTestHelper的实例源码等相关内容,可以在本站寻找。

本文标签: