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 c0.z.d.m; import com.discord.R; 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 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(R.layout.view_mobile_reports_bottom_button, this); int i2 = R.id.report_node_bottom_button; LoadingButton loadingButton = (LoadingButton) findViewById(R.id.report_node_bottom_button); if (loadingButton != null) { i2 = R.id.report_node_bottom_button_cancel; MaterialButton materialButton = (MaterialButton) findViewById(R.id.report_node_bottom_button_cancel); if (materialButton != null) { i2 = R.id.report_node_bottom_button_description; LinkifiedTextView linkifiedTextView = (LinkifiedTextView) findViewById(R.id.report_node_bottom_button_description); if (linkifiedTextView != null) { i2 = R.id.report_node_bottom_button_error_text; TextView textView = (TextView) findViewById(R.id.report_node_bottom_button_error_text); 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 function1) { this.binding.f2088c.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.f2088c; 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.f2088c; 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.h(context, R.string.mobile_reports_submit_info_text, new Object[0], null, 4)); this.binding.b.setText(getContext().getString(R.string.mobile_reports_submit_report)); this.binding.b.setBackgroundColor(ColorCompat.getColor(getContext(), (int) R.color.status_red)); this.binding.b.setOnClickListener(new MobileReportsBottomButton$setup$1(function1, reportNodeBottomButton)); } else if (reportNodeBottomButton instanceof ReportNodeBottomButton.Done) { this.binding.b.setText(getContext().getString(R.string.done)); this.binding.b.setOnClickListener(new MobileReportsBottomButton$setup$2(function1, reportNodeBottomButton)); } else if (reportNodeBottomButton instanceof ReportNodeBottomButton.Next) { this.binding.b.setText(getContext().getString(R.string.next)); this.binding.b.setOnClickListener(new MobileReportsBottomButton$setup$3(function1, reportNodeBottomButton)); } else if (z3) { this.binding.f2088c.setOnClickListener(new MobileReportsBottomButton$setup$4(function1, reportNodeBottomButton)); } } }