267 lines
12 KiB
Java
267 lines
12 KiB
Java
package com.discord.widgets.servers;
|
|
|
|
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 androidx.annotation.StringRes;
|
|
import c.a.l.b;
|
|
import c.d.b.a.a;
|
|
import com.discord.databinding.NotificationMuteSettingsViewBinding;
|
|
import com.discord.utilities.time.TimeUtils;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: NotificationMuteSettingsView.kt */
|
|
public final class NotificationMuteSettingsView extends LinearLayout {
|
|
private final NotificationMuteSettingsViewBinding binding;
|
|
|
|
/* compiled from: NotificationMuteSettingsView.kt */
|
|
public static final class ViewState {
|
|
private final boolean isMuted;
|
|
private final CharSequence muteDescriptionText;
|
|
private final String muteEndTime;
|
|
private final CharSequence rawMuteText;
|
|
private final CharSequence rawMutedStatusText;
|
|
private final int rawMutedUntilStatusResId;
|
|
private final CharSequence rawUnmuteText;
|
|
|
|
public ViewState(boolean z2, String str, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, @StringRes int i, CharSequence charSequence4) {
|
|
m.checkNotNullParameter(charSequence, "rawMuteText");
|
|
m.checkNotNullParameter(charSequence3, "rawMutedStatusText");
|
|
this.isMuted = z2;
|
|
this.muteEndTime = str;
|
|
this.rawMuteText = charSequence;
|
|
this.rawUnmuteText = charSequence2;
|
|
this.rawMutedStatusText = charSequence3;
|
|
this.rawMutedUntilStatusResId = i;
|
|
this.muteDescriptionText = charSequence4;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ ViewState(boolean z2, String str, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i, CharSequence charSequence4, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(z2, str, charSequence, charSequence2, charSequence3, i, (i2 & 64) != 0 ? null : charSequence4);
|
|
}
|
|
|
|
public static /* synthetic */ ViewState copy$default(ViewState viewState, boolean z2, String str, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i, CharSequence charSequence4, int i2, Object obj) {
|
|
if ((i2 & 1) != 0) {
|
|
z2 = viewState.isMuted;
|
|
}
|
|
if ((i2 & 2) != 0) {
|
|
str = viewState.muteEndTime;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
charSequence = viewState.rawMuteText;
|
|
}
|
|
if ((i2 & 8) != 0) {
|
|
charSequence2 = viewState.rawUnmuteText;
|
|
}
|
|
if ((i2 & 16) != 0) {
|
|
charSequence3 = viewState.rawMutedStatusText;
|
|
}
|
|
if ((i2 & 32) != 0) {
|
|
i = viewState.rawMutedUntilStatusResId;
|
|
}
|
|
if ((i2 & 64) != 0) {
|
|
charSequence4 = viewState.muteDescriptionText;
|
|
}
|
|
return viewState.copy(z2, str, charSequence, charSequence2, charSequence3, i, charSequence4);
|
|
}
|
|
|
|
public final boolean component1() {
|
|
return this.isMuted;
|
|
}
|
|
|
|
public final String component2() {
|
|
return this.muteEndTime;
|
|
}
|
|
|
|
public final CharSequence component3() {
|
|
return this.rawMuteText;
|
|
}
|
|
|
|
public final CharSequence component4() {
|
|
return this.rawUnmuteText;
|
|
}
|
|
|
|
public final CharSequence component5() {
|
|
return this.rawMutedStatusText;
|
|
}
|
|
|
|
public final int component6() {
|
|
return this.rawMutedUntilStatusResId;
|
|
}
|
|
|
|
public final CharSequence component7() {
|
|
return this.muteDescriptionText;
|
|
}
|
|
|
|
public final ViewState copy(boolean z2, String str, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, @StringRes int i, CharSequence charSequence4) {
|
|
m.checkNotNullParameter(charSequence, "rawMuteText");
|
|
m.checkNotNullParameter(charSequence3, "rawMutedStatusText");
|
|
return new ViewState(z2, str, charSequence, charSequence2, charSequence3, i, charSequence4);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ViewState)) {
|
|
return false;
|
|
}
|
|
ViewState viewState = (ViewState) obj;
|
|
return this.isMuted == viewState.isMuted && m.areEqual(this.muteEndTime, viewState.muteEndTime) && m.areEqual(this.rawMuteText, viewState.rawMuteText) && m.areEqual(this.rawUnmuteText, viewState.rawUnmuteText) && m.areEqual(this.rawMutedStatusText, viewState.rawMutedStatusText) && this.rawMutedUntilStatusResId == viewState.rawMutedUntilStatusResId && m.areEqual(this.muteDescriptionText, viewState.muteDescriptionText);
|
|
}
|
|
|
|
public final CharSequence getMuteDescriptionText() {
|
|
return this.muteDescriptionText;
|
|
}
|
|
|
|
public final String getMuteEndTime() {
|
|
return this.muteEndTime;
|
|
}
|
|
|
|
public final CharSequence getRawMuteText() {
|
|
return this.rawMuteText;
|
|
}
|
|
|
|
public final CharSequence getRawMutedStatusText() {
|
|
return this.rawMutedStatusText;
|
|
}
|
|
|
|
public final int getRawMutedUntilStatusResId() {
|
|
return this.rawMutedUntilStatusResId;
|
|
}
|
|
|
|
public final CharSequence getRawUnmuteText() {
|
|
return this.rawUnmuteText;
|
|
}
|
|
|
|
public int hashCode() {
|
|
boolean z2 = this.isMuted;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i = z2 ? 1 : 0;
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = i * 31;
|
|
String str = this.muteEndTime;
|
|
int i5 = 0;
|
|
int hashCode = (i4 + (str != null ? str.hashCode() : 0)) * 31;
|
|
CharSequence charSequence = this.rawMuteText;
|
|
int hashCode2 = (hashCode + (charSequence != null ? charSequence.hashCode() : 0)) * 31;
|
|
CharSequence charSequence2 = this.rawUnmuteText;
|
|
int hashCode3 = (hashCode2 + (charSequence2 != null ? charSequence2.hashCode() : 0)) * 31;
|
|
CharSequence charSequence3 = this.rawMutedStatusText;
|
|
int hashCode4 = (((hashCode3 + (charSequence3 != null ? charSequence3.hashCode() : 0)) * 31) + this.rawMutedUntilStatusResId) * 31;
|
|
CharSequence charSequence4 = this.muteDescriptionText;
|
|
if (charSequence4 != null) {
|
|
i5 = charSequence4.hashCode();
|
|
}
|
|
return hashCode4 + i5;
|
|
}
|
|
|
|
public final boolean isMuted() {
|
|
return this.isMuted;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("ViewState(isMuted=");
|
|
L.append(this.isMuted);
|
|
L.append(", muteEndTime=");
|
|
L.append(this.muteEndTime);
|
|
L.append(", rawMuteText=");
|
|
L.append(this.rawMuteText);
|
|
L.append(", rawUnmuteText=");
|
|
L.append(this.rawUnmuteText);
|
|
L.append(", rawMutedStatusText=");
|
|
L.append(this.rawMutedStatusText);
|
|
L.append(", rawMutedUntilStatusResId=");
|
|
L.append(this.rawMutedUntilStatusResId);
|
|
L.append(", muteDescriptionText=");
|
|
L.append(this.muteDescriptionText);
|
|
L.append(")");
|
|
return L.toString();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public NotificationMuteSettingsView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(attributeSet, "attrs");
|
|
View inflate = LayoutInflater.from(context).inflate(2131558597, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
int i = 2131364080;
|
|
TextView textView = (TextView) inflate.findViewById(2131364080);
|
|
if (textView != null) {
|
|
i = 2131364081;
|
|
TextView textView2 = (TextView) inflate.findViewById(2131364081);
|
|
if (textView2 != null) {
|
|
i = 2131364082;
|
|
TextView textView3 = (TextView) inflate.findViewById(2131364082);
|
|
if (textView3 != null) {
|
|
NotificationMuteSettingsViewBinding notificationMuteSettingsViewBinding = new NotificationMuteSettingsViewBinding((LinearLayout) inflate, textView, textView2, textView3);
|
|
m.checkNotNullExpressionValue(notificationMuteSettingsViewBinding, "NotificationMuteSettings…rom(context), this, true)");
|
|
this.binding = notificationMuteSettingsViewBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
|
|
}
|
|
|
|
public final void updateView(ViewState viewState, Function0<Unit> function0, Function0<Unit> function02) {
|
|
CharSequence charSequence;
|
|
m.checkNotNullParameter(viewState, "viewState");
|
|
m.checkNotNullParameter(function0, "onMute");
|
|
m.checkNotNullParameter(function02, "onUnmute");
|
|
CharSequence rawMuteText = viewState.getRawMuteText();
|
|
boolean isMuted = viewState.isMuted();
|
|
String muteEndTime = viewState.getMuteEndTime();
|
|
CharSequence muteDescriptionText = viewState.getMuteDescriptionText();
|
|
if (isMuted) {
|
|
rawMuteText = viewState.getRawUnmuteText();
|
|
}
|
|
TextView textView = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView, "binding.notificationMuteSettingsMuteItem");
|
|
textView.setText(rawMuteText);
|
|
this.binding.b.setOnClickListener(new NotificationMuteSettingsView$updateView$1(isMuted, function02, function0));
|
|
boolean z2 = true;
|
|
int i = 0;
|
|
if (!isMuted) {
|
|
charSequence = "";
|
|
} else if (muteEndTime != null) {
|
|
TimeUtils timeUtils = TimeUtils.INSTANCE;
|
|
Context context = getContext();
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
charSequence = b.c(this, viewState.getRawMutedUntilStatusResId(), new Object[]{TimeUtils.renderUtcDateTime$default(timeUtils, muteEndTime, context, null, 2, 3, 4, null)}, new NotificationMuteSettingsView$updateView$rawMuteStatusText$1(this));
|
|
} else {
|
|
charSequence = viewState.getRawMutedStatusText();
|
|
}
|
|
TextView textView2 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView2, "binding.notificationMuteSettingsMuteItemStatus");
|
|
textView2.setText(charSequence);
|
|
TextView textView3 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView3, "binding.notificationMuteSettingsMuteItemStatus");
|
|
textView3.setVisibility(isMuted ? 0 : 8);
|
|
TextView textView4 = this.binding.f1614c;
|
|
m.checkNotNullExpressionValue(textView4, "binding.notificationMute…ttingsMuteItemDescription");
|
|
if (muteDescriptionText == null) {
|
|
z2 = false;
|
|
}
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
textView4.setVisibility(i);
|
|
TextView textView5 = this.binding.f1614c;
|
|
m.checkNotNullExpressionValue(textView5, "binding.notificationMute…ttingsMuteItemDescription");
|
|
textView5.setText(muteDescriptionText);
|
|
}
|
|
}
|