Commit 78c547f6 authored by Adrien Béraud's avatar Adrien Béraud

call: allow to maximize/reduce participant

Change-Id: I8e6cfd732b9e6b954603121b3d781439f8320dca
parent 35443480
......@@ -172,7 +172,6 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
private List<String> callMediaHandlers;
private int previousPluginPosition = -1;
private RecyclerPicker rp;
private boolean toggleVideoPluginsCarousel = true;
private final ValueAnimator animation = new ValueAnimator();
private PointF previewDrag = null;
......@@ -911,7 +910,7 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
@Override
public void updateTime(final long duration) {
if (binding != null) {
if (duration == 0)
if (duration <= 0)
binding.callStatusTxt.setText(null);
else
binding.callStatusTxt.setText(String.format(Locale.getDefault(), "%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60));
......@@ -967,23 +966,39 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
binding.confControlGroup.setVisibility(View.VISIBLE);
if (confAdapter == null) {
confAdapter = new ConfParticipantAdapter((view, call) -> {
if (presenter == null)
return;
boolean maximized = presenter.isMaximized(call);
PopupMenu popup = new PopupMenu(view.getContext(), view);
popup.inflate(R.menu.conference_participant_actions);
MenuBuilder menu = (MenuBuilder) popup.getMenu();
MenuItem maxItem = menu.findItem(R.id.conv_contact_maximize);
if (maximized) {
maxItem.setTitle(R.string.action_call_minimize);
maxItem.setIcon(R.drawable.baseline_close_fullscreen_24);
} else {
maxItem.setTitle(R.string.action_call_maximize);
maxItem.setIcon(R.drawable.baseline_open_in_full_24);
}
popup.setOnMenuItemClickListener(item -> {
if (presenter != null)
switch (item.getItemId()) {
case R.id.conv_contact_details:
presenter.openParticipantContact(call);
break;
case R.id.conv_contact_hangup:
presenter.hangupParticipant(call);
break;
default:
return false;
}
if (presenter == null)
return false;
switch (item.getItemId()) {
case R.id.conv_contact_details:
presenter.openParticipantContact(call);
break;
case R.id.conv_contact_hangup:
presenter.hangupParticipant(call);
break;
case R.id.conv_contact_maximize:
presenter.maximizeParticipant(call);
break;
default:
return false;
}
return true;
});
MenuPopupHelper menuHelper = new MenuPopupHelper(view.getContext(), (MenuBuilder) popup.getMenu(), view);
MenuPopupHelper menuHelper = new MenuPopupHelper(view.getContext(), menu, view);
menuHelper.setForceShowIcon(true);
menuHelper.show();
});
......@@ -1360,7 +1375,6 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
}
public void toggleVideoPluginsCarousel(boolean toggle) {
toggleVideoPluginsCarousel = toggle;
if (choosePluginMode) {
if (toggle) {
binding.recyclerPicker.setVisibility(View.VISIBLE);
......@@ -1370,7 +1384,6 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
movePreview(false);
}
}
}
public void movePreview(boolean up) {
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M22,3.41l-5.29,5.29L20,12h-8V4l3.29,3.29L20.59,2L22,3.41zM3.41,22l5.29,-5.29L12,20v-8H4l3.29,3.29L2,20.59L3.41,22z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M21,11l0,-8l-8,0l3.29,3.29l-10,10l-3.29,-3.29l0,8l8,0l-3.29,-3.29l10,-10z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2004-2016 Savoir-faire Linux Inc.
Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Adrien Beraud <adrien.beraud@savoirfairelinux.com>
Romain Bertozzi <romain.bertozzi@savoirfairelinux.com>
Author: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -19,52 +17,48 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical|end"
android:minHeight="72dp"
android:paddingLeft="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="8dp">
<data />
<LinearLayout
android:layout_width="match_parent"
<TextView
android:id="@+id/display_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical|end"
android:minHeight="72dp"
android:paddingLeft="16dp"
android:layout_margin="@dimen/padding_large"
android:background="@drawable/background_conference_participant"
android:elevation="4dp"
android:ellipsize="end"
android:maxLines="2"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="8dp">
<TextView
android:id="@+id/display_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/padding_large"
android:background="@drawable/background_conference_participant"
android:elevation="4dp"
android:ellipsize="end"
android:maxLines="2"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:textAlignment="center"
android:textColor="@color/grey_800"
android:textIsSelectable="false"
android:textSize="16sp"
tools:text="Thomas\nConnecting..." />
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:textAlignment="center"
android:textColor="@color/grey_800"
android:textIsSelectable="false"
android:textSize="16sp"
tools:text="Thomas\nConnecting..." />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/photo"
android:layout_width="60dp"
android:layout_height="60dp"
android:backgroundTint="@color/transparent"
android:contentDescription="@string/contact_picture_description"
android:tintMode="multiply"
android:enabled="false"
app:maxImageSize="56dp"
tools:src="@drawable/ic_contact_picture_fallback" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/photo"
android:layout_width="60dp"
android:layout_height="60dp"
android:backgroundTint="@color/transparent"
android:contentDescription="@string/contact_picture_description"
android:tintMode="multiply"
android:enabled="false"
app:maxImageSize="56dp"
tools:src="@drawable/ic_contact_picture_fallback" />
</LinearLayout>
</layout>
\ No newline at end of file
</LinearLayout>
......@@ -2,6 +2,11 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/conv_contact_maximize"
android:icon="@drawable/baseline_open_in_full_24"
android:title="@string/action_call_maximize"
app:showAsAction="always" />
<item
android:id="@+id/conv_contact_details"
android:icon="@drawable/baseline_person_24"
......
......@@ -138,6 +138,8 @@ along with this program; if not, write to the Free Software
<!-- Call Fragment -->
<string name="you_txt_prefix">You:</string>
<string name="action_call_hangup">Hang up</string>
<string name="action_call_maximize">Maximize</string>
<string name="action_call_minimize">Reduce</string>
<string name="ongoing_call">Ongoing call</string>
<string name="hist_in_call">Incoming call of %1$s</string>
<string name="hist_out_call">Outgoing call of %1$s</string>
......
......@@ -514,6 +514,17 @@ public class CallPresenter extends RootPresenter<CallView> {
}
}
public void maximizeParticipant(SipCall call) {
if (mConference.getMaximizedCall() == call)
call = null;
mConference.setMaximizedCall(call);
if (call != null) {
mCallService.setConfMaximizedParticipant(mConference.getConfId(), call.getDaemonIdString());
} else {
mCallService.setConfGridLayout(mConference.getConfId());
}
}
private void updateTime() {
CallView view = getView();
if (view != null && mConference != null) {
......@@ -705,4 +716,8 @@ public class CallPresenter extends RootPresenter<CallView> {
public void stopScreenShare() {
mHardwareService.stopScreenShare();
}
public boolean isMaximized(SipCall call) {
return mConference.getMaximizedCall() == call;
}
}
......@@ -50,6 +50,7 @@ public class Conference {
private SipCall.CallStatus mConfState;
private final ArrayList<SipCall> mParticipants;
private boolean mRecording;
private SipCall mMaximizedCall;
public Conference(SipCall call) {
this(call.getDaemonIdString());
......@@ -92,6 +93,14 @@ public class Conference {
}
}
public void setMaximizedCall(SipCall call) {
mMaximizedCall = call;
}
public SipCall getMaximizedCall() {
return mMaximizedCall;
}
public String getPluginId() {
return "local";
}
......
......@@ -145,6 +145,17 @@ public class CallService {
}
}
public void setConfMaximizedParticipant(String confId, String callId) {
mExecutor.execute(() -> {
Ringservice.setActiveParticipant(confId, callId);
Ringservice.setConferenceLayout(confId, 1);
});
}
public void setConfGridLayout(String confId) {
mExecutor.execute(() -> Ringservice.setConferenceLayout(confId, 0));
}
private static class ConferenceEntity {
Conference conference;
ConferenceEntity(Conference conf) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment