144 lines
7 KiB
Java
144 lines
7 KiB
Java
package com.discord.widgets.voice.feedback;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.view.View;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import c.a.d.f;
|
|
import c.a.d.h0;
|
|
import c.a.d.j0;
|
|
import c.a.d.l;
|
|
import c.a.d.o;
|
|
import c.a.k.b;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppActivity;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetIssueDetailsFormBinding;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.view.text.LinkifiedTextView;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.widgets.voice.feedback.IssueDetailsFormViewModel;
|
|
import com.google.android.material.button.MaterialButton;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.z.d.a0;
|
|
import d0.z.d.m;
|
|
import java.io.Serializable;
|
|
import java.util.Objects;
|
|
import kotlin.Lazy;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
/* compiled from: WidgetIssueDetailsForm.kt */
|
|
public final class WidgetIssueDetailsForm extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetIssueDetailsForm.class, "binding", "getBinding()Lcom/discord/databinding/WidgetIssueDetailsFormBinding;", 0)};
|
|
public static final String ARG_PENDING_VOICE_FEEDBACK = "ARG_PENDING_VOICE_FEEDBACK";
|
|
public static final String ARG_SHOW_CX_PROMPT = "ARG_SHOW_CX_PROMPT";
|
|
public static final Companion Companion = new Companion(null);
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetIssueDetailsForm$binding$2.INSTANCE, null, 2, null);
|
|
private final Lazy viewModel$delegate;
|
|
|
|
/* compiled from: WidgetIssueDetailsForm.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final void launch(Context context, PendingFeedback pendingFeedback, boolean z2) {
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(pendingFeedback, "pendingFeedback");
|
|
Intent intent = new Intent();
|
|
intent.putExtra("ARG_PENDING_VOICE_FEEDBACK", pendingFeedback);
|
|
intent.putExtra("ARG_SHOW_CX_PROMPT", z2);
|
|
l.d(context, WidgetIssueDetailsForm.class, intent);
|
|
}
|
|
}
|
|
|
|
public WidgetIssueDetailsForm() {
|
|
super(2131559097);
|
|
WidgetIssueDetailsForm$viewModel$2 widgetIssueDetailsForm$viewModel$2 = new WidgetIssueDetailsForm$viewModel$2(this);
|
|
h0 h0Var = new h0(this);
|
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(IssueDetailsFormViewModel.class), new WidgetIssueDetailsForm$appViewModels$$inlined$viewModels$1(h0Var), new j0(widgetIssueDetailsForm$viewModel$2));
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetIssueDetailsFormBinding access$getBinding$p(WidgetIssueDetailsForm widgetIssueDetailsForm) {
|
|
return widgetIssueDetailsForm.getBinding();
|
|
}
|
|
|
|
public static final /* synthetic */ PendingFeedback access$getPendingFeedback(WidgetIssueDetailsForm widgetIssueDetailsForm) {
|
|
return widgetIssueDetailsForm.getPendingFeedback();
|
|
}
|
|
|
|
public static final /* synthetic */ IssueDetailsFormViewModel access$getViewModel$p(WidgetIssueDetailsForm widgetIssueDetailsForm) {
|
|
return widgetIssueDetailsForm.getViewModel();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleEvent(WidgetIssueDetailsForm widgetIssueDetailsForm, IssueDetailsFormViewModel.Event event) {
|
|
widgetIssueDetailsForm.handleEvent(event);
|
|
}
|
|
|
|
private final WidgetIssueDetailsFormBinding getBinding() {
|
|
return (WidgetIssueDetailsFormBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final PendingFeedback getPendingFeedback() {
|
|
Serializable serializableExtra = getMostRecentIntent().getSerializableExtra("ARG_PENDING_VOICE_FEEDBACK");
|
|
Objects.requireNonNull(serializableExtra, "null cannot be cast to non-null type com.discord.widgets.voice.feedback.PendingFeedback");
|
|
return (PendingFeedback) serializableExtra;
|
|
}
|
|
|
|
private final IssueDetailsFormViewModel getViewModel() {
|
|
return (IssueDetailsFormViewModel) this.viewModel$delegate.getValue();
|
|
}
|
|
|
|
private final void handleEvent(IssueDetailsFormViewModel.Event event) {
|
|
if (m.areEqual(event, IssueDetailsFormViewModel.Event.Close.INSTANCE)) {
|
|
o.i(this, 2131887118, 0, 4);
|
|
AppActivity appActivity = getAppActivity();
|
|
if (appActivity != null) {
|
|
appActivity.hideKeyboard(getBinding().f1841c);
|
|
}
|
|
requireActivity().onBackPressed();
|
|
}
|
|
}
|
|
|
|
private final boolean shouldShowCxPrompt() {
|
|
return getMostRecentIntent().getBooleanExtra("ARG_SHOW_CX_PROMPT", false);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
setActionBarTitle(2131888509);
|
|
MaterialButton materialButton = getBinding().d;
|
|
m.checkNotNullExpressionValue(materialButton, "binding.issueDetailsSubmitButton");
|
|
materialButton.setEnabled(false);
|
|
getBinding().d.setOnClickListener(new WidgetIssueDetailsForm$onViewBound$1(this));
|
|
TextInputLayout textInputLayout = getBinding().f1841c;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.issueDetailsInput");
|
|
ViewExtensions.addBindedTextWatcher(textInputLayout, this, new WidgetIssueDetailsForm$onViewBound$2(this));
|
|
TextInputLayout textInputLayout2 = getBinding().f1841c;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.issueDetailsInput");
|
|
showKeyboard(textInputLayout2);
|
|
LinkifiedTextView linkifiedTextView = getBinding().b;
|
|
m.checkNotNullExpressionValue(linkifiedTextView, "binding.issueDetailsCxPrompt");
|
|
linkifiedTextView.setVisibility(shouldShowCxPrompt() ? 0 : 8);
|
|
LinkifiedTextView linkifiedTextView2 = getBinding().b;
|
|
m.checkNotNullExpressionValue(linkifiedTextView2, "binding.issueDetailsCxPrompt");
|
|
b.m(linkifiedTextView2, 2131888510, new Object[]{f.c()}, null, 4);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeEvents(), this), WidgetIssueDetailsForm.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetIssueDetailsForm$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
}
|
|
}
|