86 lines
4.4 KiB
Java
86 lines
4.4 KiB
Java
|
package com.discord.widgets.hubs;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.view.View;
|
||
|
import androidx.fragment.app.Fragment;
|
||
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
||
|
import c.a.d.h0;
|
||
|
import c.a.d.j0;
|
||
|
import c.a.l.b;
|
||
|
import c.d.b.a.a;
|
||
|
import com.discord.app.AppFragment;
|
||
|
import com.discord.databinding.WidgetDiscordHubDescriptionBinding;
|
||
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
||
|
import com.discord.utilities.view.validators.ValidationManager;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
||
|
import com.google.android.material.textfield.TextInputEditText;
|
||
|
import d0.g;
|
||
|
import d0.z.d.a0;
|
||
|
import d0.z.d.m;
|
||
|
import kotlin.Lazy;
|
||
|
import kotlin.jvm.functions.Function0;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
import kotlin.reflect.KProperty;
|
||
|
/* compiled from: WidgetDiscordHubDescription.kt */
|
||
|
public final class WidgetDiscordHubDescription extends AppFragment {
|
||
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetDiscordHubDescription.class, "binding", "getBinding()Lcom/discord/databinding/WidgetDiscordHubDescriptionBinding;", 0)};
|
||
|
private final Lazy args$delegate = g.lazy(new WidgetDiscordHubDescription$$special$$inlined$args$1(this, "intent_args_key"));
|
||
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetDiscordHubDescription$binding$2.INSTANCE, null, 2, null);
|
||
|
private final Lazy validationManager$delegate;
|
||
|
private final Lazy viewModel$delegate;
|
||
|
|
||
|
public WidgetDiscordHubDescription() {
|
||
|
super(2131558997);
|
||
|
WidgetDiscordHubDescription$viewModel$2 widgetDiscordHubDescription$viewModel$2 = new WidgetDiscordHubDescription$viewModel$2(this);
|
||
|
h0 h0Var = new h0(this);
|
||
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetDiscordHubsDescriptionViewModel.class), new WidgetDiscordHubDescription$appViewModels$$inlined$viewModels$1(h0Var), new j0(widgetDiscordHubDescription$viewModel$2));
|
||
|
this.validationManager$delegate = g.lazy(new WidgetDiscordHubDescription$validationManager$2(this));
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$configureUI(WidgetDiscordHubDescription widgetDiscordHubDescription, HubDescriptionState hubDescriptionState) {
|
||
|
widgetDiscordHubDescription.configureUI(hubDescriptionState);
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$maybeAddServer(WidgetDiscordHubDescription widgetDiscordHubDescription) {
|
||
|
widgetDiscordHubDescription.maybeAddServer();
|
||
|
}
|
||
|
|
||
|
private final void configureUI(HubDescriptionState hubDescriptionState) {
|
||
|
getBinding().e.setTitle(b.j(this, 2131890267, new Object[]{hubDescriptionState.getGuildName()}, null, 4));
|
||
|
getBinding().b.setOnClickListener(new WidgetDiscordHubDescription$configureUI$1(this));
|
||
|
}
|
||
|
|
||
|
private final ValidationManager getValidationManager() {
|
||
|
return (ValidationManager) this.validationManager$delegate.getValue();
|
||
|
}
|
||
|
|
||
|
private final void maybeAddServer() {
|
||
|
if (getValidationManager().validate(true)) {
|
||
|
WidgetDiscordHubsDescriptionViewModel viewModel = getViewModel();
|
||
|
TextInputEditText textInputEditText = getBinding().f1771c;
|
||
|
m.checkNotNullExpressionValue(textInputEditText, "binding.description");
|
||
|
viewModel.addServer(String.valueOf(textInputEditText.getText()));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final HubDescriptionArgs getArgs() {
|
||
|
return (HubDescriptionArgs) this.args$delegate.getValue();
|
||
|
}
|
||
|
|
||
|
public final WidgetDiscordHubDescriptionBinding getBinding() {
|
||
|
return (WidgetDiscordHubDescriptionBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
||
|
}
|
||
|
|
||
|
public final WidgetDiscordHubsDescriptionViewModel getViewModel() {
|
||
|
return (WidgetDiscordHubsDescriptionViewModel) this.viewModel$delegate.getValue();
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppFragment
|
||
|
public void onViewBound(View view) {
|
||
|
m.checkNotNullParameter(view, "view");
|
||
|
super.onViewBound(view);
|
||
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeViewState(), this), WidgetDiscordHubDescription.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetDiscordHubDescription$onViewBound$1(this), 62, (Object) null);
|
||
|
}
|
||
|
}
|