Search in sources :

Example 11 with ButtonConfig

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;
        }
    }
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig) ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) ActionPreference(com.crdroid.settings.preferences.ActionPreference)

Example 12 with ButtonConfig

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);
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) Intent(android.content.Intent) ContentResolver(android.content.ContentResolver)

Example 13 with ButtonConfig

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();
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Example 14 with ButtonConfig

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;
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig)

Example 15 with ButtonConfig

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);
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView) ArrayList(java.util.ArrayList) Point(android.graphics.Point)

Aggregations

ButtonConfig (com.android.internal.utils.du.Config.ButtonConfig)25 SmartButtonView (com.android.systemui.navigation.smartbar.SmartButtonView)8 ActionConfig (com.android.internal.utils.du.Config.ActionConfig)7 OpaLayout (com.android.systemui.navigation.OpaLayout)5 ContentResolver (android.content.ContentResolver)3 Point (android.graphics.Point)3 Intent (android.content.Intent)2 Message (android.os.Message)2 FrameLayout (android.widget.FrameLayout)2 ActionPreference (com.android.settings.rr.Preferences.ActionPreference)2 ActionPreference (com.crdroid.settings.preferences.ActionPreference)2 Drawable (android.graphics.drawable.Drawable)1 ViewGroup (android.view.ViewGroup)1 ScaleType (android.widget.ImageView.ScaleType)1 LinearLayout (android.widget.LinearLayout)1 ConfigMap (com.android.internal.utils.du.ActionConstants.ConfigMap)1 SmartBackButtonDrawable (com.android.systemui.navigation.smartbar.SmartBackButtonDrawable)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1