Log undo button click

Also fix a bug where we logged workspace swipe upon clicking undo, since
rebinding the pages causes us to reset mCurrentPage = 0 followed by
setCurrentPage(pageBoundFirst). Since the page isn't actually visibly
changing, we shouldn't log in that case.

Bug: 118758133
Change-Id: Ie87164a8c7c278680f67dee75657210bd33408a4
This commit is contained in:
Tony Wickham
2019-04-25 14:22:54 -07:00
parent 1e4a43ac67
commit 03f27013bf
3 changed files with 19 additions and 7 deletions

View File

@@ -300,10 +300,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
return page;
}
public void setCurrentPage(int currentPage) {
setCurrentPage(currentPage, INVALID_PAGE);
}
/**
* Sets the current page.
*/
public void setCurrentPage(int currentPage) {
public void setCurrentPage(int currentPage, int overridePrevPage) {
if (!mScroller.isFinished()) {
abortScrollerAnimation(true);
}
@@ -312,7 +316,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (getChildCount() == 0) {
return;
}
int prevPage = mCurrentPage;
int prevPage = overridePrevPage != INVALID_PAGE ? overridePrevPage : mCurrentPage;
mCurrentPage = validateNewPage(currentPage);
updateCurrentPageScroll();
notifyPageSwitchListener(prevPage);