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