Fix crashing when deleting a custom story.

This commit is contained in:
Alex Hart 2023-07-11 10:06:07 -03:00 committed by Greyson Parrelli
parent 0ea6d9205d
commit 1d0582867b
3 changed files with 6 additions and 3 deletions

View file

@ -1,10 +1,12 @@
package org.thoughtcrime.securesms.components
import android.annotation.SuppressLint
import android.app.Dialog
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.View
import androidx.annotation.Discouraged
import androidx.fragment.app.DialogFragment
import androidx.navigation.fragment.navArgs
import org.thoughtcrime.securesms.R
@ -12,9 +14,10 @@ import org.thoughtcrime.securesms.R
/**
* Displays a small progress spinner in a card view, as a non-cancellable dialog fragment.
*/
class ProgressCardDialogFragment : DialogFragment(R.layout.progress_card_dialog) {
class ProgressCardDialogFragment @Discouraged("Use create() instead.") constructor() : DialogFragment(R.layout.progress_card_dialog) {
companion object {
@SuppressLint("DiscouragedApi")
fun create(title: String? = null): ProgressCardDialogFragment {
return ProgressCardDialogFragment().apply {
arguments = ProgressCardDialogFragmentArgs.Builder(title).build().toBundle()

View file

@ -1695,7 +1695,7 @@ class ConversationFragment :
}
private fun performAttachmentSave(attachments: Set<SaveAttachmentUtil.SaveAttachment>) {
val progressDialog = ProgressCardDialogFragment()
val progressDialog = ProgressCardDialogFragment.create()
progressDialog.arguments = ProgressCardDialogFragmentArgs.Builder(
resources.getQuantityString(R.plurals.ConversationFragment_saving_n_attachments_to_sd_card, attachments.size, attachments.size)
).build().toBundle()

View file

@ -31,7 +31,7 @@ class PrivateStorySettingsFragment : DSLSettingsFragment(
menuId = R.menu.story_private_menu
) {
private val progressDisplayManager = DialogFragmentDisplayManager { ProgressCardDialogFragment() }
private val progressDisplayManager = DialogFragmentDisplayManager { ProgressCardDialogFragment.create() }
private val viewModel: PrivateStorySettingsViewModel by viewModels(
factoryProducer = {