|
|
@@ -40,8 +40,7 @@ import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
40
|
40
|
* <tt>JKConferenceView</tt> static methods.
|
|
41
|
41
|
*/
|
|
42
|
42
|
public class JitsiMeetActivity
|
|
43
|
|
- extends AppCompatActivity
|
|
44
|
|
- implements DefaultHardwareBackBtnHandler {
|
|
|
43
|
+ extends AppCompatActivity {
|
|
45
|
44
|
|
|
46
|
45
|
/**
|
|
47
|
46
|
* The request code identifying requests for the permission to draw on top
|
|
|
@@ -50,6 +49,12 @@ public class JitsiMeetActivity
|
|
50
|
49
|
private static final int OVERLAY_PERMISSION_REQUEST_CODE
|
|
51
|
50
|
= (int) (Math.random() * Short.MAX_VALUE);
|
|
52
|
51
|
|
|
|
52
|
+ /**
|
|
|
53
|
+ * The default behavior of this <tt>JitsiMeetActivity</tt> upon invoking the
|
|
|
54
|
+ * back button if {@link #view} does not handle the invocation.
|
|
|
55
|
+ */
|
|
|
56
|
+ private DefaultHardwareBackBtnHandler defaultBackButtonImpl;
|
|
|
57
|
+
|
|
53
|
58
|
/**
|
|
54
|
59
|
* Instance of the {@link JitsiMeetView} which this activity will display.
|
|
55
|
60
|
*/
|
|
|
@@ -133,23 +138,23 @@ public class JitsiMeetActivity
|
|
133
|
138
|
}
|
|
134
|
139
|
}
|
|
135
|
140
|
|
|
136
|
|
- /**
|
|
137
|
|
- * This method is called if the JS part does not handle the physical back
|
|
138
|
|
- * button press.
|
|
139
|
|
- */
|
|
140
|
|
- @Override
|
|
141
|
|
- public void invokeDefaultOnBackPressed() {
|
|
142
|
|
- super.onBackPressed();
|
|
143
|
|
- }
|
|
144
|
|
-
|
|
145
|
141
|
/**
|
|
146
|
142
|
* {@inheritDoc}
|
|
147
|
143
|
*/
|
|
148
|
144
|
@Override
|
|
149
|
145
|
public void onBackPressed() {
|
|
150
|
146
|
if (!JitsiMeetView.onBackPressed()) {
|
|
151
|
|
- // Invoke the default handler if it wasn't handled by React.
|
|
152
|
|
- super.onBackPressed();
|
|
|
147
|
+ // JitsiMeetView didn't handle the invocation of the back button.
|
|
|
148
|
+ // Generally, an Activity extender would very likely want to invoke
|
|
|
149
|
+ // Activity#onBackPressed(). For the sake of consistency with
|
|
|
150
|
+ // JitsiMeetView and within the Jitsi Meet SDK for Android though,
|
|
|
151
|
+ // JitsiMeetActivity does what JitsiMeetView would've done if it
|
|
|
152
|
+ // were able to handle the invocation.
|
|
|
153
|
+ if (defaultBackButtonImpl == null) {
|
|
|
154
|
+ super.onBackPressed();
|
|
|
155
|
+ } else {
|
|
|
156
|
+ defaultBackButtonImpl.invokeDefaultOnBackPressed();
|
|
|
157
|
+ }
|
|
153
|
158
|
}
|
|
154
|
159
|
}
|
|
155
|
160
|
|
|
|
@@ -206,6 +211,7 @@ public class JitsiMeetActivity
|
|
206
|
211
|
super.onPause();
|
|
207
|
212
|
|
|
208
|
213
|
JitsiMeetView.onHostPause(this);
|
|
|
214
|
+ defaultBackButtonImpl = null;
|
|
209
|
215
|
}
|
|
210
|
216
|
|
|
211
|
217
|
/**
|
|
|
@@ -215,7 +221,8 @@ public class JitsiMeetActivity
|
|
215
|
221
|
protected void onResume() {
|
|
216
|
222
|
super.onResume();
|
|
217
|
223
|
|
|
218
|
|
- JitsiMeetView.onHostResume(this, this);
|
|
|
224
|
+ defaultBackButtonImpl = new DefaultHardwareBackBtnHandlerImpl(this);
|
|
|
225
|
+ JitsiMeetView.onHostResume(this, defaultBackButtonImpl);
|
|
219
|
226
|
}
|
|
220
|
227
|
|
|
221
|
228
|
/**
|