Skip to content

Conversation

@asphalt123
Copy link

Pull Request: Channel Blacklist System

🎯 Feature Overview

This PR implements a comprehensive channel blacklisting system that allows users to permanently hide all content from specific channels across the entire SmartTube application.

🚀 Key Features

1. Blacklist via Context Menu

  • Long-press any video to open the context menu
  • Select "Blacklist Channel" option
  • Confirmation dialog asks: "Hide all content from [Channel Name]?"
  • Toast notification confirms blacklisting

2. Global Content Filtering

  • Blacklisted channels are automatically filtered from ALL app views:
    • 🏠 Home feed
    • 🔍 Search results
    • 📺 Subscriptions
    • 🎬 Trending
    • 📋 Playlists
    • ⏰ History
    • ✨ Recommendations

3. Blacklisted Channels Management Tab

  • New "Blacklisted Channels" tab in the sidebar
  • View all blacklisted channels in one place
  • Long-press any channel to remove from blacklist
  • Toast notification confirms unblacklisting

4. Live UI Refresh

  • Instant UI updates when channels are blacklisted/unblacklisted
  • No need to switch tabs or restart the app
  • Listener pattern ensures all views stay synchronized

5. Data Persistence

  • Blacklist survives app restarts (SharedPreferences)
  • Multi-profile support: separate blacklists per user profile
  • Efficient storage using HashSet for O(1) lookup

6. Internationalization

  • Full translations for 17+ languages:
    • 🇫🇷 French (Français)
    • 🇪🇸 Spanish (Español)
    • 🇩🇪 German (Deutsch)
    • 🇷🇺 Russian (Русский)
    • 🇺🇦 Ukrainian (Українська)
    • 🇮🇹 Italian (Italiano)
    • 🇧🇷🇵🇹 Portuguese (Português)
    • 🇳🇱 Dutch (Nederlands)
    • 🇵🇱 Polish (Polski)
    • 🇨🇿 Czech (Čeština)
    • 🇹🇷 Turkish (Türkçe)
    • 🇻🇳 Vietnamese (Tiếng Việt)
    • 🇨🇳 Chinese Simplified (简体中文)
    • 🇹🇼 Chinese Traditional (繁體中文)
    • 🇯🇵 Japanese (日本語)
    • 🇰🇷 Korean (한국어)

📝 Implementation Details

Architecture

The blacklist system uses a multi-layer architecture:

  1. Data Layer (BlacklistData.java)

    • Singleton pattern for global access
    • HashSet for efficient channel ID lookups (O(1))
    • HashMap for channel name storage (for display)
    • Observer pattern for UI updates
    • SharedPreferences for persistence
    • ProfileChangeListener for multi-profile support
  2. Filtering Layer (VideoGroup.java)

    • Centralized video filtering in add() method
    • Applies to ALL video lists across the app
    • Graceful error handling for early initialization
  3. UI Layer

    • Context Menu (VideoMenuPresenter.java): Add/remove blacklist actions
    • Browse Tab (BrowsePresenter.java): Blacklisted Channels section
    • Sidebar (SidebarService.java): Tab visibility configuration

Files Changed

Core Implementation

  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/prefs/BlacklistData.java ⭐ NEW

    • 192 lines, core blacklist manager
  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/VideoGroup.java

    • Added filtering logic to add() method
  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/dialogs/menu/VideoMenuPresenter.java

    • Added appendBlacklistChannelButton() method
    • Dynamic button text based on blacklist status
    • Confirmation dialog integration
  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/BrowsePresenter.java

    • Added Blacklisted Channels tab support
    • Live refresh listener implementation
    • getBlacklistedChannelsVideos() data source

Supporting Files

  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java

    • Added getChannelIdForBlacklist() helper
    • Added belongsToBlacklistedChannels() check
  • MediaServiceCore/mediaserviceinterfaces/src/main/java/com/liskovsoft/mediaserviceinterfaces/data/MediaGroup.java

    • Added TYPE_BLACKLISTED_CHANNELS = 22 constant
  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/prefs/MainUIData.java

    • Added MENU_ITEM_BLACKLIST_CHANNEL constant
    • Integrated into default menu items
  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/service/SidebarService.java

    • Added Blacklisted Channels to default sections

Localization (17 languages)

  • common/src/main/res/values/strings.xml (English)
  • common/src/main/res/values-fr/strings.xml (French)
  • common/src/main/res/values-es/strings.xml (Spanish)
  • common/src/main/res/values-de/strings.xml (German)
  • common/src/main/res/values-ru/strings.xml (Russian)
  • common/src/main/res/values-uk/strings.xml (Ukrainian)
  • common/src/main/res/values-it/strings.xml (Italian)
  • common/src/main/res/values-pt-rBR/strings.xml (Portuguese BR)
  • common/src/main/res/values-pt-rPT/strings.xml (Portuguese PT)
  • common/src/main/res/values-nl/strings.xml (Dutch)
  • common/src/main/res/values-pl/strings.xml (Polish)
  • common/src/main/res/values-cs/strings.xml (Czech)
  • common/src/main/res/values-tr/strings.xml (Turkish)
  • common/src/main/res/values-vi/strings.xml (Vietnamese)
  • common/src/main/res/values-zh/strings.xml (Chinese Simplified)
  • common/src/main/res/values-zh-rTW/strings.xml (Chinese Traditional)
  • common/src/main/res/values-ja/strings.xml (Japanese)
  • common/src/main/res/values-ko/strings.xml (Korean)

String Resources Added

<string name="dialog_blacklist_channel">Blacklist Channel</string>
<string name="dialog_remove_from_blacklist">Remove from Blacklist</string>
<string name="confirm_blacklist_channel">Hide all content from %s?</string>
<string name="blacklisted_channel">Channel blacklisted</string>
<string name="removed_from_blacklist">Removed from blacklist</string>
<string name="header_blacklisted_channels">Blacklisted Channels</string>
<string name="msg_no_blacklisted_channels">No blacklisted channels</string>

✅ Testing Performed

Build Status

  • ✅ Compiled successfully with ./gradlew assembleStstableDebug
  • ✅ No build errors or warnings (except minor resource formatting warnings)
  • ✅ EXIT CODE: 0

Functional Testing

  • Context Menu Integration

    • Blacklist option appears in video context menu
    • Confirmation dialog displays correctly
    • Toast notifications work
    • Button text changes dynamically (Blacklist ↔ Remove from Blacklist)
  • Global Filtering

    • Tested blacklisting from Home feed
    • Tested blacklisting from Search results
    • Tested blacklisting from Subscriptions
    • Confirmed videos disappear immediately from all views
  • Blacklisted Channels Tab

    • Tab appears in sidebar navigation
    • Shows all blacklisted channels
    • Long-press unblacklist works
    • Empty state displays correctly
  • Live Refresh

    • UI updates instantly when channel is blacklisted
    • UI updates instantly when channel is unblacklisted
    • No need to switch tabs or restart app
  • Persistence

    • Blacklist survives app restart
    • Data correctly stored in SharedPreferences
  • Translations

    • Verified correct translations in French, Spanish, German, Russian, Chinese
    • No missing string resources

🎮 How to Use

To Blacklist a Channel:

  1. Long-press any video in the app
  2. Select "Blacklist Channel" from the context menu
  3. Confirm in the dialog
  4. All content from that channel will be hidden

To View Blacklisted Channels:

  1. Open the sidebar
  2. Select "Blacklisted Channels" tab
  3. View all blacklisted channels

To Unblacklist a Channel:

  1. Go to "Blacklisted Channels" tab
  2. Long-press the channel you want to unblacklist
  3. Select "Remove from Blacklist"
  4. Content from that channel will reappear

🔄 Backward Compatibility

  • No breaking changes
  • Existing features unaffected
  • Optional feature: Users who don't use it won't notice it
  • Clean migration: New menu item, new tab, new preference file

📊 Code Quality

  • Design Pattern: Observer pattern for decoupled UI updates
  • Performance: O(1) lookup time using HashSet
  • Memory: Efficient storage, minimal overhead
  • Error Handling: Graceful degradation if data not initialized
  • Code Style: Follows existing SmartTube conventions
  • Documentation: Clear method names and logic flow

🤝 Contribution Notes

This feature was developed with:

  • Comprehensive testing on Android TV emulator
  • Full internationalization support
  • Clean git history (cherry-picked onto upstream/master)
  • No merge conflicts with upstream

📌 Related Issues

#4471
#2242
#1956
#4471
#2242
#1956
#904

🙏 Acknowledgments

Thank you to the SmartTube community and maintainers @yuliskov for creating such an excellent app!

Long press context menu blacklist channel + confirmation prompt
Blacklisted channels tab + unblacklist channel context menu
@asphalt123
Copy link
Author

IMPORTANT NOTE @yuliskov :
We should also remember to add the const in the submodule MediaServiceCore
\MediaServiceCore\mediaserviceinterfaces\src\main\java\com\liskovsoft\mediaserviceinterfaces\data\MediaGroup.java

int TYPE_BLACKLISTED_CHANNELS = 22;

i can make a pull request if you want for submodule too
thanks

@yuliskov
Copy link
Owner

@asphalt123 got it. Thank you for understanding, my friend

@ragavpr
Copy link

ragavpr commented Feb 12, 2026

This feature is something I yearn for, thanks for making this.

I can only imaging the ease of use if a list of blacklisted (or whitelisted) channels is maintained and that list is added by URL in the settings, similar to the adblock lists (which also opens up the possibility of cross-platform shared blocking), but that can be saved for a future PR I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants