1 /* 2 * Copyright (C) 2020 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.development; 18 19 import android.content.Context; 20 import android.view.LayoutInflater; 21 import android.widget.Button; 22 23 /** 24 * Foundation interface glues between Activities and UIs like {@link AdbWirelessDialog}. 25 */ 26 public interface AdbWirelessDialogUiBase { 27 /** 28 * Dialog shown when pairing a device via six-digit code. 29 */ 30 int MODE_PAIRING = 0; 31 /** 32 * Dialog shown when connecting to a paired device failed. 33 */ 34 int MODE_CONNECTION_FAILED = 1; 35 /** 36 * Dialog shown when pairing failed. 37 */ 38 int MODE_PAIRING_FAILED = 2; 39 40 /** 41 * Dialog shown when QR code pairing failed. 42 */ 43 int MODE_QRCODE_FAILED = 3; 44 45 /** 46 * Gets the context for the dialog. 47 * 48 * @return the context for the dialog 49 */ getContext()50 Context getContext(); 51 52 /** 53 * Gets the controller for the dialog. 54 * 55 * @return the controller for the dialog. 56 */ getController()57 AdbWirelessDialogController getController(); 58 59 /** 60 * Gets the layout for the dialog. 61 * 62 * @return the {@link LayoutInflater} for the dialog 63 */ getLayoutInflater()64 LayoutInflater getLayoutInflater(); 65 66 /** 67 * Gets the dialog mode/ID. 68 * 69 * @return the mode of the dialog 70 */ getMode()71 int getMode(); 72 73 /** 74 * Sends a submit command to the dialog. 75 */ dispatchSubmit()76 void dispatchSubmit(); 77 78 /** 79 * Enables if user can cancel a dialog by clicking outside of the dialog. 80 * 81 * @param cancel The flag indicating if can cancel by clicking outside 82 */ setCanceledOnTouchOutside(boolean cancel)83 void setCanceledOnTouchOutside(boolean cancel); 84 85 /** 86 * Sets the title of the dialog. 87 * 88 * @param id the string id 89 */ setTitle(int id)90 void setTitle(int id); 91 92 /** 93 * Sets the title of the dialog. 94 * 95 * @param title the title string 96 */ setTitle(CharSequence title)97 void setTitle(CharSequence title); 98 99 /** 100 * Sets the text for the submit button. 101 * 102 * @param text the submit text 103 */ setSubmitButton(CharSequence text)104 void setSubmitButton(CharSequence text); 105 106 /** 107 * Sets the text for the cancel button. 108 * 109 * @param text the cancel text 110 */ setCancelButton(CharSequence text)111 void setCancelButton(CharSequence text); 112 113 /** 114 * Gets the button widget for the submit button. 115 * 116 * @return the submit {@link Button} widget 117 */ getSubmitButton()118 Button getSubmitButton(); 119 120 /** 121 * Gets the button widget for the cancel button. 122 * 123 * @return the cancel {@link Button} widget 124 */ getCancelButton()125 Button getCancelButton(); 126 } 127