Skip to content

setCurrentScreen animation doubt #10

Description

@znakeeye

I tried this with a TabWidget instead of the Radio buttons. Instead of the onCheckedChangedListener I'm using an onClickListener. Though, I'm sure this applies to radio buttons too.

When a radio button is checked, we set the current screen:
mPager.setCurrentScreen(0, true);

The second parameter implies an animation for 500 ms. This makes the UI thread block, which in turn delays the Radio button update. E.g.:

  1. User clicks button.
  2. Button is highlighted.
  3. Page change is animated for 500 ms.
  4. Button is checked.

Instead, we should check the button immediately (as if the animation was disabled) and then animate the page change. This is how it's done in the Music app.

Hence, we need to make an asynchronous call to snapToScreen() inside setCurrentScreen(). Post runnable? Any ideas?

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