Search in sources :

Example 1 with ActionConfig

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

the class SmartBarView method generateContextKey.

private SmartButtonView generateContextKey(boolean landscape, String tag) {
    SmartButtonView v = new SmartButtonView(getContext());
    ButtonConfig buttonConfig = new ButtonConfig(getContext());
    ActionConfig actionConfig = new ActionConfig(getContext());
    int extraKeyWidth = getContext().getResources().getDimensionPixelSize(R.dimen.navigation_extra_key_width);
    int extraKeyHeight = getContext().getResources().getDimensionPixelSize(R.dimen.navigation_extra_key_height);
    v.setHost(this);
    v.setLayoutParams(new FrameLayout.LayoutParams(landscape && !BaseNavigationBar.sIsTablet ? LayoutParams.MATCH_PARENT : extraKeyWidth, landscape && !BaseNavigationBar.sIsTablet ? extraKeyHeight : LayoutParams.MATCH_PARENT));
    v.loadRipple();
    v.setScaleType(ScaleType.CENTER_INSIDE);
    if (tag.equals(Res.Softkey.MENU_BUTTON)) {
        actionConfig = new ActionConfig(getContext(), ActionHandler.SYSTEMUI_TASK_MENU);
    } else if (tag.equals(Res.Softkey.IME_SWITCHER)) {
        actionConfig = new ActionConfig(getContext(), ActionHandler.SYSTEMUI_TASK_IME_SWITCHER);
    } else if (tag.equals(Res.Softkey.IME_ARROW_LEFT)) {
        actionConfig = new ActionConfig(getContext(), ActionHandler.SYSTEMUI_TASK_IME_NAVIGATION_LEFT);
    } else if (tag.equals(Res.Softkey.IME_ARROW_RIGHT)) {
        actionConfig = new ActionConfig(getContext(), ActionHandler.SYSTEMUI_TASK_IME_NAVIGATION_RIGHT);
    } else if (tag.equals(Res.Softkey.MEDIA_ARROW_LEFT)) {
        actionConfig = new ActionConfig(getContext(), ActionHandler.SYSTEMUI_TASK_MEDIA_PREVIOUS);
    } else if (tag.equals(Res.Softkey.MEDIA_ARROW_RIGHT)) {
        actionConfig = new ActionConfig(getContext(), ActionHandler.SYSTEMUI_TASK_MEDIA_NEXT);
    }
    buttonConfig.setActionConfig(actionConfig, ActionConfig.PRIMARY);
    buttonConfig.setTag(tag);
    v.setButtonConfig(buttonConfig);
    v.setVisibility(View.INVISIBLE);
    setButtonDrawable(v);
    v.setContentDescription(buttonConfig.getActionConfig(ActionConfig.PRIMARY).getLabel());
    v.setAnimationStyle(SmartButtonView.ANIM_STYLE_RIPPLE);
    return v;
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig) ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView) FrameLayout(android.widget.FrameLayout)

Example 2 with ActionConfig

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

the class FlingActionHandler method onLongRightPress.

@Override
public void onLongRightPress() {
    ActionConfig right_long = (ActionConfig) mActionMap.get(ActionConstants.Fling.LONG_RIGHT_PRESS_TAG);
    ActionConfig left_long = (ActionConfig) mActionMap.get(ActionConstants.Fling.LONG_LEFT_PRESS_TAG);
    if (ActionHandler.isLockTaskOn()) {
        ActionHandler.turnOffLockTask();
    } else {
        fireAction(!right_long.hasNoAction() ? right_long : left_long);
    }
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig)

Example 3 with ActionConfig

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

the class FlingActionHandler method onUpRightSwipe.

@Override
public void onUpRightSwipe() {
    ActionConfig left_swipe = (ActionConfig) mActionMap.get(ActionConstants.Fling.FLING_LEFT_UP_TAG);
    ActionConfig right_swipe = (ActionConfig) mActionMap.get(ActionConstants.Fling.FLING_RIGHT_UP_TAG);
    fireAction(!right_swipe.hasNoAction() ? right_swipe : left_swipe);
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig)

Example 4 with ActionConfig

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

the class FlingActionHandler method onSingleRightPress.

@Override
public void onSingleRightPress() {
    ActionConfig right_tap = (ActionConfig) mActionMap.get(ActionConstants.Fling.SINGLE_RIGHT_TAP_TAG);
    ActionConfig left_tap = (ActionConfig) mActionMap.get(ActionConstants.Fling.SINGLE_LEFT_TAP_TAG);
    fireAction(!right_tap.hasNoAction() ? right_tap : left_tap);
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig)

Example 5 with ActionConfig

use of com.android.internal.utils.du.Config.ActionConfig in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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)

Aggregations

ActionConfig (com.android.internal.utils.du.Config.ActionConfig)15 ButtonConfig (com.android.internal.utils.du.Config.ButtonConfig)5 ActionPreference (com.android.settings.rr.Preferences.ActionPreference)2 SmartButtonView (com.android.systemui.navigation.smartbar.SmartButtonView)2 Context (android.content.Context)1 Intent (android.content.Intent)1 Point (android.graphics.Point)1 FrameLayout (android.widget.FrameLayout)1 LinearLayout (android.widget.LinearLayout)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