### Example API Data Structure Fragment Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md A partial JSON example illustrating a data structure fragment used in the TV Metro API, typically for defining layout dimensions and item properties within a larger data object. ```APIDOC "x": 1, "w": 1, "h": 2 } }, "id": "180", "type": "item", "ns": "game" } ``` -------------------------------- ### GameCenter/AppStore API Resource URL Patterns Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines the common URL structure for accessing GameCenter and AppStore resources, including examples for albums and individual items. ```APIDOC 通用模式为`/{NS}/{Type}?id={ID}`,例如: * `/game/album?id=album1_id` GameCenter中ID为`album1_id`的游戏专辑 * `/game/album?id=recommand` Game的主页内容 * `/game/album?id=action` 所有动作类游戏(`action`)的专辑 * `/game/item?id=game1_id` GameCenter中ID为`game1_id`的单个游戏 ``` -------------------------------- ### Server API Implementation Guidance Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md Guidance for implementing the server-side API, focusing on the essential steps for defining home screen data and details/list API endpoints to support the TV Metro application. ```APIDOC Step 1: Define your home data structure Step 2: Implement your details/list API endpoints ``` -------------------------------- ### Common API Parameters for GameCenter/AppStore Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Details the common HTTP parameters appended to all API calls, including locale, resolution, device information, and signature. ```APIDOC * `locale` 区域代码,例如`zh_CN` * `res` 分辨率,值为`hd720` | `hd1080` | `hd2160` * `device`设备类型 * `device_id` 设备ID,一般为设备MAC地址的md5 * `ns_key` **Namespace**的Key * `opaque` 利用`ns_key`和URI即参数算出的URL签名 ``` -------------------------------- ### JSON Schema for Item Entity (Full Details) Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines the complete common information for an Item, extending DisplayItem with details like package name, vendor, flags, description, version, sizes, category, score, screenshots, and download counts. ```JSON { "package": "...", "phrase": "...", "vendor": { "id": "...", "name": "北京春雨天下软件有限公司" }, "flags": { "upgrade": true }, "description": "...", "times": { "updated": 1909088888 }, "ver": { "code": "200", "name": "1.0.1" }, "sizes": { "package": 1941662, "installed": 20098900 }, "category": { "id": "c1/c2", "name": "..." }, "score": 70, "screenshots": [ {ImageGroup}, {ImageGroup} ], "counts": { "download": ... } } ``` -------------------------------- ### GameCenter/AppStore API Endpoints Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Lists the available API endpoints for GameCenter and AppStore, detailing their HTTP methods, paths, parameters, and return types. ```APIDOC * **GET** `/1/{ns}/category?id={id}&sort={sort}&page={page}&filter=...` 返回`{AlbumList}` 获取**Category**内容 1. `page`是基于1的,默认值为`1` 1. `sort`参数对非**Category**类**Album**不起作用 * **GET** `/1/{ns}/album?id={id}`,返回: `{AlbumList}` 获取**Album**内容 * **GET** `/1/{ns}/search?q=word&category=c1/c2`,返回: `{AlbumList}` 搜索 * **GET** `/1/{ns}/home`,返回: `{AlbumList}` 主页 * **GET** `/1/{ns}/item?id={id}`,返回: `{ItemList}` 获取单个**Item**信息 * **GET** `/1/{ns}/download?item={id}`,返回: 待定 ``` -------------------------------- ### JSON Schema for AlbumList Entity Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines a multi-page list of Albums, including the main body of Album entities and a preload section for images. ```JSON { "body": [{Album}, {Album}, ...], "preload": { "images": [ "...", "..." ] } } ``` -------------------------------- ### Android Library Core Components Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md Key components provided by the Android TV Metro library for building UI elements and loading data, facilitating the creation of metro-style layouts. ```APIDOC RecommendCardView: Card view component for metro layouts GenericSubjectLoader: Loader for album data (tabs are an instance of an album) ``` -------------------------------- ### JSON Schema for ItemList Entity Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines a list of Items, including the main body of Item entities and a preload section for images. ```JSON { "body": [{Item}, {Item}], "preload": { "images": [ "...", "..." ] } } ``` -------------------------------- ### JSON Schema for UI Display Information Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines UI-related display information for an item or album, including its UI type and optional layout details. ```JSON { "type": "...", "layout": { "w": .., "h": .. } } ``` -------------------------------- ### JSON Schema for Image Entity Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines the structure for a single image, including its URL, background color, optional position and animation, and size. ```JSON { "url": "http://...", "bgcolor": "#3Fde88", "pos": {"x":100, "y":300}, "ani": { ... }, "size": {"w": 890, "h": 789} } ``` -------------------------------- ### General TV Metro API Endpoint Structure Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md Describes the general structure for accessing resources via the TV Metro API, including namespace (ns), resource type (type), and resource ID (id). ```APIDOC http://host/v1/ns/type/?id=res_id ns : namespace, resource type type: item or item list id : resource id in back-end server system ``` -------------------------------- ### JSON Schema for Album Entity Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines the structure for an Album, which is a collection of Items, extending DisplayItem with properties like category status, sort rule, pagination, and a list of DisplayItems. ```JSON { "is_category": true|false, "sort": "..", "pagi": "..", "items": [ {DisplayItem}, {DisplayItem} ] } ``` -------------------------------- ### JSON Schema for DisplayItem Entity Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines the basic fields for an Item when displayed in a list, including namespace, type, ID, name, images, and UI information. ```JSON { "ns": "app|game|video", "type": "category|album|item", "id": "...", "name": "...", "images": {ImageGroup}, "_ui": {UI} } ``` -------------------------------- ### JSON Schema for ImageGroup Entity Source: https://github.com/xiaomi/android_tv_metro/blob/master/server/TVMarketAPI.md Defines a collection of images that form a display effect, including background, text, spirit, icon, and thumbnail images. ```JSON { "bg": {Image}, "text": {Image}, "spirit": {Image}, "icon": {Image}, "thumb":{Image} } ``` -------------------------------- ### Home Page JSON Data Structure Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md Defines the JSON structure for the main home page display data. It consists of a 'data' array, where each element represents a tab or section, typically an album containing display items. ```JSON { "data": [ { "items": [display items], "images": {}, "name": "TAB 1", "id": "recommend", "type": "album", "ns": "video" }, { "items": [display item], "images": {}, "name": "TAB 2", "id": "recommend", "type": "album", "ns": "video" } ] } ``` -------------------------------- ### TV Metro Album JSON Structure Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md Defines the comprehensive JSON structure for an album, which acts as a container for multiple display items. It includes details such as item lists, image placeholders, names, timestamps, UI types, and identifiers for various categories like games and videos. ```JSON { "data": [ { "items": [display items], "images": { }, "name":"game tab name", "times": { "updated": 0, "created": 0 }, "_ui": { "type": "metro" }, "id": "recommend", "type": "album", "ns": "game" }, { "items": [display items], "images": { }, "name": "game tab Name", "times": { "updated": 0, "created": 0 }, "_ui": { "type": "metro" }, "id": "categories", "type": "album", "ns": "game" }, { "items": [dispay items], "images": { }, "name": "video tab name", "times": { "updated": 0, "created": 0 }, "_ui": { "type": "metro" }, "id": "recommend", "type": "album", "ns": "video" }, { "items": [display items], "images": { }, "name": "video tab name", "times": { "updated": 0, "created": 0 }, "_ui": { "type": "metro" }, "id": "categories", "type": "album", "ns": "video" } ], "preload": { "images": [] }, "update_time": 0 } ``` -------------------------------- ### Detailed TV Metro Display Item JSON Structure Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md A more detailed definition of the JSON structure for a display item, expanding on image types (text, icon, back, spirit) and including UI layout properties. Note: This snippet appears to be incomplete. ```JSON { "target": { "type": "item" }, "images": { "text": { "url": "", "ani": {}, "pos": {} }, "icon": { "url": "", "ani": {}, "pos": {} }, "back": { "url": "http://xxx/fffff.png", "ani": {}, "pos": {} }, "spirit": { "url": "", "ani": {}, "pos": {} } }, "name": "name", "times": { "updated": 1404466152, "created": 1404454443 }, "_ui": { "type": "metro_cell_banner", "layout": { "y": 1, ``` -------------------------------- ### Retrieve TV Metro Album Details API Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md API endpoint to retrieve details for a specific album (e.g., game, video, app) using its resource ID. This endpoint returns an album object. ```APIDOC http://host/game(video/app)/album?id=6464 return album ``` -------------------------------- ### TV Metro Display Item JSON Structure Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md Defines the JSON structure for a single display item. It includes properties for target type, image assets, name, timestamps, UI layout, and unique identifiers. ```JSON { "target": { "type": "item" }, "images": { "back": { "url": "", "ani": {}, "pos": {} } }, "name": "Display Name)", "times": { "updated": 1409202939, "created": 1409202939 }, "_ui": { "layout": { "y": 2, "x": 3, "w": 1, "h": 1 }, "type": "metro_cell_banner" }, "id": "987722", "type": "item", "ns": "video" } ``` -------------------------------- ### Unused Android Dimension Resources: Text Sizes Source: https://github.com/xiaomi/android_tv_metro/blob/master/android/res.txt A collection of Android XML dimension resource definitions for various text sizes, ranging from 8dp to 16dp. These resources are flagged by the Android lint tool as unused, indicating they are defined in `res/values/dimens.xml` but not referenced elsewhere in the project. ```XML 8dp 9dp 10dp 11dp 12dp 12.5dp 13dp 14dp 15dp 16dp ``` -------------------------------- ### Unused Android Color Resources: White Shades Source: https://github.com/xiaomi/android_tv_metro/blob/master/android/res.txt A collection of Android XML color resource definitions for various shades of white, ranging from 70% to 90% opacity. These resources are flagged by the Android lint tool as unused, indicating they are defined in `res/values/colors.xml` but not referenced elsewhere in the project. ```XML #B3FFFFFF #C0FFFFFF #CCFFFFFF #E6FFFFFF ``` -------------------------------- ### Retrieve TV Metro Category Details API Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md API endpoint to retrieve details for a specific category, which is conceptually similar to an album, using its resource ID. This endpoint returns an album object. ```APIDOC http://host/game(video/app)/category?id=123456 return album ``` -------------------------------- ### Retrieve TV Metro Display Item Details API Source: https://github.com/xiaomi/android_tv_metro/blob/master/README.md API endpoint to retrieve details for a specific display item (e.g., game, video, app) using its resource ID. This endpoint typically returns a single item's details. ```APIDOC http://host/game(video/app)/item?id=12346 return item list ``` -------------------------------- ### Unused Android Color Resources: Black Shades Source: https://github.com/xiaomi/android_tv_metro/blob/master/android/res.txt A collection of Android XML color resource definitions for various shades of black, ranging from 10% to 100% opacity. These resources are flagged by the Android lint tool as unused, indicating they are defined in `res/values/colors.xml` but not referenced elsewhere in the project. ```XML #19000000 #33000000 #4C000000 #66000000 #80000000 #99000000 #B3000000 #CC000000 #E6000000 #FE000000 ``` -------------------------------- ### ProGuard Rule for Android WebView JavaScript Interface Source: https://github.com/xiaomi/android_tv_metro/blob/master/android/proguard-project.txt This ProGuard rule is used to prevent obfuscation and shrinking of a JavaScript interface class that interacts with an Android WebView. It ensures that all public members of the specified class are kept, which is crucial for JavaScript to successfully call native Android methods. ```ProGuard #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} ``` -------------------------------- ### Configure ProGuard for WebView JavaScript Interface Source: https://github.com/xiaomi/android_tv_metro/blob/master/android/TVMetroSample/proguard-project.txt This ProGuard rule prevents the obfuscation or removal of public methods within a specified JavaScript interface class used by Android's WebView. This is crucial to ensure that JavaScript code running in the WebView can successfully call these methods without encountering NoSuchMethodError or similar issues after ProGuard processing. ```ProGuard Configuration -keepclassmembers class fqcn.of.javascript.interface.for.webview { public *; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.