Merge "Fix bug #15914018 Search - "wifi" does not gives any result for WifiSettings"

This commit is contained in:
Fabrice Di Meglio
2014-06-26 22:48:46 +00:00
committed by Android (Google) Code Review

View File

@@ -228,28 +228,29 @@ class AccessPoint extends Preference {
@Override @Override
protected void onBindView(View view) { protected void onBindView(View view) {
super.onBindView(view); super.onBindView(view);
updateIcon(getLevel()); updateIcon(getLevel(), getContext());
notifyChanged(); notifyChanged();
} }
protected void updateIcon(int level) { protected void updateIcon(int level, Context context) {
if (level == -1) { if (level == -1) {
setIcon(null); setIcon(null);
} else { } else {
Drawable drawable = getIcon(); Drawable drawable = getIcon();
if (drawable == null) { if (drawable == null) {
drawable = getContext().getTheme().obtainStyledAttributes( drawable = context.getTheme().obtainStyledAttributes(
wifi_signal_attributes).getDrawable(0); wifi_signal_attributes).getDrawable(0);
setIcon(drawable); setIcon(drawable);
} }
drawable.setLevel(level); if (drawable != null) {
drawable.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE); drawable.setLevel(level);
drawable.setState((security != SECURITY_NONE) ? STATE_SECURED : STATE_NONE);
}
} }
} }
@Override @Override
public int compareTo(Preference preference) { public int compareTo(Preference preference) {
if (!(preference instanceof AccessPoint)) { if (!(preference instanceof AccessPoint)) {
@@ -474,12 +475,12 @@ class AccessPoint extends Preference {
/** Updates the title and summary; may indirectly call notifyChanged() */ /** Updates the title and summary; may indirectly call notifyChanged() */
private void refresh() { private void refresh() {
setTitle(ssid); setTitle(ssid);
updateIcon(getLevel());
final Context context = getContext();
updateIcon(getLevel(), context);
StringBuilder summary = new StringBuilder(); StringBuilder summary = new StringBuilder();
Context context = getContext();
if (mState != null) { // This is the active connection if (mState != null) { // This is the active connection
summary.append(Summary.get(context, mState)); summary.append(Summary.get(context, mState));
} else if (mConfig != null && ((mConfig.status == WifiConfiguration.Status.DISABLED && } else if (mConfig != null && ((mConfig.status == WifiConfiguration.Status.DISABLED &&