Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
Launcher: Edit dock, a quick way to change one dock app from the TV
Ben Redmond-Benham534ff6cf5478
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex 5ea1f3c2a..4133217e4 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -171,6 +171,10 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {private List<String> dockApps;/** fill_dock false: the dock can have empty slots, which reorder mode leaves out and restores afterwards. */private boolean fillDockLeavesSlots;+ /** Edit-dock mode (Settings menu): a reorder session that swaps one chosen app into one dock place. */+ private boolean dockEditing;+ /** Dock place being changed in edit-dock mode, or -1 while the place is still being chosen. */+ private int dockEditSlot = -1;private AppLibraryDialog appLibrary;private boolean libraryFocusPending;private RecyclerView.OnScrollListener pendingFocusScroll;@@ -335,10 +339,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {grid.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {@Overridepublic void onChildViewAttachedToWindow(@NonNull View v) {- int pos = grid.getChildAdapterPosition(v);- boolean carried = movingKey != null && pos != RecyclerView.NO_POSITION- && movingKey.equals(adapter.keyAt(pos));- v.setAlpha(movingKey == null || carried ? 1f : 0.45f);+ v.setAlpha(tileAlpha(grid.getChildAdapterPosition(v)));}@Override@@ -746,6 +747,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {public boolean dispatchKeyEvent(KeyEvent event) {if (handleSettingsKey(event)) return true;if (!reordering) return super.dispatchKeyEvent(event);+ if (dockEditing) return dispatchDockEdit(event);boolean down = event.getAction() == KeyEvent.ACTION_DOWN;int code = event.getKeyCode();boolean ok = code == KeyEvent.KEYCODE_DPAD_CENTER || code == KeyEvent.KEYCODE_ENTER@@ -792,15 +794,88 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {endReorder();return;}- if (adapter.movableCount() < 2) return;+ if (!beginReorder()) return;+ focusTile(Math.max(0, Math.min(lastFocused, adapter.movableCount() - 1)));+ Toast.makeText(this, R.string.reorder_hint, Toast.LENGTH_LONG).show();+ }++ /** The start shared by reorder and edit-dock mode. False when there is nothing to move. */+ private boolean beginReorder() {+ if (adapter.movableCount() < 2) return false;adapter.setReordering(true);if (adapter.hasEmptySlots()) reloadTiles(); // every position must hold a tile that can movereordering = true;orderAtStart = adapter.movableKeys();glass.setAccent(REORDER_ACCENT);btnReorder.setActivated(true);- focusTile(Math.max(0, Math.min(lastFocused, adapter.movableCount() - 1)));- Toast.makeText(this, R.string.reorder_hint, Toast.LENGTH_LONG).show();+ return true;+ }++ /** Edit dock (Settings menu): focus goes to the first dock place, which OK then chooses. */+ private void startDockEdit() {+ if (reordering) endReorder();+ if (!beginReorder()) return;+ dockEditing = true;+ dockEditSlot = -1;+ focusTile(0);+ Toast.makeText(this, R.string.dock_edit_hint, Toast.LENGTH_LONG).show();+ }++ /**+ * Keys in edit-dock mode. First OK on a dock tile chooses that place (the other dock tiles dim) and focus moves+ * to the grid; then OK on any tile swaps that app into the place, saves the order and ends the mode. Back goes+ * one step back: from choosing the app to choosing the place, and from there out of the mode.+ */+ private boolean dispatchDockEdit(KeyEvent event) {+ boolean down = event.getAction() == KeyEvent.ACTION_DOWN;+ int code = event.getKeyCode();+ boolean ok = code == KeyEvent.KEYCODE_DPAD_CENTER || code == KeyEvent.KEYCODE_ENTER+ || code == KeyEvent.KEYCODE_NUMPAD_ENTER;+ boolean back = code == KeyEvent.KEYCODE_BACK || code == KeyEvent.KEYCODE_ESCAPE;+ if (back) {+ if (!down) {+ if (dockEditSlot >= 0) {+ int slot = dockEditSlot;+ dockEditSlot = -1;+ dimOthers();+ focusTile(slot);+ } else {+ endReorder();+ }+ }+ return true;+ }+ int pos = focusedTilePosition();+ if (ok && pos >= 0) {+ if (!down) {+ int n = adapter.movableCount();+ if (dockEditSlot < 0) {+ if (pos < Math.min(COLUMNS, n)) {+ dockEditSlot = pos;+ dimOthers();+ focusTile(Math.min(COLUMNS, n - 1));+ Toast.makeText(this, R.string.dock_edit_pick_app, Toast.LENGTH_LONG).show();+ }+ } else if (pos < n) {+ swapIntoDock(dockEditSlot, pos);+ }+ }+ return true; // never opens the app while editing+ }+ return super.dispatchKeyEvent(event); // arrows navigate as usual+ }++ /** Puts the app at pos into dock place slot, and the app that was there where the chosen one was; then saves. */+ private void swapIntoDock(int slot, int pos) {+ String slotKey = adapter.keyAt(slot);+ if (pos != slot) {+ keepScroll(() -> {+ adapter.move(pos, slot);+ adapter.move(adapter.positionOf(slotKey), pos);+ });+ }+ endReorder();+ refocusAfterLayout(slot);}private void pickUp(int pos) {@@ -819,15 +894,24 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {private void dimOthers() {for (int i = 0; i < grid.getChildCount(); i++) {View item = grid.getChildAt(i);- int pos = grid.getChildAdapterPosition(item);- boolean carried = movingKey != null && movingKey.equals(adapter.keyAt(pos));- item.setAlpha(movingKey == null || carried ? 1f : 0.45f);+ item.setAlpha(tileAlpha(grid.getChildAdapterPosition(item)));+ }+ }++ /** A tile's alpha: dim unless it is the carried one, or, in edit-dock mode, a dock tile other than the chosen place. */+ private float tileAlpha(int pos) {+ if (movingKey != null) {+ return pos != RecyclerView.NO_POSITION && movingKey.equals(adapter.keyAt(pos)) ? 1f : 0.45f;}+ if (dockEditSlot >= 0 && pos >= 0 && pos < COLUMNS && pos != dockEditSlot) return 0.45f;+ return 1f;}/** Ends the mode and saves the order if it changed since the mode started. */private void endReorder() {if (!reordering) return;+ dockEditing = false;+ dockEditSlot = -1;drop();reordering = false;adapter.setReordering(false);@@ -1858,6 +1942,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {addSettingsMenuRow(rows, popup, R.string.launcher_settings, () -> startActivityForResult(new Intent(this, LauncherSettingsActivity.class), LAUNCHER_SETTINGS_REQUEST));if (moduleCards) addSettingsMenuRow(rows, popup, R.string.module_cards, this::showModuleCards);+ if (dockRow) addSettingsMenuRow(rows, popup, R.string.dock_edit, this::startDockEdit);addSettingsMenuRow(rows, popup, R.string.reorder, this::toggleReorder);panel.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);popup.setWidth(Math.max((int) (200 * density), panel.getMeasuredWidth()));diff --git a/launcher/app/src/main/res/values-iw/strings.xml b/launcher/app/src/main/res/values-iw/strings.xmlindex 232722030..571d293ca 100644--- a/launcher/app/src/main/res/values-iw/strings.xml+++ b/launcher/app/src/main/res/values-iw/strings.xml@@ -66,6 +66,9 @@<string name="quick_network">רשת</string><string name="quick_apps">אפליקציות</string><string name="quick_apps_hint">הפעלה מחדש</string>+ <string name="dock_edit">עריכת שורת המועדפים</string>+ <string name="dock_edit_hint">בחרו מקום בשורת המועדפים ולחצו אישור. חזרה לסיום.</string>+ <string name="dock_edit_pick_app">עכשיו בחרו את האפליקציה שתופיע שם ולחצו אישור. חזרה לבחירת מקום אחר.</string><string name="reorder">סידור אפליקציות</string><string name="reorder_hint">אישור מרים אפליקציה, החצים מזיזים אותה, חזרה מניחה אותה. חזרה שוב לסיום.</string><string name="reorder_not_saved">לא ניתן לשמור את הסדר החדש</string>diff --git a/launcher/app/src/main/res/values/strings.xml b/launcher/app/src/main/res/values/strings.xmlindex 50144ba5c..8fe3aee61 100644--- a/launcher/app/src/main/res/values/strings.xml+++ b/launcher/app/src/main/res/values/strings.xml@@ -68,6 +68,9 @@<string name="card_state_new">New</string><string name="card_state_new_key">New key</string><string name="card_state_new_label">New name</string>+ <string name="dock_edit">Edit dock</string>+ <string name="dock_edit_hint">Choose the dock place to change and press OK. Back to finish.</string>+ <string name="dock_edit_pick_app">Now choose the app to put there and press OK. Back to choose another place.</string><string name="reorder">Reorder apps</string><string name="reorder_hint">OK picks up an app, arrows move it, Back places it. Back again to finish.</string><string name="reorder_not_saved">Couldn\'t save the new order</string>