From f6fab6b00e23f9293e6b8759687988c9b778d821 Mon Sep 17 00:00:00 2001 From: Mohamed <mohamed.metwalli@sap.com> Date: Mon, 10 May 2021 17:07:29 +0200 Subject: [PATCH] Material Alert (#3123) Co-authored-by: Matthias Urhahn <matthias.urhahn@sap.com> --- .../debuglog/ui/upload/DebugLogUploadFragment.kt | 4 ++-- .../debuglog/ui/upload/LogUploadBlockingDialog.kt | 4 ++-- .../de/rki/coronawarnapp/bugreporting/ui/ErrorDialog.kt | 3 +-- .../consent/SurveyConsentBlockingProgressDialogFragment.kt | 4 ++-- .../de/rki/coronawarnapp/ui/launcher/LauncherActivity.kt | 4 ++-- .../java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt | 6 +++--- .../ui/main/home/popups/DeviceTimeIncorrectDialog.kt | 4 ++-- .../presencetracing/attendee/checkins/CheckInsFragment.kt | 3 +-- .../organizer/list/TraceLocationsFragment.kt | 4 ++-- .../rki/coronawarnapp/ui/settings/SettingsResetFragment.kt | 5 +++-- .../ui/submission/SubmissionBlockingDialog.kt | 4 ++-- .../coronawarnapp/ui/submission/SubmissionCancelDialog.kt | 4 ++-- .../invalid/SubmissionTestResultInvalidFragment.kt | 5 +++-- .../negative/SubmissionTestResultNegativeFragment.kt | 5 +++-- .../pending/SubmissionTestResultPendingFragment.kt | 4 +++- .../positive/SubmissionTestResultConsentGivenFragment.kt | 4 ++-- .../positive/SubmissionTestResultKeysSharedFragment.kt | 4 ++-- .../positive/SubmissionTestResultNoConsentFragment.kt | 4 ++-- .../main/java/de/rki/coronawarnapp/util/DialogHelper.kt | 6 ++++-- .../util/errors/RecoveryByResetDialogFactory.kt | 7 ++++--- 20 files changed, 47 insertions(+), 41 deletions(-) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt index af206680a..8f4c80f1a 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt @@ -4,8 +4,8 @@ import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent import android.widget.Toast -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.Fragment +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.BugreportingDebuglogUploadFragmentBinding import de.rki.coronawarnapp.util.di.AutoInject @@ -49,7 +49,7 @@ class DebugLogUploadFragment : Fragment(R.layout.bugreporting_debuglog_upload_fr } vm.errorEvent.observe2(this) { - AlertDialog.Builder(requireContext()).apply { + MaterialAlertDialogBuilder(requireContext()).apply { val errorForHumans = it.tryHumanReadableError(requireContext()) setTitle(errorForHumans.title ?: getString(R.string.errors_generic_headline)) setMessage(errorForHumans.description) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/LogUploadBlockingDialog.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/LogUploadBlockingDialog.kt index 07c7289b6..ae7a44a84 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/LogUploadBlockingDialog.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/LogUploadBlockingDialog.kt @@ -1,13 +1,13 @@ package de.rki.coronawarnapp.bugreporting.debuglog.ui.upload import android.content.Context -import androidx.appcompat.app.AlertDialog +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R class LogUploadBlockingDialog(val context: Context) { private val dialog by lazy { - AlertDialog.Builder(context).apply { + MaterialAlertDialogBuilder(context).apply { setCancelable(false) setView(R.layout.bugreporting_debuglog_upload_dialog) }.create() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/ui/ErrorDialog.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/ui/ErrorDialog.kt index c4b4af463..e17a6f672 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/ui/ErrorDialog.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/ui/ErrorDialog.kt @@ -5,7 +5,6 @@ import android.text.SpannableString import android.text.method.LinkMovementMethod import android.text.util.Linkify import android.widget.TextView -import androidx.appcompat.app.AlertDialog import androidx.core.widget.TextViewCompat import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R @@ -52,7 +51,7 @@ fun Throwable.toErrorDialogBuilder(context: Context) = MaterialAlertDialogBuilde setPositiveButton(R.string.errors_generic_button_positive) { _, _ -> } setNeutralButton(R.string.errors_generic_button_negative) { _, _ -> - AlertDialog.Builder(context).apply { + MaterialAlertDialogBuilder(context).apply { setMessageView( error.toString() + "\n\n" + error.stackTraceToString(), textHasLinks = false diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/datadonation/survey/consent/SurveyConsentBlockingProgressDialogFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/datadonation/survey/consent/SurveyConsentBlockingProgressDialogFragment.kt index ce29f457f..c55a33353 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/datadonation/survey/consent/SurveyConsentBlockingProgressDialogFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/datadonation/survey/consent/SurveyConsentBlockingProgressDialogFragment.kt @@ -2,15 +2,15 @@ package de.rki.coronawarnapp.datadonation.survey.consent import android.app.Dialog import android.os.Bundle -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R class SurveyConsentBlockingProgressDialogFragment : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { isCancelable = false - return AlertDialog.Builder(requireContext()) + return MaterialAlertDialogBuilder(requireContext()) .setView(R.layout.survey_consent_blocking_progress_dialog) .setCancelable(false) .create() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/launcher/LauncherActivity.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/launcher/LauncherActivity.kt index 27a61dabf..ade8a955a 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/launcher/LauncherActivity.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/launcher/LauncherActivity.kt @@ -2,9 +2,9 @@ package de.rki.coronawarnapp.ui.launcher import android.content.Intent import android.os.Bundle -import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.ui.onboarding.OnboardingActivity @@ -46,7 +46,7 @@ class LauncherActivity : AppCompatActivity() { } private fun showUpdateNeededDialog(intent: Intent) { - AlertDialog.Builder(this) + MaterialAlertDialogBuilder(this) .setTitle(R.string.update_dialog_title) .setMessage(R.string.update_dialog_message) .setCancelable(false) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt index 1e3806426..4b3d0497a 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/HomeFragment.kt @@ -1,6 +1,6 @@ package de.rki.coronawarnapp.ui.main.home -import android.app.AlertDialog +import android.content.DialogInterface import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent @@ -165,7 +165,7 @@ class HomeFragment : Fragment(R.layout.home_fragment_layout), AutoInject { } ) DialogHelper.showDialog(removeTestDialog).apply { - getButton(AlertDialog.BUTTON_POSITIVE) + getButton(DialogInterface.BUTTON_POSITIVE) .setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) } } @@ -182,7 +182,7 @@ class HomeFragment : Fragment(R.layout.home_fragment_layout), AutoInject { ) DialogHelper.showDialog(riskLevelLoweredDialog).apply { - getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(context.getColorCompat(R.color.colorTextTint)) + getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(context.getColorCompat(R.color.colorTextTint)) } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/popups/DeviceTimeIncorrectDialog.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/popups/DeviceTimeIncorrectDialog.kt index 4ca380ddd..f24527c26 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/popups/DeviceTimeIncorrectDialog.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/home/popups/DeviceTimeIncorrectDialog.kt @@ -1,6 +1,6 @@ package de.rki.coronawarnapp.ui.main.home.popups -import androidx.appcompat.app.AlertDialog +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.ui.main.home.HomeFragment import javax.inject.Inject @@ -10,7 +10,7 @@ class DeviceTimeIncorrectDialog @Inject constructor( ) { fun show(onAcknowledged: () -> Unit) { - AlertDialog.Builder(homeFragment.requireContext()).apply { + MaterialAlertDialogBuilder(homeFragment.requireContext()).apply { setTitle(R.string.device_time_incorrect_dialog_headline) setMessage(R.string.device_time_incorrect_dialog_body) setPositiveButton(R.string.device_time_incorrect_dialog_button_confirm) { _, _ -> diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/CheckInsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/CheckInsFragment.kt index 0996c664a..cb181fa24 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/CheckInsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/CheckInsFragment.kt @@ -7,7 +7,6 @@ import android.os.Bundle import android.provider.Settings import android.view.View import android.widget.Toast -import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.Toolbar import androidx.core.net.toUri import androidx.core.view.isGone @@ -215,7 +214,7 @@ class CheckInsFragment : Fragment(R.layout.trace_location_attendee_checkins_frag } private fun showRemovalConfirmation(checkIn: CheckIn?, position: Int?) = - AlertDialog.Builder(requireContext()).apply { + MaterialAlertDialogBuilder(requireContext()).apply { setTitle( if (checkIn == null) R.string.trace_location_checkins_remove_all_title else R.string.trace_location_checkins_remove_single_title diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/organizer/list/TraceLocationsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/organizer/list/TraceLocationsFragment.kt index 360f678ba..05326b20b 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/organizer/list/TraceLocationsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/organizer/list/TraceLocationsFragment.kt @@ -3,13 +3,13 @@ package de.rki.coronawarnapp.ui.presencetracing.organizer.list import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent -import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.Toolbar import androidx.core.view.isGone import androidx.fragment.app.Fragment import androidx.navigation.NavOptions import androidx.navigation.fragment.FragmentNavigatorExtras import androidx.navigation.fragment.findNavController +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.transition.Hold import com.google.android.material.transition.MaterialSharedAxis import de.rki.coronawarnapp.R @@ -202,7 +202,7 @@ class TraceLocationsFragment : Fragment(R.layout.trace_location_organizer_trace_ } private fun showDeleteSingleDialog(traceLocation: TraceLocation, position: Int?) { - AlertDialog.Builder(requireContext()).apply { + MaterialAlertDialogBuilder(requireContext()).apply { setTitle(R.string.trace_location_organiser_list_delete_single_popup_title) setMessage(R.string.trace_location_organiser_list_delete_single_popup_message) setPositiveButton(R.string.trace_location_organiser_list_delete_all_popup_positive_button) { _, _ -> diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt index 8cf49a835..b0ee388ea 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt @@ -1,6 +1,6 @@ package de.rki.coronawarnapp.ui.settings -import android.app.AlertDialog +import android.content.DialogInterface import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent @@ -66,7 +66,8 @@ class SettingsResetFragment : Fragment(R.layout.fragment_settings_reset), AutoIn ) DialogHelper.showDialog(resetDialog).apply { - getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) + getButton(DialogInterface.BUTTON_POSITIVE) + .setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionBlockingDialog.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionBlockingDialog.kt index 7fe93abaa..f04a15fb4 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionBlockingDialog.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionBlockingDialog.kt @@ -1,7 +1,7 @@ package de.rki.coronawarnapp.ui.submission import android.content.Context -import androidx.appcompat.app.AlertDialog +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R class SubmissionBlockingDialog( @@ -9,7 +9,7 @@ class SubmissionBlockingDialog( ) { private val dialog by lazy { - AlertDialog.Builder(context).apply { + MaterialAlertDialogBuilder(context).apply { setCancelable(false) setView(R.layout.submission_blocking_dialog_view) }.create() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionCancelDialog.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionCancelDialog.kt index b1bce7867..5bee17983 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionCancelDialog.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionCancelDialog.kt @@ -1,14 +1,14 @@ package de.rki.coronawarnapp.ui.submission import android.content.Context -import androidx.appcompat.app.AlertDialog +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R class SubmissionCancelDialog( val context: Context ) { fun show(onUserDidCancel: () -> Unit) { - AlertDialog.Builder(context).apply { + MaterialAlertDialogBuilder(context).apply { setTitle(R.string.submission_error_dialog_confirm_cancellation_title) setMessage(R.string.submission_error_dialog_confirm_cancellation_body) setPositiveButton(R.string.submission_error_dialog_confirm_cancellation_button_positive) { _, _ -> diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/invalid/SubmissionTestResultInvalidFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/invalid/SubmissionTestResultInvalidFragment.kt index 021461981..2bdd54159 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/invalid/SubmissionTestResultInvalidFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/invalid/SubmissionTestResultInvalidFragment.kt @@ -1,6 +1,6 @@ package de.rki.coronawarnapp.ui.submission.testresult.invalid -import android.app.AlertDialog +import android.content.DialogInterface import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent @@ -70,7 +70,8 @@ class SubmissionTestResultInvalidFragment : Fragment(R.layout.fragment_submissio } ) DialogHelper.showDialog(removeTestDialog).apply { - getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) + getButton(DialogInterface.BUTTON_POSITIVE) + .setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/negative/SubmissionTestResultNegativeFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/negative/SubmissionTestResultNegativeFragment.kt index 7e164e088..a746633a5 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/negative/SubmissionTestResultNegativeFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/negative/SubmissionTestResultNegativeFragment.kt @@ -1,6 +1,6 @@ package de.rki.coronawarnapp.ui.submission.testresult.negative -import android.app.AlertDialog +import android.content.DialogInterface import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent @@ -70,7 +70,8 @@ class SubmissionTestResultNegativeFragment : Fragment(R.layout.fragment_submissi } ) DialogHelper.showDialog(removeTestDialog).apply { - getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) + getButton(DialogInterface.BUTTON_POSITIVE) + .setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/pending/SubmissionTestResultPendingFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/pending/SubmissionTestResultPendingFragment.kt index ee69535ab..d3a332713 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/pending/SubmissionTestResultPendingFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/pending/SubmissionTestResultPendingFragment.kt @@ -1,5 +1,6 @@ package de.rki.coronawarnapp.ui.submission.testresult.pending +import android.content.DialogInterface import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent @@ -143,7 +144,8 @@ class SubmissionTestResultPendingFragment : Fragment(R.layout.fragment_submissio } ) DialogHelper.showDialog(removeTestDialog).apply { - getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) + getButton(DialogInterface.BUTTON_POSITIVE) + .setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultConsentGivenFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultConsentGivenFragment.kt index 30208766c..2141e745c 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultConsentGivenFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultConsentGivenFragment.kt @@ -1,12 +1,12 @@ package de.rki.coronawarnapp.ui.submission.testresult.positive -import android.app.AlertDialog import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent import androidx.activity.OnBackPressedCallback import androidx.fragment.app.Fragment import androidx.navigation.fragment.navArgs +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentSubmissionTestResultConsentGivenBinding import de.rki.coronawarnapp.ui.submission.SubmissionBlockingDialog @@ -107,7 +107,7 @@ class SubmissionTestResultConsentGivenFragment : } private fun showCancelDialog() { - AlertDialog.Builder(requireContext()).apply { + MaterialAlertDialogBuilder(requireContext()).apply { setTitle(R.string.submission_error_dialog_confirm_cancellation_title) setMessage(R.string.submission_error_dialog_confirm_cancellation_body) setPositiveButton(R.string.submission_error_dialog_confirm_cancellation_button_positive) { _, _ -> diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultKeysSharedFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultKeysSharedFragment.kt index d7de6021d..922622724 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultKeysSharedFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultKeysSharedFragment.kt @@ -1,6 +1,6 @@ package de.rki.coronawarnapp.ui.submission.testresult.positive -import android.app.AlertDialog +import android.content.DialogInterface import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent @@ -87,7 +87,7 @@ class SubmissionTestResultKeysSharedFragment : } ) DialogHelper.showDialog(removeTestDialog).apply { - getButton(AlertDialog.BUTTON_POSITIVE) + getButton(DialogInterface.BUTTON_POSITIVE) .setTextColor(context.getColorCompat(R.color.colorTextSemanticRed)) } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultNoConsentFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultNoConsentFragment.kt index 5ac4b1981..8e02c19bb 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultNoConsentFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/testresult/positive/SubmissionTestResultNoConsentFragment.kt @@ -1,12 +1,12 @@ package de.rki.coronawarnapp.ui.submission.testresult.positive -import android.app.AlertDialog import android.os.Bundle import android.view.View import android.view.accessibility.AccessibilityEvent import androidx.activity.OnBackPressedCallback import androidx.fragment.app.Fragment import androidx.navigation.fragment.navArgs +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentSubmissionTestResultPositiveNoConsentBinding import de.rki.coronawarnapp.ui.submission.testresult.pending.SubmissionTestResultPendingFragmentArgs @@ -76,7 +76,7 @@ class SubmissionTestResultNoConsentFragment : } private fun showCancelDialog() { - AlertDialog.Builder(requireContext()).apply { + MaterialAlertDialogBuilder(requireContext()).apply { setTitle(R.string.submission_test_result_positive_no_consent_dialog_title) setMessage(R.string.submission_test_result_positive_no_consent_dialog_message) setNegativeButton(R.string.submission_test_result_positive_no_consent_dialog_positive_button) { _, _ -> diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DialogHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DialogHelper.kt index 9688f3585..e8bdab771 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DialogHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DialogHelper.kt @@ -7,6 +7,7 @@ import android.text.util.Linkify import android.widget.TextView import androidx.appcompat.app.AlertDialog import androidx.core.widget.TextViewCompat +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.util.ContextExtensions.getColorStateListCompat import java.util.regex.Pattern @@ -73,8 +74,9 @@ object DialogHelper { dialogInstance.message, dialogInstance.isTextSelectable ) - val alertDialog: AlertDialog = dialogInstance.context.let { - val builder = AlertDialog.Builder(it) + + val alertDialog = dialogInstance.context.let { + val builder = MaterialAlertDialogBuilder(it) builder.apply { setTitle(dialogInstance.title) setView(message) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/errors/RecoveryByResetDialogFactory.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/errors/RecoveryByResetDialogFactory.kt index f94c31280..cc97ae748 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/errors/RecoveryByResetDialogFactory.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/errors/RecoveryByResetDialogFactory.kt @@ -1,9 +1,10 @@ package de.rki.coronawarnapp.util.errors import android.content.Context +import android.content.DialogInterface import androidx.annotation.StringRes -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.Fragment +import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.util.ExternalActionHelper.openUrl @@ -16,7 +17,7 @@ class RecoveryByResetDialogFactory(private val fragment: Fragment) { @StringRes detailsLink: Int, onPositive: () -> Unit ) { - val dialog = AlertDialog.Builder(context) + val dialog = MaterialAlertDialogBuilder(context) .setTitle(R.string.errors_generic_headline) .setMessage(R.string.errors_generic_text_catastrophic_error_recovery_via_reset) .setCancelable(false) @@ -26,7 +27,7 @@ class RecoveryByResetDialogFactory(private val fragment: Fragment) { } .create() dialog.show() - dialog.getButton(AlertDialog.BUTTON_NEUTRAL)?.setOnClickListener { + dialog.getButton(DialogInterface.BUTTON_NEUTRAL)?.setOnClickListener { fragment.openUrl(context.getString(detailsLink)) } } -- GitLab