Merge "Fixed bugs in PagedTileLayout, QSAnimator using RTL" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
55fdf6d94d
@@ -91,6 +91,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
if (mLayoutOrientation != newConfig.orientation) {
|
||||
mLayoutOrientation = newConfig.orientation;
|
||||
setCurrentItem(0, false);
|
||||
mPageToRestore = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +102,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
mLayoutDirection = layoutDirection;
|
||||
setAdapter(mAdapter);
|
||||
setCurrentItem(0, false);
|
||||
mPageToRestore = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +114,17 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
super.setCurrentItem(item, smoothScroll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the current page number respecting RTL
|
||||
*/
|
||||
private int getCurrentPageNumber() {
|
||||
int page = getCurrentItem();
|
||||
if (mLayoutDirection == LAYOUT_DIRECTION_RTL) {
|
||||
page = mPages.size() - 1 - page;
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListening(boolean listening) {
|
||||
if (mListening == listening) return;
|
||||
@@ -199,7 +212,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
// marquee. This will ensure that accessibility doesn't announce the TYPE_VIEW_SELECTED
|
||||
// event on any of the children.
|
||||
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
|
||||
int currentItem = isLayoutRtl() ? mPages.size() - 1 - getCurrentItem() : getCurrentItem();
|
||||
int currentItem = getCurrentPageNumber();
|
||||
for (int i = 0; i < mPages.size(); i++) {
|
||||
mPages.get(i).setSelected(i == currentItem ? selected : false);
|
||||
}
|
||||
@@ -328,7 +341,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
|
||||
|
||||
public int getNumVisibleTiles() {
|
||||
if (mPages.size() == 0) return 0;
|
||||
TilePage currentPage = mPages.get(getCurrentItem());
|
||||
TilePage currentPage = mPages.get(getCurrentPageNumber());
|
||||
return currentPage.mRecords.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,11 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
} else { // These tiles disappear when expanding
|
||||
firstPageBuilder.addFloat(quickTileView, "alpha", 1, 0);
|
||||
translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff);
|
||||
translationXBuilder.addFloat(quickTileView, "translationX", 0, xDiff + width);
|
||||
|
||||
// xDiff is negative here and this makes it "more" negative
|
||||
final int translationX = mQsPanel.isLayoutRtl() ? xDiff - width : xDiff + width;
|
||||
translationXBuilder.addFloat(quickTileView, "translationX", 0,
|
||||
translationX);
|
||||
}
|
||||
|
||||
mQuickQsViews.add(tileView.getIconWithBackground());
|
||||
|
||||
Reference in New Issue
Block a user