|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
|
|
<!--
|
|
|
============================================================================
|
|
|
searchable.xml - Android可搜索配置资源文件
|
|
|
============================================================================
|
|
|
功能:定义便签应用与Android系统搜索框架的集成配置
|
|
|
位置:res/xml/searchable.xml
|
|
|
用途:将便签内容集成到Android全局搜索系统
|
|
|
============================================================================
|
|
|
Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
you may not use this file except in compliance with the License.
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
See the License for the specific language governing permissions and
|
|
|
limitations under the License.
|
|
|
============================================================================
|
|
|
-->
|
|
|
|
|
|
<!--
|
|
|
======================= 搜索配置定义 =======================
|
|
|
searchable元素:Android搜索框架的核心配置元素
|
|
|
所有搜索相关属性都在此元素中定义
|
|
|
注意:XML注释必须完全在元素外部,不能在元素开始标记内
|
|
|
-->
|
|
|
<searchable
|
|
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
android:label="@string/search_label"
|
|
|
android:hint="@string/search_hint"
|
|
|
android:searchMode="queryRewriteFromText"
|
|
|
android:searchSuggestAuthority="micode_notes"
|
|
|
android:searchSuggestIntentAction="android.intent.action.VIEW"
|
|
|
android:searchSettingsDescription="@string/search_setting_description"
|
|
|
android:includeInGlobalSearch="true" />
|
|
|
<!--
|
|
|
======================= Android命名空间声明 =======================
|
|
|
属性:xmlns:android
|
|
|
值:http://schemas.android.com/apk/res/android
|
|
|
功能:声明Android框架的XML命名空间
|
|
|
用途:使代码能够使用Android特定的属性和资源
|
|
|
要求:必须是searchable元素的第一个属性
|
|
|
注意:命名空间URI是固定的,不能更改
|
|
|
-->
|
|
|
|
|
|
|
|
|
<!--
|
|
|
======================= 搜索应用显示标签 =======================
|
|
|
属性:android:label
|
|
|
值:@string/search_label
|
|
|
功能:在系统搜索设置界面中显示的便签应用名称
|
|
|
对应字符串:R.string.search_label = "Searching Notes"
|
|
|
用户可见:用户在系统设置→搜索→可搜索项中看到此名称
|
|
|
重要性:帮助用户识别和启用便签的搜索功能
|
|
|
-->
|
|
|
|
|
|
|
|
|
<!--
|
|
|
======================= 搜索输入框提示文本 =======================
|
|
|
属性:android:hint
|
|
|
值:@string/search_hint
|
|
|
功能:在搜索输入框中显示的灰色占位提示文本
|
|
|
对应字符串:R.string.search_hint = "Search notes"
|
|
|
用户引导:提示用户在便签中搜索内容
|
|
|
设计:简洁明了,使用动词开头
|
|
|
-->
|
|
|
|
|
|
|
|
|
<!--
|
|
|
======================= 搜索结果呈现模式 =======================
|
|
|
属性:android:searchMode
|
|
|
值:queryRewriteFromText
|
|
|
功能:定义用户从搜索结果进入应用时的数据传递方式
|
|
|
模式说明:queryRewriteFromText表示传递搜索查询文本
|
|
|
处理流程:
|
|
|
1. 用户从系统搜索选择便签结果
|
|
|
2. 系统将搜索查询文本传递给便签应用
|
|
|
3. 应用接收文本并执行搜索逻辑
|
|
|
4. 应用显示自定义的搜索结果界面
|
|
|
优势:应用完全控制搜索逻辑和结果显示
|
|
|
-->
|
|
|
|
|
|
|
|
|
<!--
|
|
|
======================= 搜索建议数据源标识 =======================
|
|
|
属性:android:searchSuggestAuthority
|
|
|
值:notes
|
|
|
功能:定义提供实时搜索建议的ContentProvider权限
|
|
|
技术实现:对应AndroidManifest.xml中的ContentProvider声明
|
|
|
工作机制:
|
|
|
1. 用户在搜索框输入时,系统查询此数据源
|
|
|
2. 系统向content://notes/search_suggest_query发送查询
|
|
|
3. ContentProvider返回匹配的便签建议
|
|
|
4. 系统显示建议列表供用户选择
|
|
|
要求:应用需实现对应的ContentProvider支持搜索建议
|
|
|
-->
|
|
|
|
|
|
|
|
|
<!--
|
|
|
======================= 搜索建议点击动作 =======================
|
|
|
属性:android:searchSuggestIntentAction
|
|
|
值:android.intent.action.VIEW
|
|
|
功能:定义用户点击搜索建议时系统创建的Intent动作
|
|
|
动作说明:ACTION_VIEW表示查看内容的标准动作
|
|
|
处理流程:
|
|
|
1. 用户从搜索建议列表选择一项
|
|
|
2. 系统创建ACTION_VIEW Intent
|
|
|
3. Intent包含选中便签的数据URI
|
|
|
4. 系统启动能够处理此Intent的Activity
|
|
|
5. NoteEditActivity接收并显示便签内容
|
|
|
数据格式:Intent包含content://notes/notes/便签ID
|
|
|
-->
|
|
|
|
|
|
|
|
|
<!--
|
|
|
======================= 搜索功能描述文本 =======================
|
|
|
属性:android:searchSettingsDescription
|
|
|
值:@string/search_setting_description
|
|
|
功能:在系统搜索设置中显示的详细功能描述
|
|
|
对应字符串:R.string.search_setting_description = "Text in your notes"
|
|
|
用户可见:用户点击搜索设置项时看到的说明
|
|
|
设计目的:明确告知用户搜索的内容范围
|
|
|
重要性:帮助用户理解便签搜索功能
|
|
|
-->
|
|
|
|
|
|
|
|
|
<!--
|
|
|
======================= 全局搜索集成开关 =======================
|
|
|
属性:android:includeInGlobalSearch
|
|
|
值:true
|
|
|
功能:控制是否将便签内容集成到Android全局搜索
|
|
|
启用效果:
|
|
|
1. 便签内容出现在系统全局搜索结果中
|
|
|
2. 用户可从任何地方搜索便签内容
|
|
|
3. 支持多种搜索入口:
|
|
|
- 设备搜索物理键
|
|
|
- 桌面搜索小部件
|
|
|
- 语音搜索命令
|
|
|
- 快捷搜索方式
|
|
|
用户控制:用户可在系统设置中禁用此集成
|
|
|
设计理念:提供统一的无缝搜索体验
|
|
|
-->
|