Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

Merge PR #289: launcher: focusing the last visible row no longer nudges the grid up

Gathin23a551dc6ceda4
diff --cc launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index 139cfe520,54cad511c..9484ff9c4
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@@ -283,11 -276,13 +283,14 @@@ public class MainActivity extends Activ
if (getPosition(child) < COLUMNS) return false;
int top = child.getTop() + rect.top;
int bottom = top + rect.height();
- // The grid's bottom edge, not its padding: paddingBottom only lets the last row scroll clear of
- // the edge, and treating it as off-screen nudged the grid up whenever the last visible row got focus.
- int limitBottom = getHeight();
++ // A row already fully on screen stays put, even inside the bottom padding (the last row
++ // rows_below_dock leaves visible ends there; nudging it up was the bug). A row that has to scroll
++ // in still stops at the padding line, clear of the screen edge, as before.
+ int limitBottom = getHeight() - getPaddingBottom();
int dy;
if (top < 0) dy = top;
-- else if (bottom > limitBottom) dy = Math.min(top, bottom - limitBottom);
-- else dy = 0;
++ else if (bottom <= getHeight()) dy = 0;
++ else dy = Math.min(top, bottom - limitBottom);
if (dy == 0) return false;
if (immediate || reducedMotion || !animations) parent.scrollBy(0, dy);
else parent.smoothScrollBy(0, dy);