Prevent some crashes

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-08-09 18:05:23 +02:00
parent e4af75a62b
commit 45e2bd505d

View file

@ -2082,22 +2082,30 @@ public class CallController extends BaseController {
case ESTABLISHED:
handler.postDelayed(() -> setCallState(CallStatus.CALLING_TIMEOUT), 45000);
handler.post(() -> {
if (connectingView != null) {
connectingTextView.setText(R.string.nc_calling);
if (connectingTextView.getVisibility() != View.VISIBLE) {
connectingView.setVisibility(View.VISIBLE);
}
}
if (progressBar != null) {
if (progressBar.getVisibility() != View.VISIBLE) {
progressBar.setVisibility(View.VISIBLE);
}
}
if (conversationView != null) {
if (conversationView.getVisibility() != View.INVISIBLE) {
conversationView.setVisibility(View.INVISIBLE);
}
}
if (errorImageView != null) {
if (errorImageView.getVisibility() != View.GONE) {
errorImageView.setVisibility(View.GONE);
}
}
});
break;
case IN_CONVERSATION:
@ -2108,44 +2116,62 @@ public class CallController extends BaseController {
animateCallControls(false, 5000);
}
if (connectingView != null) {
if (connectingView.getVisibility() != View.INVISIBLE) {
connectingView.setVisibility(View.INVISIBLE);
}
}
if (progressBar != null) {
if (progressBar.getVisibility() != View.GONE) {
progressBar.setVisibility(View.GONE);
}
}
if (conversationView != null) {
if (conversationView.getVisibility() != View.VISIBLE) {
conversationView.setVisibility(View.VISIBLE);
}
}
if (errorImageView != null) {
if (errorImageView.getVisibility() != View.GONE) {
errorImageView.setVisibility(View.GONE);
}
}
});
break;
case OFFLINE:
handler.post(() -> {
stopCallingSound();
if (connectingTextView != null) {
connectingTextView.setText(R.string.nc_offline);
if (connectingView.getVisibility() != View.VISIBLE) {
connectingView.setVisibility(View.VISIBLE);
}
}
if (conversationView != null) {
if (conversationView.getVisibility() != View.INVISIBLE) {
conversationView.setVisibility(View.INVISIBLE);
}
}
if (progressBar != null) {
if (progressBar.getVisibility() != View.GONE) {
progressBar.setVisibility(View.GONE);
}
}
if (errorImageView != null) {
errorImageView.setImageResource(R.drawable.ic_signal_wifi_off_white_24dp);
if (errorImageView.getVisibility() != View.VISIBLE) {
errorImageView.setVisibility(View.VISIBLE);
}
}
});
break;
case LEAVING: