Skip to content
Snippets Groups Projects
Commit 1b7571c3 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

call: update participant label

Change-Id: Ifd10bb675525b9a87c07d9e000ee77ef201cb575
parent bdc2c97d
Branches
Tags
No related merge requests found
...@@ -31,6 +31,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -31,6 +31,7 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.List; import java.util.List;
import cx.ring.fragments.CallFragment; import cx.ring.fragments.CallFragment;
import cx.ring.views.AvatarDrawable;
import cx.ring.views.AvatarFactory; import cx.ring.views.AvatarFactory;
import cx.ring.databinding.ItemConferenceParticipantBinding; import cx.ring.databinding.ItemConferenceParticipantBinding;
...@@ -69,8 +70,15 @@ public class ConfParticipantAdapter extends RecyclerView.Adapter<ParticipantView ...@@ -69,8 +70,15 @@ public class ConfParticipantAdapter extends RecyclerView.Adapter<ParticipantView
if (holder.disposable != null) if (holder.disposable != null)
holder.disposable.dispose(); holder.disposable.dispose();
holder.binding.photo.setImageDrawable(new AvatarDrawable.Builder()
.withContact(contact)
.withCircleCrop(true)
.withPresence(false)
.build(context));
/*;
holder.disposable = AvatarFactory.getAvatar(context, contact) holder.disposable = AvatarFactory.getAvatar(context, contact)
.subscribe(holder.binding.photo::setImageDrawable); .subscribe(holder.binding.photo::setImageDrawable);*/
holder.itemView.setOnClickListener(view -> onSelectedCallback.onParticipantSelected(view, info)); holder.itemView.setOnClickListener(view -> onSelectedCallback.onParticipantSelected(view, info));
} }
......
...@@ -985,6 +985,7 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements ...@@ -985,6 +985,7 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
} }
@SuppressLint("RestrictedApi")
@Override @Override
public void updateConfInfo(List<Conference.ParticipantInfo> participantInfo) { public void updateConfInfo(List<Conference.ParticipantInfo> participantInfo) {
Log.w(TAG, "updateConfInfo " + participantInfo); Log.w(TAG, "updateConfInfo " + participantInfo);
...@@ -1001,6 +1002,8 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements ...@@ -1001,6 +1002,8 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
PercentFrameLayout.LayoutParams params = new PercentFrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); PercentFrameLayout.LayoutParams params = new PercentFrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.getPercentLayoutInfo().leftMarginPercent = i.x / (float) mVideoWidth; params.getPercentLayoutInfo().leftMarginPercent = i.x / (float) mVideoWidth;
params.getPercentLayoutInfo().topMarginPercent = i.y / (float) mVideoHeight; params.getPercentLayoutInfo().topMarginPercent = i.y / (float) mVideoHeight;
params.getPercentLayoutInfo().rightMarginPercent = 1.f - (i.x + i.w) / (float) mVideoWidth;
//params.getPercentLayoutInfo().rightMarginPercent = (i.x + i.w) / (float) mVideoWidth;
label.participantName.setText(displayName); label.participantName.setText(displayName);
label.moderator.setVisibility(i.isModerator ? View.VISIBLE : View.GONE); label.moderator.setVisibility(i.isModerator ? View.VISIBLE : View.GONE);
label.mute.setVisibility(i.audioMuted ? View.VISIBLE : View.GONE); label.mute.setVisibility(i.audioMuted ? View.VISIBLE : View.GONE);
...@@ -1021,23 +1024,6 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements ...@@ -1021,23 +1024,6 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
boolean maximized = presenter.isMaximized(info); boolean maximized = presenter.isMaximized(info);
PopupMenu popup = new PopupMenu(view.getContext(), view); PopupMenu popup = new PopupMenu(view.getContext(), view);
popup.inflate(R.menu.conference_participant_actions); popup.inflate(R.menu.conference_participant_actions);
MenuBuilder menu = (MenuBuilder) popup.getMenu();
MenuItem maxItem = menu.findItem(R.id.conv_contact_maximize);
MenuItem muteItem = menu.findItem(R.id.conv_mute);
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);
}
if (!info.audioMuted) {
muteItem.setTitle(R.string.action_call_mute);
muteItem.setIcon(R.drawable.baseline_mic_off_24);
} else {
muteItem.setTitle(R.string.action_call_unmute);
muteItem.setIcon(R.drawable.baseline_mic_24);
}
popup.setOnMenuItemClickListener(item -> { popup.setOnMenuItemClickListener(item -> {
if (presenter == null) if (presenter == null)
return false; return false;
...@@ -1056,7 +1042,25 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements ...@@ -1056,7 +1042,25 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
} }
return true; return true;
}); });
MenuBuilder menu = (MenuBuilder) popup.getMenu();
MenuItem maxItem = menu.findItem(R.id.conv_contact_maximize);
MenuItem muteItem = menu.findItem(R.id.conv_mute);
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);
}
if (!info.audioMuted) {
muteItem.setTitle(R.string.action_call_mute);
muteItem.setIcon(R.drawable.baseline_mic_off_24);
} else {
muteItem.setTitle(R.string.action_call_unmute);
muteItem.setIcon(R.drawable.baseline_mic_24);
}
MenuPopupHelper menuHelper = new MenuPopupHelper(view.getContext(), menu, view); MenuPopupHelper menuHelper = new MenuPopupHelper(view.getContext(), menu, view);
menuHelper.setGravity(Gravity.END);
menuHelper.setForceShowIcon(true); menuHelper.setForceShowIcon(true);
menuHelper.show(); menuHelper.show();
}); });
......
...@@ -58,7 +58,9 @@ along with this program; if not, write to the Free Software ...@@ -58,7 +58,9 @@ along with this program; if not, write to the Free Software
android:contentDescription="@string/contact_picture_description" android:contentDescription="@string/contact_picture_description"
android:tintMode="multiply" android:tintMode="multiply"
android:enabled="false" android:enabled="false"
app:maxImageSize="56dp" app:maxImageSize="64dp"
app:useCompatPadding="true"
tools:src="@drawable/ic_contact_picture_fallback" /> tools:src="@drawable/ic_contact_picture_fallback" />
</LinearLayout> </LinearLayout>
...@@ -11,22 +11,24 @@ ...@@ -11,22 +11,24 @@
android:background="@drawable/background_conference_label" android:background="@drawable/background_conference_label"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="12dp"> android:padding="4dp">
<TextView <TextView
android:id="@+id/participant_name" android:id="@+id/participant_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginEnd="4dp"
android:layout_marginStart="4dp"
android:ellipsize="marquee" android:ellipsize="marquee"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp"
tools:text="Georges Longname of Chateaubrillant" /> tools:text="Georges Longname of Chateaubrillant" />
<ImageView <ImageView
android:id="@+id/moderator" android:id="@+id/moderator"
android:layout_width="16dp" android:layout_width="12dp"
android:layout_height="16dp" android:layout_height="12dp"
android:layout_margin="4dp" android:layout_margin="4dp"
android:contentDescription="@string/call_moderator" android:contentDescription="@string/call_moderator"
android:src="@drawable/baseline_moderateur" android:src="@drawable/baseline_moderateur"
...@@ -35,8 +37,8 @@ ...@@ -35,8 +37,8 @@
<ImageView <ImageView
android:id="@+id/mute" android:id="@+id/mute"
android:layout_width="16dp" android:layout_width="12dp"
android:layout_height="16dp" android:layout_height="12dp"
android:layout_margin="4dp" android:layout_margin="4dp"
android:contentDescription="@string/call_muted" android:contentDescription="@string/call_muted"
android:src="@drawable/baseline_mic_off_24" android:src="@drawable/baseline_mic_off_24"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment