树叶云鸿蒙OS教程:鸿蒙OS NotificationUserInput

NotificationUserInput

java.lang.Object

|—ohos.event.notification.NotificationUserInput

public class NotificationUserInput
extends Object
implements Sequenceable

定义用户输入,它将与发送的 IntentAgent 中的意图一起传递。 您应该始终使用 NotificationUserInput.Builder 创建此类的实例。 您可以调用 NotificationActionButton.Builder#addNotificationUserInput(NotificationUserInput) 将 NotificationUserInput 对象添加到 NotificationActionButton。

Since:

3

嵌套类摘要

修饰符和类型描述
static classNotificationUserInput.BuilderNotificationUserInput 对象的构建器类。
从接口 ohos.utils.Sequenceable 继承的嵌套类/接口
Sequenceable.ProducerT

字段摘要

修饰符和类型字段描述
static Sequenceable.ProducerNotificationUserInputPRODUCER从 Parcel 创建 NotificationUserInput 实例。

方法总结

修饰符和类型方法描述
static voidaddInputsToIntent(ListNotificationUserInput userInputs, Intent intent, PacMap pacMap)将 NotificationUserInput 对象列表添加到 Intent。
static voidaddMimeInputToIntent(NotificationUserInput userInput, Intent intent, MapString,Uri results)将指定 MIME 类型的给定 NotificationUserInput 对象添加到 Intent。
PacMapgetAdditionalData()获取包含在此 NotificationUserInput 对象中的附加数据。
intgetEditType()获取此 NotificationUserInput 对象提供的选项的编辑类型。
StringgetInputKey()获取此 NotificationUserInput 对象的键。
static PacMapgetInputsFromIntent(Intent intent)从指定的 ohos.aafwk.content.Intent 获取输入文本结果。
static intgetInputsSource(Intent intent)获取此 NotificationUserInput 对象的输入源。
static MapString,UrigetMimeInputsFromIntent(Intent intent, String inputKey)从指定的 ohos.aafwk.content.Intent 获取特定 MIME 类型的输入结果。
ListStringgetOptions()获取提供给用户的选项以满足用户输入需求。
SetStringgetPermitMimeTypes()获取此 NotificationUserInput 对象允许的 MIME 类型。
StringgetTag()当从用户那里收集这个输入时,获取要显示给用户的标签。
booleanisMimeTypeOnly()检查此 NotificationUserInput 对象是否仅允许特定 MIME 类型的值。
booleanisPermitFreeFormInput()检查用户是否可以为此 NotificationUserInput 对象提供任意值。
booleanmarshalling(Parcel out)将 NotificationUserInput 对象编组到 Parcel 中。
static voidsetInputsSource(Intent intent, NotificationConstant.InputsSource source)设置此 NotificationUserInput 对象的输入源。
StringtoString()返回对象的字符串表示形式。
booleanunmarshalling(Parcel in)从 Parcel 中解组 NotificationUserInput 对象。
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从接口 ohos.utils.Sequenceable 继承的方法
hasFileDescriptor

字段详细信息

PRODUCER

public static final Sequenceable.ProducerNotificationUserInput PRODUCER

从 Parcel 创建 NotificationUserInput 实例。

Since:

4

方法详情

addMimeInputToIntent

public static void addMimeInputToIntent(NotificationUserInput userInput, Intent intent, MapString,Uri results)

将指定 MIME 类型的给定 NotificationUserInput 对象添加到 Intent。 该方法与 addInputsToIntent(java.util.List, ohos.aafwk.content.Intent, ohos.utils.PacMap) 类似,只是必须指定 MIME 类型。

参数:

参数名称参数描述
userInput指示为其提供输入结果的 NotificationUserInput 对象。
intent指示要添加输入结果的 Intent。
results指示包含 MIME 类型及其 URI 结果的映射。

Since:

3

addInputsToIntent

public static void addInputsToIntent(ListNotificationUserInput userInputs, Intent intent, PacMap pacMap)

将 NotificationUserInput 对象列表添加到 Intent。 此方法仅应在将输入结果发送到 IntentAgent 时由用户输入收集服务调用。

参数:

参数名称参数描述
userInputs指示为其提供输入结果的 NotificationUserInput 对象的列表。
intent指示要添加输入结果的 Intent。
pacMap指示保存输入结果的 PacMap 对象。 PacMap 键必须与 userInputs 中指定的对象中包含的键匹配。

Since:

3

getMimeInputsFromIntent

public static MapString,Uri getMimeInputsFromIntent(Intent intent, String inputKey)

从指定的 ohos.aafwk.content.Intent 获取特定 MIME 类型的输入结果。 此方法类似于 getInputsFromIntent(ohos.aafwk.content.Intent),但使用的是 NotificationUserInput 的键。

参数:

参数名称参数描述
intent表示包含用户输入结果的 Intent。
inputKey表示要获取的 NotificationUserInput 结果的键。

返回:

返回包含 MIME 类型及其 URI 结果的映射。

Since:

3

getInputsFromIntent

public static PacMap getInputsFromIntent(Intent intent)

从指定的 ohos.aafwk.content.Intent 获取输入文本结果。

参数:

参数名称参数描述
intent表示包含一个或多个用户输入结果的 Intent 对象。

返回:

返回包含输入文本结果的 PacMap 对象。

Since:

3

setInputsSource

public static void setInputsSource(Intent intent, NotificationConstant.InputsSource source)

设置此 NotificationUserInput 对象的输入源。

参数:

参数名称参数描述
intent指示要添加输入结果的 Intent。
source表示输入源。

Since:

3

getInputsSource

public static int getInputsSource(Intent intent)

获取此 NotificationUserInput 对象的输入源。

参数:

参数名称参数描述
intent表示包含输入结果的 Intent。

返回:

返回此 NotificationUserInput 对象的输入源,如 NotificationConstant.InputsSource 中所枚举。

Since:

3

getInputKey

public String getInputKey()

获取此 NotificationUserInput 对象的键。

返回:

返回此 NotificationUserInput 对象的键。

Since:

3

getTag

public String getTag()

当从用户那里收集这个输入时,获取要显示给用户的标签。

返回:

返回要显示给用户的标签。

Since:

3

getOptions

public ListString getOptions()

获取提供给用户的选项以满足用户输入需求。

返回:

返回预定义选项的列表。

Since:

3

getPermitMimeTypes

public SetString getPermitMimeTypes()

获取此 NotificationUserInput 对象允许的 MIME 类型。

返回:

返回允许的 MIME 类型列表。

Since:

3

getAdditionalData

public PacMap getAdditionalData()

获取包含在此 NotificationUserInput 对象中的附加数据。

返回:

返回此 NotificationUserInput 对象中的附加数据。

Since:

3

isPermitFreeFormInput

public boolean isPermitFreeFormInput()

检查用户是否可以为此 NotificationUserInput 对象提供任意值。

返回:

如果此对象允许任意值,则返回 true; 否则返回 false。

Since:

3

isMimeTypeOnly

public boolean isMimeTypeOnly()

检查此 NotificationUserInput 对象是否仅允许特定 MIME 类型的值。

返回:

如果此对象仅允许特定 MIME 类型的值,则返回 true; 否则返回 false。

Since:

3

getEditType

public int getEditType()

获取此 NotificationUserInput 对象提供的选项的编辑类型。

返回:

返回选项的编辑类型。

Since:

4

marshalling

public boolean marshalling(Parcel out)

将 NotificationUserInput 对象编组到 Parcel 中。

进程可以调用 unmarshalling(ohos.utils.Parcel) 方法从 Parcel 中解组 NotificationUserInput 对象以实现进程间通信 (IPC)。

指定者:

接口 Sequenceable 中的编组

参数:

参数名称参数描述
out指示用于编组的 Parcel 对象。

返回:

如果编组成功,则返回 true; 否则返回 false。

Since:

3

unmarshalling

public boolean unmarshalling(Parcel in)

从 Parcel 中解组 NotificationUserInput 对象。

指定者:

在接口 Sequenceable 中解组

参数:

参数名称参数描述
in指示用于解组的 Parcel 对象。

返回:

如果解组成功,则返回 true; 否则返回 false。

Since:

3

toString

public String toString()

从类复制的描述:对象

返回对象的字符串表示形式。 通常,toString 方法返回一个“以文本方式表示”该对象的字符串。 结果应该是一个简洁但信息丰富的表示,易于人们阅读。 建议所有子类重写此方法。

Object 类的 toString 方法返回一个字符串,该字符串由对象作为其实例的类的名称、at 符号字符“@”和对象哈希码的无符号十六进制表示形式组成。 换句话说,此方法返回一个等于以下值的字符串:

 getClass().getName() + '@' + Integer.toHexString(hashCode()) 

覆盖:

类 Object 中的 toString

返回:

对象的字符串表示形式。

Since:

4

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/201985.html<

(0)
运维的头像运维
上一篇2025-04-06 00:36
下一篇 2025-04-06 00:37

相关推荐

  • 个人主题怎么制作?

    制作个人主题是一个将个人风格、兴趣或专业领域转化为视觉化或结构化内容的过程,无论是用于个人博客、作品集、社交媒体账号还是品牌形象,核心都是围绕“个人特色”展开,以下从定位、内容规划、视觉设计、技术实现四个维度,详细拆解制作个人主题的完整流程,明确主题定位:找到个人特色的核心主题定位是所有工作的起点,需要先回答……

    2025-11-20
    0
  • 社群营销管理关键是什么?

    社群营销的核心在于通过建立有温度、有价值、有归属感的社群,实现用户留存、转化和品牌传播,其管理需贯穿“目标定位-内容运营-用户互动-数据驱动-风险控制”全流程,以下从五个维度展开详细说明:明确社群定位与目标社群管理的首要任务是精准定位,需明确社群的核心价值(如行业交流、产品使用指导、兴趣分享等)、目标用户画像……

    2025-11-20
    0
  • 香港公司网站备案需要什么材料?

    香港公司进行网站备案是一个涉及多部门协调、流程相对严谨的过程,尤其需兼顾中国内地与香港两地的监管要求,由于香港公司注册地与中国内地不同,其网站若主要服务内地用户或使用内地服务器,需根据服务器位置、网站内容性质等,选择对应的备案路径(如工信部ICP备案或公安备案),以下从备案主体资格、流程步骤、材料准备、注意事项……

    2025-11-20
    0
  • 如何企业上云推广

    企业上云已成为数字化转型的核心战略,但推广过程中需结合行业特性、企业痛点与市场需求,构建系统性、多维度的推广体系,以下从市场定位、策略设计、执行落地及效果优化四个维度,详细拆解企业上云推广的实践路径,精准定位:明确目标企业与核心价值企业上云并非“一刀切”的方案,需先锁定目标客户群体,提炼差异化价值主张,客户分层……

    2025-11-20
    0
  • PS设计搜索框的实用技巧有哪些?

    在PS中设计一个美观且功能性的搜索框需要结合创意构思、视觉设计和用户体验考量,以下从设计思路、制作步骤、细节优化及交互预览等方面详细说明,帮助打造符合需求的搜索框,设计前的规划明确使用场景:根据网站或APP的整体风格确定搜索框的调性,例如极简风适合细线条和纯色,科技感适合渐变和发光效果,电商类则可能需要突出搜索……

    2025-11-20
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注