2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.stickers;
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
import android.app.Dialog;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.Window;
|
|
|
|
import android.view.WindowManager;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.a.k.b;
|
|
|
|
import b.d.b.a.a;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.R;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.app.AppDialog;
|
|
|
|
import com.discord.databinding.StickerPackDetailsDialogBinding;
|
|
|
|
import com.discord.models.sticker.dto.ModelStickerPack;
|
|
|
|
import com.discord.stores.StoreStickers;
|
|
|
|
import com.discord.stores.StoreStream;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.stickers.StickerUtils;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.z.d.m;
|
2021-08-03 07:33:18 +00:00
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.reflect.KProperty;
|
|
|
|
/* compiled from: WidgetStickerPackDetailsDialog.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes2.dex */
|
2021-08-03 07:33:18 +00:00
|
|
|
public final class WidgetStickerPackDetailsDialog extends AppDialog {
|
2022-03-21 18:52:30 +00:00
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.b0(WidgetStickerPackDetailsDialog.class, "binding", "getBinding()Lcom/discord/databinding/StickerPackDetailsDialogBinding;", 0)};
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final String EXTRA_Y_POSITION = "EXTRA_Y_POSITION";
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetStickerPackDetailsDialog$binding$2.INSTANCE, null, 2, null);
|
|
|
|
private Long stickerPackId;
|
|
|
|
|
|
|
|
/* compiled from: WidgetStickerPackDetailsDialog.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes2.dex */
|
2021-08-03 07:33:18 +00:00
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ void show$default(Companion companion, FragmentManager fragmentManager, long j, Integer num, int i, Object obj) {
|
|
|
|
if ((i & 4) != 0) {
|
|
|
|
num = null;
|
|
|
|
}
|
|
|
|
companion.show(fragmentManager, j, num);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void show(FragmentManager fragmentManager, long j, Integer num) {
|
|
|
|
m.checkNotNullParameter(fragmentManager, "fragmentManager");
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putLong("com.discord.intent.EXTRA_STICKER_PACK_ID", j);
|
|
|
|
if (num != null) {
|
|
|
|
num.intValue();
|
2021-08-09 22:51:56 +00:00
|
|
|
bundle.putInt(WidgetStickerPackDetailsDialog.EXTRA_Y_POSITION, num.intValue());
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
WidgetStickerPackDetailsDialog widgetStickerPackDetailsDialog = new WidgetStickerPackDetailsDialog();
|
|
|
|
widgetStickerPackDetailsDialog.setArguments(bundle);
|
|
|
|
widgetStickerPackDetailsDialog.show(fragmentManager, WidgetStickerPackDetailsDialog.class.getSimpleName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetStickerPackDetailsDialog() {
|
2021-08-09 22:51:56 +00:00
|
|
|
super(R.layout.sticker_pack_details_dialog);
|
|
|
|
setStyle(1, R.style.AppTheme_Dialog_Popup_Tooltip);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetStickerPackDetailsDialog widgetStickerPackDetailsDialog, StoreStickers.StickerPackState stickerPackState) {
|
|
|
|
widgetStickerPackDetailsDialog.configureUI(stickerPackState);
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressLint({"SetTextI18n"})
|
|
|
|
private final void configureUI(StoreStickers.StickerPackState stickerPackState) {
|
|
|
|
if (stickerPackState instanceof StoreStickers.StickerPackState.Loaded) {
|
|
|
|
ModelStickerPack stickerPack = ((StoreStickers.StickerPackState.Loaded) stickerPackState).getStickerPack();
|
|
|
|
TextView textView = getBinding().e;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.stickerPackDetailsPack");
|
2021-08-09 22:51:56 +00:00
|
|
|
textView.setText(b.k(this, R.string.sticker_picker_pack_details, new Object[]{stickerPack.getName()}, null, 4));
|
2022-03-21 18:52:30 +00:00
|
|
|
TextView textView2 = getBinding().f2145b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.stickerPackDetailsAnimated");
|
|
|
|
int i = 8;
|
|
|
|
textView2.setVisibility(stickerPack.isAnimatedPack() ? 0 : 8);
|
2022-03-21 18:52:30 +00:00
|
|
|
TextView textView3 = getBinding().f2145b;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.stickerPackDetailsAnimated");
|
2021-08-09 22:51:56 +00:00
|
|
|
textView3.setText("・ " + getString(R.string.sticker_picker_pack_details_animated));
|
2021-08-03 07:33:18 +00:00
|
|
|
TextView textView4 = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(textView4, "binding.stickerPackDetailsPremium");
|
|
|
|
textView4.setVisibility(stickerPack.isPremiumPack() ? 0 : 8);
|
|
|
|
TextView textView5 = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(textView5, "binding.stickerPackDetailsPremium");
|
2021-08-09 22:51:56 +00:00
|
|
|
textView5.setText("・ " + getString(R.string.sticker_picker_pack_details_premium));
|
2021-08-03 07:33:18 +00:00
|
|
|
TextView textView6 = getBinding().d;
|
|
|
|
m.checkNotNullExpressionValue(textView6, "binding.stickerPackDetailsLimited");
|
|
|
|
if (stickerPack.isLimitedPack()) {
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
textView6.setVisibility(i);
|
|
|
|
TextView textView7 = getBinding().d;
|
|
|
|
m.checkNotNullExpressionValue(textView7, "binding.stickerPackDetailsLimited");
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append("・ ");
|
|
|
|
StickerUtils stickerUtils = StickerUtils.INSTANCE;
|
|
|
|
Context requireContext = requireContext();
|
|
|
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
2021-08-09 22:51:56 +00:00
|
|
|
sb.append(b.k(this, R.string.sticker_picker_pack_details_limited_time_left, new Object[]{stickerUtils.getLimitedTimeLeftString(requireContext, stickerPack.getStoreListing())}, null, 4));
|
2021-08-03 07:33:18 +00:00
|
|
|
textView7.setText(sb.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final StickerPackDetailsDialogBinding getBinding() {
|
|
|
|
return (StickerPackDetailsDialogBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppDialog, androidx.fragment.app.DialogFragment
|
|
|
|
public Dialog onCreateDialog(Bundle bundle) {
|
|
|
|
WindowManager.LayoutParams attributes;
|
|
|
|
Dialog onCreateDialog = super.onCreateDialog(bundle);
|
|
|
|
Window window = onCreateDialog.getWindow();
|
|
|
|
if (window != null) {
|
|
|
|
window.setGravity(81);
|
|
|
|
}
|
|
|
|
Bundle arguments = getArguments();
|
2021-08-09 22:51:56 +00:00
|
|
|
Integer valueOf = arguments != null ? Integer.valueOf(arguments.getInt(EXTRA_Y_POSITION, 0)) : null;
|
2021-08-03 07:33:18 +00:00
|
|
|
Window window2 = onCreateDialog.getWindow();
|
|
|
|
if (!(window2 == null || (attributes = window2.getAttributes()) == null)) {
|
|
|
|
if (valueOf != null && valueOf.intValue() == 0) {
|
|
|
|
Context context = onCreateDialog.getContext();
|
|
|
|
m.checkNotNullExpressionValue(context, "context");
|
2022-03-07 09:34:54 +00:00
|
|
|
valueOf = Integer.valueOf((int) (context.getResources().getDimension(R.dimen.default_keyboard_height) / 2));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
attributes.y = valueOf.intValue();
|
|
|
|
}
|
|
|
|
return onCreateDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
|
|
public void onViewBound(View view) {
|
|
|
|
m.checkNotNullParameter(view, "view");
|
|
|
|
super.onViewBound(view);
|
2021-12-17 21:59:34 +00:00
|
|
|
getBinding().c.setOnClickListener(new WidgetStickerPackDetailsDialog$onViewBound$1(this));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
|
|
public void onViewBoundOrOnResume() {
|
|
|
|
super.onViewBoundOrOnResume();
|
|
|
|
Bundle arguments = getArguments();
|
|
|
|
Long valueOf = arguments != null ? Long.valueOf(arguments.getLong("com.discord.intent.EXTRA_STICKER_PACK_ID")) : null;
|
|
|
|
this.stickerPackId = valueOf;
|
|
|
|
if (valueOf != null) {
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(StoreStream.Companion.getStickers().observeStickerPack(valueOf.longValue()), this, null, 2, null), WidgetStickerPackDetailsDialog.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetStickerPackDetailsDialog$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|