Customizing the Reference TV App

2024-01-19 13:38
文章标签 app reference tv customizing

本文主要是介绍Customizing the Reference TV App,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

本文转载自:https://source.android.google.cn/devices/tv/customize-tv-app

Live TV is a reference TV app designed for Android television devices. However,device manufacturers may want to add more product-specific functions, which arenot covered by the default implementation of Live TV, such as pictureadjustment, game mode, or 3D mode. To support these device-specific functions oroptions, Live TV supports these customizations:

  • Enabling time-shifting mode, which allows users to pause, fast forward, and rewind. Configuring time-shifting mode to use external storage instead of internal storage.
  • Adding options to the TV options row.
  • Adding a custom row and adding options in it.

Note: LiveChannels is Google's implementation of Live TV that can be used as is ondevices with Google services. To customize Live Channels, replacecom.android.tv.* with com.google.android.tv.* in theseinstructions.

Customizing Live TV

To customize Live TV, the target Android TV device needs a customization packageinstalled, which must be a prebuilt system app with thecom.android.tv.permission.CUSTOMIZE_TV_APP permission.

Live TV searches for a system package with this permission, checks the resourcefiles, and detects the package's Activitiesmarked with specific categoriesto process customization.

Key point: Only one package can customize Live TV.

Configuring time-shifting mode

Time-shifting (trickplay) allows Android television devices to pause, rewind,and fast forward channel playback. In the Live TV implementation, time-shiftingcan be used via the Play controls UI. Time-shifting is enabled by default inLive TV, but can be disabled. Time-shifting can also be configured to useexternal storage only.

To configure time-shifting, add the string resource trickplay_modeand set its value to one of these options:

  • enabled: Enable time-shifting. This is the default value when no options are given.
  • disabled: Disable time-shifting.
  • use_external_storage_only: Configure time-shifting to use external storage.
<string name="trickplay_mode">use_external_storage_only</string>
Play controls UI is activated afterpressing the D-pad center button.

Figure 1. Play controls UI is activated after pressing theD-pad center button.

Customizing TV options

Device manufacturers can add custom options for Live TV settings to the existingTV options menu, such as adding a shortcut to the Sound Picture settings.

To indicate a custom option, declare an intent-filter that filters the categorycom.android.tv.category.OPTIONS_ROW in an activity. The custom featureis implemented by the device manufacturer in the activity. The activitylaunches if the option is clicked. The activity's title and icon are used forthe option. Customized TV options should match the existing UI to provide thebest user experience.

Note: An activity can only handle one optionbecause Live TV cannot differentiate intent-filters in an activity with the samecategory due to the Android limitation. See Handle multiple options in anactivity for a workaround.

Device manufacturers can also place a custom option before or after the existingoptions by defining android:priority in AndroidManifest.xml.An option with a defined priority value lower than 100 shows before the existingitems and a value higher than 100 shows after. Multiple custom options (eitherbefore or after existing options) are sorted by their priority in ascendingorder. If options have the same priority, order among them is undefined.

In this example, the option appears first in the TV options row, andPictureSettingsActivity launches if the option is clicked.

<activity android:name=".PictureSettingsActivity"android:label="@string/activity_label_picture_settings"android:theme="@style/Theme.Panel"><intent-filterandroid:icon="@drawable/ic_tvoptions_brightness"android:label="@string/option_label_brightness"android:priority="0"><action android:name="android.intent.action.MAIN" /><category android:name="com.android.tv.category.OPTIONS_ROW" /></intent-filter>
</activity>

Sample customized TV options row

Figure 2. Sample customized TV options row (Brightness andEnergy Saving).

Sample custom TV options.

Figure 3. Sample custom TV options.

Handling multiple options in an activity

An option maps to an activity's intent-filter and vice-versa. Because Androiddoesn't differentiate intent-filters with the same categories and actions, anactivity only handles one option, even if multiple intent-filters are declaredin it. To handle multiple options in an activity, use<activity-alias> in AndroidManifest.xml. In theactivity, use getIntent().getComponent() to identify the clicked option.

<activity-alias android:name=".AnyUniqueName"android:targetActivity=".PictureSettingsActivity"><intent-filterandroid:icon="@drawable/ic_tvoptions_energy_saving"android:label="@string/option_label_energy_saving"android:priority="1"><action android:name="android.intent.action.MAIN" /><category android:name="com.android.tv.category.OPTIONS_ROW" /></intent-filter>
</activity-alias>

Creating a custom row

Device manufacturers can add and customize a row above the TV options row.This custom row is optional.

Row Title

Define a partner_row_title string inres/values/strings.xml. The string's value is used for the customrow title.

<string name="partner_row_title">Partner Row</string>
Custom options

To add custom options to the custom row, follow the process for adding optionsto the TV options menu, but change the category name tocom.android.tv.category.PARTNER_ROW instead.

<activity android:name=".ThreeDimensionalSettingDialogActivity"android:label="@string/activity_label_3d"android:theme="@android:style/Theme.Material.Light.Dialog"><intent-filterandroid:icon="@drawable/ic_tvoptions_3d"android:priority="0"><action android:name="android.intent.action.MAIN" /><category android:name="com.android.tv.category.PARTNER_ROW" /></intent-filter>
</activity>

Sample optional custom row.

Figure 4. Sample optional custom row.

Sample custom option dialog.

Figure 5. Sample custom option dialog.


这篇关于Customizing the Reference TV App的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/622593

相关文章

深入理解PHP7之REFERENCE

REFERENCE 上一章说过引用(REFERENCE)在PHP5的时候是一个标志位, 而在PHP7以后我们把它变成了一种新的类型:IS_REFERNCE. 然而引用是一种很常见的应用, 所以这个变化带来了很多的变化, 也给我们在做PHP7开发的时候, 因为有的时候疏忽忘了处理这个类型, 而带来不少的bug. 最简单的情况, 就是在处理各种类型的时候, 从此以后我们要多考虑这种新的类型, 比如

MFC中App,Doc,MainFrame,View各指针的互相获取

纸上得来终觉浅,为了熟悉获取方法,我建了个SDI。 首先说明这四个类的执行顺序是App->Doc->Main->View 另外添加CDialog类获得各个指针的方法。 多文档的获取有点小区别,有时间也总结一下。 //  App void CSDIApp::OnApp() {      //  App      //  Doc     CDocument *pD

ConstraintLayout布局里的一个属性app:layout_constraintDimensionRatio

ConstraintLayout 这是一个约束布局,可以尽可能的减少布局的嵌套。有一个属性特别好用,可以用来动态限制宽或者高app:layout_constraintDimensionRatio 关于app:layout_constraintDimensionRatio参数 app:layout_constraintDimensionRatio=“h,1:1” 表示高度height是动态变化

App Store最低版本要求汇总

1,自此日期起: 2024 年 4 月 29 日 自 2024 年 4 月 29 日起,上传到 App Store Connect 的 App 必须是使用 Xcode 15 为 iOS 17、iPadOS 17、Apple tvOS 17 或 watchOS 10 构建的 App。将 iOS App 提交至 App Store - Apple Developer 2,最低XCode版本 Xcod

鸿蒙自动化发布测试版本app

创建API客户端 API客户端是AppGallery Connect用于管理用户访问AppGallery Connect API的身份凭据,您可以给不同角色创建不同的API客户端,使不同角色可以访问对应权限的AppGallery Connect API。在访问某个API前,必须创建有权访问该API的API客户端。 1.登录AppGallery Connect网站,选择“用户与访问”。选择左侧

Xinstall助力App全渠道统计,参数传递下载提升用户体验!

在移动互联网时代,App已成为我们日常生活中不可或缺的一部分。然而,对于App开发者来说,如何有效地推广和运营自己的应用,却是一个不小的挑战。尤其是在面对众多渠道、复杂的数据统计和用户需求多样化的情况下,如何精准地触达目标用户,提升用户的下载、安装和活跃度,更是考验着每一个运营者的智慧。 今天,我们就来揭秘一个能够帮助App开发者解决这些痛点的神器——Xinstall。作为一家一站式App全渠道

Flask 创建app 时候传入的 static_folder 和 static_url_path参数理解

Flask 在创建app的时候 是用 app = Flask(__name__) 来创建的,不传入 static_folder参数的话 ,默认的静态文件的位置是在 static目录下 我们可以进入 Flask的源码里面查看 ctrl+鼠标左键进入 这是Flask的 __init__源码(后面还有一些,我就选了需要的代码)     def __init__(self,import_

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFArra

这个错误说的是一个不可变数组负值给了一个可变的数组。有可能你前面定义的数组是一个可变数组,但是在你其他方法里面用他的时候,他就是一个不可变数组,因为在可变数组拿到别的地方用的时候,他会默认为不可变的,可能这只是一个类里面你只是简单的声明了他吧,并没有进行对他初始化,或者分配什么内存,所以他只是一个不可变的数组,当你在其他地方用他的时候,他就默认为不可变的数组,他可能因为你的没分配内存,而变回不可变

app提交到腾讯开发平台,提示无法获取签名信息,请上传有效包(110506)

最近提交APP时遇到的,一般情况下是因为打包时至勾选v2没有勾选v1的原因,如下图: 这个时候将v1勾选即可。 但是在打包时ˉv1和v2都勾选了也可能会出现这个报错,那就要看一下gradle的 minSdkVersion,如果这个版本在24-26之间也可能会提示这个错误,所以降低这个版本就可以了

基于Python的电商导购APP设计与实现

基于Python的电商导购APP设计与实现 Design and Implementation of an E-commerce Shopping Guide App based on Python 完整下载链接:基于Python的电商导购APP设计与实现 文章目录 基于Python的电商导购APP设计与实现摘要第一章 简介1.1 研究背景1.2 研究目的1.3 研究方法1.4 论文结