kopia lustrzana https://github.com/ryukoposting/Signal-Android
Re-enable audio level indicators in calls.
rodzic
6860f96973
commit
04d6ccc30e
|
@ -50,12 +50,6 @@ class AudioIndicatorView(context: Context, attrs: AttributeSet) : FrameLayout(co
|
|||
fun bind(microphoneEnabled: Boolean, level: CallParticipant.AudioLevel?) {
|
||||
micMuted.visible = !microphoneEnabled
|
||||
|
||||
if (WebRtcActionProcessor.AUDIO_LEVELS_INTERVAL != null) {
|
||||
bindAudioLevel(microphoneEnabled, level)
|
||||
}
|
||||
}
|
||||
|
||||
private fun bindAudioLevel(microphoneEnabled: Boolean, level: CallParticipant.AudioLevel?) {
|
||||
val wasShowingAudioLevel = showAudioLevel
|
||||
showAudioLevel = microphoneEnabled && level != null
|
||||
|
||||
|
@ -95,7 +89,7 @@ class AudioIndicatorView(context: Context, attrs: AttributeSet) : FrameLayout(co
|
|||
val currentHeight = current?.animatedValue as? Float ?: 0f
|
||||
|
||||
return ValueAnimator.ofFloat(currentHeight, finalHeight).apply {
|
||||
duration = WebRtcActionProcessor.AUDIO_LEVELS_INTERVAL?.toLong() ?: 0
|
||||
duration = WebRtcActionProcessor.AUDIO_LEVELS_INTERVAL.toLong()
|
||||
interpolator = DecelerateInterpolator()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,10 @@ import androidx.recyclerview.widget.DiffUtil;
|
|||
import androidx.recyclerview.widget.ListAdapter;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.signal.core.util.DimensionUnit;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.events.CallParticipant;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.webrtc.RendererCommon;
|
||||
|
||||
class WebRtcCallParticipantsRecyclerAdapter extends ListAdapter<CallParticipant, WebRtcCallParticipantsRecyclerAdapter.ViewHolder> {
|
||||
|
@ -56,6 +58,11 @@ class WebRtcCallParticipantsRecyclerAdapter extends ListAdapter<CallParticipant,
|
|||
ParticipantViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
callParticipantView = itemView.findViewById(R.id.call_participant);
|
||||
|
||||
View audioIndicator = callParticipantView.findViewById(R.id.call_participant_audio_indicator);
|
||||
int audioIndicatorMargin = (int) DimensionUnit.DP.toPixels(8f);
|
||||
ViewUtil.setLeftMargin(audioIndicator, audioIndicatorMargin);
|
||||
ViewUtil.setBottomMargin(audioIndicator, audioIndicatorMargin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,8 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
|||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import androidx.constraintlayout.widget.Guideline;
|
||||
import androidx.core.util.Consumer;
|
||||
import androidx.core.view.ViewKt;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.transition.AutoTransition;
|
||||
import androidx.transition.Transition;
|
||||
|
@ -33,6 +35,8 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
|||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import org.signal.core.util.DimensionUnit;
|
||||
import org.signal.core.util.SetUtil;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.animation.ResizeAnimation;
|
||||
import org.thoughtcrime.securesms.components.AccessibleToggleButton;
|
||||
|
@ -46,7 +50,6 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.ringrtc.CameraState;
|
||||
import org.thoughtcrime.securesms.util.BlurTransformation;
|
||||
import org.signal.core.util.SetUtil;
|
||||
import org.thoughtcrime.securesms.util.ThrottledDebouncer;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.views.Stub;
|
||||
|
@ -211,6 +214,10 @@ public class WebRtcCallView extends ConstraintLayout {
|
|||
callParticipantsPager.setAdapter(pagerAdapter);
|
||||
callParticipantsRecycler.setAdapter(recyclerAdapter);
|
||||
|
||||
DefaultItemAnimator animator = new DefaultItemAnimator();
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
callParticipantsRecycler.setItemAnimator(animator);
|
||||
|
||||
callParticipantsPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
|
@ -266,6 +273,11 @@ public class WebRtcCallView extends ConstraintLayout {
|
|||
}
|
||||
});
|
||||
|
||||
View smallLocalAudioIndicator = smallLocalRender.findViewById(R.id.call_participant_audio_indicator);
|
||||
int audioIndicatorMargin = (int) DimensionUnit.DP.toPixels(8f);
|
||||
ViewUtil.setLeftMargin(smallLocalAudioIndicator, audioIndicatorMargin);
|
||||
ViewUtil.setBottomMargin(smallLocalAudioIndicator, audioIndicatorMargin);
|
||||
|
||||
startCall.setOnClickListener(v -> {
|
||||
if (controlsListener != null) {
|
||||
startCall.setEnabled(false);
|
||||
|
@ -292,7 +304,7 @@ public class WebRtcCallView extends ConstraintLayout {
|
|||
rotatableControls.add(videoToggle);
|
||||
rotatableControls.add(cameraDirectionToggle);
|
||||
rotatableControls.add(decline);
|
||||
rotatableControls.add(smallLocalRender.findViewById(R.id.call_participant_audio_indicator));
|
||||
rotatableControls.add(smallLocalAudioIndicator);
|
||||
rotatableControls.add(ringToggle);
|
||||
|
||||
largeHeaderConstraints = new ConstraintSet();
|
||||
|
@ -425,6 +437,7 @@ public class WebRtcCallView extends ConstraintLayout {
|
|||
|
||||
if (state == WebRtcLocalRenderState.EXPANDED) {
|
||||
expandPip(localCallParticipant, focusedParticipant);
|
||||
smallLocalRender.setCallParticipant(focusedParticipant);
|
||||
return;
|
||||
} else if ((state == WebRtcLocalRenderState.SMALL_RECTANGLE || state == WebRtcLocalRenderState.GONE) && pictureInPictureExpansionHelper.isExpandedOrExpanding()) {
|
||||
shrinkPip(localCallParticipant);
|
||||
|
@ -860,6 +873,11 @@ public class WebRtcCallView extends ConstraintLayout {
|
|||
}
|
||||
|
||||
private void layoutParticipants() {
|
||||
int desiredMargin = ViewUtil.dpToPx(withControlsHeight(pagerBottomMarginDp));
|
||||
if (ViewKt.getMarginBottom(callParticipantsPager) == desiredMargin) {
|
||||
return;
|
||||
}
|
||||
|
||||
Transition transition = new AutoTransition().setDuration(TRANSITION_DURATION_MILLIS);
|
||||
|
||||
TransitionManager.beginDelayedTransition(participantsParent, transition);
|
||||
|
@ -867,7 +885,7 @@ public class WebRtcCallView extends ConstraintLayout {
|
|||
ConstraintSet constraintSet = new ConstraintSet();
|
||||
constraintSet.clone(participantsParent);
|
||||
|
||||
constraintSet.setMargin(R.id.call_screen_participants_pager, ConstraintSet.BOTTOM, ViewUtil.dpToPx(withControlsHeight(pagerBottomMarginDp)));
|
||||
constraintSet.setMargin(R.id.call_screen_participants_pager, ConstraintSet.BOTTOM, desiredMargin);
|
||||
constraintSet.applyTo(participantsParent);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ import static org.thoughtcrime.securesms.service.webrtc.WebRtcData.ReceivedAnswe
|
|||
*/
|
||||
public abstract class WebRtcActionProcessor {
|
||||
|
||||
@Nullable public static final Integer AUDIO_LEVELS_INTERVAL = null;
|
||||
public static final int AUDIO_LEVELS_INTERVAL = 200;
|
||||
|
||||
protected final Context context;
|
||||
protected final WebRtcInteractor webRtcInteractor;
|
||||
|
|
|
@ -85,10 +85,10 @@
|
|||
|
||||
<org.thoughtcrime.securesms.components.webrtc.AudioIndicatorView
|
||||
android:id="@+id/call_participant_audio_indicator"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginBottom="9dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue