title: How to tell which direction a user is swiping in a ViewPager2 with TalkBack?
body: <p>For accessibility reasons, I am detecting when a view is focused in a <code>ViewPager2</code>, because unfortunately it <a href="https://issuetracker.google.com/issues/186785895" rel="nofollow noreferrer">doesn't support accessibility scrolling</a> without the two finger gesture. I'm able to detect forward scrolls because my <code>ViewPager2</code> has a transformer that shows the next adapter item, but not the previous one. So when I swipe backwards it leaves the list.</p>
  <p>Here is an illustration:</p>
  <pre><code>Off screen  | Visible screen   | Off screen
              |                  |
              | [TextView]       |
              |                  |
              |    --WORKS--&gt;    |
  .--------.  | .--------.    .--|-----.    .--------.
  | Item 1 |  | | Item 2 |    | I|em 3 |    | Item 4 |
  `--------'  | `--------'    `--|-----'    `--------'
              |   &lt;--DOESNT--    |
              |                  | 
  </code></pre>
  <p>I can swipe right from Item 1, to Item 4. But when I'm on Item 4 and I swipe left, it leaves the list and goes back to the <code>[TextView]</code>.</p>
  <p>I am currently using an <code>AccessibilityDelegate</code> on the <code>ViewPager2</code>, and the nested <code>RecyclerView</code> to achieve scrolling forward with <code>TYPE_VIEW_ACCESSIBILITY_FOCUSED</code>, but since <code>Item 1</code> is not visible it just leaves the list and gives me a <code>TYPE_VIEW_ACCESSIBILITY_FOCUSED_CLEARED</code> when swiping left. My intention is to catch the left swipe and <code>setCurrentItem(position - 1)</code> instead of leaving the list.</p>
  <p>When single finger swiping right with TalkBack on, the <code>AccessibilityDelegate</code>'s <code>onRequestSendAccessibilityEvent</code> is invoked with a <code>TYPE_VIEW_ACCESSIBILITY_FOCUSED</code> <code>AccessibilityEvent</code>. I am able to determine what the next position should be from this.</p>
  <p>When single finger swiping left with TalkBack on, the <code>AccessibilityDelegate</code>'s <code>onRequestSendAccessibilityEvent</code> is invoked with a <code>TYPE_VIEW_ACCESSIBILITY_FOCUSED_CLEARED</code> <code>AccessibilityEvent</code>, which is not enough information to tell me if they swiped left.</p>
  <p>How is this done? Can this be done?</p>