From 7f3ca1f6d361666a8d470ae94ba074d6225fbebe Mon Sep 17 00:00:00 2001 From: Daniel Alome Date: Mon, 5 Oct 2026 20:38:39 +0100 Subject: [PATCH] ADFA-6371: Make the selected toggle button visible in new-file dialogs Material 3 fills a checked outlined button with colorSecondaryContainer, which the theme sets to #E8E8E8 on a #EDEDED dialog, and keeps the text colour, so selecting Kotlin or a class type showed no change. The theme now points materialButtonOutlinedStyle at a style that fills checked buttons with colorPrimary and draws their text and icon in colorOnPrimary; unchecked and non-toggle buttons keep Material's colours. The Class button also switches to the Kotlin icon when Kotlin is picked. --- .../androidide/actions/filetree/NewFileAction.kt | 9 +++++++++ .../color/button_outlined_background_selector.xml | 8 ++++++++ .../color/button_outlined_foreground_selector.xml | 14 ++++++++++++++ resources/src/main/res/values/styles.xml | 9 +++++++++ 4 files changed, 40 insertions(+) create mode 100644 resources/src/main/res/color/button_outlined_background_selector.xml create mode 100644 resources/src/main/res/color/button_outlined_foreground_selector.xml diff --git a/app/src/main/java/com/itsaky/androidide/actions/filetree/NewFileAction.kt b/app/src/main/java/com/itsaky/androidide/actions/filetree/NewFileAction.kt index 2b0a8398b6..3e4a61c750 100644 --- a/app/src/main/java/com/itsaky/androidide/actions/filetree/NewFileAction.kt +++ b/app/src/main/java/com/itsaky/androidide/actions/filetree/NewFileAction.kt @@ -168,6 +168,15 @@ class NewFileAction( val builder = DialogUtils.newMaterialDialogBuilder(context) val binding: LayoutCreateFileJavaBinding = LayoutCreateFileJavaBinding.inflate(LayoutInflater.from(context)) + binding.languageGroup.addOnButtonCheckedListener { _, _, _ -> + binding.typeClass.setIconResource( + if (binding.languageGroup.checkedButtonId == binding.langKotlin.id) { + R.drawable.ic_language_kotlin + } else { + R.drawable.ic_language_java + }, + ) + } binding.typeGroup.addOnButtonCheckedListener { _, _, _ -> binding.createLayout.isVisible = binding.typeGroup.checkedButtonId == binding.typeActivity.id } diff --git a/resources/src/main/res/color/button_outlined_background_selector.xml b/resources/src/main/res/color/button_outlined_background_selector.xml new file mode 100644 index 0000000000..0081af738c --- /dev/null +++ b/resources/src/main/res/color/button_outlined_background_selector.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/resources/src/main/res/color/button_outlined_foreground_selector.xml b/resources/src/main/res/color/button_outlined_foreground_selector.xml new file mode 100644 index 0000000000..0a0a352ea7 --- /dev/null +++ b/resources/src/main/res/color/button_outlined_foreground_selector.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/resources/src/main/res/values/styles.xml b/resources/src/main/res/values/styles.xml index db873d2e23..a6463ae45e 100755 --- a/resources/src/main/res/values/styles.xml +++ b/resources/src/main/res/values/styles.xml @@ -55,6 +55,15 @@ @style/AppTheme.ShapeOverlay.Large @style/TextAppearance.AndroidIDE.BodySmall @color/green_500 + @style/Widget.AndroidIDE.Button.OutlinedButton + + +