use of com.android.settings.rr.Preferences.ActionPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ActionFragment method onPreferenceScreenLoaded.
/**
* load our button lists and ActionPreferences map button action targets from preference keys
* and defaults config maps subclass is required to set desired Defaults interface int
* ActionContants
*/
protected void onPreferenceScreenLoaded(Defaults defaults) {
mDefaults = defaults;
final PreferenceScreen prefScreen = getPreferenceScreen();
for (int i = 0; i < prefScreen.getPreferenceCount(); i++) {
Preference pref = prefScreen.getPreference(i);
if (pref instanceof PreferenceCategory) {
PreferenceCategory cat = (PreferenceCategory) pref;
for (int j = 0; j < cat.getPreferenceCount(); j++) {
Preference child = cat.getPreference(j);
if (child instanceof ActionPreference) {
mPrefHolder.add((ActionPreference) child);
}
}
} else if (pref instanceof ActionPreference) {
mPrefHolder.add((ActionPreference) pref);
}
}
loadAndSetConfigs();
}
use of com.android.settings.rr.Preferences.ActionPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FlingSettings method enforceAction.
/*
* Iterate the list: if only one instance, disable it otherwise, enable
*/
private void enforceAction(ArrayList<ActionPreference> prefs, String action) {
ArrayList<ActionPreference> actionPrefs = new ArrayList<ActionPreference>();
for (ActionPreference pref : prefs) {
if (pref.getActionConfig().getAction().equals(action)) {
actionPrefs.add(pref);
}
}
boolean moreThanOne = actionPrefs.size() > 1;
for (ActionPreference pref : actionPrefs) {
pref.setEnabled(moreThanOne);
}
}
use of com.android.settings.rr.Preferences.ActionPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ActionFragment method findAndUpdatePreference.
protected void findAndUpdatePreference(ActionConfig action, String tag) {
for (ActionPreference pref : mPrefHolder) {
if (pref.getTag().equals(mHolderTag)) {
if (action == null) {
action = pref.getDefaultActionConfig();
}
pref.setActionConfig(action);
ButtonConfig button = mButtons.get(pref.getConfigMap().button);
ActionConfig newAction = pref.getActionConfig();
button.setActionConfig(newAction, pref.getConfigMap().action);
mButtons = Config.replaceButtonAtPosition(mButtons, button, pref.getConfigMap());
Config.setConfig(getActivity(), mDefaults, mButtons);
onActionPolicyEnforced(mPrefHolder);
break;
}
}
}
use of com.android.settings.rr.Preferences.ActionPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ActionFragment method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
if (icicle != null) {
String holderTag = icicle.getString(KEY_FOCUSED_PREFERENCE);
if (holderTag != null) {
mHolderTag = holderTag;
}
}
mPicker = new ShortcutPickHelper(getActivity(), this);
mPrefHolder = new ArrayList<ActionPreference>();
}
use of com.android.settings.rr.Preferences.ActionPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ActionFragment method loadAndSetConfigs.
private void loadAndSetConfigs() {
mButtons = Config.getConfig(getActivity(), mDefaults);
mDefaultButtons = Config.getDefaultConfig(getActivity(), mDefaults);
for (ActionPreference pref : mPrefHolder) {
pref.setDefaults(mDefaults);
ButtonConfig button = mButtons.get(pref.getConfigMap().button);
ActionConfig action = button.getActionConfig(pref.getConfigMap().action);
pref.setActionConfig(action);
ButtonConfig defButton = mDefaultButtons.get(pref.getConfigMap().button);
ActionConfig defAction = defButton.getActionConfig(pref.getConfigMap().action);
pref.setDefaultActionConfig(defAction);
}
}
Aggregations