[Android] Naming
This commit is contained in:
parent
a266a71999
commit
a5cd118550
|
@ -97,7 +97,7 @@ display a Jitsi Meet conference (or a welcome page).
|
|||
|
||||
#### getListener()
|
||||
|
||||
Returns the `JitsiMeetView.Listener` instance attached to the view.
|
||||
Returns the `JitsiMeetViewListener` instance attached to the view.
|
||||
|
||||
#### loadURL(url)
|
||||
|
||||
|
@ -106,7 +106,7 @@ is displayed instead.
|
|||
|
||||
#### setListener(listener)
|
||||
|
||||
Sets the given listener (class implementing the `JitsiMeetView.Listener`
|
||||
Sets the given listener (class implementing the `JitsiMeetViewListener`
|
||||
interface) on the view.
|
||||
|
||||
#### onBackPressed()
|
||||
|
@ -144,10 +144,16 @@ activity's `onNewIntent` method.
|
|||
|
||||
This is a static method.
|
||||
|
||||
#### Listener
|
||||
#### JitsiMeetViewListener
|
||||
|
||||
JitsiMeetView.Listener provides an interface apps can implement in order to get
|
||||
notified about the state of the Jitsi Meet conference.
|
||||
`JitsiMeetViewListener` provides an interface apps can implement to listen to
|
||||
the state of the Jitsi Meet conference displayed in a `JitsiMeetView`.
|
||||
|
||||
### JitsiMeetViewAdapter
|
||||
|
||||
A default implementation of the `JitsiMeetViewListener` interface. Apps may
|
||||
extend the class instead of implementing the interface in order to minimize
|
||||
boilerplate.
|
||||
|
||||
##### onConferenceFailed
|
||||
|
||||
|
@ -180,10 +186,3 @@ The `data` HashMap contains a "url" key with the conference URL.
|
|||
Called before a conference is left.
|
||||
|
||||
The `data` HashMap contains a "url" key with the conference URL.
|
||||
|
||||
### JitsiMeetViewAbstractListener
|
||||
|
||||
Utility (abstract) class with stub methods for the `JitsiMeetView.Listener`
|
||||
interface. Applications can innherit from this class instead of implementing
|
||||
the interface in order to avoid adding stubs for methods they don't care about.
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/build
|
|
@ -46,7 +46,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
public static final int OVERLAY_PERMISSION_REQ_CODE = 4242;
|
||||
|
||||
/**
|
||||
* Instance of the {@JitsiMeetView} which this activity will display.
|
||||
* Instance of the {@link JitsiMeetView} which this activity will display.
|
||||
*/
|
||||
private JitsiMeetView view;
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.facebook.react.ReactRootView;
|
|||
import com.facebook.react.common.LifecycleState;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class JitsiMeetView extends FrameLayout {
|
||||
/**
|
||||
|
@ -43,7 +42,7 @@ public class JitsiMeetView extends FrameLayout {
|
|||
* Reference to the single instance of this class we currently allow. It's
|
||||
* currently used for fetching the instance from the listener's callbacks.
|
||||
*
|
||||
* TODO: lift this limitation.
|
||||
* TODO: Lift this limitation.
|
||||
*/
|
||||
private static JitsiMeetView instance;
|
||||
|
||||
|
@ -54,10 +53,10 @@ public class JitsiMeetView extends FrameLayout {
|
|||
private static ReactInstanceManager reactInstanceManager;
|
||||
|
||||
/**
|
||||
* {@JitsiMeetView.Listener} instance for reporting events occurring in
|
||||
* {@link JitsiMeetViewListener} instance for reporting events occurring in
|
||||
* Jitsi Meet.
|
||||
*/
|
||||
private JitsiMeetView.Listener listener;
|
||||
private JitsiMeetViewListener listener;
|
||||
|
||||
/**
|
||||
* React Native root view.
|
||||
|
@ -90,18 +89,19 @@ public class JitsiMeetView extends FrameLayout {
|
|||
/**
|
||||
* Returns the only instance of this class we currently allow creating.
|
||||
*
|
||||
* @returns The {@JitsiMeetView} instance.
|
||||
* @returns The {@code JitsiMeetView} instance.
|
||||
*/
|
||||
public static JitsiMeetView getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the {@JitsiMeetView.Listener} set on this view.
|
||||
* Gets the {@link JitsiMeetViewListener} set on this {@code JitsiMeetView}.
|
||||
*
|
||||
* @returns The {@JitsiMeetView.Listener} instance.
|
||||
* @returns The {@code JitsiMeetViewListener} set on this
|
||||
* {@code JitsiMeetView}.
|
||||
*/
|
||||
public Listener getListener() {
|
||||
public JitsiMeetViewListener getListener() {
|
||||
return listener;
|
||||
}
|
||||
|
||||
|
@ -160,11 +160,13 @@ public class JitsiMeetView extends FrameLayout {
|
|||
}
|
||||
|
||||
/**
|
||||
* Setter for the {@JitsiMeetView.Listener} set on this view.
|
||||
* Sets a specific {@link JitsiMeetViewListener} on this
|
||||
* {@code JitsiMeetView}.
|
||||
*
|
||||
* @param listener - Listener for this view.
|
||||
* @param listener - The {@code JitsiMeetViewListener} to set on this
|
||||
* {@code JitsiMeetView}.
|
||||
*/
|
||||
public void setListener(Listener listener) {
|
||||
public void setListener(JitsiMeetViewListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
|
@ -237,46 +239,4 @@ public class JitsiMeetView extends FrameLayout {
|
|||
reactInstanceManager.onNewIntent(intent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for listening to events coming from Jitsi Meet.
|
||||
*/
|
||||
public interface Listener {
|
||||
/**
|
||||
* Called when joining a conference fails or an ongoing conference is
|
||||
* interrupted due to a failure.
|
||||
*
|
||||
* @param data - HashMap with an "error" key describing the problem, and
|
||||
* a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceFailed(HashMap<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called when a conference was joined.
|
||||
*
|
||||
* @param data - HashMap with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceJoined(HashMap<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called when the conference was left, typically after hanging up.
|
||||
*
|
||||
* @param data - HashMap with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceLeft(HashMap<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called before the conference is joined.
|
||||
*
|
||||
* @param data - HashMap with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceWillJoin(HashMap<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called before the conference is left.
|
||||
*
|
||||
* @param data - HashMap with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceWillLeave(HashMap<String, Object> data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,51 +16,45 @@
|
|||
|
||||
package org.jitsi.meet.sdk;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class provides a reference implementation for {@JitsiMeetView.Listener} so applications
|
||||
* don't need to add stubs for all methods in the interface if they are only interested in some.
|
||||
* Implements {@link JitsiMeetViewListener} so apps don't have to add stubs for
|
||||
* all methods in the interface if they are only interested in some.
|
||||
*/
|
||||
public abstract class JitsiMeetViewAbstractListener implements JitsiMeetView.Listener {
|
||||
|
||||
public abstract class JitsiMeetViewAdapter implements JitsiMeetViewListener {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceFailed(HashMap<String, Object> data) {
|
||||
|
||||
public void onConferenceFailed(Map<String, Object> data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceJoined(HashMap<String, Object> data) {
|
||||
|
||||
public void onConferenceJoined(Map<String, Object> data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceLeft(HashMap<String, Object> data) {
|
||||
|
||||
public void onConferenceLeft(Map<String, Object> data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceWillJoin(HashMap<String, Object> data) {
|
||||
|
||||
public void onConferenceWillJoin(Map<String, Object> data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceWillLeave(HashMap<String, Object> data) {
|
||||
|
||||
public void onConferenceWillLeave(Map<String, Object> data) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright @ 2017-present Atlassian Pty Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jitsi.meet.sdk;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Interface for listening to events coming from Jitsi Meet.
|
||||
*/
|
||||
public interface JitsiMeetViewListener {
|
||||
/**
|
||||
* Called when joining a conference fails or an ongoing conference is
|
||||
* interrupted due to a failure.
|
||||
*
|
||||
* @param data - Map with an "error" key describing the problem, and
|
||||
* a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceFailed(Map<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called when a conference was joined.
|
||||
*
|
||||
* @param data - Map with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceJoined(Map<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called when the conference was left, typically after hanging up.
|
||||
*
|
||||
* @param data - Map with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceLeft(Map<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called before the conference is joined.
|
||||
*
|
||||
* @param data - Map with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceWillJoin(Map<String, Object> data);
|
||||
|
||||
/**
|
||||
* Called before the conference is left.
|
||||
*
|
||||
* @param data - Map with a "url" key with the conference URL.
|
||||
*/
|
||||
void onConferenceWillLeave(Map<String, Object> data);
|
||||
}
|
|
@ -22,6 +22,7 @@ import com.facebook.react.bridge.ReactMethod;
|
|||
import com.facebook.react.bridge.ReadableMap;
|
||||
|
||||
import org.jitsi.meet.sdk.JitsiMeetView;
|
||||
import org.jitsi.meet.sdk.JitsiMeetViewListener;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
@ -67,7 +68,7 @@ public class ExternalAPIModule extends ReactContextBaseJavaModule {
|
|||
@ReactMethod
|
||||
public void sendEvent(final String name, ReadableMap data) {
|
||||
JitsiMeetView view = JitsiMeetView.getInstance();
|
||||
JitsiMeetView.Listener listener
|
||||
JitsiMeetViewListener listener
|
||||
= view != null ? view.getListener() : null;
|
||||
|
||||
if (listener == null) {
|
||||
|
@ -84,18 +85,22 @@ public class ExternalAPIModule extends ReactContextBaseJavaModule {
|
|||
dataMap.put("url", data.getString("url"));
|
||||
listener.onConferenceFailed(dataMap);
|
||||
break;
|
||||
|
||||
case "CONFERENCE_JOINED":
|
||||
dataMap.put("url", data.getString("url"));
|
||||
listener.onConferenceJoined(dataMap);
|
||||
break;
|
||||
|
||||
case "CONFERENCE_LEFT":
|
||||
dataMap.put("url", data.getString("url"));
|
||||
listener.onConferenceLeft(dataMap);
|
||||
break;
|
||||
|
||||
case "CONFERENCE_WILL_JOIN":
|
||||
dataMap.put("url", data.getString("url"));
|
||||
listener.onConferenceWillJoin(dataMap);
|
||||
break;
|
||||
|
||||
case "CONFERENCE_WILL_LEAVE":
|
||||
dataMap.put("url", data.getString("url"));
|
||||
listener.onConferenceWillLeave(dataMap);
|
||||
|
|
Loading…
Reference in New Issue