Repository navigation
Games‐Tab
Abdul Mueed | AM Dev edited this page Jun 29, 2026
·
2 revisions
The Games tab provides users with access to a curated collection of web-based games with smart caching, offline support, and a modern search UI.
| File | Path |
|---|---|
| Main Fragment | ui/game/GameFragment.kt |
| ViewModel | ui/game/GameViewModel.kt |
| Data Models | ui/game/GameModel.kt |
| Cache Manager | ui/game/GameCacheManager.kt |
| Game Player | ui/game/GamePlayerFragment.kt |
| Adapter | ui/game/GameAdapter.kt |
| File | Path |
|---|---|
| Main Layout | res/layout/fragment_game.xml |
| Game Player | res/layout/fragment_game_player.xml |
| Normal Item | res/layout/item_game_normal.xml |
| Large Item | res/layout/item_game_large.xml |
| Shimmer | res/layout/shimmer_game_grid.xml |
| Resource | URL |
|---|---|
| Games JSON | https://cdn.jsdelivr.net/gh/am-abdulmueed/PluginStream-Games@main/games_final_lite.json |
| GitHub API | https://api.github.com/repos/am-abdulmueed/PluginStream-Games/commits |
data class GameResponse(
val title: String,
val total_count: Int,
val hits: List<GameModel>
)data class GameModel(
val title: String,
val gameURL: String,
val genres: List<String> = emptyList(),
val images: GameImages,
val isFeatured: Boolean = false
)data class GameImages(
val icon: String,
val poster: String
)- Search Bar — Real-time filtering by title and genres
- Grid Layout — Responsive grid with featured game highlights
- Shimmer Loading — Skeleton animation while data loads
- Offline Support — Shows cached games when offline
- Offers Navigation — Direct link to Offers section
Every 5th game gets a large poster card treatment:
isFeatured = (index + 1) % 5 == 0This creates visual hierarchy — featured games stand out in the grid.
- WebView — Embedded browser for game playback
- Fullscreen — Immersive gaming mode
- Network Detection — Handles online/offline states
- Progress Indicator — Shows loading state on game init
GameFragment
└─ GameViewModel.fetchGamesIfNeeded()
└─ GameCacheManager.fetchGamesWithCache()
├─ Check cache validity
├─ If outdated: Download from GitHub → Cache → Return
└─ If current: Return cached data immediately
User types in search bar
└─ GameViewModel.filterGames(query)
└─ Filter cached games locally
└─ Update UI instantly (no network call)
User clicks game
└─ Navigate to GamePlayerFragment
└─ Load game URL in WebView (fullscreen)
The GameCacheManager uses GitHub commit hashes to detect if the games file has changed.
| Key | Purpose |
|---|---|
KEY_CACHED_GAMES |
Stored games JSON |
KEY_LAST_COMMIT |
Last known GitHub commit hash |
KEY_CACHE_TIMESTAMP |
Cache creation time |
- First Launch → Download from GitHub, cache locally
- Subsequent Launches → Check GitHub for new commit hash
- If Changed → Download fresh data, update cache
- If Same → Use cached data immediately
- Offline → Use cached data regardless
GameCacheManager.clearCache(context) // Force refresh
GameCacheManager.hasCache(context) // Check cache exists
GameCacheManager.getCacheInfo(context) // Debug infofun filterGames(query: String): List<GameModel> {
val currentGames = _allGames.value ?: emptyList()
if (query.isBlank()) return currentGames
return currentGames.filter { game ->
game.title.contains(query, ignoreCase = true) ||
game.genres.any { it.contains(query, ignoreCase = true) }
}
}- Searches both title and genres
- Case-insensitive
- Real-time (instant results as user types)
| Scenario | Behavior |
|---|---|
| Network error | Use cached data, show offline indicator |
| No cached data | Show empty state with message |
| Game URL invalid | Exception caught, user notified |
| WebView error | Graceful fallback with retry option |
val cacheInfo = GameCacheManager.getCacheInfo(context)
Log.d("Games", "Cache exists: ${cacheInfo.hasCache}")
Log.d("Games", "Last update: ${cacheInfo.lastUpdateTimestamp}")
Log.d("Games", "Commit hash: ${cacheInfo.lastCommitHash}")The games_final_lite.json is produced by PowerShell and Batch scripts that optimize raw game data.
| File | Purpose |
|---|---|
UpdateGameList.ps1 |
Main data collection & transformation |
optimize_games.bat |
Initiates and schedules optimization |
games.json |
Raw unoptimized source data |
games_final_lite.json |
Final optimized output |
- Collect — Scan Playgama API for game metadata
- Filter — Remove duplicates, validate URLs and images
- Standardize — Normalize genre names
- Trim — Remove unnecessary fields, minify JSON
-
Output — Produce lightweight
games_final_lite.json
{
"title": "Fruits into Baskets",
"gameURL": "https://playgama.com/export/game/fruits-into-baskets?clid=...",
"genres": ["puzzle", "food", "logic", "easy"],
"images": {
"icon": "https://playgama.com/cdn-cgi/imagedelivery/.../enlarged",
"poster": "https://playgama.com/cdn-cgi/imagedelivery/.../enlarged"
}
}[
{
"sha": "abc123def456",
"commit": {
"message": "Update games list",
"author": {
"date": "2026-05-08T12:00:00Z"
}
}
}
]- Game categories / advanced genre filtering
- Favorites system
- Recently played history
- Play time and achievement tracking
- Background sync when online
- A/B testing framework
- All games load over HTTPS only
- WebView runs in a secure sandbox
- Game data cached in SharedPreferences (private to app)
- All network traffic uses SSL/TLS
- Cached data loads instantly on app open
- GitHub commit check runs in background (non-blocking)
- Search filtering is local — no network calls needed
- RecyclerView uses DiffUtil for efficient list updates
📺 PluginStream — Licensed under MIT License © 2026 Abdul Mueed