Use the screen context when adding preferences.

When the context from the controller itself is used, it is
not the correct context and causes the created preferences to
be styled incorrectly. By using the screen's context directly,
we can ensure that the preferences inherit the correct style.

Change-Id: I02503e5f4fab8f8110e5d29bd3a479f0ce1d6aca
Fixes: 35891968
Test: Robotest
This commit is contained in:
Daniel Nishi
2017-03-02 11:29:34 -08:00
parent b79eec9e50
commit dbc54a1736
4 changed files with 26 additions and 29 deletions

View File

@@ -97,7 +97,7 @@ public class SecondaryUserController extends PreferenceController implements
@Override
public void displayPreference(PreferenceScreen screen) {
if (mStoragePreference == null) {
mStoragePreference = new StorageItemPreferenceAlternate(mContext);
mStoragePreference = new StorageItemPreferenceAlternate(screen.getContext());
PreferenceGroup group =
(PreferenceGroup) screen.findPreference(TARGET_PREFERENCE_GROUP_KEY);