1 /*
2  * Copyright (C) 2019 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.wifi;
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 WifiDialog2}.
25  */
26 public interface WifiConfigUiBase2 {
27 
28     /**
29      * Viewing mode for a Wi-Fi access point. Data is displayed in non-editable mode.
30      */
31     int MODE_VIEW = 0;
32     /**
33      * Connect mode. Data is displayed in editable mode, and a connect button will be shown.
34      */
35     int MODE_CONNECT = 1;
36     /**
37      * Modify mode. All data is displayed in editable fields, and a "save" button is shown instead
38      * of "connect". Clients are expected to only save but not connect to the access point in this
39      * mode.
40      */
41     int MODE_MODIFY = 2;
42 
43     /**
44      * UI like {@link WifiDialog} overrides to provide {@link Context} to controller.
45      */
getContext()46     Context getContext();
47 
48     /**
49      * {@link WifiConfigController2} share the logic for controlling buttons, text fields, etc.
50      */
getController()51     WifiConfigController2 getController();
52 
53     /**
54      * UI like {@link WifiDialog} overrides to provide {@link LayoutInflater} to controller.
55      */
getLayoutInflater()56     LayoutInflater getLayoutInflater();
57 
58     /**
59      * One of MODE_VIEW, MODE_CONNECT and MODE_MODIFY of the UI like {@link WifiDialog}.
60      */
getMode()61     int getMode();
62 
63     /**
64      * For controller to dispatch submit event to host UI and UI like {@link WifiDialog}.
65      */
dispatchSubmit()66     void dispatchSubmit();
67 
68     /**
69      * UI like {@link WifiDialog} overrides to set title.
70      */
setTitle(int id)71     void setTitle(int id);
72 
73     /**
74      * UI like {@link WifiDialog} overrides to set title.
75      */
setTitle(CharSequence title)76     void setTitle(CharSequence title);
77 
78     /**
79      * UI like {@link WifiDialog} overrides to set submit button text.
80      */
setSubmitButton(CharSequence text)81     void setSubmitButton(CharSequence text);
82 
83     /**
84      * UI like {@link WifiDialog} overrides to set forget button text.
85      */
setForgetButton(CharSequence text)86     void setForgetButton(CharSequence text);
87 
88     /**
89      * UI like {@link WifiDialog} overrides to set cancel button text.
90      */
setCancelButton(CharSequence text)91     void setCancelButton(CharSequence text);
92 
93     /**
94      * UI like {@link WifiDialog} overrides to get submit button.
95      */
getSubmitButton()96     Button getSubmitButton();
97 
98     /**
99      * UI like {@link WifiDialog} overrides to get forget button.
100      */
getForgetButton()101     Button getForgetButton();
102 
103     /**
104      * UI like {@link WifiDialog} overrides to get cancel button.
105      */
getCancelButton()106     Button getCancelButton();
107 }
108