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

Commit 5f3442af authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Use SearchIndexableData enable state for WiFi Settings

- same as for Bluetooth
- now the remembered WiFi networks names can be indexed when
WiFi is turned on

Change-Id: I904ce6a425c21ee07ce3ee8fdc0cd71ab5a18d12
parent 51bfee59
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.widget.Toast;

import com.android.settings.R;
import com.android.settings.WirelessSettings;
import com.android.settings.search.Index;

import java.util.concurrent.atomic.AtomicBoolean;

@@ -136,6 +137,7 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener {
            case WifiManager.WIFI_STATE_ENABLED:
                setSwitchChecked(true);
                mSwitch.setEnabled(true);
                updateSearchIndex(true);
                break;
            case WifiManager.WIFI_STATE_DISABLING:
                mSwitch.setEnabled(false);
@@ -143,12 +145,18 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener {
            case WifiManager.WIFI_STATE_DISABLED:
                setSwitchChecked(false);
                mSwitch.setEnabled(true);
                updateSearchIndex(false);
                break;
            default:
                setSwitchChecked(false);
                mSwitch.setEnabled(true);
                break;
                updateSearchIndex(false);
        }
    }

    private void updateSearchIndex(boolean isWiFiOn) {
        Index.getInstance(mContext).updateFromClassNameResource(
                WifiSettings.class.getName(), isWiFiOn);
    }

    private void setSwitchChecked(boolean checked) {
+1 −0
Original line number Diff line number Diff line
@@ -1195,6 +1195,7 @@ public class WifiSettings extends RestrictedSettingsFragment
                    data = new SearchIndexableRaw(context);
                    data.title = accessPoint.getTitle().toString();
                    data.screenTitle = res.getString(R.string.wifi_settings);
                    data.enabled = enabled;
                    result.add(data);
                }