Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e304b9f4 authored by Neel Parekh's avatar Neel Parekh
Browse files

Add a intent extra to only show the access points in the settings menu.

Bug: 2198865
parent 8355d934
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/wifi_settings_category">

    <com.android.settings.ProgressCategory
            android:key="access_points"
            android:title="@string/wifi_access_points"
            android:persistent="false" />

    <Preference
            android:key="add_other_network"
            android:title="@string/wifi_add_other_network"
            android:persistent="false" />

</PreferenceScreen>
+84 −69
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
     */
    private Dialog mDialog;

    private static final String KEY_ONLY_ACCESS_POINTS = "only_access_points";
    private static final String KEY_ADD_OTHER_NETWORK = "add_other_network";

    private static final int CONTEXT_MENU_ID_CONNECT = Menu.FIRST;
@@ -117,11 +118,19 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
        mWifiLayer.onCreatedCallback();
    }

    private int getPreferenceResource() {
        if (getIntent().getBooleanExtra(KEY_ONLY_ACCESS_POINTS, false)) {
            return R.xml.wifi_access_points;
        } else {
            return R.xml.wifi_settings;
        }
    }

    /**
     * Shouldn't have any dependency on the wifi layer.
     */
    private void onCreatePreferences() {
        addPreferencesFromResource(R.xml.wifi_settings);
        addPreferencesFromResource(getPreferenceResource());

        final PreferenceScreen preferenceScreen = getPreferenceScreen();

@@ -134,6 +143,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
        //   * this ordering logic is in AccessPointPreference's compareTo
        mApCategory.setOrderingAsAdded(false);

        if (!getIntent().getBooleanExtra("only_access_points", false)) {
            mWifiEnabled = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI_ENABLED);
            mWifiEnabler = new WifiEnabler(this, (WifiManager) getSystemService(WIFI_SERVICE),
                    mWifiEnabled);
@@ -142,6 +152,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
                    .findPreference(KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED);
            mOpenNetworkNotificationsEnabled.setChecked(Settings.Secure.getInt(getContentResolver(),
                    Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
        }

        mAddOtherNetwork = preferenceScreen.findPreference(KEY_ADD_OTHER_NETWORK);

@@ -155,7 +166,9 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
    protected void onResume() {
        super.onResume();
        mWifiLayer.onResume();
        if (mWifiEnabler != null) {
            mWifiEnabler.resume();
        }
        // do what we should have after keystore is unlocked.
        if (mResumeState != null) {
            if (mKeyStore.test() == KeyStore.NO_ERROR) {
@@ -176,8 +189,10 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
    protected void onPause() {
        super.onPause();
        mWifiLayer.onPause();
        if (mWifiEnabler != null) {
            mWifiEnabler.pause();
        }
    }

    @Override
    protected void onDestroy() {
+2 −2

File changed.

Contains only whitespace changes.