Skip to content

Commit

Permalink
[Home] Fix app menu crash on JellyBean
Browse files Browse the repository at this point in the history
JellyBean crashes if a header is added to a ListView after the adapter
has been set. Switch the order of adding the header and setting the
adapter.

BUG=761726

[email protected]

Change-Id: I1cfafe3b437667469d28fc9f3cc79ed0137a1faf
Reviewed-on: https://chromium-review.googlesource.com/650626
Reviewed-by: Matthew Jones <[email protected]>
Commit-Queue: Theresa <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#499674}
Reviewed-on: https://chromium-review.googlesource.com/653419
Reviewed-by: Theresa <[email protected]>
Cr-Commit-Position: refs/branch-heads/3202@{crosswalk-project#49}
Cr-Branched-From: fa6a5d8-refs/heads/master@{#499098}
  • Loading branch information
Theresa Wellington authored and Theresa committed Sep 6, 2017
1 parent 3e9eebc commit 7e7b791
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,16 @@ void show(Context context, final View anchorView, boolean isByPermanentButton,
ViewGroup contentView =
(ViewGroup) LayoutInflater.from(context).inflate(R.layout.app_menu_layout, null);
mListView = (ListView) contentView.findViewById(R.id.app_menu_list);
mListView.setAdapter(mAdapter);

int footerHeight =
inflateFooter(footerResourceId, contentView, menuWidth, highlightedItemId);
int headerHeight =
inflateHeader(headerResourceId, headerOnClickListener, context, menuWidth);

// Set the adapter after the header is added to avoid crashes on JellyBean.
// See crbug.com/761726.
mListView.setAdapter(mAdapter);

int popupHeight = setMenuHeight(menuItems.size(), visibleDisplayFrame, screenHeight,
sizingPadding, footerHeight, headerHeight, anchorView);
int[] popupPosition = getPopupPosition(mCurrentScreenRotation, visibleDisplayFrame,
Expand Down

0 comments on commit 7e7b791

Please sign in to comment.