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()));
}
}
}
}
}
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);
}
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();
}
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();
}
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;
}
}
}
Aggregations