113 lines
6.3 KiB
Java
113 lines
6.3 KiB
Java
package com.discord.widgets.mobile_reports;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import c.a.k.b;
|
|
import com.discord.api.report.ReportNodeBottomButton;
|
|
import com.discord.databinding.ViewMobileReportsBottomButtonBinding;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.view.text.LinkifiedTextView;
|
|
import com.discord.views.LoadingButton;
|
|
import com.discord.widgets.mobile_reports.MobileReportsViewModel;
|
|
import com.google.android.material.button.MaterialButton;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: MobileReportsBottomButton.kt */
|
|
public final class MobileReportsBottomButton extends LinearLayout {
|
|
private final ViewMobileReportsBottomButtonBinding binding;
|
|
|
|
public MobileReportsBottomButton(Context context) {
|
|
this(context, null, 0, 6, null);
|
|
}
|
|
|
|
public MobileReportsBottomButton(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0, 4, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public MobileReportsBottomButton(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
m.checkNotNullParameter(context, "context");
|
|
LayoutInflater.from(context).inflate(2131558770, this);
|
|
int i2 = 2131364517;
|
|
LoadingButton loadingButton = (LoadingButton) findViewById(2131364517);
|
|
if (loadingButton != null) {
|
|
i2 = 2131364518;
|
|
MaterialButton materialButton = (MaterialButton) findViewById(2131364518);
|
|
if (materialButton != null) {
|
|
i2 = 2131364519;
|
|
LinkifiedTextView linkifiedTextView = (LinkifiedTextView) findViewById(2131364519);
|
|
if (linkifiedTextView != null) {
|
|
i2 = 2131364520;
|
|
TextView textView = (TextView) findViewById(2131364520);
|
|
if (textView != null) {
|
|
ViewMobileReportsBottomButtonBinding viewMobileReportsBottomButtonBinding = new ViewMobileReportsBottomButtonBinding(this, loadingButton, materialButton, linkifiedTextView, textView);
|
|
m.checkNotNullExpressionValue(viewMobileReportsBottomButtonBinding, "ViewMobileReportsBottomB…ater.from(context), this)");
|
|
this.binding = viewMobileReportsBottomButtonBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(getResources().getResourceName(i2)));
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ MobileReportsBottomButton(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
|
|
}
|
|
|
|
public final void setup(ReportNodeBottomButton reportNodeBottomButton, MobileReportsViewModel.SubmitState submitState, Function1<? super ReportNodeBottomButton, Unit> function1) {
|
|
this.binding.f1661c.setOnClickListener(null);
|
|
this.binding.b.setOnClickListener(null);
|
|
LinkifiedTextView linkifiedTextView = this.binding.d;
|
|
m.checkNotNullExpressionValue(linkifiedTextView, "binding.reportNodeBottomButtonDescription");
|
|
boolean z2 = reportNodeBottomButton instanceof ReportNodeBottomButton.Submit;
|
|
int i = 8;
|
|
linkifiedTextView.setVisibility(z2 ? 0 : 8);
|
|
MaterialButton materialButton = this.binding.f1661c;
|
|
m.checkNotNullExpressionValue(materialButton, "binding.reportNodeBottomButtonCancel");
|
|
boolean z3 = reportNodeBottomButton instanceof ReportNodeBottomButton.Cancel;
|
|
materialButton.setVisibility(z3 ? 0 : 8);
|
|
LoadingButton loadingButton = this.binding.b;
|
|
m.checkNotNullExpressionValue(loadingButton, "binding.reportNodeBottomButton");
|
|
MaterialButton materialButton2 = this.binding.f1661c;
|
|
m.checkNotNullExpressionValue(materialButton2, "binding.reportNodeBottomButtonCancel");
|
|
loadingButton.setVisibility((materialButton2.getVisibility() == 0) ^ true ? 0 : 8);
|
|
boolean z4 = submitState instanceof MobileReportsViewModel.SubmitState.Loading;
|
|
TextView textView = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView, "binding.reportNodeBottomButtonErrorText");
|
|
if (submitState instanceof MobileReportsViewModel.SubmitState.Error) {
|
|
i = 0;
|
|
}
|
|
textView.setVisibility(i);
|
|
this.binding.b.setIsLoading(z4);
|
|
LoadingButton loadingButton2 = this.binding.b;
|
|
m.checkNotNullExpressionValue(loadingButton2, "binding.reportNodeBottomButton");
|
|
loadingButton2.setEnabled(!z4);
|
|
if (z2) {
|
|
LinkifiedTextView linkifiedTextView2 = this.binding.d;
|
|
m.checkNotNullExpressionValue(linkifiedTextView2, "binding.reportNodeBottomButtonDescription");
|
|
Context context = getContext();
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
linkifiedTextView2.setText(b.g(context, 2131891387, new Object[0], null, 4));
|
|
this.binding.b.setText(getContext().getString(2131891388));
|
|
this.binding.b.setBackgroundColor(ColorCompat.getColor(getContext(), 2131100311));
|
|
this.binding.b.setOnClickListener(new MobileReportsBottomButton$setup$1(function1, reportNodeBottomButton));
|
|
} else if (reportNodeBottomButton instanceof ReportNodeBottomButton.Done) {
|
|
this.binding.b.setText(getContext().getString(2131888181));
|
|
this.binding.b.setOnClickListener(new MobileReportsBottomButton$setup$2(function1, reportNodeBottomButton));
|
|
} else if (reportNodeBottomButton instanceof ReportNodeBottomButton.Next) {
|
|
this.binding.b.setText(getContext().getString(2131891520));
|
|
this.binding.b.setOnClickListener(new MobileReportsBottomButton$setup$3(function1, reportNodeBottomButton));
|
|
} else if (z3) {
|
|
this.binding.f1661c.setOnClickListener(new MobileReportsBottomButton$setup$4(function1, reportNodeBottomButton));
|
|
}
|
|
}
|
|
}
|