mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 961773 - (Part 2) Check to make sure a panel is in the adapter before setting it as the current item in HomePager. r=lucasr
This commit is contained in:
parent
8d7b05cf31
commit
ed348d171a
@ -318,10 +318,11 @@ public class HomePager extends ViewPager {
|
||||
setAdapter(adapter);
|
||||
|
||||
// Use the default panel as defined in the HomePager's configuration
|
||||
// if the initial panel wasn't explicitly set by the show() caller.
|
||||
if (mInitialPanelId != null) {
|
||||
// XXX: Handle the case where the desired panel isn't currently in the adapter (bug 949178)
|
||||
setCurrentItem(adapter.getItemPosition(mInitialPanelId), false);
|
||||
// if the initial panel wasn't explicitly set by the show() caller,
|
||||
// or if the initial panel is not found in the adapter.
|
||||
final int itemPosition = (mInitialPanelId == null) ? -1 : adapter.getItemPosition(mInitialPanelId);
|
||||
if (itemPosition > -1) {
|
||||
setCurrentItem(itemPosition, false);
|
||||
mInitialPanelId = null;
|
||||
} else {
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user