That fuck shit the fascists are using
at master 85 lines 2.2 kB view raw
1package org.tm.archive.events; 2 3import android.os.Parcel; 4import android.os.Parcelable; 5 6import androidx.annotation.NonNull; 7import androidx.core.os.ParcelCompat; 8 9import org.tm.archive.recipients.Recipient; 10import org.tm.archive.recipients.RecipientId; 11 12import java.util.Objects; 13 14/** 15 * Allow system to identify a call participant by their device demux id and their 16 * recipient id. 17 */ 18public final class CallParticipantId implements Parcelable { 19 20 public static final long DEFAULT_ID = -1; 21 22 private final long demuxId; 23 private final RecipientId recipientId; 24 25 public CallParticipantId(@NonNull Recipient recipient) { 26 this(DEFAULT_ID, recipient.getId()); 27 } 28 29 public CallParticipantId(long demuxId, @NonNull RecipientId recipientId) { 30 this.demuxId = demuxId; 31 this.recipientId = recipientId; 32 } 33 34 public long getDemuxId() { 35 return demuxId; 36 } 37 38 public @NonNull RecipientId getRecipientId() { 39 return recipientId; 40 } 41 42 @Override 43 public boolean equals(Object o) { 44 if (this == o) return true; 45 if (o == null || getClass() != o.getClass()) return false; 46 final CallParticipantId that = (CallParticipantId) o; 47 return demuxId == that.demuxId && 48 recipientId.equals(that.recipientId); 49 } 50 51 @Override 52 public int hashCode() { 53 return Objects.hash(demuxId, recipientId); 54 } 55 56 @Override 57 public int describeContents() { 58 return 0; 59 } 60 61 @Override 62 public void writeToParcel(@NonNull Parcel dest, int flags) { 63 dest.writeLong(demuxId); 64 dest.writeParcelable(recipientId, flags); 65 } 66 67 public static final Parcelable.Creator<CallParticipantId> CREATOR = new Parcelable.Creator<CallParticipantId>() { 68 @Override 69 public CallParticipantId createFromParcel(Parcel in) { 70 return new CallParticipantId( 71 in.readLong(), 72 Objects.requireNonNull( 73 ParcelCompat.readParcelable(in, 74 RecipientId.class.getClassLoader(), 75 RecipientId.class) 76 ) 77 ); 78 } 79 80 @Override 81 public CallParticipantId[] newArray(int size) { 82 return new CallParticipantId[size]; 83 } 84 }; 85}