OSDN Git Service

Fixed poor behavior of position-based focus order
authorEvan Rosky <erosky@google.com>
Mon, 30 Jan 2017 20:19:17 +0000 (12:19 -0800)
committerEvan Rosky <erosky@google.com>
Tue, 21 Feb 2017 19:17:34 +0000 (11:17 -0800)
commit5fd69c38642a1c632e09dc0f6f9e462538909fbb
tree7999e1d38e640fcd22930e0d040ff283ecf1cb84
parentd133b00efb49adeb21b9b62b334769c03f40bf43
Fixed poor behavior of position-based focus order

Rect-based focus order algorithm used to sort all views such-that
higher tops were higher. The result is that focus order could
easily move end-to-start when elements with varying heights (even
1px different) were arranged horizontally.

This changes the algorithm to take vertical overlap into account
when sorting. It tries its best to match UX for how focus-order
should work in ambiguous cases.

Bug: 33848452
Bug: 34854951
Test: Checked in a sample-app to make sure focus order matches UX
      more closely than before. Also verified that existing
      FocusFinder CTS tests still pass.

Change-Id: I0e0f2f63d5151693a2642604f64df985856c8991
core/java/android/view/FocusFinder.java