Search in sources :

Example 6 with ActionConfig

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

the class ActionPickerDialogActivity method sendResultAndFinish.

private void sendResultAndFinish(String result) {
    Intent intent = new Intent("intent_action_action_picker");
    intent.putExtra("result", Activity.RESULT_OK);
    intent.putExtra("action_string", result);
    ActionConfig actionConfig = new ActionConfig(this, result);
    intent.putExtra("action_config", actionConfig);
    ActionHandler.dispatchNavigationEditorResult(intent);
    setResult(Activity.RESULT_OK, intent);
    finish();
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig) Intent(android.content.Intent)

Example 7 with ActionConfig

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

the class CustomActionListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    final Context ctx = mContext;
    if (convertView != null) {
        holder = (ViewHolder) convertView.getTag();
    } else {
        convertView = mInflater.inflate(R.layout.custom_action_item, null, false);
        holder = new ViewHolder();
        convertView.setTag(holder);
        holder.title = (TextView) convertView.findViewById(com.android.internal.R.id.title);
        holder.summary = (TextView) convertView.findViewById(com.android.internal.R.id.summary);
        holder.icon = (ImageView) convertView.findViewById(R.id.icon);
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) holder.icon.getLayoutParams();
        params.width = holder.icon.getMaxWidth();
        params.height = holder.icon.getMaxHeight();
        holder.icon.setLayoutParams(params);
        holder.icon.setScaleType(ScaleType.CENTER);
        holder.icon.setCropToPadding(true);
    }
    ActionConfig config = getItem(position);
    holder.title.setText(config.getLabel());
    holder.icon.setBackgroundResource(R.drawable.fab_accent);
    holder.icon.setImageDrawable(config.getDefaultIcon(ctx));
    holder.summary.setVisibility(View.GONE);
    return convertView;
}
Also used : Context(android.content.Context) ActionConfig(com.android.internal.utils.du.Config.ActionConfig) LinearLayout(android.widget.LinearLayout)

Example 8 with ActionConfig

use of com.android.internal.utils.du.Config.ActionConfig 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)

Example 9 with ActionConfig

use of com.android.internal.utils.du.Config.ActionConfig 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 10 with ActionConfig

use of com.android.internal.utils.du.Config.ActionConfig 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)

Aggregations

ActionConfig (com.android.internal.utils.du.Config.ActionConfig)19 ButtonConfig (com.android.internal.utils.du.Config.ButtonConfig)7 Context (android.content.Context)2 Intent (android.content.Intent)2 LinearLayout (android.widget.LinearLayout)2 ActionPreference (com.android.settings.rr.Preferences.ActionPreference)2 SmartButtonView (com.android.systemui.navigation.smartbar.SmartButtonView)2 ActionPreference (com.crdroid.settings.preferences.ActionPreference)2 Point (android.graphics.Point)1 FrameLayout (android.widget.FrameLayout)1 ConfigMap (com.android.internal.utils.du.ActionConstants.ConfigMap)1 OpaLayout (com.android.systemui.navigation.OpaLayout)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1