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 
17 package android.provider;
18 
19 import android.annotation.SystemApi;
20 import android.content.Context;
21 
22 /**
23  * Search Indexable Resource.
24  *
25  * This class wraps a set of reference information representing data that can be indexed from a
26  * resource which would typically be a {@link android.preference.PreferenceScreen}.
27  *
28  * xmlResId: the resource ID of a {@link android.preference.PreferenceScreen} XML file.
29  *
30  * @see SearchIndexableData
31  * @see android.preference.PreferenceScreen
32  *
33  * @hide
34  */
35 @SystemApi
36 public class SearchIndexableResource extends SearchIndexableData {
37 
38     /**
39      * Resource ID of the associated {@link android.preference.PreferenceScreen} XML file.
40      */
41     public int xmlResId;
42 
43     /**
44      * Constructor.
45      *
46      * @param rank the rank of the data.
47      * @param xmlResId the resource ID of a {@link android.preference.PreferenceScreen} XML file.
48      * @param className the class name associated with the data (generally a
49      *                  {@link android.app.Fragment}).
50      * @param iconResId the resource ID associated with the data.
51      */
SearchIndexableResource(int rank, int xmlResId, String className, int iconResId)52     public SearchIndexableResource(int rank, int xmlResId, String className, int iconResId) {
53         super();
54         this.rank = rank;
55         this.xmlResId = xmlResId;
56         this.className = className;
57         this.iconResId = iconResId;
58     }
59 
60     /**
61      * Constructor.
62      *
63      * @param context the Context associated with the data.
64      */
SearchIndexableResource(Context context)65     public SearchIndexableResource(Context context) {
66         super(context);
67     }
68 
69     @Override
toString()70     public String toString() {
71         final StringBuilder sb = new StringBuilder();
72         sb.append("SearchIndexableResource[");
73         sb.append(super.toString());
74         sb.append(", ");
75         sb.append("xmlResId: ");
76         sb.append(xmlResId);
77         sb.append("]");
78 
79         return sb.toString();
80     }
81 }