2021-06-27 20:44:35 +00:00
|
|
|
package com.discord.widgets.settings.connections;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.cardview.widget.CardView;
|
|
|
|
import com.discord.databinding.ViewConnectionGuildIntegrationBinding;
|
|
|
|
import com.discord.models.domain.ModelConnectedAccountIntegration;
|
|
|
|
import com.discord.models.domain.ModelConnectedIntegrationGuild;
|
|
|
|
import com.discord.utilities.icon.IconUtils;
|
|
|
|
import com.discord.utilities.images.MGImages;
|
|
|
|
import com.discord.widgets.settings.connections.WidgetSettingsUserConnectionsViewModel;
|
|
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
|
|
import com.google.android.material.button.MaterialButton;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
/* compiled from: ConnectionsGuildIntegrationView.kt */
|
|
|
|
public final class ConnectionsGuildIntegrationView extends FrameLayout {
|
|
|
|
private final ViewConnectionGuildIntegrationBinding binding;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public ConnectionsGuildIntegrationView(Context context, AttributeSet attributeSet) {
|
|
|
|
super(context, attributeSet);
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
View inflate = LayoutInflater.from(context).inflate(2131558740, (ViewGroup) this, false);
|
|
|
|
addView(inflate);
|
2021-06-27 20:53:42 +00:00
|
|
|
int i = 2131365601;
|
|
|
|
TextView textView = (TextView) inflate.findViewById(2131365601);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (textView != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131365602;
|
|
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) inflate.findViewById(2131365602);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (simpleDraweeView != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131365603;
|
|
|
|
TextView textView2 = (TextView) inflate.findViewById(2131365603);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (textView2 != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131365604;
|
|
|
|
TextView textView3 = (TextView) inflate.findViewById(2131365604);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (textView3 != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131365605;
|
|
|
|
MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131365605);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (materialButton != null) {
|
|
|
|
ViewConnectionGuildIntegrationBinding viewConnectionGuildIntegrationBinding = new ViewConnectionGuildIntegrationBinding((CardView) inflate, textView, simpleDraweeView, textView2, textView3, materialButton);
|
|
|
|
m.checkNotNullExpressionValue(viewConnectionGuildIntegrationBinding, "ViewConnectionGuildInteg…rom(context), this, true)");
|
|
|
|
this.binding = viewConnectionGuildIntegrationBinding;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setIntegrationData(ModelConnectedAccountIntegration modelConnectedAccountIntegration, WidgetSettingsUserConnectionsViewModel.JoinStatus joinStatus) {
|
|
|
|
m.checkNotNullParameter(modelConnectedAccountIntegration, "integration");
|
|
|
|
TextView textView = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.widgetConnectionIntegrationGuildHandle");
|
|
|
|
textView.setText(modelConnectedAccountIntegration.getDisplayName());
|
|
|
|
ModelConnectedIntegrationGuild guild = modelConnectedAccountIntegration.getGuild();
|
|
|
|
if (guild != null) {
|
|
|
|
TextView textView2 = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.widgetConnectionIntegrationGuildName");
|
|
|
|
textView2.setText(guild.getName());
|
|
|
|
String forGuild$default = IconUtils.getForGuild$default(Long.valueOf(guild.getId()), guild.getIcon(), null, false, Integer.valueOf(IconUtils.getMediaProxySize(getResources().getDimensionPixelSize(2131165296))), 12, null);
|
2021-06-27 20:53:42 +00:00
|
|
|
SimpleDraweeView simpleDraweeView = this.binding.f1648c;
|
2021-06-27 20:44:35 +00:00
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.widgetConnectionIntegrationGuildIcon");
|
|
|
|
IconUtils.setIcon$default(simpleDraweeView, forGuild$default, 0, (Function1) null, (MGImages.ChangeDetector) null, 28, (Object) null);
|
|
|
|
}
|
|
|
|
MaterialButton materialButton = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(materialButton, "binding.widgetConnectionIntegrationJoinGuild");
|
|
|
|
materialButton.setEnabled(!(joinStatus instanceof WidgetSettingsUserConnectionsViewModel.JoinStatus.Joining));
|
|
|
|
MaterialButton materialButton2 = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(materialButton2, "binding.widgetConnectionIntegrationJoinGuild");
|
2021-06-27 20:53:42 +00:00
|
|
|
materialButton2.setText(m.areEqual(joinStatus, WidgetSettingsUserConnectionsViewModel.JoinStatus.Joining.INSTANCE) ? getResources().getString(2131890672) : getResources().getString(2131890642));
|
2021-06-27 20:44:35 +00:00
|
|
|
TextView textView3 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.widgetConnectionIntegrationGuildJoinError");
|
|
|
|
int i = 0;
|
|
|
|
textView3.setVisibility(m.areEqual(joinStatus, WidgetSettingsUserConnectionsViewModel.JoinStatus.JoinFailed.INSTANCE) ? 0 : 8);
|
|
|
|
MaterialButton materialButton3 = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(materialButton3, "binding.widgetConnectionIntegrationJoinGuild");
|
|
|
|
if (m.areEqual(joinStatus, WidgetSettingsUserConnectionsViewModel.JoinStatus.Joined.INSTANCE)) {
|
|
|
|
i = 4;
|
|
|
|
}
|
|
|
|
materialButton3.setVisibility(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setJoinClickListener(View.OnClickListener onClickListener) {
|
|
|
|
this.binding.f.setOnClickListener(onClickListener);
|
|
|
|
}
|
|
|
|
}
|