Skip to content

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

Merge PR #297: launcher: dock_row option for one plain grid without a dock band

Gathin23644291f10851
diff --cc launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index 9484ff9c4,90ff5d61c..18b895734
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@@ -124,11 -124,10 +124,13 @@@ public class MainActivity extends Activ
private float density;
/** Module cards (res/values/config.xml, module_cards): discovered on resume, shown only after the owner's Show. */
private boolean moduleCards;
+ /** config settings_key_keycodes / settings_key_panel, so the Settings button works on Home without HomeKeyService. */
+ private int[] settingsKeycodes = new int[0];
+ private boolean settingsKeyPanel;
/** Calmer motion for weak GPUs (config.xml, reduced_motion): stiff spring, short fades, no replay. */
private boolean reducedMotion;
+ /** config.xml dock_row: the first row is a separate dock (band, parked low, top shelf) rather than plain grid. */
+ private boolean dockRow;
/** Festive skin from the theme (see Festival); applied while it is active today. */
private Festival festival = Festival.NONE;
private boolean festive;
@@@ -280,17 -278,16 +283,17 @@@
public boolean requestChildRectangleOnScreen(@NonNull RecyclerView parent, @NonNull View child,
@NonNull Rect rect, boolean immediate,
boolean focusedChildVisible) {
- if (getPosition(child) < COLUMNS) return false;
+ if (dockRow && 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);