1 /* 2 * Copyright (C) 2016 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 com.android.settings.search2; 18 19 import android.annotation.IntDef; 20 import android.os.Parcelable; 21 22 import java.lang.annotation.Retention; 23 import java.lang.annotation.RetentionPolicy; 24 25 /** 26 * A interface for search results types. Examples include Inline results, third party apps 27 * or any future possibilities. 28 */ 29 public abstract class ResultPayload implements Parcelable { 30 31 @IntDef({PayloadType.INLINE_SLIDER, PayloadType.INLINE_SWITCH, 32 PayloadType.INTENT, PayloadType.SAVED_QUERY}) 33 @Retention(RetentionPolicy.SOURCE) 34 public @interface PayloadType { 35 /** 36 * Resulting page will be started using an intent 37 */ 38 int INTENT = 0; 39 40 /** 41 * Result is a inline widget, using a slider widget as UI. 42 */ 43 int INLINE_SLIDER = 1; 44 45 /** 46 * Result is a inline widget, using a toggle widget as UI. 47 */ 48 int INLINE_SWITCH = 2; 49 50 /** 51 * Result is a recently saved query. 52 */ 53 int SAVED_QUERY = 3; 54 } 55 56 @IntDef({SettingsSource.UNKNOWN, SettingsSource.SYSTEM, SettingsSource.SECURE, 57 SettingsSource.GLOBAL}) 58 @Retention(RetentionPolicy.SOURCE) 59 public @interface SettingsSource { 60 int UNKNOWN = 0; 61 int SYSTEM = 1; 62 int SECURE = 2; 63 int GLOBAL = 3; 64 } 65 66 67 @ResultPayload.PayloadType getType()68 public abstract int getType(); 69 } 70