package com.shizhuang.duapp.modules.live.common.model.live.message; import a.f; import android.os.Parcel; import android.os.Parcelable; import com.goim.bootstrap.core.config.MessageLevel; import com.google.protobuf.AbstractMessageLite; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.RepeatedFieldBuilderV3; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.meituan.robust.PatchProxyResult; import com.shizhuang.duapp.message.LiveGiftMessageProto; import com.shizhuang.duapp.message.LiveLevelItemProto; import com.shizhuang.duapp.modules.live.common.model.live.LiveLevelItem; import com.shizhuang.duapp.modules.live.common.test.IMTest; import g.a; import java.util.ArrayList; import java.util.List; import org.jetbrains.annotations.Nullable; import us.h; public class LiveGiftMessage extends BaseLiveChatMessage implements Comparable<LiveGiftMessage> { public static final Parcelable.Creator<LiveGiftMessage> CREATOR = new Parcelable.Creator<LiveGiftMessage>() { /* class com.shizhuang.duapp.modules.live.common.model.live.message.LiveGiftMessage.AnonymousClass1 */ public static ChangeQuickRedirect changeQuickRedirect; @Override // android.os.Parcelable.Creator public LiveGiftMessage createFromParcel(Parcel parcel) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{parcel}, this, changeQuickRedirect, false, 198392, new Class[]{Parcel.class}, LiveGiftMessage.class); return proxy.isSupported ? (LiveGiftMessage) proxy.result : new LiveGiftMessage(parcel); } @Override // android.os.Parcelable.Creator public LiveGiftMessage[] newArray(int i) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 198393, new Class[]{Integer.TYPE}, LiveGiftMessage[].class); return proxy.isSupported ? (LiveGiftMessage[]) proxy.result : new LiveGiftMessage[i]; } }; public static ChangeQuickRedirect changeQuickRedirect; public int combine; public String comboId; public long createTime; public long expireTime; public List<LiveLevelItem> extraLevel; public List<LiveLevelItem> extraLevels; public long fadeOutDuration; public long giftDuration; public String giftEffect; public String giftEffectMp4; public String giftIcon; public String giftId; public int giftLevel; public String giftName; public long giftPrice; public int giftType; public boolean hasEffect; public int isAllowCombine; public int isCache; public int isNewUser; public boolean isSelf; public long micelleDuration; public boolean needInterruptEffect; public int scaleType = 1; public int stock; public String userIcon; public String userId; public String userName; public LiveGiftMessage() { this.category = 18; this.priorityLevel = MessageLevel.HIGH.getLevel(); } private void setParamsByProtoBody(LiveGiftMessageProto.LiveGiftMessage liveGiftMessage) { if (!PatchProxy.proxy(new Object[]{liveGiftMessage}, this, changeQuickRedirect, false, 198387, new Class[]{LiveGiftMessageProto.LiveGiftMessage.class}, Void.TYPE).isSupported) { this.userId = liveGiftMessage.getUserId(); this.userName = liveGiftMessage.getUserName(); this.userIcon = liveGiftMessage.getUserIcon(); this.createTime = liveGiftMessage.getCreateTime(); this.giftId = liveGiftMessage.getGiftId(); this.giftIcon = liveGiftMessage.getGiftIcon(); this.giftName = liveGiftMessage.getGiftName(); this.giftEffect = liveGiftMessage.getGiftEffect(); this.giftLevel = liveGiftMessage.getGiftLevel(); this.giftDuration = liveGiftMessage.getGiftDuration(); this.giftPrice = liveGiftMessage.getGiftPrice(); this.combine = liveGiftMessage.getCombine(); this.comboId = liveGiftMessage.getComboId() == null ? "" : liveGiftMessage.getComboId(); this.micelleDuration = liveGiftMessage.getMicelleDuration(); this.fadeOutDuration = liveGiftMessage.getFadeOutDuration(); this.giftType = liveGiftMessage.getGiftType(); this.isNewUser = liveGiftMessage.getIsNewUser(); this.isAllowCombine = liveGiftMessage.getIsAllowCombine(); this.giftEffectMp4 = liveGiftMessage.getGiftEffectMp4(); ArrayList arrayList = new ArrayList(); for (int i = 0; i < liveGiftMessage.getExtraLevelsCount(); i++) { arrayList.add(new LiveLevelItem(liveGiftMessage.getExtraLevels(i))); } ArrayList arrayList2 = new ArrayList(); for (int i3 = 0; i3 < liveGiftMessage.getExtraLevelCount(); i3++) { arrayList2.add(new LiveLevelItem(liveGiftMessage.getExtraLevel(i3))); } this.extraLevel = arrayList2; this.extraLevels = arrayList; } } @Override // com.shizhuang.duapp.modules.live.common.model.live.message.BaseLiveChatMessage public int describeContents() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 198389, new Class[0], Integer.TYPE); if (proxy.isSupported) { return ((Integer) proxy.result).intValue(); } return 0; } public boolean isFreeGift() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 198384, new Class[0], Boolean.TYPE); if (proxy.isSupported) { return ((Boolean) proxy.result).booleanValue(); } return this.giftType == 0; } @Override // com.shizhuang.duapp.modules.live.common.model.live.message.MockInterface @Nullable public BaseLiveChatMessage mock(int i) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 198391, new Class[]{Integer.TYPE}, BaseLiveChatMessage.class); if (proxy.isSupported) { return (BaseLiveChatMessage) proxy.result; } IMTest iMTest = IMTest.f18606a; int nextInt = iMTest.c().nextInt(5); if (nextInt == 0) { this.giftIcon = "https://cdn.poizon.com/node-common/a47ca7e378f43852bd26595fa3a87be9.png"; this.giftType = 0; this.giftName = "欧气"; this.giftId = "109"; this.giftLevel = 1; } else if (nextInt == 1) { this.giftIcon = "https://cdn.poizon.com/node-common/1eff9461b8ae4054cdfec118ac16a42e.png"; this.giftType = 2; this.giftName = "快乐水"; this.giftId = "110"; this.giftLevel = 1; } else if (nextInt == 2) { this.giftIcon = "https://cdn.poizon.com/node-common/72c187fdca707025c5079de96c9b2357.png"; this.giftType = 2; this.giftName = "买爆"; this.giftId = "107"; this.giftLevel = 2; this.giftEffect = "https://cdn.poizon.com/node-common/e8bcefe8961aa97fd6edb4516f90cc97.mp4"; } else if (nextInt == 3) { this.giftEffect = "https://cdn.poizon.com/node-common/158dee9c2f1bbc1d9c301c61bdca7927.mp4"; this.giftIcon = "https://cdn.poizon.com/node-common/1984c6e11e42cd82c5ec4f7ff7ef850e.png"; this.giftType = 2; this.giftName = "喷枪"; this.giftId = "108"; this.giftLevel = 2; } else if (nextInt == 4) { this.giftEffect = "https://cdn.poizon.com/node-common/f7d1f7f0bcdc177c1408a8ec213b8354.mp4"; this.giftIcon = "https://cdn.poizon.com/node-common/ed031f523d6f18f0e4a2d29da9f95758.png"; this.giftType = 3; this.giftName = "火箭"; this.giftId = "1"; this.giftLevel = 2; } StringBuilder h12 = f.h(""); h12.append(iMTest.d()); this.comboId = h12.toString(); this.combine = 1; this.micelleDuration = 1500; this.fadeOutDuration = 500; this.userName = "哈哈哈"; this.scaleType = 1; this.userIcon = "https://qiniu.dewucdn.com/FjIIs8ZyQpJU7Yma3uaR0u-L7GVI"; return this; } public String toString() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 198385, new Class[0], String.class); if (proxy.isSupported) { return (String) proxy.result; } StringBuilder h12 = f.h("LiveGiftMessage{userId='"); h.h(h12, this.userId, '\'', ", userIcon='"); h.h(h12, this.userIcon, '\'', ", userName='"); h.h(h12, this.userName, '\'', ", createTime="); h12.append(this.createTime); h12.append(", giftId='"); h.h(h12, this.giftId, '\'', ", giftIcon='"); h.h(h12, this.giftIcon, '\'', ", giftName='"); h.h(h12, this.giftName, '\'', ", giftEffect='"); h.h(h12, this.giftEffect, '\'', ", giftLevel="); h12.append(this.giftLevel); h12.append(", giftDuration="); h12.append(this.giftDuration); h12.append(", giftPrice="); h12.append(this.giftPrice); h12.append(", giftType="); h12.append(this.giftType); h12.append(", combine="); h12.append(this.combine); h12.append(", comboId='"); h.h(h12, this.comboId, '\'', ", micelleDuration="); h12.append(this.micelleDuration); h12.append(", fadeOutDuration="); h12.append(this.fadeOutDuration); h12.append(", isNewUser="); h12.append(this.isNewUser); h12.append(", scaleType="); h12.append(this.scaleType); h12.append(", isCache="); return a.l(h12, this.isCache, '}'); } @Override // com.shizhuang.duapp.modules.live.common.model.live.message.BaseLiveChatMessage public void writeToParcel(Parcel parcel, int i) { if (!PatchProxy.proxy(new Object[]{parcel, new Integer(i)}, this, changeQuickRedirect, false, 198390, new Class[]{Parcel.class, Integer.TYPE}, Void.TYPE).isSupported) { super.writeToParcel(parcel, i); parcel.writeString(this.userId); parcel.writeString(this.userIcon); parcel.writeString(this.userName); parcel.writeLong(this.createTime); parcel.writeString(this.giftId); parcel.writeString(this.giftIcon); parcel.writeString(this.giftName); parcel.writeString(this.giftEffect); parcel.writeInt(this.giftLevel); parcel.writeLong(this.giftDuration); parcel.writeLong(this.giftPrice); parcel.writeInt(this.combine); parcel.writeString(this.comboId); parcel.writeLong(this.micelleDuration); parcel.writeLong(this.fadeOutDuration); parcel.writeLong(this.expireTime); parcel.writeInt(this.giftType); parcel.writeInt(this.isNewUser); parcel.writeInt(this.isAllowCombine); parcel.writeInt(this.stock); parcel.writeString(this.giftEffectMp4); parcel.writeTypedList(this.extraLevels); parcel.writeTypedList(this.extraLevel); parcel.writeInt(this.scaleType); parcel.writeInt(this.isCache); } } public int compareTo(LiveGiftMessage liveGiftMessage) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{liveGiftMessage}, this, changeQuickRedirect, false, 198388, new Class[]{LiveGiftMessage.class}, Integer.TYPE); if (proxy.isSupported) { return ((Integer) proxy.result).intValue(); } if (liveGiftMessage == null) { return -1; } int i = liveGiftMessage.giftLevel; int i3 = this.giftLevel; if (i != i3) { return i > i3 ? -1 : 1; } long j = liveGiftMessage.giftPrice; long j12 = this.giftPrice; if (j == j12) { return Long.compare(this.createTime, liveGiftMessage.createTime); } return Long.compare(j12, j); } @Override // com.shizhuang.duapp.modules.live.common.model.live.message.BaseLiveChatMessage public LiveGiftMessageProto.LiveGiftMessage toProtoMessage() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 198386, new Class[0], LiveGiftMessageProto.LiveGiftMessage.class); if (proxy.isSupported) { return (LiveGiftMessageProto.LiveGiftMessage) proxy.result; } ArrayList arrayList = new ArrayList(); List<LiveLevelItem> list = this.extraLevels; int size = list == null ? 0 : list.size(); for (int i = 0; i < size; i++) { arrayList.add(this.extraLevels.get(i).toProtoMessage()); } ArrayList arrayList2 = new ArrayList(); List<LiveLevelItem> list2 = this.extraLevel; int size2 = list2 == null ? 0 : list2.size(); for (int i3 = 0; i3 < size2; i3++) { arrayList2.add(this.extraLevel.get(i3).toProtoMessage()); } LiveGiftMessageProto.LiveGiftMessage.b newBuilder = LiveGiftMessageProto.LiveGiftMessage.newBuilder(); String str = this.userId; String str2 = ""; if (str == null) { str = str2; } PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{str}, newBuilder, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54779, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy2.isSupported) { newBuilder = (LiveGiftMessageProto.LiveGiftMessage.b) proxy2.result; } else { newBuilder.f10585c = str; newBuilder.onChanged(); } String str3 = this.userName; if (str3 == null) { str3 = str2; } PatchProxyResult proxy3 = PatchProxy.proxy(new Object[]{str3}, newBuilder, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54789, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy3.isSupported) { newBuilder = (LiveGiftMessageProto.LiveGiftMessage.b) proxy3.result; } else { newBuilder.e = str3; newBuilder.onChanged(); } String str4 = this.userIcon; if (str4 == null) { str4 = str2; } PatchProxyResult proxy4 = PatchProxy.proxy(new Object[]{str4}, newBuilder, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54784, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy4.isSupported) { newBuilder = (LiveGiftMessageProto.LiveGiftMessage.b) proxy4.result; } else { newBuilder.d = str4; newBuilder.onChanged(); } LiveGiftMessageProto.LiveGiftMessage.b r = newBuilder.r(this.createTime); String str5 = this.giftId; if (str5 == null) { str5 = str2; } PatchProxyResult proxy5 = PatchProxy.proxy(new Object[]{str5}, r, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54797, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy5.isSupported) { r = (LiveGiftMessageProto.LiveGiftMessage.b) proxy5.result; } else { r.f10586g = str5; r.onChanged(); } String str6 = this.giftIcon; if (str6 == null) { str6 = str2; } PatchProxyResult proxy6 = PatchProxy.proxy(new Object[]{str6}, r, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54802, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy6.isSupported) { r = (LiveGiftMessageProto.LiveGiftMessage.b) proxy6.result; } else { r.f10587h = str6; r.onChanged(); } String str7 = this.giftName; if (str7 == null) { str7 = str2; } PatchProxyResult proxy7 = PatchProxy.proxy(new Object[]{str7}, r, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54807, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy7.isSupported) { r = (LiveGiftMessageProto.LiveGiftMessage.b) proxy7.result; } else { r.i = str7; r.onChanged(); } String str8 = this.giftEffect; if (str8 == null) { str8 = str2; } PatchProxyResult proxy8 = PatchProxy.proxy(new Object[]{str8}, r, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54812, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy8.isSupported) { r = (LiveGiftMessageProto.LiveGiftMessage.b) proxy8.result; } else { r.j = str8; r.onChanged(); } LiveGiftMessageProto.LiveGiftMessage.b q8 = r.v(this.giftLevel).u(this.giftDuration).w(this.giftPrice).q(this.combine); String str9 = this.comboId; if (str9 == null) { str9 = str2; } PatchProxyResult proxy9 = PatchProxy.proxy(new Object[]{str9}, q8, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54829, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy9.isSupported) { q8 = (LiveGiftMessageProto.LiveGiftMessage.b) proxy9.result; } else { q8.o = str9; q8.onChanged(); } LiveGiftMessageProto.LiveGiftMessage.b y = q8.A(this.micelleDuration).s(this.fadeOutDuration).x(this.giftType).z(this.isNewUser).y(this.isAllowCombine); String str10 = this.giftEffectMp4; if (str10 != null) { str2 = str10; } PatchProxyResult proxy10 = PatchProxy.proxy(new Object[]{str2}, y, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54849, new Class[]{String.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy10.isSupported) { y = (LiveGiftMessageProto.LiveGiftMessage.b) proxy10.result; } else { y.f10589u = str2; y.onChanged(); } PatchProxyResult proxy11 = PatchProxy.proxy(new Object[]{arrayList}, y, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54862, new Class[]{Iterable.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy11.isSupported) { y = (LiveGiftMessageProto.LiveGiftMessage.b) proxy11.result; } else { RepeatedFieldBuilderV3<LiveLevelItemProto.LiveLevelItem, LiveLevelItemProto.LiveLevelItem.b, LiveLevelItemProto.LiveLevelItemOrBuilder> repeatedFieldBuilderV3 = y.w; if (repeatedFieldBuilderV3 == null) { y.i(); AbstractMessageLite.Builder.addAll((Iterable) arrayList, (List) y.f10590v); y.onChanged(); } else { repeatedFieldBuilderV3.addAllMessages(arrayList); } } PatchProxyResult proxy12 = PatchProxy.proxy(new Object[]{arrayList2}, y, LiveGiftMessageProto.LiveGiftMessage.b.changeQuickRedirect, false, 54882, new Class[]{Iterable.class}, LiveGiftMessageProto.LiveGiftMessage.b.class); if (proxy12.isSupported) { y = (LiveGiftMessageProto.LiveGiftMessage.b) proxy12.result; } else { RepeatedFieldBuilderV3<LiveLevelItemProto.LiveLevelItem, LiveLevelItemProto.LiveLevelItem.b, LiveLevelItemProto.LiveLevelItemOrBuilder> repeatedFieldBuilderV32 = y.y; if (repeatedFieldBuilderV32 == null) { y.h(); AbstractMessageLite.Builder.addAll((Iterable) arrayList2, (List) y.x); y.onChanged(); } else { repeatedFieldBuilderV32.addAllMessages(arrayList2); } } return y.build(); } public LiveGiftMessage(LiveGiftMessageProto.LiveGiftMessage liveGiftMessage) { setParamsByProtoBody(liveGiftMessage); } public LiveGiftMessage(byte[] bArr) { try { setParamsByProtoBody(LiveGiftMessageProto.LiveGiftMessage.parseFrom(bArr)); } catch (InvalidProtocolBufferException e) { e.printStackTrace(); } } public LiveGiftMessage(Parcel parcel) { super(parcel); this.userId = parcel.readString(); this.userIcon = parcel.readString(); this.userName = parcel.readString(); this.createTime = parcel.readLong(); this.giftId = parcel.readString(); this.giftIcon = parcel.readString(); this.giftName = parcel.readString(); this.giftEffect = parcel.readString(); this.giftLevel = parcel.readInt(); this.giftDuration = parcel.readLong(); this.giftPrice = parcel.readLong(); this.combine = parcel.readInt(); this.comboId = parcel.readString(); this.micelleDuration = parcel.readLong(); this.fadeOutDuration = parcel.readLong(); this.giftType = parcel.readInt(); this.isNewUser = parcel.readInt(); this.isAllowCombine = parcel.readInt(); this.stock = parcel.readInt(); this.giftEffectMp4 = parcel.readString(); this.expireTime = parcel.readLong(); Parcelable.Creator<LiveLevelItem> creator = LiveLevelItem.CREATOR; this.extraLevels = parcel.createTypedArrayList(creator); this.extraLevel = parcel.createTypedArrayList(creator); this.scaleType = parcel.readInt(); this.isCache = parcel.readInt(); } }