可以使用Dragonfly修改现有文本,例如DNS中的“Capitalize That”吗?

时间:2016-03-29 20:20:09

标签: speech-recognition python-dragonfly

作为一个例子,我为camelCase文本编写了一个简单的规则。 它使用以下规范:

    public class MedicineInputListAdapter extends ArrayAdapter<MedicineVo> {
    public static final int[]   COLORS  = new int[] { Color.WHITE, Color.BLUE };

    private Context mContext;
    private List<MedicineVo> medicineVos;
    private MedicineVo medicineVoActual;


    public BasePreOSPreventivaCorretivaInputListAdapter(Context context, int resource, List<MedicineVo> medicineVos) {
        super(context, resource, medicineVos);

        this.medicineVoActual = new MedicineVo();
        this.medicineVos = new ArrayList<MedicineVo>();
        this.medicineVos.addAll(medicineVos);

        this.mContext = context;

    }

    private static class ViewHolder {        
        TextView mMedicineTextView;
        //------------------------------------------------------
        // others Android view components 
        //------------------------------------------------------

    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        final ViewHolder viewHolder;

        if (convertView == null) {

            //------------------------------------------------------
            // mapper from xml to view and add itens to holder
            //------------------------------------------------------





            //------------------------------------------------------
            // add event action to the mMedicineTextView
            //------------------------------------------------------
            viewHolder.mMedicineTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    TextView textView = (TextView) view;
                    MedicineVo medicineVo = (MedicineVo) textView.getTag();

                    boolean selected = medicineVo.getSelected();
                    if (selected) {
                        /*do it*/
                    }

                    refreshPreOSMaterialWhenUpdate(preOSMaterialVo);

                }
            });


            convertView.setTag(viewHolder);
        }
        else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        //------------------------------------------------------
        // get item and adjust color
        //------------------------------------------------------
        MedicineVo item = getItem(position);

        /*do it*/

        return convertView;
    }



    public void refreshMedicineListWhenUpdate(MedicineVo medicineVo){
        List<MedicineVo> newMedicineVos = new ArrayList<MedicineVo>();

        for (MedicineVo medicineVoOnList : medicineVos) {
            if( StringUtils.isNull(medicineVoOnList.getId()) )
                continue;

            if( MedicineLogic.existsOnList(medicineVos, medicineVoOnList) )
                continue;

            /* others checks if necessary */    

            newMedicineVos.add(medicineVoOnList);


        }
        medicineVos.addAll(newMedicineVos);
    }
}

在命令'camel case'之后正确修改了文本。

但是这仍然不像“大写那样”这样的内置命令那么灵活。

例如,“Capitalize That”可用于对鼠标当前选择的文本进行操作。这使得编辑现有代码变得非常容易。

这项功能可以在蜻蜓中实现吗?

1 个答案:

答案 0 :(得分:0)

是的,但你必须要有创意。使用Dragonfly Function Action按键突出显示要大写的文本。 (例如,Shift-Right或Control-Shift-Left。)当仍在函数操作调用的函数中时,通过发送Control-C的键来读取文本,然后获取剪贴板的内容。然后你可以根据需要修改它并将其打印出来。