package com.ids1024.whitakerswords;

import android.preference.PreferenceActivity;
import android.os.Bundle;
import android.app.ActionBar;

public class WhitakersSettings extends PreferenceActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}

@@ -30,16 +30,38 @@
 words;%0A%0A
+import java.util.Map;%0A
 import a
@@ -117,372 +117,2070 @@
 oid.
-os.Bundle;%0Aimport android.app.ActionBar;%0A%0Apublic class WhitakersSettings extends PreferenceActivity %7B%0A    @Override%0A    public void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        addPreferencesFromResource(R.xml.preferences);%0A%0A        ActionBar actionBar = getActionBar();%0A        actionBar.setDisplayHomeAsUpEnabled(true
+content.SharedPreferences;%0Aimport android.content.SharedPreferences.OnSharedPreferenceChangeListener;%0Aimport android.os.Bundle;%0Aimport android.app.ActionBar;%0Aimport java.io.IOException;%0Aimport java.io.FileOutputStream;%0A%0Apublic class WhitakersSettings extends PreferenceActivity%0A                               implements OnSharedPreferenceChangeListener %7B%0A    @Override%0A    public void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        addPreferencesFromResource(R.xml.preferences);%0A%0A        ActionBar actionBar = getActionBar();%0A        actionBar.setDisplayHomeAsUpEnabled(true);%0A    %7D%0A%0A    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,%0A    String changed_key) %7B%0A        String%5B%5D settings = %7B%22trim_output%22, %22do_unknowns_only%22,%0A                             %22ignore_unknown_names%22, %22ignore_unknown_caps%22,%0A                             %22do_compounds%22, %22do_fixes%22,%0A                             %22do_dictionary_forms%22, %22show_age%22,%0A                             %22show_frequency%22, %22do_examples%22,%0A                             %22do_only_meanings%22, %22do_stems_for_unknown%22%7D;%0A        try %7B%0A            FileOutputStream fos = openFileOutput(%22WORD.MOD%22, MODE_PRIVATE);%0A            for (String setting: settings) %7B%0A%09%09if (sharedPreferences.contains(setting)) %7B%0A                    String value = sharedPreferences.getBoolean(setting, false) ? %22Y%22 : %22N%22;%0A                    String line = setting.toUpperCase() + %22 %22 + value + %22%5Cn%22;%0A                    fos.write(line.getBytes());%0A%09%09%7D%0A            %7D%0A            fos.close();%0A        %7D catch(IOException e) %7B%0A            throw new RuntimeException(e.getMessage());%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected void onResume() %7B%0A        super.onResume();%0A        getPreferenceScreen().getSharedPreferences()%0A                .registerOnSharedPreferenceChangeListener(this);%0A    %7D%0A%0A    @Override%0A    protected void onPause() %7B%0A        super.onPause();%0A        getPreferenceScreen().getSharedPreferences()%0A                .unregisterOnSharedPreferenceChangeListener(this
 );%0A 

Handle preferences