mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-17 09:45:02 +01:00
Fix network receiver
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
8c46f2c9b0
commit
0bb2968424
@ -200,6 +200,8 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
private boolean cameraInitialized = false;
|
private boolean cameraInitialized = false;
|
||||||
private boolean microphoneInitialized = false;
|
private boolean microphoneInitialized = false;
|
||||||
|
|
||||||
|
private BroadcastReceiver networkBroadcastReceier;
|
||||||
|
|
||||||
private static int getSystemUiVisibility() {
|
private static int getSystemUiVisibility() {
|
||||||
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
|
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||||
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||||
@ -226,6 +228,17 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
callSession = "0";
|
callSession = "0";
|
||||||
credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
||||||
|
|
||||||
|
networkBroadcastReceier = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (!Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY) && !leavingCall) {
|
||||||
|
startPullingSignalingMessages(true);
|
||||||
|
} else if (Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY) && leavingCall) {
|
||||||
|
hangup(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
callControls.setZ(100.0f);
|
callControls.setZ(100.0f);
|
||||||
basicInitialization();
|
basicInitialization();
|
||||||
|
|
||||||
@ -1098,6 +1111,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
hangup(false);
|
hangup(false);
|
||||||
|
this.unregisterReceiver(networkBroadcastReceier);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1301,18 +1315,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
|
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
|
||||||
intentFilter.addAction("android.net.wifi.STATE_CHANGE");
|
intentFilter.addAction("android.net.wifi.STATE_CHANGE");
|
||||||
|
|
||||||
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
this.registerReceiver(networkBroadcastReceier, intentFilter);
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (!Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY) && leavingCall) {
|
|
||||||
startPullingSignalingMessages(true);
|
|
||||||
} else if (Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY) && !leavingCall) {
|
|
||||||
hangup(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.registerReceiver(broadcastReceiver, intentFilter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animateCallControls(boolean show, long startDelay) {
|
private void animateCallControls(boolean show, long startDelay) {
|
||||||
|
Loading…
Reference in New Issue
Block a user