mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-11 06:44:09 +01:00
reformat code in CallActivity
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
71ae7eddc2
commit
7a7888f5d1
@ -325,7 +325,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
basicInitialization();
|
basicInitialization();
|
||||||
participantDisplayItems = new HashMap<>();
|
participantDisplayItems = new HashMap<>();
|
||||||
initViews();
|
initViews();
|
||||||
if (!isConnectionEstablished()){
|
if (!isConnectionEstablished()) {
|
||||||
initiateCall();
|
initiateCall();
|
||||||
}
|
}
|
||||||
updateSelfVideoViewPosition();
|
updateSelfVideoViewPosition();
|
||||||
@ -473,7 +473,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleFromNotification() {
|
private void handleFromNotification() {
|
||||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
|
|
||||||
ncApi.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion, baseUrl))
|
ncApi.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion, baseUrl))
|
||||||
.retry(3)
|
.retry(3)
|
||||||
@ -528,12 +528,12 @@ public class CallActivity extends BaseActivity {
|
|||||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.addRule(RelativeLayout.BELOW, R.id.callInfosLinearLayout);
|
params.addRule(RelativeLayout.BELOW, R.id.callInfosLinearLayout);
|
||||||
int callControlsHeight = Math.round(getApplicationContext().getResources().getDimension(R.dimen.call_controls_height));
|
int callControlsHeight = Math.round(getApplicationContext().getResources().getDimension(R.dimen.call_controls_height));
|
||||||
params.setMargins(0,0,0, callControlsHeight);
|
params.setMargins(0, 0, 0, callControlsHeight);
|
||||||
binding.gridview.setLayoutParams(params);
|
binding.gridview.setLayoutParams(params);
|
||||||
} else {
|
} else {
|
||||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.setMargins(0,0,0, 0);
|
params.setMargins(0, 0, 0, 0);
|
||||||
binding.gridview.setLayoutParams(params);
|
binding.gridview.setLayoutParams(params);
|
||||||
|
|
||||||
binding.speakerButton.setVisibility(View.GONE);
|
binding.speakerButton.setVisibility(View.GONE);
|
||||||
@ -560,9 +560,9 @@ public class CallActivity extends BaseActivity {
|
|||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
private void initSelfVideoView() {
|
private void initSelfVideoView() {
|
||||||
try{
|
try {
|
||||||
binding.selfVideoRenderer.init(rootEglBase.getEglBaseContext(), null);
|
binding.selfVideoRenderer.init(rootEglBase.getEglBaseContext(), null);
|
||||||
} catch(IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
Log.d(TAG, "selfVideoRenderer already initialized", e);
|
Log.d(TAG, "selfVideoRenderer already initialized", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
isVoiceOnlyCall);
|
isVoiceOnlyCall);
|
||||||
binding.gridview.setAdapter(participantsAdapter);
|
binding.gridview.setAdapter(participantsAdapter);
|
||||||
|
|
||||||
if (isInPipMode){
|
if (isInPipMode) {
|
||||||
updateUiForPipMode();
|
updateUiForPipMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1108,7 +1108,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fetchSignalingSettings() {
|
private void fetchSignalingSettings() {
|
||||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {ApiUtils.APIv3, 2, 1});
|
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[]{ApiUtils.APIv3, 2, 1});
|
||||||
|
|
||||||
ncApi.getSignalingSettings(credentials, ApiUtils.getUrlForSignalingSettings(apiVersion, baseUrl))
|
ncApi.getSignalingSettings(credentials, ApiUtils.getUrlForSignalingSettings(apiVersion, baseUrl))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@ -1240,7 +1240,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
private void joinRoomAndCall() {
|
private void joinRoomAndCall() {
|
||||||
callSession = ApplicationWideCurrentRoomHolder.getInstance().getSession();
|
callSession = ApplicationWideCurrentRoomHolder.getInstance().getSession();
|
||||||
|
|
||||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
|
|
||||||
Log.d(TAG, "joinRoomAndCall");
|
Log.d(TAG, "joinRoomAndCall");
|
||||||
Log.d(TAG, " baseUrl= " + baseUrl);
|
Log.d(TAG, " baseUrl= " + baseUrl);
|
||||||
@ -1305,7 +1305,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
inCallFlag = (int) Participant.ParticipantFlags.IN_CALL_WITH_AUDIO_AND_VIDEO.getValue();
|
inCallFlag = (int) Participant.ParticipantFlags.IN_CALL_WITH_AUDIO_AND_VIDEO.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
|
|
||||||
ncApi.joinCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken), inCallFlag)
|
ncApi.joinCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken), inCallFlag)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@ -1333,7 +1333,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
|
|
||||||
if (!hasExternalSignalingServer) {
|
if (!hasExternalSignalingServer) {
|
||||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser,
|
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser,
|
||||||
new int[] {ApiUtils.APIv3, 2, 1});
|
new int[]{ApiUtils.APIv3, 2, 1});
|
||||||
|
|
||||||
ncApi.pullSignalingMessages(credentials,
|
ncApi.pullSignalingMessages(credentials,
|
||||||
ApiUtils.getUrlForSignaling(apiVersion,
|
ApiUtils.getUrlForSignaling(apiVersion,
|
||||||
@ -1600,7 +1600,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void hangupNetworkCalls(boolean shutDownView) {
|
private void hangupNetworkCalls(boolean shutDownView) {
|
||||||
int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
|
|
||||||
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@ -1636,7 +1636,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
|
|
||||||
// TODO: why is this never called?!
|
// TODO: why is this never called?!
|
||||||
private void leaveRoom(boolean shutDownView) {
|
private void leaveRoom(boolean shutDownView) {
|
||||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
|
|
||||||
ncApi.leaveRoom(credentials, ApiUtils.getUrlForParticipantsActive(apiVersion, baseUrl, roomToken))
|
ncApi.leaveRoom(credentials, ApiUtils.getUrlForParticipantsActive(apiVersion, baseUrl, roomToken))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@ -1742,7 +1742,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
|
|
||||||
private void getPeersForCall() {
|
private void getPeersForCall() {
|
||||||
Log.d(TAG, "getPeersForCall");
|
Log.d(TAG, "getPeersForCall");
|
||||||
int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[] {ApiUtils.APIv4, 1});
|
int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[]{ApiUtils.APIv4, 1});
|
||||||
|
|
||||||
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@ -2075,7 +2075,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
String stringToSend = stringBuilder.toString();
|
String stringToSend = stringBuilder.toString();
|
||||||
strings.add(stringToSend);
|
strings.add(stringToSend);
|
||||||
|
|
||||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {ApiUtils.APIv3, 2, 1});
|
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[]{ApiUtils.APIv3, 2, 1});
|
||||||
|
|
||||||
ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion, baseUrl, roomToken),
|
ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion, baseUrl, roomToken),
|
||||||
strings.toString())
|
strings.toString())
|
||||||
@ -2527,10 +2527,10 @@ public class CallActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUiForPipMode(){
|
public void updateUiForPipMode() {
|
||||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.setMargins(0,0,0, 0);
|
params.setMargins(0, 0, 0, 0);
|
||||||
binding.gridview.setLayoutParams(params);
|
binding.gridview.setLayoutParams(params);
|
||||||
|
|
||||||
|
|
||||||
@ -2539,7 +2539,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
binding.selfVideoViewWrapper.setVisibility(View.GONE);
|
binding.selfVideoViewWrapper.setVisibility(View.GONE);
|
||||||
binding.callStates.callStateRelativeLayout.setVisibility(View.GONE);
|
binding.callStates.callStateRelativeLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (participantDisplayItems.size() > 1){
|
if (participantDisplayItems.size() > 1) {
|
||||||
binding.pipCallConversationNameTextView.setText(conversationName);
|
binding.pipCallConversationNameTextView.setText(conversationName);
|
||||||
binding.pipGroupCallOverlay.setVisibility(View.VISIBLE);
|
binding.pipGroupCallOverlay.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
@ -2549,7 +2549,7 @@ public class CallActivity extends BaseActivity {
|
|||||||
binding.selfVideoRenderer.release();
|
binding.selfVideoRenderer.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUiForNormalMode(){
|
public void updateUiForNormalMode() {
|
||||||
if (isVoiceOnlyCall) {
|
if (isVoiceOnlyCall) {
|
||||||
binding.callControls.setVisibility(View.VISIBLE);
|
binding.callControls.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user