2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.directories;
|
|
|
|
|
2021-10-15 06:18:26 +00:00
|
|
|
import c0.z.d.m;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.api.directory.DirectoryEntry;
|
|
|
|
import com.discord.databinding.DirectoryEntryListItemBinding;
|
2021-08-18 06:27:30 +00:00
|
|
|
import com.discord.utilities.features.GrowthTeamFeatures;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.utilities.guilds.GuildUtilsKt;
|
|
|
|
import com.discord.utilities.icon.IconUtils;
|
|
|
|
import com.discord.views.directories.ServerDiscoveryItem;
|
|
|
|
import com.discord.widgets.directories.DirectoryChannelItem;
|
|
|
|
/* compiled from: WidgetDirectoryEntryViewHolder.kt */
|
|
|
|
public final class DirectoryEntryViewHolder extends DirectoryChannelViewHolder {
|
|
|
|
private final DirectoryEntryListItemBinding viewBinding;
|
|
|
|
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
|
|
public DirectoryEntryViewHolder(DirectoryEntryListItemBinding directoryEntryListItemBinding) {
|
|
|
|
super(r0);
|
|
|
|
m.checkNotNullParameter(directoryEntryListItemBinding, "viewBinding");
|
|
|
|
ServerDiscoveryItem serverDiscoveryItem = directoryEntryListItemBinding.a;
|
|
|
|
m.checkNotNullExpressionValue(serverDiscoveryItem, "viewBinding.root");
|
|
|
|
this.viewBinding = directoryEntryListItemBinding;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.widgets.directories.DirectoryChannelViewHolder
|
|
|
|
public void bind(DirectoryChannelItem directoryChannelItem, DirectoryChannelItemClickInterface directoryChannelItemClickInterface) {
|
|
|
|
DirectoryEntryData directoryEntryData;
|
|
|
|
m.checkNotNullParameter(directoryChannelItem, "item");
|
|
|
|
m.checkNotNullParameter(directoryChannelItemClickInterface, "listener");
|
2021-08-18 06:27:30 +00:00
|
|
|
DirectoryEntryViewHolder$bind$$inlined$apply$lambda$4 directoryEntryViewHolder$bind$$inlined$apply$lambda$4 = null;
|
2021-08-03 07:33:18 +00:00
|
|
|
if (!(directoryChannelItem instanceof DirectoryChannelItem.DirectoryItem)) {
|
|
|
|
directoryChannelItem = null;
|
|
|
|
}
|
|
|
|
DirectoryChannelItem.DirectoryItem directoryItem = (DirectoryChannelItem.DirectoryItem) directoryChannelItem;
|
|
|
|
if (directoryItem != null && (directoryEntryData = directoryItem.getDirectoryEntryData()) != null) {
|
|
|
|
DirectoryEntry entry = directoryEntryData.getEntry();
|
|
|
|
ServerDiscoveryItem serverDiscoveryItem = this.viewBinding.b;
|
2021-08-18 06:27:30 +00:00
|
|
|
serverDiscoveryItem.setTitle(entry.d().h());
|
2021-08-03 07:33:18 +00:00
|
|
|
serverDiscoveryItem.setDescription(entry.a());
|
2021-08-18 06:27:30 +00:00
|
|
|
Integer a = entry.d().a();
|
2021-08-03 07:33:18 +00:00
|
|
|
int i = 0;
|
|
|
|
serverDiscoveryItem.setMembers(a != null ? a.intValue() : 0);
|
2021-08-18 06:27:30 +00:00
|
|
|
Integer b = entry.d().b();
|
2021-08-03 07:33:18 +00:00
|
|
|
if (b != null) {
|
|
|
|
i = b.intValue();
|
|
|
|
}
|
|
|
|
serverDiscoveryItem.setOnline(i);
|
2021-08-18 06:27:30 +00:00
|
|
|
String forGuild$default = IconUtils.getForGuild$default(Long.valueOf(entry.d().g()), entry.d().f(), null, false, null, 28, null);
|
|
|
|
String computeShortName = GuildUtilsKt.computeShortName(entry.d().h());
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(computeShortName, "fallbackText");
|
2021-09-11 06:38:47 +00:00
|
|
|
serverDiscoveryItem.i.f.a(forGuild$default, computeShortName);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (!directoryEntryData.getHasJoinedGuild()) {
|
|
|
|
serverDiscoveryItem.setJoinButtonOnClickListener(new DirectoryEntryViewHolder$bind$$inlined$apply$lambda$1(entry, directoryEntryData, directoryChannelItemClickInterface));
|
|
|
|
serverDiscoveryItem.setJoinedButtonOnClickListener(null);
|
|
|
|
} else {
|
|
|
|
serverDiscoveryItem.setJoinButtonOnClickListener(null);
|
|
|
|
serverDiscoveryItem.setJoinedButtonOnClickListener(new DirectoryEntryViewHolder$bind$$inlined$apply$lambda$2(entry, directoryEntryData, directoryChannelItemClickInterface));
|
|
|
|
}
|
2021-08-18 06:27:30 +00:00
|
|
|
if (GrowthTeamFeatures.INSTANCE.isHubReportingEnabled()) {
|
|
|
|
serverDiscoveryItem.setOnLongClickListener(new DirectoryEntryViewHolder$bind$$inlined$apply$lambda$3(entry, directoryEntryData, directoryChannelItemClickInterface));
|
|
|
|
} else {
|
|
|
|
if (directoryEntryData.getHasEditPermissions()) {
|
|
|
|
directoryEntryViewHolder$bind$$inlined$apply$lambda$4 = new DirectoryEntryViewHolder$bind$$inlined$apply$lambda$4(entry, directoryEntryData, directoryChannelItemClickInterface);
|
|
|
|
}
|
|
|
|
serverDiscoveryItem.setOverflowOnClickListener(directoryEntryViewHolder$bind$$inlined$apply$lambda$4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
serverDiscoveryItem.setJoinedGuild(directoryEntryData.getHasJoinedGuild());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final DirectoryEntryListItemBinding getViewBinding() {
|
|
|
|
return this.viewBinding;
|
|
|
|
}
|
|
|
|
}
|