1 /* 2 * Copyright (C) 2022 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 package com.android.quicksearchbox 17 18 import android.content.ComponentName 19 20 /** A Suggestion that delegates all calls to other suggestions. */ 21 abstract class AbstractSuggestionWrapper : Suggestion { 22 /** Gets the current suggestion. */ currentnull23 protected abstract fun current(): Suggestion? 24 override val shortcutId: String? 25 get() = current()?.shortcutId 26 override val suggestionFormat: String? 27 get() = current()?.suggestionFormat 28 override val suggestionIcon1: String? 29 get() = current()?.suggestionIcon1 30 override val suggestionIcon2: String? 31 get() = current()?.suggestionIcon2 32 override val suggestionIntentAction: String? 33 get() = current()?.suggestionIntentAction 34 override val suggestionIntentComponent: ComponentName? 35 get() = current()?.suggestionIntentComponent 36 override val suggestionIntentDataString: String? 37 get() = current()?.suggestionIntentDataString 38 override val suggestionIntentExtraData: String? 39 get() = current()?.suggestionIntentExtraData 40 override val suggestionLogType: String? 41 get() = current()?.suggestionLogType 42 override val suggestionQuery: String? 43 get() = current()?.suggestionQuery 44 override val suggestionSource: Source? 45 get() = current()?.suggestionSource 46 override val suggestionText1: String? 47 get() = current()?.suggestionText1 48 override val suggestionText2: String? 49 get() = current()?.suggestionText2 50 override val suggestionText2Url: String? 51 get() = current()?.suggestionText2Url 52 override val isSpinnerWhileRefreshing: Boolean 53 get() = current()?.isSpinnerWhileRefreshing == true 54 override val isSuggestionShortcut: Boolean 55 get() = current()?.isSuggestionShortcut == true 56 override val isWebSearchSuggestion: Boolean 57 get() = current()?.isWebSearchSuggestion == true 58 override val isHistorySuggestion: Boolean 59 get() = current()?.isHistorySuggestion == true 60 override val extras: SuggestionExtras? 61 get() = current()?.extras 62 } 63