SearchIndexableData.java revision b49995d4d997bf086c2f3214ca410b2a30861b13
1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.provider; 18 19import android.content.Context; 20 21import java.util.Locale; 22 23/** 24 * The Indexable data for Search. This abstract class defines the common parts for all search 25 * indexable data. 26 * 27 * @hide 28 */ 29public abstract class SearchIndexableData { 30 31 /** 32 * The context for the data. Will usually allow to retrieve some resources. 33 * 34 * @see Context 35 */ 36 public Context context; 37 38 /** 39 * The locale for the data 40 */ 41 public Locale locale; 42 43 /** 44 * The rank for the data. This is application specific. 45 */ 46 public int rank; 47 48 /** 49 * The class name associated with the data. Generally this is a Fragment class name for 50 * referring where the data is coming from and for launching the associated Fragment for 51 * displaying the data. This is used only when the data is provided "locally". 52 * 53 * If the data is provided "externally", the relevant information come from the 54 * {@link SearchIndexableData#intentAction} and {@link SearchIndexableData#intentTargetPackage} 55 * and {@link SearchIndexableData#intentTargetClass}. 56 * 57 * @see SearchIndexableData#intentAction 58 * @see SearchIndexableData#intentTargetPackage 59 * @see SearchIndexableData#intentTargetClass 60 */ 61 public String className; 62 63 /** 64 * The package name for retrieving the icon associated with the data. 65 * 66 * @see SearchIndexableData#iconResId 67 */ 68 public String packageName; 69 70 /** 71 * The icon resource ID associated with the data. 72 * 73 * @see SearchIndexableData#packageName 74 */ 75 public int iconResId; 76 77 /** 78 * The Intent action associated with the data. This is used when the 79 * {@link SearchIndexableData#className} is not relevant. 80 * 81 * @see SearchIndexableData#intentTargetPackage 82 * @see SearchIndexableData#intentTargetClass 83 */ 84 public String intentAction; 85 86 /** 87 * The Intent target package associated with the data. 88 * 89 * @see SearchIndexableData#intentAction 90 * @see SearchIndexableData#intentTargetClass 91 */ 92 public String intentTargetPackage; 93 94 /** 95 * The Intent target class associated with the data. 96 * 97 * @see SearchIndexableData#intentAction 98 * @see SearchIndexableData#intentTargetPackage 99 */ 100 public String intentTargetClass; 101 102 /** 103 * Default constructor. 104 */ 105 public SearchIndexableData() { 106 } 107 108 /** 109 * Constructor with a {@link Context}. 110 * 111 * @param ctx the Context 112 */ 113 public SearchIndexableData(Context ctx) { 114 context = ctx; 115 locale = Locale.getDefault(); 116 } 117} 118