    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle(R.string.lockscreen_settings_title_subhead);
        addPreferencesFromResource(R.xml.lockscreen_widgets_settings);
        PreferenceScreen prefSet = getPreferenceScreen();
        mMusicControlPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_MUSIC_CONTROLS);
        mMusicControlPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1) == 1);
        mNowPlayingPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_NOW_PLAYING);
        mNowPlayingPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_NOW_PLAYING, 1) == 1);
        mAlbumArtPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_ALBUM_ART);
        mAlbumArtPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_ALBUM_ART, 1) == 1);
        mLockscreenMusicHeadsetPref = (ListPreference) prefSet
                .findPreference(LOCKSCREEN_MUSIC_CONTROLS_HEADSET);
        int lockscreenMusicHeadsetPref = Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_MUSIC_CONTROLS_HEADSET, 0);
        mLockscreenMusicHeadsetPref.setValue(String.valueOf(lockscreenMusicHeadsetPref));
        mLockscreenMusicHeadsetPref.setOnPreferenceChangeListener(this);
        mAlwaysMusicControlPref = (CheckBoxPreference) prefSet
                .findPreference(LOCKSCREEN_ALWAYS_MUSIC_CONTROLS);
        boolean alwaysMusicControlPref = Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_ALWAYS_MUSIC_CONTROLS, 0) == 1;
        mAlwaysMusicControlPref.setChecked(alwaysMusicControlPref);
        mLockscreenMusicHeadsetPref.setEnabled(!alwaysMusicControlPref);
        mLockscreenWidgetLayout = (ListPreference) prefSet
                .findPreference(LOCKSCREEN_WIDGETS_LAYOUT);
        mLockscreenWidgetLayout.setOnPreferenceChangeListener(this);
        mAlwaysBatteryPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_ALWAYS_BATTERY);
        mAlwaysBatteryPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_ALWAYS_BATTERY, 0) == 1);
        mCalendarsPref = (MultiSelectListPreference) prefSet.findPreference(LOCKSCREEN_CALENDARS);
        mCalendarsPref.setValue(Settings.System.getString(getContentResolver(),
                Settings.System.LOCKSCREEN_CALENDARS));
        mCalendarsPref.setOnPreferenceChangeListener(this);
        CalendarEntries calEntries = CalendarEntries.findCalendars(getContentResolver());
        mCalendarsPref.setEntries(calEntries.getEntries());
        mCalendarsPref.setEntryValues(calEntries.getEntryValues());
        mCalendarRemindersOnlyPref = (CheckBoxPreference) prefSet
                .findPreference(LOCKSCREEN_CALENDAR_REMINDERS_ONLY);
        mCalendarRemindersOnlyPref.setChecked(Settings.System.getInt(getContentResolver(),
                LOCKSCREEN_CALENDAR_REMINDERS_ONLY, 0) == 1);
        mCalendarAlarmLookaheadPref = (ListPreference) prefSet
                .findPreference(LOCKSCREEN_CALENDAR_LOOKAHEAD);
        long calendarAlarmLookaheadPref = Settings.System.getLong(getContentResolver(),
                Settings.System.LOCKSCREEN_CALENDAR_LOOKAHEAD, 10800000);
        mCalendarAlarmLookaheadPref.setValue(String.valueOf(calendarAlarmLookaheadPref));
        mCalendarAlarmLookaheadPref.setOnPreferenceChangeListener(this);
        mCalendarAlarmPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_CALENDAR_ALARM);
        mCalendarAlarmPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_CALENDAR_ALARM, 0) == 1);
        boolean hideAlwaysBatteryPref = mLockscreenWidgetLayout.getEntry().equals(getResources()
                .getStringArray(R.array.pref_lockscreen_widget_layout_entries)[1]);
        mAlwaysBatteryPref.setEnabled(hideAlwaysBatteryPref);
    }

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle(R.string.lockscreen_settings_title_subhead);
        addPreferencesFromResource(R.xml.lockscreen_widgets_settings);
        PreferenceScreen prefSet = getPreferenceScreen();
        mMusicControlPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_MUSIC_CONTROLS);
        mMusicControlPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1) == 1);
        mNowPlayingPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_NOW_PLAYING);
        mNowPlayingPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_NOW_PLAYING, 1) == 1);
        mAlbumArtPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_ALBUM_ART);
        mAlbumArtPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_ALBUM_ART, 1) == 1);
        mLockscreenMusicHeadsetPref = (ListPreference) prefSet
                .findPreference(LOCKSCREEN_MUSIC_CONTROLS_HEADSET);
        int lockscreenMusicHeadsetPref = Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_MUSIC_CONTROLS_HEADSET, 0);
        mLockscreenMusicHeadsetPref.setValue(String.valueOf(lockscreenMusicHeadsetPref));
        mLockscreenMusicHeadsetPref.setOnPreferenceChangeListener(this);
        mAlwaysMusicControlPref = (CheckBoxPreference) prefSet
                .findPreference(LOCKSCREEN_ALWAYS_MUSIC_CONTROLS);
        boolean alwaysMusicControlPref = Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_ALWAYS_MUSIC_CONTROLS, 0) == 1;
        mAlwaysMusicControlPref.setChecked(alwaysMusicControlPref);
        mLockscreenMusicHeadsetPref.setEnabled(!alwaysMusicControlPref);
        mLockscreenWidgetLayout = (ListPreference) prefSet
                .findPreference(LOCKSCREEN_WIDGETS_LAYOUT);
        mLockscreenWidgetLayout.setOnPreferenceChangeListener(this);
        mAlwaysBatteryPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_ALWAYS_BATTERY);
        mAlwaysBatteryPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_ALWAYS_BATTERY, 0) == 1);
        mCalendarsPref = (MultiSelectListPreference) prefSet.findPreference(LOCKSCREEN_CALENDARS);
        mCalendarsPref.setValue(Settings.System.getString(getContentResolver(),
                Settings.System.LOCKSCREEN_CALENDARS));
        mCalendarsPref.setOnPreferenceChangeListener(this);
        CalendarEntries calEntries = CalendarEntries.findCalendars(getContentResolver());
        mCalendarsPref.setEntries(calEntries.getEntries());
        mCalendarsPref.setEntryValues(calEntries.getEntryValues());
        mCalendarRemindersOnlyPref = (CheckBoxPreference) prefSet
                .findPreference(LOCKSCREEN_CALENDAR_REMINDERS_ONLY);
        mCalendarRemindersOnlyPref.setChecked(Settings.System.getInt(getContentResolver(),
                LOCKSCREEN_CALENDAR_REMINDERS_ONLY, 0) == 1);
        mCalendarAlarmLookaheadPref = (ListPreference) prefSet
                .findPreference(LOCKSCREEN_CALENDAR_LOOKAHEAD);
        long calendarAlarmLookaheadPref = Settings.System.getLong(getContentResolver(),
                Settings.System.LOCKSCREEN_CALENDAR_LOOKAHEAD, 10800000);
        mCalendarAlarmLookaheadPref.setValue(String.valueOf(calendarAlarmLookaheadPref));
        mCalendarAlarmLookaheadPref.setOnPreferenceChangeListener(this);
        mCalendarAlarmPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_CALENDAR_ALARM);
        mCalendarAlarmPref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.LOCKSCREEN_CALENDAR_ALARM, 0) == 1);
        boolean enableAlwaysBatteryPref = !mLockscreenWidgetLayout.getEntry().equals(getResources()
                .getStringArray(R.array.pref_lockscreen_widget_layout_entries)[1]);
        mAlwaysBatteryPref.setEnabled(enableAlwaysBatteryPref);
    }
