Skip to content

getPosition(SOME_ITEM_ID) returning -1 when account switcher menu is shown #2826

Open
@nikclayton

Description

@nikclayton

Edit: This is with version 9.0.2.

This sequence of events:

  1. Start the app.
  2. Open the drawer, to which an AccountHeaderView has been attached.
  3. Tap the account switcher arrow to show the list of account items.
  4. Leave the app (e.g., press Home button).
  5. Relaunch the app.

At this point I think the drawer reloads the saved state, which seems to include the state that the account menu is being shown instead of the regular menu.

This means calls like slider.getPosition(SOME_ITEM_ID) return -1 instead of the actual position of SOME_ITEM_ID in the main drawer.

Interestingly, in the same scenario slider.itemAdapter.getAdapterPosition(SOME_ITEM_ID) does return a positive position (although it appears to be one less than the actual position).

Not sure if this is a bug, and slider.getPosition() should not return -1 in this case, or if this is expected behaviour and there's some mechanism to "wait until the account switcher menu is closed, then update the main drawer items" on resume that I'm missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions