316 lines
18 KiB
Java
316 lines
18 KiB
Java
package com.discord.widgets.notice;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.Window;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.AnimationUtils;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import c.p.a.a;
|
|
import c.p.a.b;
|
|
import c.p.a.g;
|
|
import c.p.a.h;
|
|
import c.p.a.i;
|
|
import c.p.a.j;
|
|
import c.p.a.l;
|
|
import com.discord.api.sticker.Sticker;
|
|
import com.discord.databinding.WidgetNoticePopupBinding;
|
|
import com.discord.stores.StoreNotices;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
import com.discord.utilities.images.MGImages;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.view.text.SimpleDraweeSpanTextView;
|
|
import com.discord.views.sticker.StickerView;
|
|
import com.facebook.drawee.span.DraweeSpanStringBuilder;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import com.tapadoo.alerter.R;
|
|
import d0.g0.t;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: NoticePopup.kt */
|
|
public final class NoticePopup$enqueue$notice$1 extends o implements Function1<FragmentActivity, Boolean> {
|
|
public final /* synthetic */ Integer $noticeAutoDismissPeriodSecs;
|
|
public final /* synthetic */ CharSequence $noticeBody;
|
|
public final /* synthetic */ Drawable $noticeBodyBackgroundDrawable;
|
|
public final /* synthetic */ Drawable $noticeBodyImageDrawable;
|
|
public final /* synthetic */ String $noticeBodyImageUrl;
|
|
public final /* synthetic */ Integer $noticeIconResId;
|
|
public final /* synthetic */ Drawable $noticeIconTopRight;
|
|
public final /* synthetic */ String $noticeIconUrl;
|
|
public final /* synthetic */ String $noticeName;
|
|
public final /* synthetic */ List $noticeStickers;
|
|
public final /* synthetic */ CharSequence $noticeSubtitle;
|
|
public final /* synthetic */ CharSequence $noticeTitle;
|
|
public final /* synthetic */ Function1 $onClick;
|
|
public final /* synthetic */ Function1 $onClickTopRightIcon;
|
|
|
|
/* compiled from: NoticePopup.kt */
|
|
/* renamed from: com.discord.widgets.notice.NoticePopup$enqueue$notice$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 implements View.OnClickListener {
|
|
public final /* synthetic */ NoticePopup$enqueue$notice$1 this$0;
|
|
|
|
public AnonymousClass1(NoticePopup$enqueue$notice$1 noticePopup$enqueue$notice$1) {
|
|
this.this$0 = noticePopup$enqueue$notice$1;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
Function1 function1 = this.this$0.$onClick;
|
|
m.checkNotNullExpressionValue(view, "view");
|
|
function1.invoke(view);
|
|
NoticePopup.access$dismiss(NoticePopup.INSTANCE, this.this$0.$noticeName);
|
|
}
|
|
}
|
|
|
|
/* compiled from: NoticePopup.kt */
|
|
/* renamed from: com.discord.widgets.notice.NoticePopup$enqueue$notice$1$2 reason: invalid class name */
|
|
public static final class AnonymousClass2 implements j {
|
|
public final /* synthetic */ NoticePopup$enqueue$notice$1 this$0;
|
|
|
|
public AnonymousClass2(NoticePopup$enqueue$notice$1 noticePopup$enqueue$notice$1) {
|
|
this.this$0 = noticePopup$enqueue$notice$1;
|
|
}
|
|
|
|
@Override // c.p.a.j
|
|
public final void onHide() {
|
|
StoreNotices.markSeen$default(StoreStream.Companion.getNotices(), this.this$0.$noticeName, 0, 2, null);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public NoticePopup$enqueue$notice$1(Function1 function1, String str, Integer num, String str2, Integer num2, String str3, Drawable drawable, Drawable drawable2, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, Drawable drawable3, List list, Function1 function12) {
|
|
super(1);
|
|
this.$onClick = function1;
|
|
this.$noticeName = str;
|
|
this.$noticeAutoDismissPeriodSecs = num;
|
|
this.$noticeIconUrl = str2;
|
|
this.$noticeIconResId = num2;
|
|
this.$noticeBodyImageUrl = str3;
|
|
this.$noticeBodyImageDrawable = drawable;
|
|
this.$noticeBodyBackgroundDrawable = drawable2;
|
|
this.$noticeTitle = charSequence;
|
|
this.$noticeSubtitle = charSequence2;
|
|
this.$noticeBody = charSequence3;
|
|
this.$noticeIconTopRight = drawable3;
|
|
this.$noticeStickers = list;
|
|
this.$onClickTopRightIcon = function12;
|
|
}
|
|
|
|
/* 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 */ Boolean invoke(FragmentActivity fragmentActivity) {
|
|
return Boolean.valueOf(invoke(fragmentActivity));
|
|
}
|
|
|
|
public final boolean invoke(FragmentActivity fragmentActivity) {
|
|
b bVar;
|
|
View view;
|
|
ViewGroup viewGroup;
|
|
Sticker sticker;
|
|
Window window;
|
|
int childCount;
|
|
b bVar2;
|
|
Window window2;
|
|
m.checkNotNullParameter(fragmentActivity, "activity");
|
|
m.checkNotNullParameter(fragmentActivity, "activity");
|
|
i iVar = new i(null);
|
|
View decorView = (fragmentActivity == null || (window2 = fragmentActivity.getWindow()) == null) ? null : window2.getDecorView();
|
|
if (!(decorView instanceof ViewGroup)) {
|
|
decorView = null;
|
|
}
|
|
ViewGroup viewGroup2 = (ViewGroup) decorView;
|
|
int i = 0;
|
|
if (viewGroup2 != null && (childCount = viewGroup2.getChildCount()) >= 0) {
|
|
int i2 = 0;
|
|
while (true) {
|
|
if (viewGroup2.getChildAt(i2) instanceof b) {
|
|
View childAt = viewGroup2.getChildAt(i2);
|
|
Objects.requireNonNull(childAt, "null cannot be cast to non-null type com.tapadoo.alerter.Alert");
|
|
bVar2 = (b) childAt;
|
|
} else {
|
|
bVar2 = null;
|
|
}
|
|
if (!(bVar2 == null || bVar2.getWindowToken() == null)) {
|
|
ViewCompat.animate(bVar2).alpha(0.0f).withEndAction(new g(bVar2));
|
|
}
|
|
if (i2 == childCount) {
|
|
break;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
if (fragmentActivity == null || (window = fragmentActivity.getWindow()) == null) {
|
|
bVar = null;
|
|
} else {
|
|
View decorView2 = window.getDecorView();
|
|
Objects.requireNonNull(decorView2, "null cannot be cast to non-null type android.view.ViewGroup");
|
|
i.a = new WeakReference<>((ViewGroup) decorView2);
|
|
View decorView3 = window.getDecorView();
|
|
m.checkNotNullExpressionValue(decorView3, "it.decorView");
|
|
Context context = decorView3.getContext();
|
|
m.checkNotNullExpressionValue(context, "it.decorView.context");
|
|
bVar = new b(context, 2131559120, null, 0, 12);
|
|
}
|
|
iVar.b = bVar;
|
|
int themedColor = ColorCompat.getThemedColor(fragmentActivity, 2130968907);
|
|
b bVar3 = iVar.b;
|
|
if (bVar3 != null) {
|
|
bVar3.setAlertBackgroundColor(themedColor);
|
|
}
|
|
b bVar4 = iVar.b;
|
|
if (bVar4 != null) {
|
|
LinearLayout linearLayout = (LinearLayout) bVar4.c(R.d.llAlertBackground);
|
|
m.checkNotNullExpressionValue(linearLayout, "it");
|
|
linearLayout.setOnTouchListener(new l(linearLayout, new a(bVar4)));
|
|
}
|
|
b bVar5 = iVar.b;
|
|
if (bVar5 != null) {
|
|
bVar5.setVibrationEnabled(false);
|
|
}
|
|
b bVar6 = iVar.b;
|
|
if (bVar6 != null) {
|
|
bVar6.setEnableInfiniteDuration(true);
|
|
}
|
|
b bVar7 = iVar.b;
|
|
if (bVar7 != null) {
|
|
Animation loadAnimation = AnimationUtils.loadAnimation(bVar7.getContext(), 2130772021);
|
|
m.checkNotNullExpressionValue(loadAnimation, "AnimationUtils.loadAnima…lert?.context, animation)");
|
|
bVar7.setEnterAnimation$alerter_release(loadAnimation);
|
|
}
|
|
AnonymousClass1 r4 = new AnonymousClass1(this);
|
|
m.checkNotNullParameter(r4, "onClickListener");
|
|
b bVar8 = iVar.b;
|
|
if (bVar8 != null) {
|
|
bVar8.setOnClickListener(r4);
|
|
}
|
|
AnonymousClass2 r42 = new AnonymousClass2(this);
|
|
m.checkNotNullParameter(r42, "listener");
|
|
b bVar9 = iVar.b;
|
|
if (bVar9 != null) {
|
|
bVar9.setOnHideListener$alerter_release(r42);
|
|
}
|
|
b bVar10 = iVar.b;
|
|
View layoutContainer = bVar10 != null ? bVar10.getLayoutContainer() : null;
|
|
if (layoutContainer != null) {
|
|
layoutContainer.setOnTouchListener(new NoticePopup$enqueue$notice$1$3$1(NoticePopup.access$getAutoDismissAnimator(NoticePopup.INSTANCE, this.$noticeAutoDismissPeriodSecs, new NoticePopup$enqueue$notice$1$$special$$inlined$also$lambda$1(this, fragmentActivity))));
|
|
int i3 = 2131364320;
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) layoutContainer.findViewById(2131364320);
|
|
if (simpleDraweeView != null) {
|
|
i3 = 2131364321;
|
|
SimpleDraweeSpanTextView simpleDraweeSpanTextView = (SimpleDraweeSpanTextView) layoutContainer.findViewById(2131364321);
|
|
if (simpleDraweeSpanTextView != null) {
|
|
i3 = 2131364322;
|
|
ImageView imageView = (ImageView) layoutContainer.findViewById(2131364322);
|
|
if (imageView != null) {
|
|
i3 = 2131364323;
|
|
SimpleDraweeView simpleDraweeView2 = (SimpleDraweeView) layoutContainer.findViewById(2131364323);
|
|
if (simpleDraweeView2 != null) {
|
|
i3 = 2131364324;
|
|
StickerView stickerView = (StickerView) layoutContainer.findViewById(2131364324);
|
|
if (stickerView != null) {
|
|
i3 = 2131364325;
|
|
TextView textView = (TextView) layoutContainer.findViewById(2131364325);
|
|
if (textView != null) {
|
|
i3 = 2131364326;
|
|
TextView textView2 = (TextView) layoutContainer.findViewById(2131364326);
|
|
if (textView2 != null) {
|
|
i3 = 2131364327;
|
|
RelativeLayout relativeLayout = (RelativeLayout) layoutContainer.findViewById(2131364327);
|
|
if (relativeLayout != null) {
|
|
WidgetNoticePopupBinding widgetNoticePopupBinding = new WidgetNoticePopupBinding((RelativeLayout) layoutContainer, simpleDraweeView, simpleDraweeSpanTextView, imageView, simpleDraweeView2, stickerView, textView, textView2, relativeLayout);
|
|
m.checkNotNullExpressionValue(widgetNoticePopupBinding, "WidgetNoticePopupBinding.bind(view)");
|
|
if (this.$noticeIconUrl != null) {
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.popupIcon");
|
|
MGImages.setImage$default(simpleDraweeView2, this.$noticeIconUrl, 0, 0, false, null, null, 124, null);
|
|
} else if (this.$noticeIconResId != null) {
|
|
MGImages mGImages = MGImages.INSTANCE;
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.popupIcon");
|
|
MGImages.setImage$default(mGImages, simpleDraweeView2, this.$noticeIconResId.intValue(), (MGImages.ChangeDetector) null, 4, (Object) null);
|
|
}
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.popupAttachment");
|
|
simpleDraweeView.setVisibility(this.$noticeBodyImageUrl != null || this.$noticeBodyImageDrawable != null ? 0 : 8);
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.popupAttachment");
|
|
simpleDraweeView.setBackground(this.$noticeBodyBackgroundDrawable);
|
|
if (this.$noticeBodyImageUrl != null) {
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.popupAttachment");
|
|
MGImages.setImage$default(simpleDraweeView, this.$noticeBodyImageUrl, 0, 0, false, null, null, 124, null);
|
|
} else if (this.$noticeBodyImageDrawable != null) {
|
|
MGImages mGImages2 = MGImages.INSTANCE;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.popupAttachment");
|
|
MGImages.setImage$default(mGImages2, simpleDraweeView, this.$noticeBodyImageDrawable, (MGImages.ChangeDetector) null, 4, (Object) null);
|
|
}
|
|
m.checkNotNullExpressionValue(textView2, "binding.popupTitle");
|
|
textView2.setText(this.$noticeTitle);
|
|
m.checkNotNullExpressionValue(textView, "binding.popupSubtitle");
|
|
ViewExtensions.setTextAndVisibilityBy(textView, this.$noticeSubtitle);
|
|
CharSequence charSequence = this.$noticeBody;
|
|
if (charSequence instanceof DraweeSpanStringBuilder) {
|
|
simpleDraweeSpanTextView.setDraweeSpanStringBuilder((DraweeSpanStringBuilder) charSequence);
|
|
} else {
|
|
m.checkNotNullExpressionValue(simpleDraweeSpanTextView, "binding.popupBody");
|
|
simpleDraweeSpanTextView.setText(this.$noticeBody);
|
|
}
|
|
m.checkNotNullExpressionValue(simpleDraweeSpanTextView, "binding.popupBody");
|
|
CharSequence charSequence2 = this.$noticeBody;
|
|
simpleDraweeSpanTextView.setVisibility(charSequence2 != null && (t.isBlank(charSequence2) ^ true) ? 0 : 8);
|
|
simpleDraweeSpanTextView.post(new NoticePopup$enqueue$notice$1$3$2(widgetNoticePopupBinding));
|
|
Drawable drawable = this.$noticeIconTopRight;
|
|
if (drawable == null) {
|
|
drawable = ContextCompat.getDrawable(fragmentActivity, DrawableCompat.getThemedDrawableRes$default(fragmentActivity, 2130969451, 0, 2, (Object) null));
|
|
}
|
|
m.checkNotNullExpressionValue(stickerView, "binding.popupSticker");
|
|
List list = this.$noticeStickers;
|
|
if (!(list != null && !list.isEmpty())) {
|
|
i = 8;
|
|
}
|
|
stickerView.setVisibility(i);
|
|
List list2 = this.$noticeStickers;
|
|
if (list2 == null || (sticker = (Sticker) u.firstOrNull((List<? extends Object>) list2)) == null) {
|
|
view = null;
|
|
} else {
|
|
view = null;
|
|
StickerView.d(stickerView, sticker, null, 2);
|
|
}
|
|
imageView.setImageDrawable(drawable);
|
|
imageView.setOnClickListener(new NoticePopup$enqueue$notice$1$$special$$inlined$also$lambda$2(layoutContainer, this, fragmentActivity));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(layoutContainer.getResources().getResourceName(i3)));
|
|
}
|
|
view = null;
|
|
WeakReference<ViewGroup> weakReference = i.a;
|
|
if (!(weakReference == null || (viewGroup = weakReference.get()) == null)) {
|
|
new Handler(Looper.getMainLooper()).post(new h(viewGroup, iVar));
|
|
}
|
|
b bVar11 = iVar.b;
|
|
View findViewById = bVar11 != null ? bVar11.findViewById(2131363850) : view;
|
|
if (findViewById != null) {
|
|
ViewCompat.setElevation(findViewById, fragmentActivity.getResources().getDimension(2131165279));
|
|
}
|
|
return true;
|
|
}
|
|
}
|