discord-jadx/app/src/main/java/com/discord/widgets/user/usersheet/UserProfileVoiceSettingsVie...

201 lines
7.9 KiB
Java

package com.discord.widgets.user.usersheet;
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.SeekBar;
import android.widget.TextView;
import c.d.b.a.a;
import com.discord.databinding.UserProfileVoiceSettingsViewBinding;
import com.discord.views.calls.VolumeSliderView;
import com.google.android.material.switchmaterial.SwitchMaterial;
import d0.z.d.m;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
/* compiled from: UserProfileVoiceSettingsView.kt */
public final class UserProfileVoiceSettingsView extends LinearLayout {
private final UserProfileVoiceSettingsViewBinding binding;
/* compiled from: UserProfileVoiceSettingsView.kt */
public static final class ViewState {
private final Boolean isDeafened;
private final boolean isMuted;
private final Float outputVolume;
public ViewState(boolean z2, Boolean bool, Float f) {
this.isMuted = z2;
this.isDeafened = bool;
this.outputVolume = f;
}
public static /* synthetic */ ViewState copy$default(ViewState viewState, boolean z2, Boolean bool, Float f, int i, Object obj) {
if ((i & 1) != 0) {
z2 = viewState.isMuted;
}
if ((i & 2) != 0) {
bool = viewState.isDeafened;
}
if ((i & 4) != 0) {
f = viewState.outputVolume;
}
return viewState.copy(z2, bool, f);
}
public final boolean component1() {
return this.isMuted;
}
public final Boolean component2() {
return this.isDeafened;
}
public final Float component3() {
return this.outputVolume;
}
public final ViewState copy(boolean z2, Boolean bool, Float f) {
return new ViewState(z2, bool, f);
}
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.isDeafened, viewState.isDeafened) && m.areEqual(this.outputVolume, viewState.outputVolume);
}
public final Float getOutputVolume() {
return this.outputVolume;
}
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;
Boolean bool = this.isDeafened;
int i5 = 0;
int hashCode = (i4 + (bool != null ? bool.hashCode() : 0)) * 31;
Float f = this.outputVolume;
if (f != null) {
i5 = f.hashCode();
}
return hashCode + i5;
}
public final Boolean isDeafened() {
return this.isDeafened;
}
public final boolean isMuted() {
return this.isMuted;
}
public String toString() {
StringBuilder L = a.L("ViewState(isMuted=");
L.append(this.isMuted);
L.append(", isDeafened=");
L.append(this.isDeafened);
L.append(", outputVolume=");
L.append(this.outputVolume);
L.append(")");
return L.toString();
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public UserProfileVoiceSettingsView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
m.checkNotNullParameter(context, "context");
m.checkNotNullParameter(attributeSet, "attrs");
View inflate = LayoutInflater.from(context).inflate(2131558713, (ViewGroup) this, false);
addView(inflate);
int i = 2131365430;
SwitchMaterial switchMaterial = (SwitchMaterial) inflate.findViewById(2131365430);
if (switchMaterial != null) {
i = 2131365442;
SwitchMaterial switchMaterial2 = (SwitchMaterial) inflate.findViewById(2131365442);
if (switchMaterial2 != null) {
i = 2131365456;
TextView textView = (TextView) inflate.findViewById(2131365456);
if (textView != null) {
i = 2131365457;
VolumeSliderView volumeSliderView = (VolumeSliderView) inflate.findViewById(2131365457);
if (volumeSliderView != null) {
UserProfileVoiceSettingsViewBinding userProfileVoiceSettingsViewBinding = new UserProfileVoiceSettingsViewBinding((LinearLayout) inflate, switchMaterial, switchMaterial2, textView, volumeSliderView);
m.checkNotNullExpressionValue(userProfileVoiceSettingsViewBinding, "UserProfileVoiceSettings…rom(context), this, true)");
this.binding = userProfileVoiceSettingsViewBinding;
return;
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
public final void setOnDeafenChecked(Function1<? super Boolean, Unit> function1) {
m.checkNotNullParameter(function1, "onChecked");
this.binding.b.setOnCheckedChangeListener(new UserProfileVoiceSettingsView$setOnDeafenChecked$1(function1));
}
public final void setOnMuteChecked(Function1<? super Boolean, Unit> function1) {
m.checkNotNullParameter(function1, "onChecked");
this.binding.f1640c.setOnCheckedChangeListener(new UserProfileVoiceSettingsView$setOnMuteChecked$1(function1));
}
public final void setOnVolumeChange(Function2<? super Float, ? super Boolean, Unit> function2) {
m.checkNotNullParameter(function2, "onProgressChanged");
this.binding.e.setOnVolumeChange(function2);
}
public final void updateView(ViewState viewState) {
m.checkNotNullParameter(viewState, "viewState");
VolumeSliderView volumeSliderView = this.binding.e;
Float outputVolume = viewState.getOutputVolume();
boolean z2 = false;
int roundToInt = outputVolume != null ? d0.a0.a.roundToInt(outputVolume.floatValue()) : 0;
SeekBar seekBar = volumeSliderView.i.d;
m.checkNotNullExpressionValue(seekBar, "binding.volumeSliderSeekBar");
seekBar.setProgress(roundToInt);
VolumeSliderView volumeSliderView2 = this.binding.e;
m.checkNotNullExpressionValue(volumeSliderView2, "binding.userSheetVolumeSlider");
boolean z3 = true;
int i = 8;
volumeSliderView2.setVisibility(viewState.getOutputVolume() != null ? 0 : 8);
TextView textView = this.binding.d;
m.checkNotNullExpressionValue(textView, "binding.userSheetVolumeLabel");
textView.setVisibility(viewState.getOutputVolume() != null ? 0 : 8);
SwitchMaterial switchMaterial = this.binding.f1640c;
m.checkNotNullExpressionValue(switchMaterial, "binding.userSheetMuted");
switchMaterial.setChecked(viewState.isMuted());
SwitchMaterial switchMaterial2 = this.binding.b;
m.checkNotNullExpressionValue(switchMaterial2, "binding.userSheetDeafen");
if (viewState.isDeafened() == null) {
z3 = false;
}
if (z3) {
i = 0;
}
switchMaterial2.setVisibility(i);
SwitchMaterial switchMaterial3 = this.binding.b;
m.checkNotNullExpressionValue(switchMaterial3, "binding.userSheetDeafen");
Boolean isDeafened = viewState.isDeafened();
if (isDeafened != null) {
z2 = isDeafened.booleanValue();
}
switchMaterial3.setChecked(z2);
}
}