WifiPickerActivity.java revision d3446c5708aff2580d4ddb9f559e72784bfac55e
1/*
2 * Copyright (C) 2011 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 */
16package com.android.settings.wifi;
17
18import com.android.settings.ButtonBarHandler;
19import com.android.settings.SettingsActivity;
20import com.android.settings.wifi.p2p.WifiP2pSettings;
21
22import android.content.Intent;
23
24import java.lang.Class;
25
26public class WifiPickerActivity extends SettingsActivity implements ButtonBarHandler {
27
28    @Override
29    public Intent getIntent() {
30        Intent modIntent = new Intent(super.getIntent());
31        if (!modIntent.hasExtra(EXTRA_SHOW_FRAGMENT)) {
32            modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getWifiSettingsClass().getName());
33        }
34        return modIntent;
35    }
36
37    @Override
38    protected boolean isValidFragment(String fragmentName) {
39        if (getWifiSettingsClass().getName().equals(fragmentName)
40                || WifiP2pSettings.class.getName().equals(fragmentName)
41                || AdvancedWifiSettings.class.getName().equals(fragmentName)) return true;
42        return false;
43    }
44
45    /* package */ Class getWifiSettingsClass() {
46        return WifiSettings.class;
47    }
48}