enhance account removal confirmation dialog m3 theming

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-09-12 15:13:57 +02:00 committed by Álvaro Brey
parent 25bbbea282
commit dd9bdaa886
No known key found for this signature in database
GPG key ID: 2585783189A62105

View file

@ -25,6 +25,7 @@ package com.owncloud.android.ui.dialog;
import android.app.Dialog;
import android.os.Bundle;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.nextcloud.client.account.User;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.jobs.BackgroundJobManager;
@ -76,14 +77,17 @@ public class AccountRemovalConfirmationDialog extends DialogFragment implements
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(requireActivity(), R.style.Theme_ownCloud_Dialog)
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity())
.setTitle(R.string.delete_account)
.setMessage(getResources().getString(R.string.delete_account_warning, user.getAccountName()))
.setIcon(R.drawable.ic_warning)
.setPositiveButton(R.string.common_ok,
(dialogInterface, i) -> backgroundJobManager.startAccountRemovalJob(user.getAccountName(),
false))
.setNeutralButton(R.string.common_cancel, null)
.create();
.setNeutralButton(R.string.common_cancel, null);
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(requireActivity(), builder);
return builder.create();
}
}