395 lines
17 KiB
Java
395 lines
17 KiB
Java
package com.discord.widgets.user.profile;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import c.d.b.a.a;
|
|
import com.discord.databinding.UserProfileAdminViewBinding;
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
/* compiled from: UserProfileAdminView.kt */
|
|
public final class UserProfileAdminView extends LinearLayout {
|
|
private final UserProfileAdminViewBinding binding;
|
|
|
|
/* compiled from: UserProfileAdminView.kt */
|
|
public static final class ViewState {
|
|
private final boolean isAdminSectionEnabled;
|
|
private final boolean isMe;
|
|
private final boolean isMultiUserDM;
|
|
private final boolean isServerDeafened;
|
|
private final boolean isServerMuted;
|
|
private final boolean showBanButton;
|
|
private final boolean showEditMemberButton;
|
|
private final boolean showKickButton;
|
|
private final boolean showServerDeafenButton;
|
|
private final boolean showServerMoveAndDisconnectButtons;
|
|
private final boolean showServerMuteButton;
|
|
|
|
public ViewState(boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, boolean z8, boolean z9, boolean z10, boolean z11, boolean z12) {
|
|
this.showEditMemberButton = z2;
|
|
this.showKickButton = z3;
|
|
this.isMultiUserDM = z4;
|
|
this.showBanButton = z5;
|
|
this.showServerMuteButton = z6;
|
|
this.isServerMuted = z7;
|
|
this.showServerDeafenButton = z8;
|
|
this.isServerDeafened = z9;
|
|
this.showServerMoveAndDisconnectButtons = z10;
|
|
this.isAdminSectionEnabled = z11;
|
|
this.isMe = z12;
|
|
}
|
|
|
|
public static /* synthetic */ ViewState copy$default(ViewState viewState, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, boolean z8, boolean z9, boolean z10, boolean z11, boolean z12, int i, Object obj) {
|
|
return viewState.copy((i & 1) != 0 ? viewState.showEditMemberButton : z2, (i & 2) != 0 ? viewState.showKickButton : z3, (i & 4) != 0 ? viewState.isMultiUserDM : z4, (i & 8) != 0 ? viewState.showBanButton : z5, (i & 16) != 0 ? viewState.showServerMuteButton : z6, (i & 32) != 0 ? viewState.isServerMuted : z7, (i & 64) != 0 ? viewState.showServerDeafenButton : z8, (i & 128) != 0 ? viewState.isServerDeafened : z9, (i & 256) != 0 ? viewState.showServerMoveAndDisconnectButtons : z10, (i & 512) != 0 ? viewState.isAdminSectionEnabled : z11, (i & 1024) != 0 ? viewState.isMe : z12);
|
|
}
|
|
|
|
public final boolean component1() {
|
|
return this.showEditMemberButton;
|
|
}
|
|
|
|
public final boolean component10() {
|
|
return this.isAdminSectionEnabled;
|
|
}
|
|
|
|
public final boolean component11() {
|
|
return this.isMe;
|
|
}
|
|
|
|
public final boolean component2() {
|
|
return this.showKickButton;
|
|
}
|
|
|
|
public final boolean component3() {
|
|
return this.isMultiUserDM;
|
|
}
|
|
|
|
public final boolean component4() {
|
|
return this.showBanButton;
|
|
}
|
|
|
|
public final boolean component5() {
|
|
return this.showServerMuteButton;
|
|
}
|
|
|
|
public final boolean component6() {
|
|
return this.isServerMuted;
|
|
}
|
|
|
|
public final boolean component7() {
|
|
return this.showServerDeafenButton;
|
|
}
|
|
|
|
public final boolean component8() {
|
|
return this.isServerDeafened;
|
|
}
|
|
|
|
public final boolean component9() {
|
|
return this.showServerMoveAndDisconnectButtons;
|
|
}
|
|
|
|
public final ViewState copy(boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, boolean z8, boolean z9, boolean z10, boolean z11, boolean z12) {
|
|
return new ViewState(z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ViewState)) {
|
|
return false;
|
|
}
|
|
ViewState viewState = (ViewState) obj;
|
|
return this.showEditMemberButton == viewState.showEditMemberButton && this.showKickButton == viewState.showKickButton && this.isMultiUserDM == viewState.isMultiUserDM && this.showBanButton == viewState.showBanButton && this.showServerMuteButton == viewState.showServerMuteButton && this.isServerMuted == viewState.isServerMuted && this.showServerDeafenButton == viewState.showServerDeafenButton && this.isServerDeafened == viewState.isServerDeafened && this.showServerMoveAndDisconnectButtons == viewState.showServerMoveAndDisconnectButtons && this.isAdminSectionEnabled == viewState.isAdminSectionEnabled && this.isMe == viewState.isMe;
|
|
}
|
|
|
|
public final boolean getShowBanButton() {
|
|
return this.showBanButton;
|
|
}
|
|
|
|
public final boolean getShowEditMemberButton() {
|
|
return this.showEditMemberButton;
|
|
}
|
|
|
|
public final boolean getShowKickButton() {
|
|
return this.showKickButton;
|
|
}
|
|
|
|
public final boolean getShowServerDeafenButton() {
|
|
return this.showServerDeafenButton;
|
|
}
|
|
|
|
public final boolean getShowServerMoveAndDisconnectButtons() {
|
|
return this.showServerMoveAndDisconnectButtons;
|
|
}
|
|
|
|
public final boolean getShowServerMuteButton() {
|
|
return this.showServerMuteButton;
|
|
}
|
|
|
|
public int hashCode() {
|
|
boolean z2 = this.showEditMemberButton;
|
|
int i = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = i2 * 31;
|
|
boolean z3 = this.showKickButton;
|
|
if (z3) {
|
|
z3 = true;
|
|
}
|
|
int i6 = z3 ? 1 : 0;
|
|
int i7 = z3 ? 1 : 0;
|
|
int i8 = z3 ? 1 : 0;
|
|
int i9 = (i5 + i6) * 31;
|
|
boolean z4 = this.isMultiUserDM;
|
|
if (z4) {
|
|
z4 = true;
|
|
}
|
|
int i10 = z4 ? 1 : 0;
|
|
int i11 = z4 ? 1 : 0;
|
|
int i12 = z4 ? 1 : 0;
|
|
int i13 = (i9 + i10) * 31;
|
|
boolean z5 = this.showBanButton;
|
|
if (z5) {
|
|
z5 = true;
|
|
}
|
|
int i14 = z5 ? 1 : 0;
|
|
int i15 = z5 ? 1 : 0;
|
|
int i16 = z5 ? 1 : 0;
|
|
int i17 = (i13 + i14) * 31;
|
|
boolean z6 = this.showServerMuteButton;
|
|
if (z6) {
|
|
z6 = true;
|
|
}
|
|
int i18 = z6 ? 1 : 0;
|
|
int i19 = z6 ? 1 : 0;
|
|
int i20 = z6 ? 1 : 0;
|
|
int i21 = (i17 + i18) * 31;
|
|
boolean z7 = this.isServerMuted;
|
|
if (z7) {
|
|
z7 = true;
|
|
}
|
|
int i22 = z7 ? 1 : 0;
|
|
int i23 = z7 ? 1 : 0;
|
|
int i24 = z7 ? 1 : 0;
|
|
int i25 = (i21 + i22) * 31;
|
|
boolean z8 = this.showServerDeafenButton;
|
|
if (z8) {
|
|
z8 = true;
|
|
}
|
|
int i26 = z8 ? 1 : 0;
|
|
int i27 = z8 ? 1 : 0;
|
|
int i28 = z8 ? 1 : 0;
|
|
int i29 = (i25 + i26) * 31;
|
|
boolean z9 = this.isServerDeafened;
|
|
if (z9) {
|
|
z9 = true;
|
|
}
|
|
int i30 = z9 ? 1 : 0;
|
|
int i31 = z9 ? 1 : 0;
|
|
int i32 = z9 ? 1 : 0;
|
|
int i33 = (i29 + i30) * 31;
|
|
boolean z10 = this.showServerMoveAndDisconnectButtons;
|
|
if (z10) {
|
|
z10 = true;
|
|
}
|
|
int i34 = z10 ? 1 : 0;
|
|
int i35 = z10 ? 1 : 0;
|
|
int i36 = z10 ? 1 : 0;
|
|
int i37 = (i33 + i34) * 31;
|
|
boolean z11 = this.isAdminSectionEnabled;
|
|
if (z11) {
|
|
z11 = true;
|
|
}
|
|
int i38 = z11 ? 1 : 0;
|
|
int i39 = z11 ? 1 : 0;
|
|
int i40 = z11 ? 1 : 0;
|
|
int i41 = (i37 + i38) * 31;
|
|
boolean z12 = this.isMe;
|
|
if (!z12) {
|
|
i = z12 ? 1 : 0;
|
|
}
|
|
return i41 + i;
|
|
}
|
|
|
|
public final boolean isAdminSectionEnabled() {
|
|
return this.isAdminSectionEnabled;
|
|
}
|
|
|
|
public final boolean isMe() {
|
|
return this.isMe;
|
|
}
|
|
|
|
public final boolean isMultiUserDM() {
|
|
return this.isMultiUserDM;
|
|
}
|
|
|
|
public final boolean isServerDeafened() {
|
|
return this.isServerDeafened;
|
|
}
|
|
|
|
public final boolean isServerMuted() {
|
|
return this.isServerMuted;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("ViewState(showEditMemberButton=");
|
|
L.append(this.showEditMemberButton);
|
|
L.append(", showKickButton=");
|
|
L.append(this.showKickButton);
|
|
L.append(", isMultiUserDM=");
|
|
L.append(this.isMultiUserDM);
|
|
L.append(", showBanButton=");
|
|
L.append(this.showBanButton);
|
|
L.append(", showServerMuteButton=");
|
|
L.append(this.showServerMuteButton);
|
|
L.append(", isServerMuted=");
|
|
L.append(this.isServerMuted);
|
|
L.append(", showServerDeafenButton=");
|
|
L.append(this.showServerDeafenButton);
|
|
L.append(", isServerDeafened=");
|
|
L.append(this.isServerDeafened);
|
|
L.append(", showServerMoveAndDisconnectButtons=");
|
|
L.append(this.showServerMoveAndDisconnectButtons);
|
|
L.append(", isAdminSectionEnabled=");
|
|
L.append(this.isAdminSectionEnabled);
|
|
L.append(", isMe=");
|
|
return a.G(L, this.isMe, ")");
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public UserProfileAdminView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(attributeSet, "attrs");
|
|
View inflate = LayoutInflater.from(context).inflate(2131558708, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
int i = 2131365460;
|
|
TextView textView = (TextView) inflate.findViewById(2131365460);
|
|
if (textView != null) {
|
|
i = 2131365461;
|
|
TextView textView2 = (TextView) inflate.findViewById(2131365461);
|
|
if (textView2 != null) {
|
|
i = 2131365462;
|
|
TextView textView3 = (TextView) inflate.findViewById(2131365462);
|
|
if (textView3 != null) {
|
|
i = 2131365463;
|
|
TextView textView4 = (TextView) inflate.findViewById(2131365463);
|
|
if (textView4 != null) {
|
|
i = 2131365464;
|
|
TextView textView5 = (TextView) inflate.findViewById(2131365464);
|
|
if (textView5 != null) {
|
|
i = 2131365465;
|
|
TextView textView6 = (TextView) inflate.findViewById(2131365465);
|
|
if (textView6 != null) {
|
|
i = 2131365466;
|
|
TextView textView7 = (TextView) inflate.findViewById(2131365466);
|
|
if (textView7 != null) {
|
|
UserProfileAdminViewBinding userProfileAdminViewBinding = new UserProfileAdminViewBinding((LinearLayout) inflate, textView, textView2, textView3, textView4, textView5, textView6, textView7);
|
|
m.checkNotNullExpressionValue(userProfileAdminViewBinding, "UserProfileAdminViewBind…rom(context), this, true)");
|
|
this.binding = userProfileAdminViewBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
|
|
}
|
|
|
|
public final void setOnBan(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onBan");
|
|
this.binding.b.setOnClickListener(new UserProfileAdminView$setOnBan$1(function0));
|
|
}
|
|
|
|
public final void setOnDisconnect(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onDisconnect");
|
|
this.binding.f.setOnClickListener(new UserProfileAdminView$setOnDisconnect$1(function0));
|
|
}
|
|
|
|
public final void setOnEditMember(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onEditMember");
|
|
this.binding.f1633c.setOnClickListener(new UserProfileAdminView$setOnEditMember$1(function0));
|
|
}
|
|
|
|
public final void setOnKick(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onKick");
|
|
this.binding.d.setOnClickListener(new UserProfileAdminView$setOnKick$1(function0));
|
|
}
|
|
|
|
public final void setOnServerDeafen(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onServerDeafen");
|
|
this.binding.e.setOnClickListener(new UserProfileAdminView$setOnServerDeafen$1(function0));
|
|
}
|
|
|
|
public final void setOnServerMove(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onServerMove");
|
|
this.binding.g.setOnClickListener(new UserProfileAdminView$setOnServerMove$1(function0));
|
|
}
|
|
|
|
public final void setOnServerMute(Function0<Unit> function0) {
|
|
m.checkNotNullParameter(function0, "onServerMute");
|
|
this.binding.h.setOnClickListener(new UserProfileAdminView$setOnServerMute$1(function0));
|
|
}
|
|
|
|
public final void updateView(ViewState viewState) {
|
|
m.checkNotNullParameter(viewState, "viewState");
|
|
TextView textView = this.binding.f1633c;
|
|
m.checkNotNullExpressionValue(textView, "binding.userProfileAdminEditMember");
|
|
int i = 8;
|
|
textView.setVisibility(viewState.getShowEditMemberButton() ? 0 : 8);
|
|
TextView textView2 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView2, "binding.userProfileAdminKick");
|
|
textView2.setVisibility(viewState.getShowKickButton() ? 0 : 8);
|
|
this.binding.d.setText(viewState.isMultiUserDM() ? 2131892649 : 2131890825);
|
|
TextView textView3 = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView3, "binding.userProfileAdminBan");
|
|
textView3.setVisibility(viewState.getShowBanButton() ? 0 : 8);
|
|
TextView textView4 = this.binding.h;
|
|
m.checkNotNullExpressionValue(textView4, "binding.userProfileAdminServerMute");
|
|
textView4.setVisibility(viewState.getShowServerMuteButton() ? 0 : 8);
|
|
boolean isServerMuted = viewState.isServerMuted();
|
|
boolean isMe = viewState.isMe();
|
|
int themedDrawableRes$default = isServerMuted ? DrawableCompat.getThemedDrawableRes$default(this, 2130969423, 0, 2, (Object) null) : DrawableCompat.getThemedDrawableRes$default(this, 2130969421, 0, 2, (Object) null);
|
|
int i2 = isServerMuted ? 2131893272 : 2131893259;
|
|
TextView textView5 = this.binding.h;
|
|
m.checkNotNullExpressionValue(textView5, "binding.userProfileAdminServerMute");
|
|
ViewExtensions.setCompoundDrawableWithIntrinsicBounds$default(textView5, themedDrawableRes$default, 0, 0, 0, 14, null);
|
|
this.binding.h.setText(i2);
|
|
TextView textView6 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView6, "binding.userProfileAdminServerDeafen");
|
|
textView6.setVisibility(viewState.getShowServerDeafenButton() ? 0 : 8);
|
|
boolean isServerDeafened = viewState.isServerDeafened();
|
|
int themedDrawableRes$default2 = isServerDeafened ? DrawableCompat.getThemedDrawableRes$default(this, 2130969413, 0, 2, (Object) null) : DrawableCompat.getThemedDrawableRes$default(this, 2130969413, 0, 2, (Object) null);
|
|
int i3 = isServerDeafened ? 2131893271 : 2131893248;
|
|
int i4 = isMe ? 2131888145 : 2131888144;
|
|
TextView textView7 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView7, "binding.userProfileAdminServerDeafen");
|
|
ViewExtensions.setCompoundDrawableWithIntrinsicBounds$default(textView7, themedDrawableRes$default2, 0, 0, 0, 14, null);
|
|
this.binding.e.setText(i3);
|
|
TextView textView8 = this.binding.g;
|
|
m.checkNotNullExpressionValue(textView8, "binding.userProfileAdminServerMove");
|
|
textView8.setVisibility(viewState.getShowServerMoveAndDisconnectButtons() ? 0 : 8);
|
|
this.binding.f.setText(i4);
|
|
TextView textView9 = this.binding.f;
|
|
m.checkNotNullExpressionValue(textView9, "binding.userProfileAdminServerDisconnect");
|
|
if (viewState.getShowServerMoveAndDisconnectButtons()) {
|
|
i = 0;
|
|
}
|
|
textView9.setVisibility(i);
|
|
}
|
|
}
|