110 lines
7.0 KiB
Java
110 lines
7.0 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.api.guildscheduledevent.GuildScheduledEventStatus;
|
|
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, boolean z5, Function0 function0, Function0 function02, Function0 function03, int i, Object obj) {
|
|
boolean z6 = false;
|
|
boolean z7 = (i & 2) != 0 ? false : z2;
|
|
boolean z8 = (i & 4) != 0 ? false : z3;
|
|
boolean z9 = (i & 8) != 0 ? false : z4;
|
|
if ((i & 16) == 0) {
|
|
z6 = z5;
|
|
}
|
|
guildScheduledEventBottomButtonView.configure(guildScheduledEvent, z7, z8, z9, z6, (i & 32) != 0 ? GuildScheduledEventBottomButtonView$configure$1.INSTANCE : function0, (i & 64) != 0 ? GuildScheduledEventBottomButtonView$configure$2.INSTANCE : function02, (i & 128) != 0 ? GuildScheduledEventBottomButtonView$configure$3.INSTANCE : function03);
|
|
}
|
|
|
|
public final void configure(GuildScheduledEvent guildScheduledEvent, boolean z2, boolean z3, boolean z4, boolean z5, 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");
|
|
int i = 0;
|
|
boolean z6 = z4 && GuildScheduledEventsSharingFeatureFlag.Companion.getINSTANCE().canShareGuildScheduledEvents();
|
|
GuildScheduledEventTiming eventTiming = GuildScheduledEventUtilitiesKt.getEventTiming(guildScheduledEvent);
|
|
boolean z7 = eventTiming == GuildScheduledEventTiming.LIVE;
|
|
boolean z8 = guildScheduledEvent.k() == GuildScheduledEventStatus.COMPLETED;
|
|
boolean isStartable = (z5 && guildScheduledEvent.e() != GuildScheduledEventEntityType.EXTERNAL) ? eventTiming.isStartable() : false;
|
|
ImageView imageView = this.binding.b;
|
|
imageView.setVisibility(z3 ? 0 : 8);
|
|
imageView.setImageResource(z7 ? 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(z3, z7, z2, function0, z8));
|
|
imageView.setEnabled(!z8);
|
|
TextView textView = this.binding.f1634c;
|
|
textView.setVisibility(z3 ? 0 : 8);
|
|
int color = (!z2 || z7 || z8) ? z8 ? ColorCompat.getColor(textView.getContext(), (int) R.color.white_alpha_40) : ColorCompat.getColor(textView.getContext(), (int) R.color.white) : ColorCompat.getThemedColor(textView.getContext(), (int) R.attr.colorControlBrandForegroundNew);
|
|
int i2 = (z7 || z8) ? 0 : z2 ? R.drawable.ic_check_brand_16dp : R.drawable.ic_bell_16dp;
|
|
int i3 = z7 ? R.string.stage_channel_join_button : z8 ? R.string.guild_event_invite_completed : 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 && !z8)) {
|
|
i = 8;
|
|
}
|
|
imageView3.setVisibility(i);
|
|
imageView3.setOnClickListener(new GuildScheduledEventBottomButtonView$configure$$inlined$apply$lambda$3(z6, z8, function03));
|
|
}
|
|
|
|
public final GuildScheduledEventBottomButtonViewBinding getBinding() {
|
|
return this.binding;
|
|
}
|
|
}
|