List of usage examples for com.facebook.react.bridge UiThreadUtil isOnUiThread
public static boolean isOnUiThread()
From source file:org.jitsi.meet.sdk.invite.InviteModule.java
License:Apache License
/** * Signals that a click/tap has been performed on {@code InviteButton} and * that the execution flow for adding/inviting people to the current * conference/meeting is to begin//from w ww . j a v a 2 s . co m * * @param externalAPIScope the unique identifier of the * {@code JitsiMeetView} whose {@code InviteButton} was clicked/tapped. */ @ReactMethod public void beginAddPeople(final String externalAPIScope) { // Make sure InviteControllerListener (like all other listeners of the // SDK) is invoked on the UI thread. It was requested by SDK consumers. if (!UiThreadUtil.isOnUiThread()) { UiThreadUtil.runOnUiThread(new Runnable() { @Override public void run() { beginAddPeople(externalAPIScope); } }); return; } InviteController inviteController = findInviteControllerByExternalAPIScope(externalAPIScope); if (inviteController != null) { inviteController.beginAddPeople(getReactApplicationContext()); } }
From source file:org.jitsi.meet.sdk.invite.InviteModule.java
License:Apache License
/** * Callback for invitation failures/*from w ww. j av a 2s . c o m*/ * * @param failedInvitees the items for which the invitation failed * @param addPeopleControllerScope a string that represents a connection to a specific AddPeopleController */ @ReactMethod public void inviteSettled(final String externalAPIScope, final String addPeopleControllerScope, final ReadableArray failedInvitees) { // Make sure AddPeopleControllerListener (like all other listeners of // the SDK) is invoked on the UI thread. It was requested by SDK // consumers. if (!UiThreadUtil.isOnUiThread()) { UiThreadUtil.runOnUiThread(new Runnable() { @Override public void run() { inviteSettled(externalAPIScope, addPeopleControllerScope, failedInvitees); } }); return; } InviteController inviteController = findInviteControllerByExternalAPIScope(externalAPIScope); if (inviteController == null) { Log.w("InviteModule", "Invite settled, but failed to find active controller to notify"); } else { inviteController.inviteSettled(addPeopleControllerScope, failedInvitees); } }
From source file:org.jitsi.meet.sdk.invite.InviteModule.java
License:Apache License
/** * Callback for results received from the JavaScript invite search call * * @param results the results in a ReadableArray of ReadableMap objects * @param query the query associated with the search * @param addPeopleControllerScope a string that represents a connection to a specific AddPeopleController *///from w w w. jav a 2s. c o m @ReactMethod public void receivedResults(final String externalAPIScope, final String addPeopleControllerScope, final String query, final ReadableArray results) { // Make sure AddPeopleControllerListener (like all other listeners of // the SDK) is invoked on the UI thread. It was requested by SDK // consumers. if (!UiThreadUtil.isOnUiThread()) { UiThreadUtil.runOnUiThread(new Runnable() { @Override public void run() { receivedResults(externalAPIScope, addPeopleControllerScope, query, results); } }); return; } InviteController inviteController = findInviteControllerByExternalAPIScope(externalAPIScope); if (inviteController == null) { Log.w("InviteModule", "Received results, but failed to find active controller to send results back"); } else { inviteController.receivedResultsForQuery(addPeopleControllerScope, query, results); } }
From source file:org.jitsi.meet.sdk.ListenerUtils.java
License:Apache License
/** * Executes the right listener method for the given event. * NOTE: This function will run asynchronously on the UI thread. * * @param listener - The listener on which the method will be called. * @param listenerMethods - Mapping with event names and the matching * methods.//from w w w . j a va 2 s . co m * @param eventName - Name of the event. * @param eventData - Data associated with the event. */ public static void runListenerMethod(final Object listener, final Map<String, Method> listenerMethods, final String eventName, final ReadableMap eventData) { // Make sure listener methods are invoked on the UI thread. It // was requested by SDK consumers. if (UiThreadUtil.isOnUiThread()) { runListenerMethodOnUiThread(listener, listenerMethods, eventName, eventData); } else { UiThreadUtil.runOnUiThread(new Runnable() { @Override public void run() { runListenerMethodOnUiThread(listener, listenerMethods, eventName, eventData); } }); } }