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