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