Improve group call reactions UI when presented without raise hand.

This also dismisses the custom reaction picker when switching to PiP mode.
This commit is contained in:
Nicholas Tinsley
2024-04-24 10:13:56 -04:00
parent 293634c758
commit 881d231a93
4 changed files with 24 additions and 5 deletions

View File

@@ -35,6 +35,7 @@ import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.app.PictureInPictureModeChangedInfo;
import androidx.core.content.ContextCompat;
import androidx.core.util.Consumer;
import androidx.lifecycle.LiveDataReactiveStreams;
@@ -61,6 +62,7 @@ import org.thoughtcrime.securesms.components.webrtc.CallLinkProfileKeySender;
import org.thoughtcrime.securesms.components.webrtc.CallOverflowPopupWindow;
import org.thoughtcrime.securesms.components.webrtc.CallParticipantsListUpdatePopupWindow;
import org.thoughtcrime.securesms.components.webrtc.CallParticipantsState;
import org.thoughtcrime.securesms.components.webrtc.CallReactionScrubber;
import org.thoughtcrime.securesms.components.webrtc.CallStateUpdatePopupWindow;
import org.thoughtcrime.securesms.components.webrtc.CallToastPopupWindow;
import org.thoughtcrime.securesms.components.webrtc.GroupCallSafetyNumberChangeNotificationUtil;
@@ -223,6 +225,8 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
processIntent(getIntent());
registerSystemPipChangeListeners();
windowLayoutInfoConsumer = new WindowLayoutInfoConsumer();
windowInfoTrackerCallbackAdapter = new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this));
@@ -235,6 +239,13 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
WindowUtil.setNavigationBarColor(this, ContextCompat.getColor(this, R.color.signal_dark_colorSurface));
}
private void registerSystemPipChangeListeners() {
addOnPictureInPictureModeChangedListener(pictureInPictureModeChangedInfo -> {
CallParticipantsListDialog.dismiss(getSupportFragmentManager());
CallReactionScrubber.dismissCustomEmojiBottomSheet(getSupportFragmentManager());
});
}
@Override
protected void onStart() {
super.onStart();
@@ -357,8 +368,6 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
return false;
}
CallParticipantsListDialog.dismiss(getSupportFragmentManager());
return true;
}
if (Build.VERSION.SDK_INT >= 31) {

View File

@@ -30,7 +30,6 @@ class CallOverflowPopupWindow(private val activity: FragmentActivity, parentView
LayoutInflater.from(activity).inflate(R.layout.call_overflow_holder, parentViewGroup, false),
activity.resources.getDimension(R.dimen.calling_reaction_popup_menu_width).toInt(),
activity.resources.getDimension(R.dimen.calling_reaction_popup_menu_height).toInt()
) {
private val raiseHandLabel: TextView = (contentView as LinearLayout).findViewById(R.id.raise_hand_label)

View File

@@ -20,6 +20,16 @@ class CallReactionScrubber @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
companion object {
const val CUSTOM_REACTION_BOTTOM_SHEET_TAG = "CallReaction"
@JvmStatic
fun dismissCustomEmojiBottomSheet(fm: FragmentManager) {
val bottomSheet = fm.findFragmentByTag(CUSTOM_REACTION_BOTTOM_SHEET_TAG) as? ReactWithAnyEmojiBottomSheetDialogFragment
bottomSheet?.dismissNow()
}
}
private val emojiViews: Array<EmojiImageView>
private var customEmojiIndex = 0
@@ -48,7 +58,7 @@ class CallReactionScrubber @JvmOverloads constructor(
view.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_any_emoji_32))
view.setOnClickListener {
val bottomSheet = ReactWithAnyEmojiBottomSheetDialogFragment.createForCallingReactions()
bottomSheet.show(fragmentManager, "CallReaction")
bottomSheet.show(fragmentManager, CUSTOM_REACTION_BOTTOM_SHEET_TAG)
}
} else {
val preferredVariation = SignalStore.emojiValues().getPreferredVariation(emojis[i])