Procházet zdrojové kódy

android: add initial implementation of join / leave

master
Saúl Ibarra Corretgé před 6 roky
rodič
revize
56135bd085

+ 3
- 3
android/app/src/main/java/org/jitsi/meet/MainActivity.java Zobrazit soubor

@@ -58,7 +58,7 @@ public class MainActivity extends FragmentActivity implements JitsiMeetActivityI
58 58
     private void initialize() {
59 59
         JitsiMeetFragment fragment = getFragment();
60 60
         fragment.setWelcomePageEnabled(true);
61
-        fragment.loadURL(getIntentUrl(getIntent()));
61
+        fragment.getJitsiView().join(getIntentUrl(getIntent()));
62 62
     }
63 63
 
64 64
     private @Nullable String getIntentUrl(Intent intent) {
@@ -113,7 +113,7 @@ public class MainActivity extends FragmentActivity implements JitsiMeetActivityI
113 113
         String url;
114 114
 
115 115
         if ((url = getIntentUrl(intent)) != null) {
116
-            getFragment().loadURL(url);
116
+            getFragment().getJitsiView().join(url);
117 117
             return;
118 118
         }
119 119
 
@@ -145,7 +145,7 @@ public class MainActivity extends FragmentActivity implements JitsiMeetActivityI
145 145
                     }
146 146
 
147 147
                     if (dynamicLink != null) {
148
-                        getFragment().loadURL(dynamicLink.toString());
148
+                        getFragment().getJitsiView().join(dynamicLink.toString());
149 149
                     }
150 150
                 });
151 151
         }

+ 4
- 10
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java Zobrazit soubor

@@ -107,6 +107,10 @@ public class JitsiMeetFragment extends Fragment {
107 107
         return view;
108 108
     }
109 109
 
110
+    public JitsiMeetView getJitsiView() {
111
+        return view;
112
+    }
113
+
110 114
     /**
111 115
      *
112 116
      * @see JitsiMeetView#isPictureInPictureEnabled()
@@ -126,16 +130,6 @@ public class JitsiMeetFragment extends Fragment {
126 130
         return view == null ? welcomePageEnabled : view.isWelcomePageEnabled();
127 131
     }
128 132
 
129
-    /**
130
-     * Loads the given URL and displays the conference. If the specified URL is
131
-     * null, the welcome page is displayed instead.
132
-     *
133
-     * @param url The conference URL.
134
-     */
135
-    public void loadURL(@Nullable String url) {
136
-        view.loadURLString(url);
137
-    }
138
-
139 133
     @Override
140 134
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
141 135
         JitsiMeetActivityDelegate.onActivityResult(

+ 17
- 57
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java Zobrazit soubor

@@ -1,5 +1,6 @@
1 1
 /*
2
- * Copyright @ 2017-present Atlassian Pty Ltd
2
+ * Copyright @ 2018-present 8x8, Inc.
3
+ * Copyright @ 2017-2018 Atlassian Pty Ltd
3 4
  *
4 5
  * Licensed under the Apache License, Version 2.0 (the "License");
5 6
  * you may not use this file except in compliance with the License.
@@ -44,31 +45,6 @@ public class JitsiMeetView
44 45
      */
45 46
     private static final String TAG = JitsiMeetView.class.getSimpleName();
46 47
 
47
-    /**
48
-     * Loads a specific URL {@code String} in all existing
49
-     * {@code JitsiMeetView}s.
50
-     *
51
-     * @param urlString he URL {@code String} to load in all existing
52
-     * {@code JitsiMeetView}s.
53
-     * @return If the specified {@code urlString} was submitted for loading in
54
-     * at least one {@code JitsiMeetView}, then {@code true}; otherwise,
55
-     * {@code false}.
56
-     */
57
-    public static boolean loadURLStringInViews(String urlString) {
58
-        boolean loaded = false;
59
-
60
-        synchronized (views) {
61
-            for (BaseReactView view : views) {
62
-                if (view instanceof JitsiMeetView) {
63
-                    ((JitsiMeetView)view).loadURLString(urlString);
64
-                    loaded = true;
65
-                }
66
-            }
67
-        }
68
-
69
-        return loaded;
70
-    }
71
-
72 48
     /**
73 49
      * A color scheme object to override the default color is the SDK.
74 50
      */
@@ -197,16 +173,20 @@ public class JitsiMeetView
197 173
         return welcomePageEnabled;
198 174
     }
199 175
 
200
-    /**
201
-     * Loads a specific {@link URL} which may identify a conference to join. If
202
-     * the specified {@code URL} is {@code null} and the Welcome page is
203
-     * enabled, the Welcome page is displayed instead.
204
-     *
205
-     * @param url The {@code URL} to load which may identify a conference to
206
-     * join.
207
-     */
208
-    public void loadURL(@Nullable URL url) {
209
-        loadURLString(url == null ? null : url.toString());
176
+    public void join(@Nullable String url) {
177
+        Bundle urlObject;
178
+
179
+        if (url == null) {
180
+            urlObject = null;
181
+        } else {
182
+            urlObject = new Bundle();
183
+            urlObject.putString("url", url);
184
+        }
185
+        loadURL(urlObject);
186
+    }
187
+
188
+    public void leave() {
189
+        loadURL(null);
210 190
     }
211 191
 
212 192
     /**
@@ -219,7 +199,7 @@ public class JitsiMeetView
219 199
      *
220 200
      * @param urlObject The URL to load which may identify a conference to join.
221 201
      */
222
-    public void loadURLObject(@Nullable Bundle urlObject) {
202
+    private void loadURL(@Nullable Bundle urlObject) {
223 203
         Bundle props = new Bundle();
224 204
 
225 205
         // color scheme
@@ -259,26 +239,6 @@ public class JitsiMeetView
259 239
         createReactRootView("App", props);
260 240
     }
261 241
 
262
-    /**
263
-     * Loads a specific URL {@link String} which may identify a conference to
264
-     * join. If the specified URL {@code String} is {@code null} and the Welcome
265
-     * page is enabled, the Welcome page is displayed instead.
266
-     *
267
-     * @param urlString The URL {@code String} to load which may identify a
268
-     * conference to join.
269
-     */
270
-    public void loadURLString(@Nullable String urlString) {
271
-        Bundle urlObject;
272
-
273
-        if (urlString == null) {
274
-            urlObject = null;
275
-        } else {
276
-            urlObject = new Bundle();
277
-            urlObject.putString("url", urlString);
278
-        }
279
-        loadURLObject(urlObject);
280
-    }
281
-
282 242
     /**
283 243
      * The internal processing for the URL of the current conference set on the
284 244
      * associated {@link JitsiMeetView}.

Načítá se…
Zrušit
Uložit