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