use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_crDroidSettings by crdroidandroid.
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.internal.utils.du.Config.ButtonConfig in project android_packages_apps_crDroidSettings by crdroidandroid.
the class Smartbar method resetSmartbar.
private void resetSmartbar() {
ArrayList<ButtonConfig> buttonConfigs = Config.getDefaultConfig(getActivity(), ActionConstants.getDefaults(ActionConstants.SMARTBAR));
Config.setConfig(getActivity(), ActionConstants.getDefaults(ActionConstants.SMARTBAR), buttonConfigs);
Intent intent = new Intent("intent_navbar_edit_reset_layout");
ActionHandler.dispatchNavigationEditorResult(intent);
ContentResolver resolver = getActivity().getContentResolver();
Settings.Secure.putIntForUser(resolver, Settings.Secure.SMARTBAR_CONTEXT_MENU_MODE, 0, UserHandle.USER_CURRENT);
mSmartBarContext.setValue(String.valueOf(0));
mSmartBarContext.setOnPreferenceChangeListener(this);
Settings.Secure.putIntForUser(resolver, Settings.Secure.SMARTBAR_IME_HINT_MODE, 0, UserHandle.USER_CURRENT);
mImeActions.setValue(String.valueOf(0));
mImeActions.setOnPreferenceChangeListener(this);
Settings.Secure.putIntForUser(resolver, Settings.Secure.SMARTBAR_BUTTON_ANIMATION_STYLE, 0, UserHandle.USER_CURRENT);
mButtonAnim.setValue(String.valueOf(0));
mButtonAnim.setOnPreferenceChangeListener(this);
Settings.Secure.putIntForUser(resolver, Settings.Secure.NAVBAR_BUTTONS_ALPHA, 255, UserHandle.USER_CURRENT);
mButtonsAlpha.setValue(255);
mButtonsAlpha.setOnPreferenceChangeListener(this);
Settings.Secure.putIntForUser(resolver, Settings.Secure.SMARTBAR_LONGPRESS_DELAY, 0, UserHandle.USER_CURRENT);
mButtonLongpressDelay.setValue(String.valueOf(0));
mButtonLongpressDelay.setOnPreferenceChangeListener(this);
Settings.Secure.putIntForUser(resolver, Settings.Secure.SMARTBAR_CUSTOM_ICON_SIZE, 60, UserHandle.USER_CURRENT);
mCustomButtonScaling.setValue(60);
mCustomButtonScaling.setOnPreferenceChangeListener(this);
Settings.Secure.putIntForUser(resolver, Settings.Secure.SMARTBAR_DOUBLETAP_SLEEP, 1, UserHandle.USER_CURRENT);
mDoubleTapSleep.setChecked(true);
}
use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarEditor method onIconPicked.
@Override
protected void onIconPicked(String type, String packageName, String iconName) {
final String buttonFocus = getEditButtonTag();
SmartButtonView currentButton = mHost.findCurrentButton(buttonFocus);
SmartButtonView otherButton = (SmartButtonView) getHiddenNavButtons().findViewWithTag(buttonFocus);
ButtonConfig currentConfig = currentButton.getButtonConfig();
ButtonConfig otherConfig = otherButton.getButtonConfig();
OpaLayout currentOpa = (OpaLayout) currentButton.getParent();
OpaLayout otherOpa = (OpaLayout) otherButton.getParent();
currentConfig.setCustomIconUri(type, packageName, iconName);
otherConfig.setCustomIconUri(type, packageName, iconName);
currentButton.setButtonConfig(currentConfig);
otherButton.setButtonConfig(otherConfig);
mHost.setButtonDrawable(currentButton);
SmartBarHelper.updateButtonScalingAndPadding(currentOpa, isLandscape());
mHost.setButtonDrawable(otherButton);
SmartBarHelper.updateButtonScalingAndPadding(otherOpa, !isLandscape());
onCommitChanges();
}
use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarEditor method removeButton.
private void removeButton() {
mLockEditMode = true;
final String buttonFocus = getEditButtonTag();
ArrayList<ButtonConfig> buttonConfigs = Config.getConfig(mContext, ActionConstants.getDefaults(ActionConstants.SMARTBAR));
ButtonConfig toRemove = null;
for (ButtonConfig config : buttonConfigs) {
if (TextUtils.equals(config.getTag(), buttonFocus)) {
toRemove = config;
break;
}
}
if (toRemove != null) {
buttonConfigs.remove(toRemove);
Config.setConfig(mContext, ActionConstants.getDefaults(ActionConstants.SMARTBAR), buttonConfigs);
mHost.recreateLayouts();
setButtonsEditMode(true);
}
mLockEditMode = false;
}
use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarEditor method onCommitChanges.
@Override
public void onCommitChanges() {
ArrayList<ButtonConfig> buttonConfigs = new ArrayList<ButtonConfig>();
final int size = mHost.getCurrentSequence().size();
for (int i = 0; i < size; i++) {
String tag = mHost.getCurrentSequence().get(i);
SmartButtonView v = mHost.findCurrentButton(tag);
if (v == null)
continue;
ButtonConfig config = v.getButtonConfig();
if (config == null)
continue;
buttonConfigs.add(config);
}
Config.setConfig(mContext, ActionConstants.getDefaults(ActionConstants.SMARTBAR), buttonConfigs);
}
Aggregations