Added workaround for PreferenceScreen bug

http://code.google.com/p/android/issues/detail?id=4611
This commit is contained in:
daniel oeh 2013-03-25 10:56:27 +01:00
parent 0da8b0acc9
commit ab6b4a4e3b
1 changed files with 29 additions and 9 deletions

View File

@ -157,15 +157,16 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
return true;
}
});
findPreference(UserPreferences.PREF_ENABLE_AUTODL).setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
checkItemVisibility();
return true;
}
});
findPreference(UserPreferences.PREF_ENABLE_AUTODL)
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
checkItemVisibility();
return true;
}
});
buildAutodownloadSelectedNetworsPreference();
setSelectedNetworksEnabled(UserPreferences
.isEnableAutodownloadWifiFilter());
@ -330,4 +331,23 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
}
}
}
@SuppressWarnings("deprecation")
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference) {
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference != null)
if (preference instanceof PreferenceScreen)
if (((PreferenceScreen) preference).getDialog() != null)
((PreferenceScreen) preference)
.getDialog()
.getWindow()
.getDecorView()
.setBackgroundDrawable(
this.getWindow().getDecorView()
.getBackground().getConstantState()
.newDrawable());
return false;
}
}