소스 검색

[Android] Naming

j8
Lyubo Marinov 8 년 전
부모
커밋
a5cd118550

+ 11
- 12
android/README.md 파일 보기

@@ -97,7 +97,7 @@ display a Jitsi Meet conference (or a welcome page).
97 97
 
98 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 102
 #### loadURL(url)
103 103
 
@@ -106,7 +106,7 @@ is displayed instead.
106 106
 
107 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 110
 interface) on the view.
111 111
 
112 112
 #### onBackPressed()
@@ -144,10 +144,16 @@ activity's `onNewIntent` method.
144 144
 
145 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 158
 ##### onConferenceFailed
153 159
 
@@ -180,10 +186,3 @@ The `data` HashMap contains a "url" key with the conference URL.
180 186
 Called before a conference is left.
181 187
 
182 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 +0,0 @@
1
-/build

+ 1
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java 파일 보기

@@ -46,7 +46,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
46 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 51
     private JitsiMeetView view;
52 52
 

+ 13
- 53
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java 파일 보기

@@ -30,7 +30,6 @@ import com.facebook.react.ReactRootView;
30 30
 import com.facebook.react.common.LifecycleState;
31 31
 
32 32
 import java.net.URL;
33
-import java.util.HashMap;
34 33
 
35 34
 public class JitsiMeetView extends FrameLayout {
36 35
     /**
@@ -43,7 +42,7 @@ public class JitsiMeetView extends FrameLayout {
43 42
      * Reference to the single instance of this class we currently allow. It's
44 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 47
     private static JitsiMeetView instance;
49 48
 
@@ -54,10 +53,10 @@ public class JitsiMeetView extends FrameLayout {
54 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 57
      * Jitsi Meet.
59 58
      */
60
-    private JitsiMeetView.Listener listener;
59
+    private JitsiMeetViewListener listener;
61 60
 
62 61
     /**
63 62
      * React Native root view.
@@ -90,18 +89,19 @@ public class JitsiMeetView extends FrameLayout {
90 89
     /**
91 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 94
     public static JitsiMeetView getInstance() {
96 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 105
         return listener;
106 106
     }
107 107
 
@@ -160,11 +160,13 @@ public class JitsiMeetView extends FrameLayout {
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 170
         this.listener = listener;
169 171
     }
170 172
 
@@ -237,46 +239,4 @@ public class JitsiMeetView extends FrameLayout {
237 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,51 +16,45 @@
16 16
 
17 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 27
      * {@inheritDoc}
29 28
      */
30 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 34
      * {@inheritDoc}
37 35
      */
38 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 41
      * {@inheritDoc}
45 42
      */
46 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 48
      * {@inheritDoc}
53 49
      */
54 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 55
      * {@inheritDoc}
61 56
      */
62 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 파일 보기

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

Loading…
취소
저장