SearchIndexableResource.java revision 71b3975c8a9c11a88d18b2851066049dda4000c2
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 this.rank = rank; 52 this.xmlResId = xmlResId; 53 this.className = className; 54 this.iconResId = iconResId; 55 } 56 57 /** 58 * Constructor. 59 * 60 * @param context the Context associated with the data. 61 */ 62 public SearchIndexableResource(Context context) { 63 super(context); 64 } 65 66 @Override 67 public String toString() { 68 final StringBuilder sb = new StringBuilder(); 69 sb.append("SearchIndexableResource["); 70 sb.append(super.toString()); 71 sb.append(", "); 72 sb.append("xmlResId: "); 73 sb.append(xmlResId); 74 sb.append("]"); 75 76 return sb.toString(); 77 } 78}