mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 20:18:36 +00:00
Convert WebRtcCallingActivity to Kotlin.
This commit is contained in:
committed by
Greyson Parrelli
parent
386ebaa6df
commit
fee7d20cc6
@@ -128,7 +128,7 @@
|
||||
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />
|
||||
<meta-data android:name="android.webkit.WebView.MetricsOptOut" android:value="true" />
|
||||
|
||||
<activity android:name=".WebRtcCallActivity"
|
||||
<activity android:name=".components.webrtc.v2.WebRtcCallActivity"
|
||||
android:theme="@style/TextSecure.DarkTheme.WebRTCCall"
|
||||
android:excludeFromRecents="true"
|
||||
android:supportsPictureInPicture="true"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,7 +68,7 @@ class CallOverflowPopupWindow(private val activity: FragmentActivity, parentView
|
||||
PopupWindowCompat.showAsDropDown(this, anchor, xOffset, yOffset, Gravity.NO_GRAVITY)
|
||||
}
|
||||
|
||||
interface RaisedHandDelegate {
|
||||
fun interface RaisedHandDelegate {
|
||||
fun isSelfHandRaised(): Boolean
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import org.signal.core.util.PendingIntentFlags;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity;
|
||||
import org.thoughtcrime.securesms.components.webrtc.v2.CallIntent;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
||||
@@ -26,7 +26,7 @@ public final class GroupCallSafetyNumberChangeNotificationUtil {
|
||||
}
|
||||
|
||||
public static void showNotification(@NonNull Context context, @NonNull Recipient recipient) {
|
||||
Intent contentIntent = new Intent(context, WebRtcCallActivity.class);
|
||||
Intent contentIntent = new Intent(context, CallIntent.getActivityClass());
|
||||
contentIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, contentIntent, PendingIntentFlags.mutable());
|
||||
|
||||
@@ -46,8 +46,8 @@ import io.reactivex.rxjava3.kotlin.subscribeBy
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import org.signal.core.util.dp
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.BaseActivity
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity
|
||||
import org.thoughtcrime.securesms.calls.links.EditCallLinkNameDialogFragment
|
||||
import org.thoughtcrime.securesms.components.InsetAwareConstraintLayout
|
||||
import org.thoughtcrime.securesms.components.webrtc.CallOverflowPopupWindow
|
||||
@@ -65,7 +65,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
* Brain for rendering the call controls and info within a bottom sheet when we display the activity in portrait mode.
|
||||
*/
|
||||
class ControlsAndInfoController private constructor(
|
||||
private val webRtcCallActivity: WebRtcCallActivity,
|
||||
private val activity: BaseActivity,
|
||||
private val webRtcCallView: WebRtcCallView,
|
||||
private val overflowPopupWindow: CallOverflowPopupWindow,
|
||||
private val viewModel: WebRtcCallViewModel,
|
||||
@@ -74,13 +74,13 @@ class ControlsAndInfoController private constructor(
|
||||
) : Disposable by disposables {
|
||||
|
||||
constructor(
|
||||
webRtcCallActivity: WebRtcCallActivity,
|
||||
activity: BaseActivity,
|
||||
webRtcCallView: WebRtcCallView,
|
||||
overflowPopupWindow: CallOverflowPopupWindow,
|
||||
viewModel: WebRtcCallViewModel,
|
||||
controlsAndInfoViewModel: ControlsAndInfoViewModel
|
||||
) : this(
|
||||
webRtcCallActivity,
|
||||
activity,
|
||||
webRtcCallView,
|
||||
overflowPopupWindow,
|
||||
viewModel,
|
||||
@@ -108,15 +108,15 @@ class ControlsAndInfoController private constructor(
|
||||
private val aboveControlsGuideline: Guideline = webRtcCallView.findViewById(R.id.call_screen_above_controls_guideline)
|
||||
private val toggleCameraDirectionView: View = webRtcCallView.findViewById(R.id.call_screen_camera_direction_toggle)
|
||||
private val callControls: ConstraintLayout = webRtcCallView.findViewById(R.id.call_controls_constraint_layout)
|
||||
private val isLandscape = webRtcCallActivity.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
private val isLandscape = activity.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
private val waitingToBeLetInProgressDrawable = IndeterminateDrawable.createCircularDrawable(
|
||||
webRtcCallActivity,
|
||||
CircularProgressIndicatorSpec(webRtcCallActivity, null).apply {
|
||||
activity,
|
||||
CircularProgressIndicatorSpec(activity, null).apply {
|
||||
indicatorSize = 20.dp
|
||||
indicatorInset = 0.dp
|
||||
trackThickness = 2.dp
|
||||
trackCornerRadius = 1.dp
|
||||
indicatorColors = intArrayOf(ContextCompat.getColor(webRtcCallActivity, R.color.signal_colorOnBackground))
|
||||
indicatorColors = intArrayOf(ContextCompat.getColor(activity, R.color.signal_colorOnBackground))
|
||||
trackColor = Color.TRANSPARENT
|
||||
}
|
||||
)
|
||||
@@ -133,7 +133,7 @@ class ControlsAndInfoController private constructor(
|
||||
private var previousCallControlHeightData = HeightData()
|
||||
private var controlState: WebRtcControls = WebRtcControls.NONE
|
||||
|
||||
private val callInfoCallbacks = CallInfoCallbacks(webRtcCallActivity, controlsAndInfoViewModel)
|
||||
private val callInfoCallbacks = CallInfoCallbacks(activity, controlsAndInfoViewModel)
|
||||
|
||||
init {
|
||||
raiseHandComposeView.apply {
|
||||
@@ -179,9 +179,9 @@ class ControlsAndInfoController private constructor(
|
||||
hide(delay = HIDE_CONTROL_DELAY)
|
||||
}
|
||||
|
||||
webRtcCallActivity
|
||||
activity
|
||||
.supportFragmentManager
|
||||
.setFragmentResultListener(EditCallLinkNameDialogFragment.RESULT_KEY, webRtcCallActivity) { resultKey, bundle ->
|
||||
.setFragmentResultListener(EditCallLinkNameDialogFragment.RESULT_KEY, activity) { resultKey, bundle ->
|
||||
if (bundle.containsKey(resultKey)) {
|
||||
setName(bundle.getString(resultKey)!!)
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class ControlsAndInfoController private constructor(
|
||||
.setTopRightCorner(CornerFamily.ROUNDED, 18.dp.toFloat())
|
||||
.build()
|
||||
).apply {
|
||||
fillColor = ColorStateList.valueOf(ContextCompat.getColor(webRtcCallActivity, R.color.signal_colorSurface))
|
||||
fillColor = ColorStateList.valueOf(ContextCompat.getColor(activity, R.color.signal_colorSurface))
|
||||
}
|
||||
|
||||
behavior.isHideable = true
|
||||
@@ -440,7 +440,7 @@ class ControlsAndInfoController private constructor(
|
||||
}
|
||||
|
||||
private fun toastFailure() {
|
||||
Toast.makeText(webRtcCallActivity, R.string.CallLinkDetailsFragment__couldnt_save_changes, Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(activity, R.string.CallLinkDetailsFragment__couldnt_save_changes, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
private fun ConstraintSet.setControlConstraints(@IdRes viewId: Int, visible: Boolean, @Px horizontalMargins: Int) {
|
||||
|
||||
@@ -8,7 +8,6 @@ package org.thoughtcrime.securesms.components.webrtc.v2
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
|
||||
@@ -23,7 +22,8 @@ class CallIntent(
|
||||
|
||||
private const val CALL_INTENT_PREFIX = "CallIntent"
|
||||
|
||||
private fun getActivityClass(): Class<out Activity> = if (RemoteConfig.newCallUi || SignalStore.internal.newCallingUi) {
|
||||
@JvmStatic
|
||||
fun getActivityClass(): Class<out Activity> = if (RemoteConfig.newCallUi || SignalStore.internal.newCallingUi) {
|
||||
CallActivity::class.java
|
||||
} else {
|
||||
WebRtcCallActivity::class.java
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,6 @@ import org.signal.ringrtc.NetworkRoute;
|
||||
import org.signal.ringrtc.PeekInfo;
|
||||
import org.signal.ringrtc.Remote;
|
||||
import org.signal.storageservice.protos.groups.GroupExternalCredential;
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity;
|
||||
import org.thoughtcrime.securesms.components.webrtc.v2.CallIntent;
|
||||
import org.thoughtcrime.securesms.crypto.SealedSenderAccessUtil;
|
||||
import org.thoughtcrime.securesms.database.CallLinkTable;
|
||||
@@ -538,7 +537,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
return false;
|
||||
}
|
||||
|
||||
context.startActivity(new Intent(context, WebRtcCallActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
context.startActivity(new Intent(context, CallIntent.getActivityClass()).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@ import org.signal.core.util.concurrent.SimpleTask;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.ringrtc.CallLinkRootKey;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity;
|
||||
import org.thoughtcrime.securesms.calls.links.CallLinks;
|
||||
import org.thoughtcrime.securesms.components.webrtc.v2.CallActivity;
|
||||
import org.thoughtcrime.securesms.components.webrtc.v2.CallIntent;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.conversation.ConversationIntents;
|
||||
|
||||
@@ -7,11 +7,11 @@ import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.signal.core.util.concurrent.SimpleTask;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity;
|
||||
import org.thoughtcrime.securesms.components.webrtc.v2.CallIntent;
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.signal.core.util.concurrent.SimpleTask;
|
||||
|
||||
public class VoiceCallShare extends Activity {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class VoiceCallShare extends Activity {
|
||||
AppDependencies.getSignalCallManager().startOutgoingAudioCall(recipient);
|
||||
}
|
||||
|
||||
Intent activityIntent = new Intent(this, WebRtcCallActivity.class);
|
||||
Intent activityIntent = new Intent(this, CallIntent.getActivityClass());
|
||||
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(activityIntent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user