Search in sources :

Example 16 with ButtonConfig

use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartBarView method onKeyguardShowing.

@Override
protected void onKeyguardShowing(boolean showing) {
    if (mEditor != null) {
        mEditor.setKeyguardShowing(showing);
    }
    // do so without slowing faster boot time.
    if (!showing) {
        ViewGroup hidden = (ViewGroup) getHiddenView().findViewWithTag(Res.Common.NAV_BUTTONS);
        for (String buttonTag : mCurrentSequence) {
            SmartButtonView v = findCurrentButton(buttonTag);
            if (v != null) {
                ButtonConfig config = v.getButtonConfig();
                if (config != null && v.getDrawable() == null) {
                    v.setImageDrawable(config.getCurrentIcon(getContext()));
                }
            }
            v = (SmartButtonView) hidden.findViewWithTag(buttonTag);
            if (v != null) {
                ButtonConfig config = v.getButtonConfig();
                if (config != null && v.getDrawable() == null) {
                    v.setImageDrawable(config.getCurrentIcon(getContext()));
                }
            }
        }
    }
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) ViewGroup(android.view.ViewGroup) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Example 17 with ButtonConfig

use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartBarEditor method swapConfigs.

private void swapConfigs(OpaLayout v1, OpaLayout v2) {
    ButtonConfig config1 = v1.getButton().getButtonConfig();
    ButtonConfig config2 = v2.getButton().getButtonConfig();
    int[] padding1 = SmartBarHelper.getViewPadding(v1);
    int[] padding2 = SmartBarHelper.getViewPadding(v2);
    ScaleType scale1 = v1.getButton().getScaleType();
    ScaleType scale2 = v2.getButton().getScaleType();
    v1.getButton().setButtonConfig(config2);
    v2.getButton().setButtonConfig(config1);
    mHost.setButtonDrawable(v1.getButton());
    mHost.setButtonDrawable(v2.getButton());
    SmartBarHelper.applyPaddingToView(v1, padding2);
    SmartBarHelper.applyPaddingToView(v2, padding1);
    v1.getButton().setScaleType(scale2);
    v2.getButton().setScaleType(scale1);
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) ScaleType(android.widget.ImageView.ScaleType)

Example 18 with ButtonConfig

use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartBarEditor method onActionPicked.

@Override
protected void onActionPicked(String action, ActionConfig actionConfig) {
    final String buttonFocus = getEditButtonTag();
    final int tapFocus = mTapHasFocusTag;
    SmartButtonView currentButton = mHost.findCurrentButton(buttonFocus);
    SmartButtonView otherButton = (SmartButtonView) getHiddenNavButtons().findViewWithTag(buttonFocus);
    ActionConfig currentAction = new ActionConfig(mContext, action);
    ActionConfig otherAction = new ActionConfig(mContext, action);
    ButtonConfig currentConfig = currentButton.getButtonConfig();
    ButtonConfig otherConfig = otherButton.getButtonConfig();
    OpaLayout currentOpa = (OpaLayout) currentButton.getParent();
    OpaLayout otherOpa = (OpaLayout) otherButton.getParent();
    currentConfig.setActionConfig(currentAction, tapFocus);
    otherConfig.setActionConfig(otherAction, tapFocus);
    currentButton.setButtonConfig(currentConfig);
    otherButton.setButtonConfig(otherConfig);
    if (tapFocus == ActionConfig.PRIMARY) {
        // update icon for single tap only
        mHost.setButtonDrawable(currentButton);
        SmartBarHelper.updateButtonScalingAndPadding(currentOpa, isLandscape());
        mHost.setButtonDrawable(otherButton);
        SmartBarHelper.updateButtonScalingAndPadding(otherOpa, !isLandscape());
    }
    onCommitChanges();
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig) ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView) Point(android.graphics.Point)

Example 19 with ButtonConfig

use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_DUI by DirtyUnicorns.

the class FlingActionHandler method loadConfigs.

void loadConfigs() {
    mActionMap.clear();
    ArrayList<ButtonConfig> configs = Config.getConfig(mContext, ActionConstants.getDefaults(ActionConstants.FLING));
    for (Map.Entry<String, ConfigMap> entry : ActionConstants.getDefaults(ActionConstants.FLING).getActionMap().entrySet()) {
        ButtonConfig button = configs.get(entry.getValue().button);
        ActionConfig action = button.getActionConfig(entry.getValue().action);
        mActionMap.put(entry.getKey(), action);
    }
    isDoubleTapEnabled = !((ActionConfig) mActionMap.get(ActionConstants.Fling.DOUBLE_LEFT_TAP_TAG)).hasNoAction() || !((ActionConfig) mActionMap.get(ActionConstants.Fling.DOUBLE_RIGHT_TAP_TAG)).hasNoAction();
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig) ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) ConfigMap(com.android.internal.utils.du.ActionConstants.ConfigMap) HashMap(java.util.HashMap) Map(java.util.Map) ConfigMap(com.android.internal.utils.du.ActionConstants.ConfigMap)

Example 20 with ButtonConfig

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

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