165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane/*
265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Copyright (C) 2014 The Android Open Source Project
365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Licensed under the Apache License, Version 2.0 (the "License");
565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * you may not use this file except in compliance with the License.
665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * You may obtain a copy of the License at
765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *      http://www.apache.org/licenses/LICENSE-2.0
965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
1065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Unless required by applicable law or agreed to in writing, software
1165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * distributed under the License is distributed on an "AS IS" BASIS,
1265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * See the License for the specific language governing permissions and
1465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * limitations under the License.
1565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */
1665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
1765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepackage com.android.tv.settings.connectivity;
1865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
1965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.R;
2065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.connectivity.setup.SelectFromListWizardFragment;
2165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.connectivity.setup.TextInputWizardFragment;
2265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.form.FormPage;
2365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
2465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.content.Context;
2565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.content.Intent;
2665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
2765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport java.util.ArrayList;
2865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
2965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane/**
3065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Wifi form pages.
3165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */
3265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepublic enum WifiFormPageType implements FormPageDisplayer.FormPageInfo {
3365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    CHOOSE_NETWORK(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE, R.string.title_select_wifi_network,
34cf4533d1371b0a7c5817a54164edb13a974e8d40Christopher Lane            0, new int[] { R.string.wps_network, R.string.other_network },
35cf4533d1371b0a7c5817a54164edb13a974e8d40Christopher Lane            new int[] { R.drawable.ic_wps, R.drawable.ic_menu_add }),
3665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    ENTER_SSID(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_ssid, 0,
3765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
3865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    CHOOSE_SECURITY(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE, R.string.security_type, 0,
3965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            new int[] { R.string.wifi_security_type_none, R.string.wifi_security_type_wep,
4065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_security_type_wpa, R.string.wifi_security_type_eap }),
4165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    ENTER_PASSWORD(FormPageDisplayer.DISPLAY_TYPE_PASSWORD_INPUT,
4265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_setup_input_password, 0, 0),
4365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    CONNECT(FormPageDisplayer.DISPLAY_TYPE_LOADING, R.string.wifi_connecting, 0),
4465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    CONNECT_FAILED(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
4565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_could_not_connect, 0, new int[] { R.string.wifi_action_try_again,
4665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_view_available_networks }),
4765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    CONNECT_TIMEOUT(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
4865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_could_not_connect_timeout, 0, new int[] {
4965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_try_again, R.string.wifi_action_view_available_networks }),
5065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    CONNECT_AUTHENTICATION_FAILURE(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
5165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_could_not_connect_authentication_failure, 0, new int[] {
5265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_try_again, R.string.wifi_action_view_available_networks }),
5365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    CONNECT_REJECTED_BY_AP(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
5465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_could_not_connect_ap_reject, 0, new int[] {
5565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_try_again, R.string.wifi_action_view_available_networks }),
5665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    SAVE(FormPageDisplayer.DISPLAY_TYPE_LOADING, R.string.wifi_saving, 0),
5765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    SAVE_FAILED(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
5865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_could_not_save, 0, new int[] { R.string.wifi_action_ok }),
5965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    SAVE_SUCCESS(FormPageDisplayer.DISPLAY_TYPE_LOADING, R.string.wifi_setup_save_success, 0),
6065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    SUCCESS(FormPageDisplayer.DISPLAY_TYPE_LOADING, R.string.wifi_setup_connection_success, 0),
6165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    SUMMARY_CONNECTED_WIFI(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
6265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_summary_title_connected,
6365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_summary_description_connected_to_wifi_network, new int[] {
6465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_dont_change_network, R.string.wifi_action_change_network }),
6565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    SUMMARY_CONNECTED_NON_WIFI(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
6665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_summary_title_connected, 0, new int[] { R.string.wifi_action_ok }),
6765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    SUMMARY_NOT_CONNECTED(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
6865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_summary_title_not_connected, 0, new int[] { R.string.wifi_action_ok }),
6965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    ADVANCED_OPTIONS(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
7065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_advanced_options, 0, new int[] { R.string.wifi_action_advanced_no,
7165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_advanced_yes }),
7265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    PROXY_SETTINGS(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE, R.string.title_wifi_proxy_settings,
7365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.proxy_warning_limited_support, new int[] { R.string.wifi_action_proxy_none,
7465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_proxy_manual }),
7565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    PROXY_HOSTNAME(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_wifi_proxy_hostname,
7665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.proxy_hostname_hint, TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
7765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    PROXY_PORT(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_wifi_proxy_port,
7865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.proxy_port_hint, TextInputWizardFragment.INPUT_TYPE_NUMERIC),
7965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    PROXY_BYPASS(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_wifi_proxy_bypass,
8065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.proxy_exclusionlist_hint, TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
8165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    IP_SETTINGS(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE, R.string.title_wifi_ip_settings, 0,
8265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            new int[] { R.string.wifi_action_dhcp, R.string.wifi_action_static }),
8365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    IP_ADDRESS(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_wifi_ip_address,
8465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_ip_address_hint, TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
8565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    GATEWAY(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_wifi_gateway,
8665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_gateway_hint, TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
8765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    NETWORK_PREFIX_LENGTH(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT,
8865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_network_prefix_length, R.string.wifi_network_prefix_length_hint,
8965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
9065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    DNS1(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_wifi_dns1,
9165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_dns1_hint, TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
9265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    DNS2(FormPageDisplayer.DISPLAY_TYPE_TEXT_INPUT, R.string.title_wifi_dns2,
9365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_dns2_hint, TextInputWizardFragment.INPUT_TYPE_NO_SUGGESTIONS),
9465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    PROXY_SETTINGS_INVALID(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
9565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_proxy_settings_invalid, 0, new int[] {
9665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_try_again }),
9765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    IP_SETTINGS_INVALID(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE,
9865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.title_wifi_ip_settings_invalid, 0, new int[] {
9965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            R.string.wifi_action_try_again }),
10065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    KNOWN_NETWORK(FormPageDisplayer.DISPLAY_TYPE_LIST_CHOICE, R.string.title_wifi_known_network, 0,
10165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            new int[] { R.string.wifi_connect, R.string.wifi_forget_network }),
10265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    WPS(FormPageDisplayer.DISPLAY_TYPE_LOADING, 0, 0);
10365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
10465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private final int mDisplayType;
10565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private final int mTitleResource;
10665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private final int mDescriptionResource;
10765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private final int mInputType;
10865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private final int[] mDefaultListItemTitles;
10965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private final int[] mDefaultListItemIcons;
11065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
11165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private WifiFormPageType(int displayType, int titleResource, int descriptionResource) {
11265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        this(displayType, titleResource, descriptionResource,
11365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                TextInputWizardFragment.INPUT_TYPE_NORMAL);
11465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
11565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
11665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private WifiFormPageType(int displayType, int titleResource, int descriptionResource,
11765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            int textType) {
11865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDisplayType = displayType;
11965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mTitleResource = titleResource;
12065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDescriptionResource = descriptionResource;
12165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mInputType = textType;
12265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDefaultListItemTitles = null;
12365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDefaultListItemIcons = null;
12465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
12565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
12665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private WifiFormPageType(int displayType, int titleResource, int descriptionResource,
12765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            int[] defaultListItemTitles) {
12865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        this(displayType, titleResource, descriptionResource, defaultListItemTitles, null);
12965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
13065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
13165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private WifiFormPageType(int displayType, int titleResource, int descriptionResource,
13265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            int[] defaultListItemTitles, int[] defaultListItemIcons) {
13365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDisplayType = displayType;
13465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mTitleResource = titleResource;
13565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDescriptionResource = descriptionResource;
13665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mInputType = TextInputWizardFragment.INPUT_TYPE_NORMAL;
13765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDefaultListItemTitles = defaultListItemTitles;
13865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mDefaultListItemIcons = defaultListItemIcons;
13965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        if (mDefaultListItemTitles != null && mDefaultListItemIcons != null
14065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                && mDefaultListItemTitles.length != mDefaultListItemIcons.length) {
14165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            throw new IllegalArgumentException("Form page type " + name()
14265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    + " had title and icon arrays that we'ren't the same length! "
14365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    + "The title array had length " + mDefaultListItemTitles.length
14465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    + " but the icon array had length " + mDefaultListItemIcons.length + "!");
14565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
14665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
14765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
14865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
14965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public int getTitleResourceId() {
15065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return mTitleResource;
15165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
15265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
15365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
15465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public int getDescriptionResourceId() {
15565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return mDescriptionResource;
15665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
15765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
15865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
15965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public int getInputType() {
16065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return mInputType;
16165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
16265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
16365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
16465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public int getDisplayType() {
16565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return mDisplayType;
16665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
16765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
16865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
16965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public ArrayList<SelectFromListWizardFragment.ListItem> getChoices(
17065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            Context context, ArrayList<SelectFromListWizardFragment.ListItem> extraChoices) {
17165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        ArrayList<SelectFromListWizardFragment.ListItem> choices = new ArrayList<
17265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                SelectFromListWizardFragment.ListItem>();
17365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        if (extraChoices != null) {
17465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            choices.addAll(extraChoices);
17565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
17665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        if (mDefaultListItemTitles != null) {
17765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            for (int i = 0; i < mDefaultListItemTitles.length; i++) {
17865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                choices.add(new SelectFromListWizardFragment.ListItem(
17965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        context.getString(mDefaultListItemTitles[i]).toUpperCase(),
18065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        mDefaultListItemIcons == null ? 0 : mDefaultListItemIcons[i]));
18165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            }
18265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
18365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return choices;
18465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
18565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
18665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public FormPage create() {
18765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return FormPage.createTextInputForm(name());
18865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
18965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
19065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public FormPage create(Intent intent) {
19165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        if (mDisplayType != FormPageDisplayer.DISPLAY_TYPE_LOADING) {
19265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            throw new IllegalArgumentException("Form page type " + name() + " had display type "
19365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    + mDisplayType + " but " + FormPageDisplayer.DISPLAY_TYPE_LOADING
19465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    + " expected!");
19565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
19665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return FormPage.createIntentForm(name(), intent);
19765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
19865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane}
199