package com.discord.widgets.chat.input.sticker; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import com.discord.api.sticker.Sticker; import com.discord.widgets.chat.input.expression.WidgetExpressionPickerSheet; import d0.z.d.m; import java.io.Serializable; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.DefaultConstructorMarker; /* compiled from: WidgetStickerPickerSheet.kt */ public final class WidgetStickerPickerSheet extends WidgetExpressionPickerSheet implements StickerPickerListener { public static final Companion Companion = new Companion(null); private View container; private WidgetStickerPicker stickerPickerFragment; private StickerPickerListener stickerPickerListenerDelegate; /* compiled from: WidgetStickerPickerSheet.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public static /* synthetic */ WidgetStickerPickerSheet show$default(Companion companion, FragmentManager fragmentManager, StickerPickerListener stickerPickerListener, Long l, String str, Function0 function0, int i, Object obj) { return companion.show(fragmentManager, stickerPickerListener, (i & 4) != 0 ? null : l, (i & 8) != 0 ? null : str, (i & 16) != 0 ? null : function0); } public final WidgetStickerPickerSheet show(FragmentManager fragmentManager, StickerPickerListener stickerPickerListener, Long l, String str, Function0 function0) { m.checkNotNullParameter(fragmentManager, "fragmentManager"); System.gc(); Bundle bundle = new Bundle(); if (l != null) { l.longValue(); bundle.putLong("com.discord.intent.EXTRA_STICKER_PACK_ID", l.longValue()); } bundle.putString("com.discord.intent.extra.EXTRA_TEXT", str); WidgetStickerPickerSheet widgetStickerPickerSheet = new WidgetStickerPickerSheet(); widgetStickerPickerSheet.setStickerPickerListener(stickerPickerListener); widgetStickerPickerSheet.setOnCancel(function0); widgetStickerPickerSheet.setArguments(bundle); widgetStickerPickerSheet.show(fragmentManager, WidgetStickerPickerSheet.class.getSimpleName()); return widgetStickerPickerSheet; } } public static final /* synthetic */ View access$getContainer$p(WidgetStickerPickerSheet widgetStickerPickerSheet) { View view = widgetStickerPickerSheet.container; if (view == null) { m.throwUninitializedPropertyAccessException("container"); } return view; } public static final /* synthetic */ void access$setContainer$p(WidgetStickerPickerSheet widgetStickerPickerSheet, View view) { widgetStickerPickerSheet.container = view; } @Override // com.discord.app.AppBottomSheet public int getContentViewResId() { return 2131559248; } @Override // com.discord.widgets.chat.input.expression.WidgetExpressionPickerSheet, androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnCancelListener public void onCancel(DialogInterface dialogInterface) { m.checkNotNullParameter(dialogInterface, "dialog"); super.onCancel(dialogInterface); WidgetStickerPicker widgetStickerPicker = this.stickerPickerFragment; if (widgetStickerPicker == null) { m.throwUninitializedPropertyAccessException("stickerPickerFragment"); } widgetStickerPicker.clearSearchInput(); } @Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnDismissListener public void onDismiss(DialogInterface dialogInterface) { m.checkNotNullParameter(dialogInterface, "dialog"); super.onDismiss(dialogInterface); WidgetStickerPicker widgetStickerPicker = this.stickerPickerFragment; if (widgetStickerPicker == null) { m.throwUninitializedPropertyAccessException("stickerPickerFragment"); } widgetStickerPicker.selectCategoryById(-1); } @Override // com.discord.widgets.chat.input.sticker.StickerPickerListener public void onStickerPicked(Sticker sticker) { m.checkNotNullParameter(sticker, "sticker"); StickerPickerListener stickerPickerListener = this.stickerPickerListenerDelegate; if (stickerPickerListener != null) { stickerPickerListener.onStickerPicked(sticker); } dismiss(); } @Override // com.discord.widgets.chat.input.expression.WidgetExpressionPickerSheet, com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment public void onViewCreated(View view, Bundle bundle) { m.checkNotNullParameter(view, "view"); super.onViewCreated(view, bundle); this.container = view; Bundle arguments = getArguments(); String str = null; Long valueOf = arguments != null ? Long.valueOf(arguments.getLong("com.discord.intent.EXTRA_STICKER_PACK_ID")) : null; Bundle arguments2 = getArguments(); Serializable serializable = arguments2 != null ? arguments2.getSerializable("com.discord.intent.EXTRA_STICKER_PICKER_SCREEN") : null; Bundle arguments3 = getArguments(); if (arguments3 != null) { str = arguments3.getString("com.discord.intent.extra.EXTRA_TEXT"); } WidgetStickerPicker widgetStickerPicker = new WidgetStickerPicker(); this.stickerPickerFragment = widgetStickerPicker; if (widgetStickerPicker == null) { m.throwUninitializedPropertyAccessException("stickerPickerFragment"); } Bundle bundle2 = new Bundle(); bundle2.putSerializable("MODE", StickerPickerMode.BOTTOM_SHEET); bundle2.putSerializable("VIEW_TYPE", StickerPackStoreSheetViewType.STICKER_SEARCH_VIEW_ALL); bundle2.putString("com.discord.intent.extra.EXTRA_TEXT", str); if (valueOf != null) { bundle2.putLong("com.discord.intent.EXTRA_STICKER_PACK_ID", valueOf.longValue()); } if (serializable != null) { bundle2.putSerializable("com.discord.intent.EXTRA_STICKER_PICKER_SCREEN", serializable); } widgetStickerPicker.setArguments(bundle2); WidgetStickerPicker widgetStickerPicker2 = this.stickerPickerFragment; if (widgetStickerPicker2 == null) { m.throwUninitializedPropertyAccessException("stickerPickerFragment"); } widgetStickerPicker2.setListener(this); FragmentTransaction beginTransaction = getChildFragmentManager().beginTransaction(); WidgetStickerPicker widgetStickerPicker3 = this.stickerPickerFragment; if (widgetStickerPicker3 == null) { m.throwUninitializedPropertyAccessException("stickerPickerFragment"); } WidgetStickerPicker widgetStickerPicker4 = this.stickerPickerFragment; if (widgetStickerPicker4 == null) { m.throwUninitializedPropertyAccessException("stickerPickerFragment"); } beginTransaction.replace(2131365151, widgetStickerPicker3, widgetStickerPicker4.getClass().getSimpleName()).runOnCommit(new WidgetStickerPickerSheet$onViewCreated$2(this)).commit(); } public final void scrollToPack(Long l) { WidgetStickerPicker widgetStickerPicker = this.stickerPickerFragment; if (widgetStickerPicker == null) { m.throwUninitializedPropertyAccessException("stickerPickerFragment"); } widgetStickerPicker.scrollToPack(l); } public final void setStickerPickerListener(StickerPickerListener stickerPickerListener) { this.stickerPickerListenerDelegate = stickerPickerListener; } }