discord-jadx/app/src/main/java/com/discord/widgets/directories/WidgetDirectoryChannel$init...

103 lines
4.9 KiB
Java

package com.discord.widgets.directories;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import c.d.b.a.a;
import com.discord.R;
import com.discord.models.hubs.DirectoryEntryCategory;
import com.discord.widgets.directories.WidgetDirectoriesViewModel;
import com.google.android.material.tabs.TabLayout;
import d0.t.u;
import d0.z.d.m;
import d0.z.d.o;
import java.util.Objects;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
/* compiled from: WidgetDirectoryChannel.kt */
public final class WidgetDirectoryChannel$initializeUI$$inlined$apply$lambda$1 extends o implements Function2<TabLayout.Tab, Integer, Unit> {
public final /* synthetic */ TabLayout $this_apply;
public final /* synthetic */ WidgetDirectoryChannel this$0;
/* compiled from: WidgetDirectoryChannel.kt */
/* renamed from: com.discord.widgets.directories.WidgetDirectoryChannel$initializeUI$$inlined$apply$lambda$1$1 reason: invalid class name */
public static final class AnonymousClass1 extends o implements Function1<WidgetDirectoriesViewModel.ViewState, Unit> {
public final /* synthetic */ int $position;
public final /* synthetic */ TabLayout.Tab $tab;
public final /* synthetic */ WidgetDirectoryChannel$initializeUI$$inlined$apply$lambda$1 this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass1(WidgetDirectoryChannel$initializeUI$$inlined$apply$lambda$1 widgetDirectoryChannel$initializeUI$$inlined$apply$lambda$1, int i, TabLayout.Tab tab) {
super(1);
this.this$0 = widgetDirectoryChannel$initializeUI$$inlined$apply$lambda$1;
this.$position = i;
this.$tab = tab;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(WidgetDirectoriesViewModel.ViewState viewState) {
invoke(viewState);
return Unit.a;
}
public final void invoke(WidgetDirectoriesViewModel.ViewState viewState) {
String str;
m.checkNotNullParameter(viewState, "state");
Pair pair = (Pair) u.getOrNull(viewState.getMappedTabs(), this.$position);
if (pair != null) {
TabLayout.Tab tab = this.$tab;
View inflate = this.this$0.this$0.getLayoutInflater().inflate(R.layout.directory_channel_tab, (ViewGroup) null, false);
Objects.requireNonNull(inflate, "rootView");
TextView textView = (TextView) inflate;
c.a.i.m mVar = new c.a.i.m(textView, textView);
if (((Number) pair.getSecond()).intValue() <= 0) {
str = "";
} else {
StringBuilder R = a.R(" (");
R.append(((Number) pair.getSecond()).intValue());
R.append(')');
str = R.toString();
}
m.checkNotNullExpressionValue(textView, "tabView");
StringBuilder sb = new StringBuilder();
Context context = this.this$0.$this_apply.getContext();
m.checkNotNullExpressionValue(context, "context");
sb.append(((DirectoryEntryCategory) pair.getFirst()).getTitle(context));
sb.append(str);
textView.setText(sb.toString());
m.checkNotNullExpressionValue(mVar, "DirectoryChannelTabBindi…text)}$count\"\n }");
tab.setCustomView(textView);
return;
}
StringBuilder R2 = a.R("Missing tab for position: ");
R2.append(this.$position);
throw new IllegalStateException(R2.toString());
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetDirectoryChannel$initializeUI$$inlined$apply$lambda$1(TabLayout tabLayout, WidgetDirectoryChannel widgetDirectoryChannel) {
super(2);
this.$this_apply = tabLayout;
this.this$0 = widgetDirectoryChannel;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Unit invoke(TabLayout.Tab tab, Integer num) {
invoke(tab, num.intValue());
return Unit.a;
}
public final void invoke(TabLayout.Tab tab, int i) {
m.checkNotNullParameter(tab, "tab");
this.this$0.getViewModel().withViewState(new AnonymousClass1(this, i, tab));
}
}