From c6c51ed7be2021dcad290927c9de3ceb5c1ed10e Mon Sep 17 00:00:00 2001 From: Xtr126 Date: Mon, 26 Feb 2024 09:48:22 +0530 Subject: [PATCH] fix: use material theme for dialog --- app/src/main/java/xtr/keymapper/editor/EditorActivity.java | 3 ++- app/src/main/java/xtr/keymapper/editor/EditorUI.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/xtr/keymapper/editor/EditorActivity.java b/app/src/main/java/xtr/keymapper/editor/EditorActivity.java index e2198440..a25cdb4a 100644 --- a/app/src/main/java/xtr/keymapper/editor/EditorActivity.java +++ b/app/src/main/java/xtr/keymapper/editor/EditorActivity.java @@ -53,7 +53,8 @@ public void onCreate(Bundle savedInstanceState) { Log.e("editorActivity", e.getMessage(), e); } else { - MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(new ContextThemeWrapper(this, R.style.Theme_XtMapper)); + Context dialogContext = new ContextThemeWrapper(this, R.style.Theme_XtMapper); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(dialogContext); builder.setMessage(R.string.dialog_alert_editor) .setPositiveButton(R.string.ok, (dialog, which) -> {}) diff --git a/app/src/main/java/xtr/keymapper/editor/EditorUI.java b/app/src/main/java/xtr/keymapper/editor/EditorUI.java index a42da634..cda38b50 100644 --- a/app/src/main/java/xtr/keymapper/editor/EditorUI.java +++ b/app/src/main/java/xtr/keymapper/editor/EditorUI.java @@ -14,6 +14,7 @@ import android.view.WindowManager; import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.view.ContextThemeWrapper; import com.google.android.material.dialog.MaterialAlertDialogBuilder; @@ -197,7 +198,8 @@ else if (id == R.id.save) { } else if (id == R.id.dpad) { final CharSequence[] items = { "Arrow Keys", "WASD Keys"}; - MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); + Context dialogContext = new ContextThemeWrapper(context, R.style.Theme_XtMapper); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(dialogContext); builder.setTitle("Select Dpad").setItems(items, (dialog, i) -> { if (i == 0) addArrowKeysDpad(defaultX, defaultY); else addWasdDpad(defaultX, defaultY);