diff --git a/app/src/main/java/it/niedermann/owncloud/notes/accountpicker/AccountPickerDialogFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/accountpicker/AccountPickerDialogFragment.java
index 56350be7..8caa4540 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/accountpicker/AccountPickerDialogFragment.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/accountpicker/AccountPickerDialogFragment.java
@@ -10,9 +10,9 @@ import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
-import androidx.recyclerview.widget.RecyclerView;
+
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList;
import java.util.Collection;
@@ -21,13 +21,11 @@ import java.util.Objects;
import java.util.stream.Collectors;
import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.branding.BrandedAlertDialogBuilder;
import it.niedermann.owncloud.notes.branding.BrandedDialogFragment;
import it.niedermann.owncloud.notes.databinding.DialogChooseAccountBinding;
import it.niedermann.owncloud.notes.persistence.entity.Account;
import it.niedermann.owncloud.notes.persistence.entity.Note;
import it.niedermann.owncloud.notes.shared.account.AccountChooserAdapter;
-import it.niedermann.owncloud.notes.shared.account.AccountChooserViewHolder;
/**
* A {@link DialogFragment} which provides an {@link Account} chooser that hides the current {@link Account}.
@@ -75,7 +73,7 @@ public class AccountPickerDialogFragment extends BrandedDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- final var dialogBuilder = new BrandedAlertDialogBuilder(requireActivity())
+ final var dialogBuilder = new MaterialAlertDialogBuilder(requireActivity())
.setTitle(R.string.simple_move)
.setNegativeButton(android.R.string.cancel, null);
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedAlertDialogBuilder.java b/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedAlertDialogBuilder.java
deleted file mode 100644
index a30c176f..00000000
--- a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedAlertDialogBuilder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package it.niedermann.owncloud.notes.branding;
-
-import static it.niedermann.owncloud.notes.branding.BrandingUtil.getSecondaryForegroundColorDependingOnTheme;
-
-import android.content.Context;
-import android.content.DialogInterface;
-import android.widget.Button;
-
-import androidx.annotation.CallSuper;
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.AlertDialog;
-
-import com.google.android.material.dialog.MaterialAlertDialogBuilder;
-
-public class BrandedAlertDialogBuilder extends MaterialAlertDialogBuilder implements Branded {
-
- protected AlertDialog dialog;
-
- public BrandedAlertDialogBuilder(Context context) {
- super(context);
- }
-
- @NonNull
- @Override
- public AlertDialog create() {
- this.dialog = super.create();
-
- @NonNull final var context = getContext();
- @ColorInt final int mainColor = BrandingUtil.readBrandMainColor(context);
- @ColorInt final int textColor = BrandingUtil.readBrandTextColor(context);
- applyBrand(mainColor, textColor);
- dialog.setOnShowListener(dialog -> applyBrand(mainColor, textColor));
- return dialog;
- }
-
- @CallSuper
- @Override
- public void applyBrand(int mainColor, int textColor) {
- final var buttons = new Button[3];
- buttons[0] = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
- buttons[1] = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
- buttons[2] = dialog.getButton(DialogInterface.BUTTON_NEUTRAL);
- for (final var button : buttons) {
- if (button != null) {
- button.setTextColor(getSecondaryForegroundColorDependingOnTheme(button.getContext(), mainColor));
- }
- }
- }
-}
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedDeleteAlertDialogBuilder.java b/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedDeleteAlertDialogBuilder.java
deleted file mode 100644
index e50b6fcb..00000000
--- a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedDeleteAlertDialogBuilder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package it.niedermann.owncloud.notes.branding;
-
-import android.content.Context;
-import android.content.DialogInterface;
-import android.widget.Button;
-
-import androidx.annotation.CallSuper;
-
-import it.niedermann.owncloud.notes.R;
-
-public class BrandedDeleteAlertDialogBuilder extends BrandedAlertDialogBuilder {
-
- public BrandedDeleteAlertDialogBuilder(Context context) {
- super(context);
- }
-
- @CallSuper
- @Override
- public void applyBrand(int mainColor, int textColor) {
- super.applyBrand(mainColor, textColor);
- final var positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
- if (positiveButton != null) {
- positiveButton.setTextColor(getContext().getResources().getColor(R.color.bg_attention));
- }
- }
-}
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/branding/DeleteAlertDialogBuilder.java b/app/src/main/java/it/niedermann/owncloud/notes/branding/DeleteAlertDialogBuilder.java
new file mode 100644
index 00000000..e51b5024
--- /dev/null
+++ b/app/src/main/java/it/niedermann/owncloud/notes/branding/DeleteAlertDialogBuilder.java
@@ -0,0 +1,37 @@
+package it.niedermann.owncloud.notes.branding;
+
+import android.content.Context;
+import android.content.DialogInterface;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
+import androidx.core.content.ContextCompat;
+
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
+import it.niedermann.owncloud.notes.R;
+
+public class DeleteAlertDialogBuilder extends MaterialAlertDialogBuilder {
+
+ protected AlertDialog dialog;
+
+ public DeleteAlertDialogBuilder(Context context) {
+ super(context);
+ }
+
+ @NonNull
+ @Override
+ public AlertDialog create() {
+ this.dialog = super.create();
+ applyBrand();
+ dialog.setOnShowListener(dialog -> applyBrand());
+ return dialog;
+ }
+
+ public void applyBrand() {
+ final var positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
+ if (positiveButton != null) {
+ positiveButton.setTextColor(ContextCompat.getColor(getContext(), R.color.danger));
+ }
+ }
+}
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/category/CategoryDialogFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/category/CategoryDialogFragment.java
index 16e0686b..c440f830 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/edit/category/CategoryDialogFragment.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/category/CategoryDialogFragment.java
@@ -13,14 +13,14 @@ import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
-import androidx.fragment.app.Fragment;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModelProvider;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import java.util.List;
import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.branding.BrandedAlertDialogBuilder;
import it.niedermann.owncloud.notes.branding.BrandedDialogFragment;
import it.niedermann.owncloud.notes.branding.BrandingUtil;
import it.niedermann.owncloud.notes.databinding.DialogChangeCategoryBinding;
@@ -150,7 +150,7 @@ public class CategoryDialogFragment extends BrandedDialogFragment {
}
});
- return new BrandedAlertDialogBuilder(getActivity())
+ return new MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.change_category_title)
.setView(dialogView)
.setCancelable(true)
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/title/EditTitleDialogFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/title/EditTitleDialogFragment.java
index b4221d98..e48ff63d 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/edit/title/EditTitleDialogFragment.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/title/EditTitleDialogFragment.java
@@ -57,7 +57,7 @@ public class EditTitleDialogFragment extends BrandedDialogFragment {
binding.title.setText(oldTitle);
}
- return new MaterialAlertDialogBuilder(requireActivity())
+ return new MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.change_note_title)
.setView(dialogView)
.setCancelable(true)
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/manageaccounts/ManageAccountsActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/manageaccounts/ManageAccountsActivity.java
index 267b5eec..6be9397b 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/manageaccounts/ManageAccountsActivity.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/manageaccounts/ManageAccountsActivity.java
@@ -18,6 +18,7 @@ import androidx.annotation.Px;
import androidx.annotation.StringRes;
import androidx.lifecycle.ViewModelProvider;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.nextcloud.android.sso.AccountImporter;
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppAccountNotFoundException;
@@ -27,8 +28,7 @@ import java.util.function.Function;
import it.niedermann.owncloud.notes.LockedActivity;
import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.branding.BrandedAlertDialogBuilder;
-import it.niedermann.owncloud.notes.branding.BrandedDeleteAlertDialogBuilder;
+import it.niedermann.owncloud.notes.branding.DeleteAlertDialogBuilder;
import it.niedermann.owncloud.notes.databinding.ActivityManageAccountsBinding;
import it.niedermann.owncloud.notes.exception.ExceptionDialogFragment;
import it.niedermann.owncloud.notes.persistence.NotesRepository;
@@ -91,7 +91,7 @@ public class ManageAccountsActivity extends LockedActivity implements IManageAcc
public void onSuccess(Long unsynchronizedChangesCount) {
runOnUiThread(() -> {
if (unsynchronizedChangesCount > 0) {
- new BrandedDeleteAlertDialogBuilder(ManageAccountsActivity.this)
+ new DeleteAlertDialogBuilder(ManageAccountsActivity.this)
.setTitle(getString(R.string.remove_account, accountToDelete.getUserName()))
.setMessage(getResources().getQuantityString(R.plurals.remove_account_message, (int) unsynchronizedChangesCount.longValue(), accountToDelete.getAccountName(), unsynchronizedChangesCount))
.setNeutralButton(android.R.string.cancel, null)
@@ -134,7 +134,7 @@ public class ManageAccountsActivity extends LockedActivity implements IManageAcc
final var repository = NotesRepository.getInstance(getApplicationContext());
final var editText = new EditText(this);
final var wrapper = createDialogViewWrapper();
- final var dialog = new BrandedAlertDialogBuilder(this)
+ final var dialog = new MaterialAlertDialogBuilder(this)
.setTitle(title)
.setMessage(message)
.setView(wrapper)
diff --git a/app/src/main/res/layout/dialog_edit_title.xml b/app/src/main/res/layout/dialog_edit_title.xml
index b7d3fa5a..5e744c99 100644
--- a/app/src/main/res/layout/dialog_edit_title.xml
+++ b/app/src/main/res/layout/dialog_edit_title.xml
@@ -4,13 +4,18 @@
style="@style/textInputLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="@dimen/spacer_2x">
+ android:hint="@string/change_note_title"
+ android:padding="?attr/dialogPreferredPadding">
-
+ android:inputType="text">
+
+
+
+
\ No newline at end of file