158 lines
7.9 KiB
Java
158 lines
7.9 KiB
Java
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;
|
|
import c.a.l.b;
|
|
import c.d.b.a.a;
|
|
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.dsti.StickerUtils;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import d0.z.d.m;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
/* compiled from: WidgetStickerPackDetailsDialog.kt */
|
|
public final class WidgetStickerPackDetailsDialog extends AppDialog {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetStickerPackDetailsDialog.class, "binding", "getBinding()Lcom/discord/databinding/StickerPackDetailsDialogBinding;", 0)};
|
|
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 */
|
|
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();
|
|
bundle.putInt("EXTRA_Y_POSITION", num.intValue());
|
|
}
|
|
WidgetStickerPackDetailsDialog widgetStickerPackDetailsDialog = new WidgetStickerPackDetailsDialog();
|
|
widgetStickerPackDetailsDialog.setArguments(bundle);
|
|
widgetStickerPackDetailsDialog.show(fragmentManager, WidgetStickerPackDetailsDialog.class.getSimpleName());
|
|
}
|
|
}
|
|
|
|
public WidgetStickerPackDetailsDialog() {
|
|
super(2131558670);
|
|
setStyle(1, 2131951655);
|
|
}
|
|
|
|
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");
|
|
textView.setText(b.j(this, 2131893624, new Object[]{stickerPack.getName()}, null, 4));
|
|
TextView textView2 = getBinding().b;
|
|
m.checkNotNullExpressionValue(textView2, "binding.stickerPackDetailsAnimated");
|
|
int i = 8;
|
|
textView2.setVisibility(stickerPack.isAnimatedPack() ? 0 : 8);
|
|
TextView textView3 = getBinding().b;
|
|
m.checkNotNullExpressionValue(textView3, "binding.stickerPackDetailsAnimated");
|
|
textView3.setText("・ " + getString(2131893625));
|
|
TextView textView4 = getBinding().f;
|
|
m.checkNotNullExpressionValue(textView4, "binding.stickerPackDetailsPremium");
|
|
textView4.setVisibility(stickerPack.isPremiumPack() ? 0 : 8);
|
|
TextView textView5 = getBinding().f;
|
|
m.checkNotNullExpressionValue(textView5, "binding.stickerPackDetailsPremium");
|
|
textView5.setText("・ " + getString(2131893627));
|
|
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()");
|
|
sb.append(b.j(this, 2131893626, new Object[]{stickerUtils.getLimitedTimeLeftString(requireContext, stickerPack.getStoreListing())}, null, 4));
|
|
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();
|
|
Integer valueOf = arguments != null ? Integer.valueOf(arguments.getInt("EXTRA_Y_POSITION", 0)) : null;
|
|
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");
|
|
valueOf = Integer.valueOf((int) (context.getResources().getDimension(2131165339) / ((float) 2)));
|
|
}
|
|
attributes.y = valueOf.intValue();
|
|
}
|
|
return onCreateDialog;
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
getBinding().f1628c.setOnClickListener(new WidgetStickerPackDetailsDialog$onViewBound$1(this));
|
|
}
|
|
|
|
@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);
|
|
}
|
|
}
|
|
}
|