Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Edit and Reorder Label options sheets fails to open #204

Closed
Tracked by #190
pgrilo opened this issue Jul 17, 2023 · 2 comments
Closed
Tracked by #190

The Edit and Reorder Label options sheets fails to open #204

pgrilo opened this issue Jul 17, 2023 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@pgrilo
Copy link

pgrilo commented Jul 17, 2023

ISSUE

When the Label options bottomSheet is dismissed, since it is a navigation stack, everything on top of it is removed. As result the Edit and Reorder label bottomSheets fails to open.

To reproduce:

  • Long press a Label
  • Tap Edit or Reorder

LOG

DialogFragmentNavigator: 
Dialog LabelDialogFragment{d5a0bad} (7c5cafb0-d6b2-48d3-84bf-b55f13a396f1 tag=d5dac1c4-b811-4eec-97d8-14c2d7bfcbf4) 
was dismissed while it was not the top of the back stack, popping all dialogs above this dismissed dialog

SOLUTION

Remove dismiss() from the LabelDialogFragmentBinding.setupListeners function.

java/com/noto/app/label/LabelDialogFragment.kt

private fun LabelDialogFragmentBinding.setupListeners() {
    tvEditLabel.setOnClickListener {
        context?.updateAllWidgetsData()
        //dismiss()
        navController
            ?.navigateSafely(LabelDialogFragmentDirections.actionLabelDialogFragmentToNewLabelDialogFragment(args.folderId, args.labelId))
    }

    tvReorderLabel.setOnClickListener {
        context?.updateAllWidgetsData()
         //dismiss()
        navController
             ?.navigateSafely(LabelDialogFragmentDirections.actionLabelDialogFragmentToReorderLabelDialogFragment(args.folderId, args.labelId))
     }

And make use of popUpTo and popUpToInclusive on the navigate call.

res/navigation/nav_graph.xml

<dialog
    android:id="@+id/labelDialogFragment"
    android:name="com.noto.app.label.LabelDialogFragment"
    android:label="LabelDialogFragment">
    <action
        android:id="@+id/action_labelDialogFragment_to_newLabelDialogFragment"
        app:destination="@id/newLabelDialogFragment"
        app:popUpTo="@id/labelDialogFragment"
        app:popUpToInclusive="true" />

(...)

    <action
        android:id="@+id/action_labelDialogFragment_to_reorderLabelDialogFragment"
        app:destination="@id/reorderLabelDialogFragment"
        app:popUpTo="@id/labelDialogFragment"
        app:popUpToInclusive="true" />

(...)

</dialog>

Thank you

@pgrilo pgrilo changed the title The *Edit* and *Reorder* Label options sheets fails to open The Edit and Reorder Label options sheets fails to open Jul 17, 2023
@alialbaali alialbaali added the bug Something isn't working label Jul 21, 2023
@alialbaali alialbaali added this to the 2.3.0 milestone Jul 21, 2023
@alialbaali alialbaali mentioned this issue Jul 21, 2023
35 tasks
@uli-on
Copy link

uli-on commented Jul 25, 2023

Pheeeew, that one was the worst of all, and it's gone. Thank you soo much!

@alialbaali
Copy link
Owner

Thanks to @pgrilo, I used their solution! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants