Skip to content

Disable Save button in Change Note Type when there are no changes#20968

Open
sanjaysargam wants to merge 1 commit intoankidroid:mainfrom
sanjaysargam:save1
Open

Disable Save button in Change Note Type when there are no changes#20968
sanjaysargam wants to merge 1 commit intoankidroid:mainfrom
sanjaysargam:save1

Conversation

@sanjaysargam
Copy link
Copy Markdown
Member

Purpose / Description

Currently in Change Note Type, clicking Save without making any changes shows a No changes to save dialog.

Approach

Instead of showing a dialog, Save button is now disabled when there are no pending changes.

How Has This Been Tested?

Emulator API 35

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Copy Markdown
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please convert to a flow in the ViewModel

onItemSelectedListener =
BasicItemSelectedListener { position, id: NoteTypeId ->
viewModel.setOutputNoteTypeId(id)
updateSaveButton(binding)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

architecture: This should react to an update, not be set in a listener

Comment on lines +419 to +422
(requireParentFragment() as ChangeNoteTypeDialog)
.updateSaveButton(
DialogChangeNoteTypeBinding.bind(requireParentFragment().requireView()),
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: this line shouldn't update and the data should come from a flow in the ViewModel

SelectedIndex.from(position)
}
viewModel.updateTemplateMapping(outputTemplateIndex = spinnerIndex, newMapping)
(requireParentFragment() as ChangeNoteTypeDialog)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Author Reply Waiting for a reply from the original author Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants