Loading packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +6 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,12 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { page.setMinRows(mMinRows); page.setMaxColumns(mMaxColumns); page.setSelected(false); // All pages should have the same squishiness, so grabbing the value from the first page // and giving it to new pages. float squishiness = mPages.isEmpty() ? 1f : mPages.get(0).getSquishinessFraction(); page.setSquishinessFraction(squishiness); return page; } Loading packages/SystemUI/src/com/android/systemui/qs/TileLayout.java +9 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,11 @@ public class TileLayout extends ViewGroup implements QSTileLayout { } protected void addTileView(TileRecord tile) { // Re-using tile views might lead to having out-of-date squishiness. This is fixed by // making sure we set the correct squishiness value when added to the layout. if (tile.tileView instanceof HeightOverrideable) { ((HeightOverrideable) tile.tileView).setSquishinessFraction(mSquishinessFraction); } addView(tile.tileView); } Loading Loading @@ -349,6 +354,10 @@ public class TileLayout extends ViewGroup implements QSTileLayout { } } public float getSquishinessFraction() { return mSquishinessFraction; } @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); Loading packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -39,10 +39,11 @@ import android.view.accessibility.AccessibilityNodeInfo; import androidx.test.runner.AndroidJUnit4; import com.android.systemui.res.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.qs.tileimpl.HeightOverrideable; import com.android.systemui.qs.tileimpl.QSTileViewImpl; import com.android.systemui.res.R; import org.junit.Before; import org.junit.Test; Loading Loading @@ -87,6 +88,14 @@ public class TileLayoutTest extends SysuiTestCase { verify(tileRecord.tile, times(1)).setListening(mTileLayout, false); } @Test public void testAddTile_SetsRightSquishiness() { QSPanelControllerBase.TileRecord tileRecord = createTileRecord(); ((HeightOverrideable) tileRecord.tileView).setSquishinessFraction(.5f); mTileLayout.addTile(tileRecord); assertEquals(1f, ((HeightOverrideable) tileRecord.tileView).getSquishinessFraction()); } @Test public void testSetListening_CallsSetListeningOnTile() { QSPanelControllerBase.TileRecord tileRecord = createTileRecord(); Loading Loading
packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +6 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,12 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { page.setMinRows(mMinRows); page.setMaxColumns(mMaxColumns); page.setSelected(false); // All pages should have the same squishiness, so grabbing the value from the first page // and giving it to new pages. float squishiness = mPages.isEmpty() ? 1f : mPages.get(0).getSquishinessFraction(); page.setSquishinessFraction(squishiness); return page; } Loading
packages/SystemUI/src/com/android/systemui/qs/TileLayout.java +9 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,11 @@ public class TileLayout extends ViewGroup implements QSTileLayout { } protected void addTileView(TileRecord tile) { // Re-using tile views might lead to having out-of-date squishiness. This is fixed by // making sure we set the correct squishiness value when added to the layout. if (tile.tileView instanceof HeightOverrideable) { ((HeightOverrideable) tile.tileView).setSquishinessFraction(mSquishinessFraction); } addView(tile.tileView); } Loading Loading @@ -349,6 +354,10 @@ public class TileLayout extends ViewGroup implements QSTileLayout { } } public float getSquishinessFraction() { return mSquishinessFraction; } @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); Loading
packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -39,10 +39,11 @@ import android.view.accessibility.AccessibilityNodeInfo; import androidx.test.runner.AndroidJUnit4; import com.android.systemui.res.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.qs.tileimpl.HeightOverrideable; import com.android.systemui.qs.tileimpl.QSTileViewImpl; import com.android.systemui.res.R; import org.junit.Before; import org.junit.Test; Loading Loading @@ -87,6 +88,14 @@ public class TileLayoutTest extends SysuiTestCase { verify(tileRecord.tile, times(1)).setListening(mTileLayout, false); } @Test public void testAddTile_SetsRightSquishiness() { QSPanelControllerBase.TileRecord tileRecord = createTileRecord(); ((HeightOverrideable) tileRecord.tileView).setSquishinessFraction(.5f); mTileLayout.addTile(tileRecord); assertEquals(1f, ((HeightOverrideable) tileRecord.tileView).getSquishinessFraction()); } @Test public void testSetListening_CallsSetListeningOnTile() { QSPanelControllerBase.TileRecord tileRecord = createTileRecord(); Loading