History log of /frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e2443a93fcb82151f5290b89617b34b69442fdd3 29-Mar-2016 Dake Gu <dake@google.com> leanback: switch to use helper methods for margins

Switch to use RecyclerView helper methods with margin support.
Added test cases for optical bounds used together with margins and
item decoration.

Change-Id: I021a4f1c6c6c777845a7379fd8c23a128a13356c
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
5509e275a04396bfb16b3a217c5392a864398174 25-Mar-2016 Dake Gu <dake@google.com> leanback: Fix ItemDecoration

1. We should skip the optimizaton of checking isLayoutRequested()
Because when child view's decoration changes, it will not
be layout requested.
2. calculate opticalInsets is wrong, it doesn't count the decoration
offset, so incorrectly put decoration insets as optical insets.

Bug 27794028

Change-Id: Ide4f907764a4f35507c32ba3db764f8ad4ccd090
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
936fd406f49a6fae8768084e84fa7d1beccf40a9 19-Mar-2016 Dake Gu <dake@google.com> leanback: Fix selection offset when restoring gridview

We add offset to selected position in onItemAdded, this
should be avoided before LM layout children.

Bug 27819090

Change-Id: I299832c491bff19846f1f7bacda01ecb8ea685ea
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
678a58f6a6772d955f21d1ff869f2bcd999aade3 23-Mar-2016 Dake Gu <dake@google.com> Leanback: Fix crash in navigation and removing a view

We should exclude removing view (but still focused) from focus search.
It crashes because we start searching from removing view's index in
RecyclerView which might be out of range of LM.getChildCount().

Bug 27766012

Change-Id: I6adc629dd3210abeb84072dc3f07d45b522d1b8a
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
34914fd296a56b55c3c6c3183c7b58c4f16ca775 01-Mar-2016 Dake Gu <dake@google.com> leanback DatePicker: fix range updates

Missing a notifyDataSetChange in scroll pass caused the mess, do the
updateSpinner in a post Runnable

Bug 27431465

Change-Id: I489b19645ee0934e15beb7dcb131f150b5cfa0d1
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
362fda0323b85ec2379967901a0bd33a2ad4b8b5 25-Feb-2016 Dake Gu <dake@google.com> leanback: customize focusables in secondary direction

When the focus search direction is PREV_ROW or NEXT_ROW,
we fall back to default addFocusables() which basically
add all children and descendants within RecyclerView.

This isn't the default behavior desired when navigating LEFT
out of a vertical list, we do not want the siblings of
current focused item to be part of focusables list.
Because the siblings might got a higher score in FocusFinder.

In the broken case (a modified browse row moves first card to
the middle when it gets focused), sibling browse row's first
card gets a higher score than left side navigation menu because
they are closer to current focused card.

This fix explicitly handles PREV_ROW and NEXT_ROW case
and overrides default addFocusables(), it wont add siblings when
they are on same grid ROW.

Bug 27258366

Change-Id: I2e11cea7bc8e370fbda0be1dc5ccccb587a3fb43
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
e2f2ff730ed20153aa006d655888190763c16d5c 17-Feb-2016 Dake Gu <dake@google.com> Fix crash: Dont fetch items in onMeasure when HasFixedSize is true

With new RV change, HasFixedSize=true hehavior has been defined as:
RV size is not determined by child size. So when HasFixedSize is
true, the items passed to onMeasure() are no longer valid and should
not be used. Though HasFixedSize=true is generally not allowed when
WRAP_CONTENT is used, add extra protection.

Bug 27202689

Change-Id: Ic1e30674588227988621f7802692a1f12eeac3d7
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
fd4ac97d700ae14ed2b4bb2f0eb6ef83c68a6966 02-Feb-2016 Dake Gu <dake@google.com> Fix leanback grid view addFocusables() when isFocusable is false

When strategy is FOCUS_SCROLL_ALIGNED, we need add the last focused
item remembered at mFocusPosition into the focusables list, so even
the GridView itself is not focusable, we could make FocusFinder
selects the child item.

Bug 26918143
Needed to fix Bug 26894680

Change-Id: I7125ea0389a0299deb7d0fd31c02a5c3dc77e74f
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
173d79a987bec7d8dc9fd4e7066200d0b9b9842e 03-Dec-2015 Dake Gu <dake@google.com> Fix focusOutSideStart and focusOutSideEnd for VerticalGridView

Bug: 25982172
RTL GuidedStepfragment is unable to move focus to button actions

Change-Id: I3e534753ef1d187ce2518bd60819215581dc0931
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
00e05297683e1cc2a5fb25a00632a778b7b5d0e4 10-Nov-2015 Dake Gu <dake@google.com> GridLayoutManager: fire selected event when selected item type changed

Not only compare focused position but also compare the focused View that might
changed in fastLayout pass.

Bug 25619502

Change-Id: Ib59c8d753224daf23667d2f6ebd9a1babad61eb4
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
ac6a1a35cff83fdb50d9c8e203f881a54e92e40c 27-Oct-2015 Dake Gu <dake@google.com> GridLayoutManager: handle smoothscroller cancellation properly

When smoothscroller is cancelled and the targetView not found yet,
immediately jumps to the final position. Otherwise the LayoutManager
is in a bad state.

Bug 25322065

Change-Id: I3e8cce98ff218ad74c263c2f6412ba39911c7e3e
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
a63d86321b1b4d09f965019e4bcb62f0d0aaa12f 28-May-2015 Dake Gu <dake@google.com> GridLayoutManager: supports decorated bounds and margin

Switched to use "getDecoratedXXX" bounds method and added support of margin.
This also makes LM available to future RV size change animation.

Change-Id: I508c9419ae9bb6b8d363164e7eacf7f29fd3598c
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
06388129e48b308b25bfd85e6f136db8528d4c62 27-Jul-2015 Dake Gu <dake@google.com> Fix regression of unable to focus out of empty gridview

b/22706497

Change-Id: I53b7a9d7840fe614f0bb0d0c3307386a1e4e65db
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
89b4aed6fcd80f940531e265936ab908a8037f87 22-Jul-2015 Dake Gu <dake@google.com> GridView: fix two focus problems

1. if gridView has a list of children and gridView.requestFocus()
is called from top-down which is a typical case when activity
created: gridview should auto focus to first focusable child.

2. When none of visible children is focusable and gridview itself
is focused, focusSearch(int) should navigate to first focusable
child.

b/22634251

Change-Id: I345119c47f0d70029e18eb8405ed67a53bc26fe8
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
91feb947412e0521a5f1835553214dcbe03fd362 09-Jul-2015 Dake Gu <dake@google.com> GridLayoutManager: fix jumping problem caused by requestLayout

When requestLayout during scrolling, onLayoutChildren() does not
check return value of getScrollPosition so it may get dirty values
from the temp array.

Bug 22209986

Change-Id: I2506d2774d2069cae86b360f8c985d2ea05cc629
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
4927a3bbd1921aed5da5d276a5d15240b2960fae 09-Jul-2015 Dake Gu <dake@google.com> Add test cases for b/22306025

ag/723346 kills two birds with one stone.
added test case for Bug 22306025

Change-Id: Id5a0d341f119fced5cd1f6e9948543e509dc92c7
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
ff3b38c570fa25327bb6a9bca1753827d9f9d7fd 08-Jul-2015 Dake Gu <dake@google.com> GridLayoutManager: Fix scroll bug when target view is removed.

When item is removed, we should stop scroll animation and scroll to
a new focus position or same focus position of different item.

b/21970393

Change-Id: I3917adbbed7dd1599f93a5459c7f4bfc3bbac7c6
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
d1cab1b54104d55407335c5d649398635822fffd 24-Jun-2015 Dake Gu <dake@google.com> Leanback: support Scroll Accessibility action

Behaves differently than phone/tablet, it scrolls to
last/first item on the same row for SCROLL action.

simplify the dispatchChildSelection() in SmoothScroller
a little bit: only dispatchChildSelection() for the
final target.

b/19072385

Change-Id: I543e5298c681e3809d87de767ec3ab93ef6fe15c
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
88dea72af6042049560140a70e059820dbb8f746 19-Jun-2015 Dake Gu <dake@google.com> Supports extra layout space

When layout reordering aligned focused item, extra space is
needed during prelayout for filling. However there is no
general solution now based on REMOVE/CHANGE flag of ViewHolder.

This CL is a case-by-case solution allows extra item to be added in
invisble area so that item animator can animate slide-in instead of
fade-in.

b/21949401

Change-Id: Ic78a0d639f387a0bf319fcc504b8401262148a0b
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
db0b1afb71440b79923692d58adee982b5954838 29-Apr-2015 Dake Gu <dake@google.com> fix bug of wrong selection when itemAdded is triggered

When items are added at the same time that setSelection()
is called, we incorrectly apply the offset to the position that
user wants to select. Disable the offset when target view
hasn't created yet.

Bug 20672263

Change-Id: Iaf990b58109d005ef04d9a47029e5c0a493bb8c3
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
08c56822b71ab0aa0b9bb03e5fd45e28f6e358b8 28-Apr-2015 Dake Gu <dake@google.com> Revert "Revert "Support multiple alignment within one ViewHolder""

This reverts commit bc0edc3ab9bac3c8d7d3cc9de1cb499ea3b4155e.

Change-Id: I1f9540e54fdee874adf7239a0ead1fb5447f2610
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
bc0edc3ab9bac3c8d7d3cc9de1cb499ea3b4155e 27-Apr-2015 Dake Gu <dake@google.com> Revert "Support multiple alignment within one ViewHolder"

This reverts commit 86a6309c3e89ec6abc40ec045bfaef7827cbe427.

Change-Id: I3385d74766e948566b7321cbe2afcf31a66282c1
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
86a6309c3e89ec6abc40ec045bfaef7827cbe427 07-Apr-2015 Dake Gu <dake@google.com> Support multiple alignment within one ViewHolder

Add support of align to multiple positions within one ViewHolder of
Grid View.

Introduce "FacetProvider" inteface for optional features to be implemented
without requiring an object must implement a java interface. Benefit
is less impact on the major feature of a class, make the extra optional
features loosely coupled with existing class. (And it is the only way
for ItemBridgeAdapter to provide a list of optional features that
are implemented by some Presenters but not others)

Add a new ItemAlignmentFacet class to describe multiple alignment positions.

Grid view gets optional ItemAlignmentFacet from RecyclerView.ViewHolder(rare)
or RecyclerView.Adapter for a given view type. If the facet exists, it's used
to calculate multiple alignment positions within this ViewHolder.

At high level, for apps that using Presenter, they don't directly use
RecyclerView.ViewHolder or RecyclerView.Adapter. apps put Facet in Presenter
(most cases) or a ViewHolder(rare cases). For example in the new detail page
design, DetailsOverviewRowPresenter will need this facet(TODO),
ItemBridgeAdapter is responsible to "bridge" facet from Presenter.

In the future, Facet may be used to customize child view state saving.

Bug: 20094419

Change-Id: Iabef94e46f9a304ffd68e49bed10e74a57dfe4ce
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
61e5a56ed066815e69be7526e3d1bee2d5268d20 01-Apr-2015 Dake Gu <dake@google.com> GridLayoutManager: fix child states incorrectly saved

We already handles child state in LM.onSaveInstanceState(). But
ViewGroup dispatchSaveInstanceState() and dispatchRestoreInstanceState()
directly invoke child view's dispatch methods without going
through onSaveInstanceState(), so it saves states that we don't need
and later being used unexpectedly in dispatchRestoreInstanceState().

Disable the dispatchXXX() of child by toggling the flag
when a child view is created.

Bug 20016293

Change-Id: I599515ac8a0bfe29b7abef190509ef464fd2ccb6
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
3bd331ac6fe8ef25a2deb3559b0b5958573c231b 26-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager Fix child state restoring bug

A regression of ag/630154: detached and reattached child is
assigned with obsolete state saved at opening activity.

The (correct) logic is now:
1. Child state is saved when child is unbound (onViewRecycled)
2. When being asked for onSaveInstanceState(), copy the states
saved in (1) and save current onscreen views state into bundle.

Bug in ag/630154 is that in (2) we saved onscreen views state in
the GridView offscreen states and that information can be invalidated
after a while (e.g. selection of a row can change) and it's later
incorrectly used when a view is detached/re-attached.

added test case.

Bug 19937291

Change-Id: Iac6bd849fdd9755471bce6c7763316d0264cc7a2
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
1a5a2c58890e69b0554a82f22e3c0d1ffb238366 25-Mar-2015 Dake Gu <dake@google.com> Fix crash when calculated secondary size is 0

If for some reasons, parent of GridView asks to measure with 0 secondary size,
calculated mFixedRowSizeSecondary is zero and the array for maintaining the
secondary size of each row is also null. Then processRowSizeSecondary()
will crash.

Bug 19930906

Change-Id: Ifa45ee94cda133830a0e78b563df5edeeaff9c3f
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
492506cede17ecee39ce7fa35ee7a347ff31c5ba 25-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix size change not detected

When rowHeight=wrap_content, onMeasure() will measure
the child's size. So when fastRelayout is run, the
measured size is already new value, it should not be
compared to decide wether there is a size change.
Switch to use the correct view size method.

Bug 18537143

Change-Id: I084e54ba45cbb1a79fe67b65d064843035d3abf4
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
c0b265dd2df42b399ba1f959b3dfd14dd14012b5 25-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: Fix focus bug

During layout, when a view already had focus.
Should not call requestFocus() again which might
change the focused child within it.

Bug 19828044

Change-Id: I97074469d9e4fbcc8f45cd8c738200b7faba00a5
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
57f5baa07260dad2a9641e9ceb80567ce2784e9a 21-Mar-2015 Dake Gu <dake@google.com> Fix setNumRows gets ignored

setNumRows goes through onMeasure() then onLayout().
Before the onMeasure() gets called, another onLayout()
clears the mForceFullLayout flag without knowing
there is a pending numRows change not handled by onMeasure()
yet. When 2nd onLayout() gets called, it doesn't go to the
non fastlayout pass.

There is no need to set the flag when change num rows,
comparing with grid row number can decide if goes through
fast layout pass.

Bug 19872498

Change-Id: Ia5254a49e24be04665a1e5175355827a5dfa7258
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
3a7aa9cd68bd39f3a843291817dc209d1d9a45aa 20-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix bug smoothscroller gets interrupted

Vertical scroll in Videos app is janky.

During VerticalGridView scroll pass it appends a row and layout
the row, the row layout might request focus on a child, that causes
a onRequestChildFocus() call back into the top level VerticalGridView.
In that case high level verticalGridView should not start another
scrollToView() animation. onRequestChildFocus() is supposed to handle
user's interaction only.

The bug is difficult to test, both RV.smoothScrollBy() and LinearSmoothScroller
uses the same scroll state, calling RV.smoothScrollBy() does not
stop linearSmoothScroller. Added a override class to intercept calls
on RV.smoothScrollBy().

Bug: 19846906

Change-Id: Ica857f443e41f14710b2bf177eafba30403817c7
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
7538845719cd1e588185ce9ae60320377862ef8d 19-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: Fix ANR

Regression of fixing b/19625410
We are trying to add non-existing focused position view in fast
layout pass and ended in a deadloop.
Switched to a different fix for b/19625410.

Bug: 19823374
Change-Id: I9fd1e985c09f8deffb46285366b5cf97d881c1b9
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
f518dc6b5898d16d0b8818ff4d06425b2bb0b3d0 09-Mar-2015 Dake Gu <dake@google.com> GridWidgetTest: Cleanup sleep handling

Change-Id: Ie7f253dd77dc421c66080c738b8dc91409564bc3
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
f80ef0d6b0b6403f3cd94e7197bc4a39d285280a 07-Mar-2015 Dake Gu <dake@google.com> Fix missing dispatchChildSelected() for staggered grid

This bug does not happen to single row grid where we
change mFocusPosition before createItem.

For staggered grid, when scroll up to item 1: we first
create item1, then consumePendingMovesAfterLayout() changes
mFocusPosition to 1; the event is not fired in createItem
and it's not fired in smoothscroller onStop() if mPendingMoves
is 0.

Bug 19620864

Change-Id: If90fa1b11f7ba689015ecd5462482b83254f345b
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
9c56475370d1df940252ff1360b92de50022fff6 06-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix fastRelayout() not focus to added child

When items are added to empty GridLayoutManager, it triggers the
fastRelayout pass which does not set focus position to 0.

Bug 19625410

Change-Id: I2ce11abde2162bb7fd28fd1fa6343b9d9b6b32f1
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
8c5d3b45f6afa838e64e4cf011a385c191d557c6 04-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix crash and support scroll delta.

Fix crash of setSelectedPosition.
Add scroll delta that applied to setSelectedPosition.
Moved updateFirstVisibleOffset into StaggeredGrid class,
the offset is now calculated when inserting first visible item,
because the offset is needed when we append next visible item.
Fixed a loop variable bug in updateFirstVisibleOffset.

Added test cases

Bug 19272838
Bug 19593908

Change-Id: Ibb6f2e115e9e4af6a2b18a48a921e6766cd0c0a6
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
fa5f60106a84a2b475c38cc6b8baa347bbd6ae1d 03-Mar-2015 Dake Gu <dake@google.com> test case for focus lost in fast layout

Bug 19573463

Change-Id: Ia8aba5a2de3e5677b42c42e0da32ed147b12d3b5
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
6b22c4c875d7a540e705b2b6b65bf52c7a89299a 28-Feb-2015 Dake Gu <dake@google.com> Dont scroll to non-focusable items in onLayoutChildren

Added test cases

Bug 19283027

Change-Id: I1de48881dfc4117a42a7e74722f3cc4607f25a51
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
77b17ebed6d1f8488b150b25e2b6754971480cae 10-Feb-2015 Dake Gu <dake@google.com> Do not scroll to non-focusable item

Refactoring to use same PendingMoveSmoothScroller for both
staggered case and non-staggered case (RowsFragment vertical).
The problem of position based linearsmoothscroller is that
it calculates target position before the view is created;
so we may scroll to a target position that is not focusable.
Now using PendingMovementSmoothScroller, added a callback
consumePendingMovementBeforeLayout() where we skip the view
that's not focusable.

Allow dispatchChildSelected() during scroll pass, so we can append
an item with selected state without running another layout pass if
we apply select status after laid out it. This requires a change
in StagggeredGrid to make data structure consistent before
dispatchChildSelected() call. To avoid excessive dispatchChildSelected,
we postpone dispatchChildSelected() if a PendingMoveSmoothScroller is
still running. We only dispatchChildSelected() event on the final target.

Fixed a problem of unbind RowView does not apply animator end value.

Added TestCases

Bug: 19283027

Change-Id: I5cab61420514b5d0141387aa13a18d623b38536f
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
7ee22537e201c3d6b5de2908aecc4b0cc59a05c2 06-Feb-2015 Dake Gu <dake@google.com> Fix Test

Change-Id: I1bb4b316182a58f563b7a4237f9188a63211e559
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
a3c24a53034f1effc24b2d01328d63d96ad2ac7c 04-Feb-2015 Dake Gu <dake@google.com> Fix GridWidgetTest tests

Now smooth scroller has a max of pending DPAD keys.
Sending 100 keys a time may not scroll to begin or end.
Rewrite methods scrollToBegin() and scrollToEnd().

Change-Id: Ide7f6cb34fc6bb9945b96763608d2667447cfe21
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java
802f0901c737f044409c4359831da1613e544b58 20-Jan-2015 Dake Gu <dake@google.com> Excludes leanback tests from framework javadoc build

Frameworks/base make file includes all java files under v17/leanback
for javadoc build.

Change-Id: I8f8a2e9f0f194848a29cb032f5686b53d3b47631
/frameworks/support/v17/tests/src/android/support/v17/leanback/widget/GridWidgetTest.java