mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Move all files to natural position.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package org.thoughtcrime.securesms.events;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
|
||||
public final class PartProgressEvent {
|
||||
|
||||
public final Attachment attachment;
|
||||
public final Type type;
|
||||
public final long total;
|
||||
public final long progress;
|
||||
|
||||
public enum Type {
|
||||
COMPRESSION,
|
||||
NETWORK
|
||||
}
|
||||
|
||||
public PartProgressEvent(@NonNull Attachment attachment, @NonNull Type type, long total, long progress) {
|
||||
this.attachment = attachment;
|
||||
this.type = type;
|
||||
this.total = total;
|
||||
this.progress = progress;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.thoughtcrime.securesms.events;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
||||
public class RedPhoneEvent {
|
||||
|
||||
public enum Type {
|
||||
CALL_CONNECTED,
|
||||
WAITING_FOR_RESPONDER,
|
||||
SERVER_FAILURE,
|
||||
PERFORMING_HANDSHAKE,
|
||||
HANDSHAKE_FAILED,
|
||||
CONNECTING_TO_INITIATOR,
|
||||
CALL_DISCONNECTED,
|
||||
CALL_RINGING,
|
||||
SERVER_MESSAGE,
|
||||
RECIPIENT_UNAVAILABLE,
|
||||
INCOMING_CALL,
|
||||
OUTGOING_CALL,
|
||||
CALL_BUSY,
|
||||
LOGIN_FAILED,
|
||||
CLIENT_FAILURE,
|
||||
DEBUG_INFO,
|
||||
NO_SUCH_USER
|
||||
}
|
||||
|
||||
private final @NonNull Type type;
|
||||
private final @NonNull Recipient recipient;
|
||||
private final @Nullable String extra;
|
||||
|
||||
public RedPhoneEvent(@NonNull Type type, @NonNull Recipient recipient, @Nullable String extra) {
|
||||
this.type = type;
|
||||
this.recipient = recipient;
|
||||
this.extra = extra;
|
||||
}
|
||||
|
||||
public @NonNull Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public @NonNull Recipient getRecipient() {
|
||||
return recipient;
|
||||
}
|
||||
|
||||
public @Nullable String getExtra() {
|
||||
return extra;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.thoughtcrime.securesms.events;
|
||||
|
||||
|
||||
public class ReminderUpdateEvent {
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package org.thoughtcrime.securesms.events;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.ringrtc.CameraState;
|
||||
import org.webrtc.SurfaceViewRenderer;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
|
||||
public class WebRtcViewModel {
|
||||
|
||||
public enum State {
|
||||
// Normal states
|
||||
CALL_INCOMING,
|
||||
CALL_OUTGOING,
|
||||
CALL_CONNECTED,
|
||||
CALL_RINGING,
|
||||
CALL_BUSY,
|
||||
CALL_DISCONNECTED,
|
||||
|
||||
// Error states
|
||||
NETWORK_FAILURE,
|
||||
RECIPIENT_UNAVAILABLE,
|
||||
NO_SUCH_USER,
|
||||
UNTRUSTED_IDENTITY,
|
||||
}
|
||||
|
||||
|
||||
private final @NonNull State state;
|
||||
private final @NonNull Recipient recipient;
|
||||
private final @Nullable IdentityKey identityKey;
|
||||
|
||||
private final boolean remoteVideoEnabled;
|
||||
|
||||
private final boolean isBluetoothAvailable;
|
||||
private final boolean isMicrophoneEnabled;
|
||||
|
||||
private final CameraState localCameraState;
|
||||
private final SurfaceViewRenderer localRenderer;
|
||||
private final SurfaceViewRenderer remoteRenderer;
|
||||
|
||||
public WebRtcViewModel(@NonNull State state,
|
||||
@NonNull Recipient recipient,
|
||||
@NonNull CameraState localCameraState,
|
||||
@NonNull SurfaceViewRenderer localRenderer,
|
||||
@NonNull SurfaceViewRenderer remoteRenderer,
|
||||
boolean remoteVideoEnabled,
|
||||
boolean isBluetoothAvailable,
|
||||
boolean isMicrophoneEnabled)
|
||||
{
|
||||
this(state,
|
||||
recipient,
|
||||
null,
|
||||
localCameraState,
|
||||
localRenderer,
|
||||
remoteRenderer,
|
||||
remoteVideoEnabled,
|
||||
isBluetoothAvailable,
|
||||
isMicrophoneEnabled);
|
||||
}
|
||||
|
||||
public WebRtcViewModel(@NonNull State state,
|
||||
@NonNull Recipient recipient,
|
||||
@Nullable IdentityKey identityKey,
|
||||
@NonNull CameraState localCameraState,
|
||||
@NonNull SurfaceViewRenderer localRenderer,
|
||||
@NonNull SurfaceViewRenderer remoteRenderer,
|
||||
boolean remoteVideoEnabled,
|
||||
boolean isBluetoothAvailable,
|
||||
boolean isMicrophoneEnabled)
|
||||
{
|
||||
this.state = state;
|
||||
this.recipient = recipient;
|
||||
this.localCameraState = localCameraState;
|
||||
this.localRenderer = localRenderer;
|
||||
this.remoteRenderer = remoteRenderer;
|
||||
this.identityKey = identityKey;
|
||||
this.remoteVideoEnabled = remoteVideoEnabled;
|
||||
this.isBluetoothAvailable = isBluetoothAvailable;
|
||||
this.isMicrophoneEnabled = isMicrophoneEnabled;
|
||||
}
|
||||
|
||||
public @NonNull State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public @NonNull Recipient getRecipient() {
|
||||
return recipient;
|
||||
}
|
||||
|
||||
public @NonNull CameraState getLocalCameraState() {
|
||||
return localCameraState;
|
||||
}
|
||||
|
||||
public @Nullable IdentityKey getIdentityKey() {
|
||||
return identityKey;
|
||||
}
|
||||
|
||||
public boolean isRemoteVideoEnabled() {
|
||||
return remoteVideoEnabled;
|
||||
}
|
||||
|
||||
public boolean isBluetoothAvailable() {
|
||||
return isBluetoothAvailable;
|
||||
}
|
||||
|
||||
public boolean isMicrophoneEnabled() {
|
||||
return isMicrophoneEnabled;
|
||||
}
|
||||
|
||||
public SurfaceViewRenderer getLocalRenderer() {
|
||||
return localRenderer;
|
||||
}
|
||||
|
||||
public SurfaceViewRenderer getRemoteRenderer() {
|
||||
return remoteRenderer;
|
||||
}
|
||||
|
||||
public @NonNull String toString() {
|
||||
return "[State: " + state + ", recipient: " + recipient.getId().serialize() + ", identity: " + identityKey + ", remoteVideo: " + remoteVideoEnabled + ", localVideo: " + localCameraState.isEnabled() + "]";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user