[Android] Add a handler for the global config CheckBoxPreference.

This commit is contained in:
Lioncash 2013-10-11 18:48:12 -04:00
parent 1105304df5
commit 2770b23e9f

View File

@ -2,8 +2,13 @@ package org.retroarch.browser.preferences.fragments;
import org.retroarch.R;
import org.retroarch.browser.preferences.fragments.util.PreferenceListFragment;
import org.retroarch.browser.preferences.util.UserPreferences;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
/**
* A {@link PreferenceListFragment} that handles the general settings.
@ -17,5 +22,17 @@ public final class GeneralPreferenceFragment extends PreferenceListFragment
// Add general preferences from the XML.
addPreferencesFromResource(R.xml.general_preferences);
// Set a listener for the global configuration checkbox.
final CheckBoxPreference usingGlobalConfig = (CheckBoxPreference) findPreference("global_config_enable");
usingGlobalConfig.setOnPreferenceClickListener(new OnPreferenceClickListener(){
@Override
public boolean onPreferenceClick(Preference preference)
{
UserPreferences.updateConfigFile(getActivity());
UserPreferences.readbackConfigFile(getActivity());
return true;
}
});
}
}