Search in sources :

Example 6 with ButtonConfig

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

the class SmartBarEditor method addButton.

private void addButton() {
    mLockEditMode = true;
    final String buttonFocus = getEditButtonTag();
    ArrayList<ButtonConfig> buttonConfigs = Config.getConfig(mContext, ActionConstants.getDefaults(ActionConstants.SMARTBAR));
    int newIndex = mHost.getCurrentSequence().indexOf(buttonFocus) + 1;
    String newTag = String.valueOf(System.currentTimeMillis());
    ButtonConfig newConfig = new ButtonConfig(mContext);
    newConfig.setTag(newTag);
    buttonConfigs.add(newIndex, newConfig);
    Config.setConfig(mContext, ActionConstants.getDefaults(ActionConstants.SMARTBAR), buttonConfigs);
    mHost.recreateLayouts();
    setButtonsEditMode(true);
    mLockEditMode = false;
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) Point(android.graphics.Point)

Example 7 with ButtonConfig

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

the class SmartBarEditor method resetIcon.

private void resetIcon() {
    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.clearCustomIconIconUri();
    otherConfig.clearCustomIconIconUri();
    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 8 with ButtonConfig

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

the class HardkeyActionHandler method updateKeyAssignments.

private void updateKeyAssignments() {
    ContentResolver cr = mContext.getContentResolver();
    synchronized (mLock) {
        mHwKeysDisabled = Settings.Secure.getIntForUser(cr, Settings.Secure.HARDWARE_KEYS_DISABLE, 0, UserHandle.USER_CURRENT) != 0;
        final boolean hasMenu = (mDeviceHardwareKeys & KEY_MASK_MENU) != 0;
        final boolean hasHome = (mDeviceHardwareKeys & KEY_MASK_HOME) != 0;
        final boolean hasAssist = (mDeviceHardwareKeys & KEY_MASK_ASSIST) != 0;
        final boolean hasAppSwitch = (mDeviceHardwareKeys & KEY_MASK_APP_SWITCH) != 0;
        ArrayList<ButtonConfig> configs = Config.getConfig(mContext, ActionConstants.getDefaults(ActionConstants.HWKEYS));
        ButtonConfig config = Config.getButtonConfigFromTag(configs, ActionConstants.Hwkeys.BACK_BUTTON_TAG);
        mBackButton.setConfig(config);
        config = Config.getButtonConfigFromTag(configs, ActionConstants.Hwkeys.HOME_BUTTON_TAG);
        mHomeButton.setConfig(config);
        config = Config.getButtonConfigFromTag(configs, ActionConstants.Hwkeys.OVERVIEW_BUTTON_TAG);
        mRecentButton.setConfig(config);
        config = Config.getButtonConfigFromTag(configs, ActionConstants.Hwkeys.MENU_BUTTON_TAG);
        mMenuButton.setConfig(config);
        config = Config.getButtonConfigFromTag(configs, ActionConstants.Hwkeys.ASSIST_BUTTON_TAG);
        mAssistButton.setConfig(config);
        boolean hasMenuKeyEnabled = false;
        if (hasHome) {
            hasMenuKeyEnabled = mHomeButton.keyHasMenuAction();
        }
        if (hasMenu) {
            hasMenuKeyEnabled |= mMenuButton.keyHasMenuAction();
        }
        if (hasAssist) {
            hasMenuKeyEnabled |= mAssistButton.keyHasMenuAction();
        }
        if (hasAppSwitch) {
            hasMenuKeyEnabled |= mRecentButton.keyHasMenuAction();
        }
        hasMenuKeyEnabled |= mBackButton.keyHasMenuAction();
        // let PWM know to update menu key settings
        Message msg = mHandler.obtainMessage(MSG_UPDATE_MENU_KEY);
        msg.arg1 = hasMenuKeyEnabled ? 1 : 0;
        mHandler.sendMessage(msg);
    //            mRingHomeBehavior = Settings.Secure.getIntForUser(cr,
    //                    Settings.Secure.RING_HOME_BUTTON_BEHAVIOR,
    //                    Settings.Secure.RING_HOME_BUTTON_BEHAVIOR_DEFAULT,
    //                    UserHandle.USER_CURRENT);
    }
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) Message(android.os.Message) ContentResolver(android.content.ContentResolver)

Example 9 with ButtonConfig

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

the class SmartBarEditor method onImagePicked.

protected void onImagePicked(String uri) {
    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.setCustomImageUri(Uri.parse(uri));
    otherConfig.setCustomImageUri(Uri.parse(uri));
    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 10 with ButtonConfig

use of com.android.internal.utils.du.Config.ButtonConfig in project android_packages_apps_crDroidSettings by crdroidandroid.

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