Skip to content

Commit

Permalink
use appcompat AlertDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
MorenoTropical authored and mikehardy committed Jun 5, 2024
1 parent de409a5 commit 8e1c71a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
package com.ichi2.anki.analytics

import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.DialogInterface
import android.os.Bundle
import android.view.View
import android.widget.CheckBox
import android.widget.EditText
import androidx.appcompat.app.AlertDialog
import androidx.core.content.edit
import com.ichi2.anki.CrashReportService
import com.ichi2.anki.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package com.ichi2.anki.dialogs

import android.app.AlertDialog
import android.app.Dialog
import android.os.Bundle
import android.text.format.Formatter.formatShortFileSize
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
Expand Down Expand Up @@ -85,7 +85,7 @@ class MigrationProgressDialogFragment : DialogFragment() {
}
}

return AlertDialog.Builder(activity)
return AlertDialog.Builder(requireActivity())
.setView(layout)
.setPositiveButton(R.string.dialog_ok) { _, _ -> dismiss() }
.setNegativeButton(R.string.scoped_storage_learn_more) { _, _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.ichi2.anki.dialogs

import android.app.AlertDialog
import android.content.ActivityNotFoundException
import android.content.Intent
import android.content.res.ColorStateList
Expand All @@ -28,6 +27,7 @@ import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.viewModels
Expand Down Expand Up @@ -160,7 +160,7 @@ class TtsVoicesDialogFragment : DialogFragment() {
viewModel.availableVoicesFlow.observe {
if (it is TtsVoicesViewModel.VoiceLoadingState.Failure) {
progressBar.visibility = View.VISIBLE
AlertDialog.Builder(this.context)
AlertDialog.Builder(requireContext())
.setMessage(it.exception.localizedMessage)
.setOnDismissListener { this@TtsVoicesDialogFragment.dismiss() }
.show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
package com.ichi2.anki.multimediacard.activity

import android.R
import android.app.AlertDialog
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.widget.ArrayAdapter
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import com.ichi2.utils.KotlinCleanup
import java.util.*
Expand All @@ -40,7 +40,7 @@ class PickStringDialogFragment : DialogFragment() {
@KotlinCleanup("requireActivity")
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
// Use the Builder class for convenient dialog construction
val builder = AlertDialog.Builder(activity)
val builder = AlertDialog.Builder(requireActivity())
builder.setTitle(title)
val adapter = ArrayAdapter(
requireActivity(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

package com.ichi2.anki.ui.dialogs.tools

import android.app.AlertDialog
import android.content.Context
import android.content.DialogInterface.BUTTON_POSITIVE
import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlin.coroutines.Continuation
import kotlin.coroutines.resume
Expand Down

0 comments on commit 8e1c71a

Please sign in to comment.