| 1 | /* |
| 2 | * Copyright (C) 2018 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.internal.globalactions; |
| 17 | |
| 18 | import android.content.Context; |
| 19 | import android.view.LayoutInflater; |
| 20 | import android.view.View; |
| 21 | import android.view.ViewGroup; |
| 22 | |
| 23 | /** What each item in the global actions dialog must be able to support. */ |
| 24 | public interface Action { |
| 25 | /** @return Text that will be announced when dialog is created. {@code null} for none. */ |
| 26 | CharSequence getLabelForAccessibility(Context context); |
| 27 | |
| 28 | /** Create the view that represents this action. */ |
| 29 | View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater); |
| 30 | |
| 31 | /** Called when the action is selected by the user. */ |
| 32 | void onPress(); |
| 33 | |
| 34 | /** @return whether this action should appear in the dialog when the keygaurd is showing. */ |
| 35 | boolean showDuringKeyguard(); |
| 36 | |
| 37 | /** @return whether this action should appear in the dialog before the device is provisioned. */ |
| 38 | boolean showBeforeProvisioning(); |
| 39 | |
| 40 | /** @return {@code true} if the action is enabled for user interaction. */ |
| 41 | boolean isEnabled(); |
| 42 | } |