108 lines
6.6 KiB
Java
108 lines
6.6 KiB
Java
package com.discord.widgets.guildscheduledevent;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import c.a.k.b;
|
|
import com.discord.R;
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType;
|
|
import com.discord.databinding.GuildScheduledEventBottomButtonViewBinding;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
import com.discord.utilities.guildscheduledevent.GuildScheduledEventTiming;
|
|
import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilitiesKt;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
/* compiled from: GuildScheduledEventBottomButtonView.kt */
|
|
public final class GuildScheduledEventBottomButtonView extends ConstraintLayout {
|
|
private final GuildScheduledEventBottomButtonViewBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public GuildScheduledEventBottomButtonView(Context context) {
|
|
super(context);
|
|
m.checkNotNullParameter(context, "context");
|
|
GuildScheduledEventBottomButtonViewBinding a = GuildScheduledEventBottomButtonViewBinding.a(LayoutInflater.from(getContext()), this, true);
|
|
m.checkNotNullExpressionValue(a, "GuildScheduledEventBotto…rom(context), this, true)");
|
|
this.binding = a;
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public GuildScheduledEventBottomButtonView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(attributeSet, "attrs");
|
|
GuildScheduledEventBottomButtonViewBinding a = GuildScheduledEventBottomButtonViewBinding.a(LayoutInflater.from(getContext()), this, true);
|
|
m.checkNotNullExpressionValue(a, "GuildScheduledEventBotto…rom(context), this, true)");
|
|
this.binding = a;
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public GuildScheduledEventBottomButtonView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(attributeSet, "attrs");
|
|
GuildScheduledEventBottomButtonViewBinding a = GuildScheduledEventBottomButtonViewBinding.a(LayoutInflater.from(getContext()), this, true);
|
|
m.checkNotNullExpressionValue(a, "GuildScheduledEventBotto…rom(context), this, true)");
|
|
this.binding = a;
|
|
}
|
|
|
|
public static /* synthetic */ void configure$default(GuildScheduledEventBottomButtonView guildScheduledEventBottomButtonView, GuildScheduledEvent guildScheduledEvent, boolean z2, boolean z3, boolean z4, Function0 function0, Function0 function02, Function0 function03, int i, Object obj) {
|
|
boolean z5 = false;
|
|
boolean z6 = (i & 2) != 0 ? false : z2;
|
|
boolean z7 = (i & 4) != 0 ? false : z3;
|
|
if ((i & 8) == 0) {
|
|
z5 = z4;
|
|
}
|
|
guildScheduledEventBottomButtonView.configure(guildScheduledEvent, z6, z7, z5, (i & 16) != 0 ? GuildScheduledEventBottomButtonView$configure$1.INSTANCE : function0, (i & 32) != 0 ? GuildScheduledEventBottomButtonView$configure$2.INSTANCE : function02, (i & 64) != 0 ? GuildScheduledEventBottomButtonView$configure$3.INSTANCE : function03);
|
|
}
|
|
|
|
public final void configure(GuildScheduledEvent guildScheduledEvent, boolean z2, boolean z3, boolean z4, Function0<Unit> function0, Function0<Unit> function02, Function0<Unit> function03) {
|
|
m.checkNotNullParameter(guildScheduledEvent, "guildScheduledEvent");
|
|
m.checkNotNullParameter(function0, "onRsvpButtonClicked");
|
|
m.checkNotNullParameter(function02, "onStartEventButtonClicked");
|
|
m.checkNotNullParameter(function03, "onShareButtonClicked");
|
|
boolean z5 = true;
|
|
int i = 0;
|
|
boolean z6 = z3 && GuildScheduledEventsSharingFeatureFlag.Companion.getINSTANCE().canShareGuildScheduledEvents();
|
|
GuildScheduledEventTiming eventTiming = GuildScheduledEventUtilitiesKt.getEventTiming(guildScheduledEvent);
|
|
GuildScheduledEventTiming guildScheduledEventTiming = GuildScheduledEventTiming.LIVE;
|
|
if (eventTiming != guildScheduledEventTiming) {
|
|
z5 = false;
|
|
}
|
|
boolean isStartable = (z4 && guildScheduledEvent.e() != GuildScheduledEventEntityType.EXTERNAL) ? eventTiming.isStartable() : false;
|
|
ImageView imageView = this.binding.b;
|
|
imageView.setImageResource(z5 ? R.drawable.bg_guild_scheduled_event_list_item_interested_button_active : z2 ? R.drawable.bg_guild_scheduled_event_list_item_interested_button_interested : R.drawable.bg_guild_scheduled_event_list_item_interested_button_default);
|
|
imageView.setOnClickListener(new GuildScheduledEventBottomButtonView$configure$$inlined$apply$lambda$1(z5, z2, function0));
|
|
TextView textView = this.binding.f1615c;
|
|
int color = (!z2 || eventTiming == guildScheduledEventTiming) ? ColorCompat.getColor(textView.getContext(), (int) R.color.white) : ColorCompat.getThemedColor(textView.getContext(), (int) R.attr.colorControlBrandForegroundNew);
|
|
int i2 = z5 ? 0 : z2 ? R.drawable.ic_check_brand_16dp : R.drawable.ic_bell_16dp;
|
|
int i3 = z5 ? R.string.stage_channel_join_button : R.string.stage_instance_interested_label;
|
|
DrawableCompat.setCompoundDrawablesCompat$default(textView, i2, 0, 0, 0, 14, (Object) null);
|
|
textView.setTextColor(color);
|
|
Context context = textView.getContext();
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
textView.setText(b.h(context, i3, new Object[0], null, 4));
|
|
TextView textView2 = this.binding.f;
|
|
m.checkNotNullExpressionValue(textView2, "binding.guildScheduledEv…ottomStartEventButtonText");
|
|
textView2.setVisibility(isStartable ? 0 : 8);
|
|
ImageView imageView2 = this.binding.e;
|
|
imageView2.setVisibility(isStartable ? 0 : 8);
|
|
imageView2.setOnClickListener(new GuildScheduledEventBottomButtonView$configure$$inlined$apply$lambda$2(isStartable, function02));
|
|
ImageView imageView3 = this.binding.d;
|
|
if (!z6) {
|
|
i = 8;
|
|
}
|
|
imageView3.setVisibility(i);
|
|
imageView3.setOnClickListener(new GuildScheduledEventBottomButtonView$configure$$inlined$apply$lambda$3(z6, function03));
|
|
}
|
|
|
|
public final GuildScheduledEventBottomButtonViewBinding getBinding() {
|
|
return this.binding;
|
|
}
|
|
}
|