Add dynamic Preferences indexing (part 2)
- change the Index SQL model. Add a new "enabled" column. - use that column for issuing a more restrictive search query - change the SearchIndexProvider API to pass the "enable" state - apply it to Bluetooth settings - refactor the list of indexable resources (SearchIndexableResources) Change-Id: Ic900fb27cb12a285a80d953aa1aa88f0070cd986
This commit is contained in:
@@ -28,6 +28,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.WirelessSettings;
|
||||
import com.android.settings.search.Index;
|
||||
|
||||
/**
|
||||
* BluetoothEnabler is a helper to manage the Bluetooth on/off checkbox
|
||||
@@ -132,6 +133,7 @@ public final class BluetoothEnabler implements CompoundButton.OnCheckedChangeLis
|
||||
case BluetoothAdapter.STATE_ON:
|
||||
setChecked(true);
|
||||
mSwitch.setEnabled(true);
|
||||
updateSearchIndex(true);
|
||||
break;
|
||||
case BluetoothAdapter.STATE_TURNING_OFF:
|
||||
mSwitch.setEnabled(false);
|
||||
@@ -139,10 +141,12 @@ public final class BluetoothEnabler implements CompoundButton.OnCheckedChangeLis
|
||||
case BluetoothAdapter.STATE_OFF:
|
||||
setChecked(false);
|
||||
mSwitch.setEnabled(true);
|
||||
updateSearchIndex(false);
|
||||
break;
|
||||
default:
|
||||
setChecked(false);
|
||||
mSwitch.setEnabled(true);
|
||||
updateSearchIndex(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,4 +163,9 @@ public final class BluetoothEnabler implements CompoundButton.OnCheckedChangeLis
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSearchIndex(boolean isBluetoothOn) {
|
||||
Index.getInstance(mContext).updateFromClassNameResource(
|
||||
BluetoothSettings.class.getName(), isBluetoothOn);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user