{"content":"Command: cd /Users/nickchen/WorkBuddy/2026-10-23-15-17-57/cleanyourtv && sed -n '400,560p' launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java\nStdout:             nameLp.height = Math.round(20 * density);\r\n            int pad = Math.round(4 * density);\r\n            v.setPadding(v.getPaddingLeft(), pad, v.getPaddingRight(), pad);\r\n        }\r\n        name.setLayoutParams(nameLp);\r\n        return new Holder(v, listener, animations, advancedEffects, reducedMotion, restNameAlpha, focusOvershoot);\r\n    }\r\n\r\n    @Override\r\n    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {\r\n        if (isLibraryAt(position)) return;\r\n        Holder h = (Holder) holder;\r\n        Entry e = items.get(position);\r\n        if (e.kind == Entry.EMPTY) {\r\n            // A free dock slot keeps its place in the row and the band, but shows nothing and takes no focus.\r\n            h.card.setVisibility(View.INVISIBLE);\r\n            h.card.setFocusable(false);\r\n            h.name.setVisibility(View.INVISIBLE);\r\n            h.banner.setImageDrawable(null);\r\n            h.icon.setImageDrawable(null);\r\n            h.card.setOnClickListener(null);\r\n            h.card.setOnLongClickListener(null);\r\n            return;\r\n        }\r\n        h.card.setVisibility(View.VISIBLE);\r\n        h.card.setFocusable(true);\r\n        h.name.setText(e.name);\r\n        // The dock has no labels, unless always_show_names asks for them (DockDecoration then makes room in the band).\r\n        h.name.setVisibility(dockRow && position < dockSize && restNameAlpha == 0f ? View.INVISIBLE : View.VISIBLE);\r\n        boolean focused = h.card.isFocused();   // a rebind after reload() can hit the focused tile\r\n        h.name.setAlpha(focused ? 1f : restNameAlpha);\r\n        h.card.setScaleX(focused && animations ? focusScale() : 1f);\r\n        h.card.setScaleY(focused && animations ? focusScale() : 1f);\r\n        h.card.setTranslationY(focused && advancedEffects ? -4f * ctx.getResources().getDisplayMetrics().density : 0f);\r\n        h.card.setTranslationZ(focused && advancedEffects ? 8f * ctx.getResources().getDisplayMetrics().density : 0f);\r\n        h.banner.setScaleX(focused && advancedEffects ? 1.035f : 1f);\r\n        h.banner.setScaleY(focused && advancedEffects ? 1.035f : 1f);\r\n        // A fully opaque banner covers the whole card (centerCrop), so the card's own fill under it is drawn for\r\n        // nothing on every frame; keep it under banners with transparent parts and under icon tiles.\r\n        h.card.setBackground(e.banner != null && e.banner.getOpacity() == PixelFormat.OPAQUE ? null : h.cardBackground);\r\n        if (e.banner != null) {\r\n            h.banner.setImageDrawable(e.banner);\r\n            h.banner.setVisibility(View.VISIBLE);\r\n            h.icon.setVisibility(View.GONE);\r\n            h.label.setVisibility(View.GONE);\r\n        } else {\r\n            h.banner.setImageDrawable(null);\r\n            h.banner.setVisibility(View.GONE);\r\n            h.icon.setImageDrawable(e.icon);\r\n            h.icon.setVisibility(View.VISIBLE);\r\n            h.label.setText(e.label);\r\n            h.label.setVisibility(View.VISIBLE);\r\n        }\r\n        h.card.setOnClickListener(v -> launch(e));\r\n        h.card.setOnLongClickListener(v -> {\r\n            if (tileMenu) {\r\n                int pos = h.getBindingAdapterPosition();\r\n                if (pos != RecyclerView.NO_POSITION) listener.onTileLongPress(pos, v);\r\n                return true;\r\n            }\r\n            Intent i = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse(\"package:\" + e.pkg));\r\n            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n            try {\r\n                ctx.startActivity(i);\r\n            } catch (ActivityNotFoundException ignored) {\r\n            }\r\n            return true;\r\n        });\r\n    }\r\n\r\n    /** Opens the tile's activity by explicit component, with no extras: a card can name nothing else. */\r\n    private void launch(Entry e) {\r\n        if (e.kind == Entry.HOME_SETTINGS) {\r\n            ctx.startActivity(new Intent(ctx, HomeSettingsActivity.class)\r\n                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));\r\n            return;\r\n        }\r\n        Intent i = new Intent(Intent.ACTION_MAIN)\r\n                .setComponent(e.component)\r\n                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);\r\n        // TV apps launch with the same leanback intent as from the stock launcher or the remote, so an app\r\n        // already running resumes instead of restarting; only phone apps added from the library use plain MAIN.\r\n        if (leanbackPackages.contains(e.pkg)) i.addCategory(Intent.CATEGORY_LEANBACK_LAUNCHER);\r\n        String action = launchActions.get(e.pkg);\r\n        if (action != null) {\r\n            // NEW_TASK only: with RESET_TASK_IF_NEEDED, Android just brings a running task of the app to the front\r\n            // (\"Activity not started\"), so the screen never opens while the app is up, e.g. MagentaTV's boot-time task.\r\n            Intent byAction = new Intent(action).setPackage(e.pkg).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n            if (ctx.getPackageManager().resolveActivity(byAction, 0) != null) i = byAction;\r\n        }\r\n        try {\r\n            ctx.startActivity(i);\r\n            if (cinematic) LastOpened.record(ctx, e.pkg);\r\n            if (advancedEffects && !reducedMotion && ctx instanceof Activity) {\r\n                ((Activity) ctx).overridePendingTransition(R.anim.app_open_enter, R.anim.app_open_exit);\r\n            }\r\n        } catch (Exception ex) {\r\n            Toast.makeText(ctx, ctx.getString(R.string.cant_open, e.label), Toast.LENGTH_SHORT).show();\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public int getItemCount() {\r\n        return items.size() + (showLibrary ? 1 : 0);\r\n    }\r\n\r\n    int appCount() { return items.size(); }\r\n\r\n    boolean isLibraryAt(int position) { return showLibrary && position == items.size(); }\r\n\r\n    @Override public int getItemViewType(int position) { return isLibraryAt(position) ? 1 : 0; }\r\n\r\n    boolean containsPackage(String pkg) {\r\n        for (Entry entry : items) if (entry.pkg.equals(pkg)) return true;\r\n        return false;\r\n    }\r\n\r\n    @Override\r\n    public long getItemId(int position) {\r\n        return isLibraryAt(position) ? Long.MIN_VALUE : items.get(position).component.flattenToShortString().hashCode();\r\n    }\r\n\r\n    /** Uses this saved order and dock size from the next reload() (Order.ranks, Order.docked). */\r\n    void setSavedOrder(Map<String, Integer> ranks, int docked) {\r\n        savedRanks = ranks;\r\n        savedDocked = docked;\r\n    }\r\n\r\n    /**\r\n     * A tile in the dock: one of the first savedDocked tiles of the saved order when one was recorded, so an app\r\n     * the owner moved into the dock stays there (#499); else a dock_apps entry.\r\n     */\r\n    private boolean isDocked(Entry e) {\r\n        if (savedDocked < 0) return favourites.contains(e.pkg);\r\n        Integer rank = savedRanks.get(e.component.flattenToShortString());\r\n        return rank != null && rank < savedDocked;\r\n    }\r\n\r\n    /** Reorder mode on or off; takes effect at the next reload() (empty dock slots are left out while on). */\r\n    void setReordering(boolean on) {\r\n        reordering = on;\r\n    }\r\n\r\n    boolean hasEmptySlots() {\r\n        return emptySlots > 0;\r\n    }\r\n\r\n    /** Tiles that can be moved: everything but the \"Default home\" tile, which always stays last. */\r\n    int movableCount() {\r\n        int n = items.size();\r\n        return n > 0 && items.get(n - 1).kind == Entry.HOME_SETTINGS ? n - 1 : n;\r\n    }\r\n\r\n    /** Keys of the movable tiles in their current order, for Order (empty dock slots are not tiles). */\r\n    List<String> movableKeys() {\r\n        List<String> keys = new ArrayList<>();\r\n        for (int i = 0; i < movableCount(); i++) {\r\n            Entry e = items.get(i);\r\n            if (e.kind != Entry.EMPTY) keys.add(e.component.flattenToShortString());\r\n        }\r\n        return keys;\r\n\nStderr: (empty)\nExit Code: 0\nSignal: (none)","renderer":{"type":"text","value":"            nameLp.height = Math.round(20 * density);\r\n            int pad = Math.round(4 * density);\r\n            v.setPadding(v.getPaddingLeft(), pad, v.getPaddingRight(), pad);\r\n        }\r\n        name.setLayoutParams(nameLp);\r\n        return new Holder(v, listener, animations, advancedEffects, reducedMotion, restNameAlpha, focusOvershoot);\r\n    }\r\n\r\n    @Override\r\n    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {\r\n        if (isLibraryAt(position)) return;\r\n        Holder h = (Holder) holder;\r\n        Entry e = items.get(position);\r\n        if (e.kind == Entry.EMPTY) {\r\n            // A free dock slot keeps its place in the row and the band, but shows nothing and takes no focus.\r\n            h.card.setVisibility(View.INVISIBLE);\r\n            h.card.setFocusable(false);\r\n            h.name.setVisibility(View.INVISIBLE);\r\n            h.banner.setImageDrawable(null);\r\n            h.icon.setImageDrawable(null);\r\n            h.card.setOnClickListener(null);\r\n            h.card.setOnLongClickListener(null);\r\n            return;\r\n        }\r\n        h.card.setVisibility(View.VISIBLE);\r\n        h.card.setFocusable(true);\r\n        h.name.setText(e.name);\r\n        // The dock has no labels, unless always_show_names asks for them (DockDecoration then makes room in the band).\r\n        h.name.setVisibility(dockRow && position < dockSize && restNameAlpha == 0f ? View.INVISIBLE : View.VISIBLE);\r\n        boolean focused = h.card.isFocused();   // a rebind after reload() can hit the focused tile\r\n        h.name.setAlpha(focused ? 1f : restNameAlpha);\r\n        h.card.setScaleX(focused && animations ? focusScale() : 1f);\r\n        h.card.setScaleY(focused && animations ? focusScale() : 1f);\r\n        h.card.setTranslationY(focused && advancedEffects ? -4f * ctx.getResources().getDisplayMetrics().density : 0f);\r\n        h.card.setTranslationZ(focused && advancedEffects ? 8f * ctx.getResources().getDisplayMetrics().density : 0f);\r\n        h.banner.setScaleX(focused && advancedEffects ? 1.035f : 1f);\r\n        h.banner.setScaleY(focused && advancedEffects ? 1.035f : 1f);\r\n        // A fully opaque banner covers the whole card (centerCrop), so the card's own fill under it is drawn for\r\n        // nothing on every frame; keep it under banners with transparent parts and under icon tiles.\r\n        h.card.setBackground(e.banner != null && e.banner.getOpacity() == PixelFormat.OPAQUE ? null : h.cardBackground);\r\n        if (e.banner != null) {\r\n            h.banner.setImageDrawable(e.banner);\r\n            h.banner.setVisibility(View.VISIBLE);\r\n            h.icon.setVisibility(View.GONE);\r\n            h.label.setVisibility(View.GONE);\r\n        } else {\r\n            h.banner.setImageDrawable(null);\r\n            h.banner.setVisibility(View.GONE);\r\n            h.icon.setImageDrawable(e.icon);\r\n            h.icon.setVisibility(View.VISIBLE);\r\n            h.label.setText(e.label);\r\n            h.label.setVisibility(View.VISIBLE);\r\n        }\r\n        h.card.setOnClickListener(v -> launch(e));\r\n        h.card.setOnLongClickListener(v -> {\r\n            if (tileMenu) {\r\n                int pos = h.getBindingAdapterPosition();\r\n                if (pos != RecyclerView.NO_POSITION) listener.onTileLongPress(pos, v);\r\n                return true;\r\n            }\r\n            Intent i = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse(\"package:\" + e.pkg));\r\n            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n            try {\r\n                ctx.startActivity(i);\r\n            } catch (ActivityNotFoundException ignored) {\r\n            }\r\n            return true;\r\n        });\r\n    }\r\n\r\n    /** Opens the tile's activity by explicit component, with no extras: a card can name nothing else. */\r\n    private void launch(Entry e) {\r\n        if (e.kind == Entry.HOME_SETTINGS) {\r\n            ctx.startActivity(new Intent(ctx, HomeSettingsActivity.class)\r\n                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));\r\n            return;\r\n        }\r\n        Intent i = new Intent(Intent.ACTION_MAIN)\r\n                .setComponent(e.component)\r\n                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);\r\n        // TV apps launch with the same leanback intent as from the stock launcher or the remote, so an app\r\n        // already running resumes instead of restarting; only phone apps added from the library use plain MAIN.\r\n        if (leanbackPackages.contains(e.pkg)) i.addCategory(Intent.CATEGORY_LEANBACK_LAUNCHER);\r\n        String action = launchActions.get(e.pkg);\r\n        if (action != null) {\r\n            // NEW_TASK only: with RESET_TASK_IF_NEEDED, Android just brings a running task of the app to the front\r\n            // (\"Activity not started\"), so the screen never opens while the app is up, e.g. MagentaTV's boot-time task.\r\n            Intent byAction = new Intent(action).setPackage(e.pkg).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n            if (ctx.getPackageManager().resolveActivity(byAction, 0) != null) i = byAction;\r\n        }\r\n        try {\r\n            ctx.startActivity(i);\r\n            if (cinematic) LastOpened.record(ctx, e.pkg);\r\n            if (advancedEffects && !reducedMotion && ctx instanceof Activity) {\r\n                ((Activity) ctx).overridePendingTransition(R.anim.app_open_enter, R.anim.app_open_exit);\r\n            }\r\n        } catch (Exception ex) {\r\n            Toast.makeText(ctx, ctx.getString(R.string.cant_open, e.label), Toast.LENGTH_SHORT).show();\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public int getItemCount() {\r\n        return items.size() + (showLibrary ? 1 : 0);\r\n    }\r\n\r\n    int appCount() { return items.size(); }\r\n\r\n    boolean isLibraryAt(int position) { return showLibrary && position == items.size(); }\r\n\r\n    @Override public int getItemViewType(int position) { return isLibraryAt(position) ? 1 : 0; }\r\n\r\n    boolean containsPackage(String pkg) {\r\n        for (Entry entry : items) if (entry.pkg.equals(pkg)) return true;\r\n        return false;\r\n    }\r\n\r\n    @Override\r\n    public long getItemId(int position) {\r\n        return isLibraryAt(position) ? Long.MIN_VALUE : items.get(position).component.flattenToShortString().hashCode();\r\n    }\r\n\r\n    /** Uses this saved order and dock size from the next reload() (Order.ranks, Order.docked). */\r\n    void setSavedOrder(Map<String, Integer> ranks, int docked) {\r\n        savedRanks = ranks;\r\n        savedDocked = docked;\r\n    }\r\n\r\n    /**\r\n     * A tile in the dock: one of the first savedDocked tiles of the saved order when one was recorded, so an app\r\n     * the owner moved into the dock stays there (#499); else a dock_apps entry.\r\n     */\r\n    private boolean isDocked(Entry e) {\r\n        if (savedDocked < 0) return favourites.contains(e.pkg);\r\n        Integer rank = savedRanks.get(e.component.flattenToShortString());\r\n        return rank != null && rank < savedDocked;\r\n    }\r\n\r\n    /** Reorder mode on or off; takes effect at the next reload() (empty dock slots are left out while on). */\r\n    void setReordering(boolean on) {\r\n        reordering = on;\r\n    }\r\n\r\n    boolean hasEmptySlots() {\r\n        return emptySlots > 0;\r\n    }\r\n\r\n    /** Tiles that can be moved: everything but the \"Default home\" tile, which always stays last. */\r\n    int movableCount() {\r\n        int n = items.size();\r\n        return n > 0 && items.get(n - 1).kind == Entry.HOME_SETTINGS ? n - 1 : n;\r\n    }\r\n\r\n    /** Keys of the movable tiles in their current order, for Order (empty dock slots are not tiles). */\r\n    List<String> movableKeys() {\r\n        List<String> keys = new ArrayList<>();\r\n        for (int i = 0; i < movableCount(); i++) {\r\n            Entry e = items.get(i);\r\n            if (e.kind != Entry.EMPTY) keys.add(e.component.flattenToShortString());\r\n        }\r\n        return keys;"}}