瀏覽代碼

[Android] Naming

master
Lyubo Marinov 8 年之前
父節點
當前提交
a5cd118550

+ 11
- 12
android/README.md 查看文件

97
 
97
 
98
 #### getListener()
98
 #### getListener()
99
 
99
 
100
-Returns the `JitsiMeetView.Listener` instance attached to the view.
100
+Returns the `JitsiMeetViewListener` instance attached to the view.
101
 
101
 
102
 #### loadURL(url)
102
 #### loadURL(url)
103
 
103
 
106
 
106
 
107
 #### setListener(listener)
107
 #### setListener(listener)
108
 
108
 
109
-Sets the given listener (class implementing the `JitsiMeetView.Listener`
109
+Sets the given listener (class implementing the `JitsiMeetViewListener`
110
 interface) on the view.
110
 interface) on the view.
111
 
111
 
112
 #### onBackPressed()
112
 #### onBackPressed()
144
 
144
 
145
 This is a static method.
145
 This is a static method.
146
 
146
 
147
-#### Listener
147
+#### JitsiMeetViewListener
148
 
148
 
149
-JitsiMeetView.Listener provides an interface apps can implement in order to get
150
-notified about the state of the Jitsi Meet conference.
149
+`JitsiMeetViewListener` provides an interface apps can implement to listen to
150
+the state of the Jitsi Meet conference displayed in a `JitsiMeetView`.
151
+
152
+### JitsiMeetViewAdapter
153
+
154
+A default implementation of the `JitsiMeetViewListener` interface. Apps may
155
+extend the class instead of implementing the interface in order to minimize
156
+boilerplate.
151
 
157
 
152
 ##### onConferenceFailed
158
 ##### onConferenceFailed
153
 
159
 
180
 Called before a conference is left.
186
 Called before a conference is left.
181
 
187
 
182
 The `data` HashMap contains a "url" key with the conference URL.
188
 The `data` HashMap contains a "url" key with the conference URL.
183
-
184
-### JitsiMeetViewAbstractListener
185
-
186
-Utility (abstract) class with stub methods for the `JitsiMeetView.Listener`
187
-interface. Applications can innherit from this class instead of implementing
188
-the interface in order to avoid adding stubs for methods they don't care about.
189
-

+ 0
- 1
android/sdk/.gitignore 查看文件

1
-/build

+ 1
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java 查看文件

46
     public static final int OVERLAY_PERMISSION_REQ_CODE = 4242;
46
     public static final int OVERLAY_PERMISSION_REQ_CODE = 4242;
47
 
47
 
48
     /**
48
     /**
49
-     * Instance of the {@JitsiMeetView} which this activity will display.
49
+     * Instance of the {@link JitsiMeetView} which this activity will display.
50
      */
50
      */
51
     private JitsiMeetView view;
51
     private JitsiMeetView view;
52
 
52
 

+ 13
- 53
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java 查看文件

30
 import com.facebook.react.common.LifecycleState;
30
 import com.facebook.react.common.LifecycleState;
31
 
31
 
32
 import java.net.URL;
32
 import java.net.URL;
33
-import java.util.HashMap;
34
 
33
 
35
 public class JitsiMeetView extends FrameLayout {
34
 public class JitsiMeetView extends FrameLayout {
36
     /**
35
     /**
43
      * Reference to the single instance of this class we currently allow. It's
42
      * Reference to the single instance of this class we currently allow. It's
44
      * currently used for fetching the instance from the listener's callbacks.
43
      * currently used for fetching the instance from the listener's callbacks.
45
      *
44
      *
46
-     * TODO: lift this limitation.
45
+     * TODO: Lift this limitation.
47
      */
46
      */
48
     private static JitsiMeetView instance;
47
     private static JitsiMeetView instance;
49
 
48
 
54
     private static ReactInstanceManager reactInstanceManager;
53
     private static ReactInstanceManager reactInstanceManager;
55
 
54
 
56
     /**
55
     /**
57
-     * {@JitsiMeetView.Listener} instance for reporting events occurring in
56
+     * {@link JitsiMeetViewListener} instance for reporting events occurring in
58
      * Jitsi Meet.
57
      * Jitsi Meet.
59
      */
58
      */
60
-    private JitsiMeetView.Listener listener;
59
+    private JitsiMeetViewListener listener;
61
 
60
 
62
     /**
61
     /**
63
      * React Native root view.
62
      * React Native root view.
90
     /**
89
     /**
91
      * Returns the only instance of this class we currently allow creating.
90
      * Returns the only instance of this class we currently allow creating.
92
      *
91
      *
93
-     * @returns The {@JitsiMeetView} instance.
92
+     * @returns The {@code JitsiMeetView} instance.
94
      */
93
      */
95
     public static JitsiMeetView getInstance() {
94
     public static JitsiMeetView getInstance() {
96
         return instance;
95
         return instance;
97
     }
96
     }
98
 
97
 
99
     /**
98
     /**
100
-     * Getter for the {@JitsiMeetView.Listener} set on this view.
99
+     * Gets the {@link JitsiMeetViewListener} set on this {@code JitsiMeetView}.
101
      *
100
      *
102
-     * @returns The {@JitsiMeetView.Listener} instance.
101
+     * @returns The {@code JitsiMeetViewListener} set on this
102
+     * {@code JitsiMeetView}.
103
      */
103
      */
104
-    public Listener getListener() {
104
+    public JitsiMeetViewListener getListener() {
105
         return listener;
105
         return listener;
106
     }
106
     }
107
 
107
 
160
     }
160
     }
161
 
161
 
162
     /**
162
     /**
163
-     * Setter for the {@JitsiMeetView.Listener} set on this view.
163
+     * Sets a specific {@link JitsiMeetViewListener} on this
164
+     * {@code JitsiMeetView}.
164
      *
165
      *
165
-     * @param listener - Listener for this view.
166
+     * @param listener - The {@code JitsiMeetViewListener} to set on this
167
+     * {@code JitsiMeetView}.
166
      */
168
      */
167
-    public void setListener(Listener listener) {
169
+    public void setListener(JitsiMeetViewListener listener) {
168
         this.listener = listener;
170
         this.listener = listener;
169
     }
171
     }
170
 
172
 
237
             reactInstanceManager.onNewIntent(intent);
239
             reactInstanceManager.onNewIntent(intent);
238
         }
240
         }
239
     }
241
     }
240
-
241
-    /**
242
-     * Interface for listening to events coming from Jitsi Meet.
243
-     */
244
-    public interface Listener {
245
-        /**
246
-         * Called when joining a conference fails or an ongoing conference is
247
-         * interrupted due to a failure.
248
-         *
249
-         * @param data - HashMap with an "error" key describing the problem, and
250
-         * a "url" key with the conference URL.
251
-         */
252
-        void onConferenceFailed(HashMap<String, Object> data);
253
-
254
-        /**
255
-         * Called when a conference was joined.
256
-         *
257
-         * @param data - HashMap with a "url" key with the conference URL.
258
-         */
259
-        void onConferenceJoined(HashMap<String, Object> data);
260
-
261
-        /**
262
-         * Called when the conference was left, typically after hanging up.
263
-         *
264
-         * @param data - HashMap with a "url" key with the conference URL.
265
-         */
266
-        void onConferenceLeft(HashMap<String, Object> data);
267
-
268
-        /**
269
-         * Called before the conference is joined.
270
-         *
271
-         * @param data - HashMap with a "url" key with the conference URL.
272
-         */
273
-        void onConferenceWillJoin(HashMap<String, Object> data);
274
-
275
-        /**
276
-         * Called before the conference is left.
277
-         *
278
-         * @param data - HashMap with a "url" key with the conference URL.
279
-         */
280
-        void onConferenceWillLeave(HashMap<String, Object> data);
281
-    }
282
 }
242
 }

android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAbstractListener.java → android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAdapter.java 查看文件

16
 
16
 
17
 package org.jitsi.meet.sdk;
17
 package org.jitsi.meet.sdk;
18
 
18
 
19
-import java.util.HashMap;
19
+import java.util.Map;
20
 
20
 
21
 /**
21
 /**
22
- * This class provides a reference implementation for {@JitsiMeetView.Listener} so applications
23
- * don't need to add stubs for all methods in the interface if they are only interested in some.
22
+ * Implements {@link JitsiMeetViewListener} so apps don't have to add stubs for
23
+ * all methods in the interface if they are only interested in some.
24
  */
24
  */
25
-public abstract class JitsiMeetViewAbstractListener implements JitsiMeetView.Listener {
26
-
25
+public abstract class JitsiMeetViewAdapter implements JitsiMeetViewListener {
27
     /**
26
     /**
28
      * {@inheritDoc}
27
      * {@inheritDoc}
29
      */
28
      */
30
     @Override
29
     @Override
31
-    public void onConferenceFailed(HashMap<String, Object> data) {
32
-
30
+    public void onConferenceFailed(Map<String, Object> data) {
33
     }
31
     }
34
 
32
 
35
     /**
33
     /**
36
      * {@inheritDoc}
34
      * {@inheritDoc}
37
      */
35
      */
38
     @Override
36
     @Override
39
-    public void onConferenceJoined(HashMap<String, Object> data) {
40
-
37
+    public void onConferenceJoined(Map<String, Object> data) {
41
     }
38
     }
42
 
39
 
43
     /**
40
     /**
44
      * {@inheritDoc}
41
      * {@inheritDoc}
45
      */
42
      */
46
     @Override
43
     @Override
47
-    public void onConferenceLeft(HashMap<String, Object> data) {
48
-
44
+    public void onConferenceLeft(Map<String, Object> data) {
49
     }
45
     }
50
 
46
 
51
     /**
47
     /**
52
      * {@inheritDoc}
48
      * {@inheritDoc}
53
      */
49
      */
54
     @Override
50
     @Override
55
-    public void onConferenceWillJoin(HashMap<String, Object> data) {
56
-
51
+    public void onConferenceWillJoin(Map<String, Object> data) {
57
     }
52
     }
58
 
53
 
59
     /**
54
     /**
60
      * {@inheritDoc}
55
      * {@inheritDoc}
61
      */
56
      */
62
     @Override
57
     @Override
63
-    public void onConferenceWillLeave(HashMap<String, Object> data) {
64
-
58
+    public void onConferenceWillLeave(Map<String, Object> data) {
65
     }
59
     }
66
 }
60
 }

+ 61
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java 查看文件

1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package org.jitsi.meet.sdk;
18
+
19
+import java.util.Map;
20
+
21
+/**
22
+ * Interface for listening to events coming from Jitsi Meet.
23
+ */
24
+public interface JitsiMeetViewListener {
25
+    /**
26
+     * Called when joining a conference fails or an ongoing conference is
27
+     * interrupted due to a failure.
28
+     *
29
+     * @param data - Map with an "error" key describing the problem, and
30
+     * a "url" key with the conference URL.
31
+     */
32
+    void onConferenceFailed(Map<String, Object> data);
33
+
34
+    /**
35
+     * Called when a conference was joined.
36
+     *
37
+     * @param data - Map with a "url" key with the conference URL.
38
+     */
39
+    void onConferenceJoined(Map<String, Object> data);
40
+
41
+    /**
42
+     * Called when the conference was left, typically after hanging up.
43
+     *
44
+     * @param data - Map with a "url" key with the conference URL.
45
+     */
46
+    void onConferenceLeft(Map<String, Object> data);
47
+
48
+    /**
49
+     * Called before the conference is joined.
50
+     *
51
+     * @param data - Map with a "url" key with the conference URL.
52
+     */
53
+    void onConferenceWillJoin(Map<String, Object> data);
54
+
55
+    /**
56
+     * Called before the conference is left.
57
+     *
58
+     * @param data - Map with a "url" key with the conference URL.
59
+     */
60
+    void onConferenceWillLeave(Map<String, Object> data);
61
+}

+ 6
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/externalapi/ExternalAPIModule.java 查看文件

22
 import com.facebook.react.bridge.ReadableMap;
22
 import com.facebook.react.bridge.ReadableMap;
23
 
23
 
24
 import org.jitsi.meet.sdk.JitsiMeetView;
24
 import org.jitsi.meet.sdk.JitsiMeetView;
25
+import org.jitsi.meet.sdk.JitsiMeetViewListener;
25
 
26
 
26
 import java.util.HashMap;
27
 import java.util.HashMap;
27
 
28
 
67
     @ReactMethod
68
     @ReactMethod
68
     public void sendEvent(final String name, ReadableMap data) {
69
     public void sendEvent(final String name, ReadableMap data) {
69
         JitsiMeetView view = JitsiMeetView.getInstance();
70
         JitsiMeetView view = JitsiMeetView.getInstance();
70
-        JitsiMeetView.Listener listener
71
+        JitsiMeetViewListener listener
71
             = view != null ? view.getListener() : null;
72
             = view != null ? view.getListener() : null;
72
 
73
 
73
         if (listener == null) {
74
         if (listener == null) {
84
             dataMap.put("url", data.getString("url"));
85
             dataMap.put("url", data.getString("url"));
85
             listener.onConferenceFailed(dataMap);
86
             listener.onConferenceFailed(dataMap);
86
             break;
87
             break;
88
+
87
         case "CONFERENCE_JOINED":
89
         case "CONFERENCE_JOINED":
88
             dataMap.put("url", data.getString("url"));
90
             dataMap.put("url", data.getString("url"));
89
             listener.onConferenceJoined(dataMap);
91
             listener.onConferenceJoined(dataMap);
90
             break;
92
             break;
93
+
91
         case "CONFERENCE_LEFT":
94
         case "CONFERENCE_LEFT":
92
             dataMap.put("url", data.getString("url"));
95
             dataMap.put("url", data.getString("url"));
93
             listener.onConferenceLeft(dataMap);
96
             listener.onConferenceLeft(dataMap);
94
             break;
97
             break;
98
+
95
         case "CONFERENCE_WILL_JOIN":
99
         case "CONFERENCE_WILL_JOIN":
96
             dataMap.put("url", data.getString("url"));
100
             dataMap.put("url", data.getString("url"));
97
             listener.onConferenceWillJoin(dataMap);
101
             listener.onConferenceWillJoin(dataMap);
98
             break;
102
             break;
103
+
99
         case "CONFERENCE_WILL_LEAVE":
104
         case "CONFERENCE_WILL_LEAVE":
100
             dataMap.put("url", data.getString("url"));
105
             dataMap.put("url", data.getString("url"));
101
             listener.onConferenceWillLeave(dataMap);
106
             listener.onConferenceWillLeave(dataMap);

Loading…
取消
儲存