Skip to content

Comments

chore: convert FlagRenameDialog to ViewBinding#19892

Merged
lukstbit merged 1 commit intoankidroid:mainfrom
david-allison:vb-FlagRenameDialog
Dec 21, 2025
Merged

chore: convert FlagRenameDialog to ViewBinding#19892
lukstbit merged 1 commit intoankidroid:mainfrom
david-allison:vb-FlagRenameDialog

Conversation

@david-allison
Copy link
Member

Approach

How Has This Been Tested?

Brief test: Open Dialog with Pixel 6 Pro API 35 Emulator

Checklist

  • 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

@BrayanDSO BrayanDSO added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Dec 21, 2025
@lukstbit lukstbit added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Dec 21, 2025
@lukstbit lukstbit added this pull request to the merge queue Dec 21, 2025

private fun setupRecyclerView() =
private fun setupRecyclerView(binding: RenameFlagLayoutBinding) =
requireActivity().lifecycleScope.launch {

Choose a reason for hiding this comment

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

Hi @david-allison, I found a lifecycle scope mismatch here. This function is launched on Activity scope, but update a DialogFragment view after suspension. If the dialog is dismissed before createFlagList() resumes, you risk touching a dead view, potentially crashing after dismiss.

Instead, let's tie the job to the dialog's view lifecycle:

lifecycleScope.launch {
    val items = withContext(Dispatchers.IO) { createFlagList() }
    val adapter = FlagAdapter(lifecycleScope = lifecycleScope)
    binding.recyclerViewFlags.layoutManager = LinearLayoutManager(requireContext())
    binding.recyclerViewFlags.adapter = adapter
    adapter.submitList(items)
}

Merged via the queue into ankidroid:main with commit 221e719 Dec 21, 2025
18 checks passed
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Dec 21, 2025
@github-actions github-actions bot added this to the 2.24 release milestone Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants