/**
 *  Copyright (C) 2015  Jon Griffiths (jon_p_griffiths@yahoo.com)
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.sufficientlysecure.ical.ui;

import android.content.SharedPreferences;


public class SettingsActivity extends android.preference.PreferenceActivity
                              implements SharedPreferences.OnSharedPreferenceChangeListener {

    public static final String PREF_LAST_URL_PASSWORD = "lastUrlPassword";

    @Override
    protected void onCreate(android.os.Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(org.sufficientlysecure.ical.R.xml.settings);
    }

    public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
        if (key.equals("setting_save_passwords")) {
            // Blank any stored password when this setting is changed
            MainActivity.preferences.edit().putString(PREF_LAST_URL_PASSWORD, "").commit();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();
        prefs.registerOnSharedPreferenceChangeListener(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();
        prefs.unregisterOnSharedPreferenceChangeListener(this);
    }
}

@@ -1593,169 +1593,217 @@
     
-@Override%0A    protected void onResume() %7B%0A        super.onResume();%0A        SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();%0A        prefs
+private SharedPreferences getPreferences() %7B%0A        return getPreferenceScreen().getSharedPreferences();%0A    %7D%0A%0A    @Override%0A    protected void onResume() %7B%0A        super.onResume();%0A        getPreferences()
 .reg
@@ -1936,93 +1936,24 @@
     
-SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();%0A        prefs
+getPreferences()
 .unr

Remove a duplicated deprecation warning