Search in sources :

Example 21 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class GTParamInFragment method getInputParamsList.

private void getInputParamsList() {
    tv_ip_title_toast = (TextView) layout_inparamlayout.findViewById(R.id.ip_title_toast);
    IpUIManager.list_ip.clear();
    if (IpUIManager.isEmpty()) {
        tv_ip_title_toast.setVisibility(View.VISIBLE);
    } else {
        tv_ip_title_toast.setVisibility(View.GONE);
        // 悬浮框分界线
        InPara iv_ac = new InPara();
        iv_ac.setKey(ParamConst.PROMPT_INIT_TITLE);
        iv_ac.setDisplayProperty(InPara.DISPLAY_TITLE);
        IpUIManager.list_ip.add(iv_ac);
        // 加悬浮框入参
        for (InPara iv : IpUIManager.getAll()) {
            if (InPara.DISPLAY_AC == iv.getDisplayProperty()) {
                IpUIManager.list_ip.add(iv);
            }
        }
        // 加普通关注分界线
        InPara iv_normalDivid = new InPara();
        iv_normalDivid.setKey(ParamConst.DIVID_TITLE);
        iv_normalDivid.setDisplayProperty(InPara.DISPLAY_TITLE);
        IpUIManager.list_ip.add(iv_normalDivid);
        // 加普通关注入参
        for (InPara iv : IpUIManager.getAll()) {
            if (InPara.DISPLAY_NORMAL == iv.getDisplayProperty()) {
                IpUIManager.list_ip.add(iv);
            }
        }
        // 加disable入参分界线
        InPara iv_disableDivid = new InPara();
        iv_disableDivid.setKey(ParamConst.PROMPT_DISABLE_TITLE);
        iv_disableDivid.setDisplayProperty(InPara.DISPLAY_TITLE);
        IpUIManager.list_ip.add(iv_disableDivid);
        // 加disable的入参
        for (InPara iv : IpUIManager.getAll()) {
            if (InPara.DISPLAY_DISABLE == iv.getDisplayProperty()) {
                IpUIManager.list_ip.add(iv);
            }
        }
    }
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Example 22 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class GTParamInFragment method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    String key = IpUIManager.list_ip.get(position).getKey();
    if (key.equals(ParamConst.DIVID_TITLE) || key.equals(ParamConst.PROMPT_INIT_TITLE) || key.equals(ParamConst.PROMPT_TITLE) || key.equals(ParamConst.PROMPT_DISABLE_TITLE)) {
        return;
    }
    if (position > IpUIManager.getInListDisableTitlePosition()) {
        return;
    }
    InPara ip = IpUIManager.list_ip.get(position);
    Bundle bundle = new Bundle();
    bundle.putString("ip_name", key);
    bundle.putString("ip_client", ip.getClient());
    bundle.putStringArrayList("ip_values", (ArrayList<String>) ip.getValues());
    Intent intent = new Intent(getActivity(), GTInputParamSetActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtras(bundle);
    startActivity(intent);
}
Also used : InPara(com.tencent.wstt.gt.InPara) Bundle(android.os.Bundle) Intent(android.content.Intent)

Example 23 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class GTParamInListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ParamConst.ViewHolderDrag switch_drag = null;
    InPara o = (InPara) list.get(position);
    String key = o.getKey();
    final String alias = o.getAlias();
    final int type = getItemViewType(position);
    /*
		 * 根据每行UI的类型进行UI模型准备与数据准备
		 */
    switch(type) {
        case TYPE_PROMPT_ITEM:
            convertView = PROMPT_ITEM_convertView;
            if (((InPara) list.get(1)).getKey().equals(ParamConst.DIVID_TITLE)) {
                PROMPT_ITEM_title.setText(ParamConst.PROMPT_INIT_TITLE);
            } else {
                PROMPT_ITEM_title.setText(ParamConst.PROMPT_TITLE);
            }
            break;
        case TYPE_DIVIDE_ITEM:
            convertView = DIVIDE_ITEM_convertView;
            if (position == 1) {
                DIVIDE_ITEM_top_border.setVisibility(View.GONE);
            } else {
                DIVIDE_ITEM_top_border.setVisibility(View.VISIBLE);
            }
            break;
        case TYPE_DISABLE_ITEM:
            convertView = DISABLE_ITEM_convertView;
            if (2 == position || position > 1 && ((InPara) list.get(position - 1)).getKey().equals(ParamConst.DIVID_TITLE)) {
                DISABLE_ITEM_top_border.setVisibility(View.GONE);
            } else {
                DISABLE_ITEM_top_border.setVisibility(View.VISIBLE);
            }
            break;
        case TYPE_SWITCH_ITEM:
            if (convertView == null || convertView.getTag() == null) {
                convertView = mInflater.inflate(R.layout.gt_inlistrow_value, null);
                switch_drag = new ParamConst.ViewHolderDrag();
                switch_drag.tv_key = (TextView) convertView.findViewById(R.id.draglist_key);
                switch_drag.tv_alias = (TextView) convertView.findViewById(R.id.draglist_shotkey);
                switch_drag.tv_value = (TextView) convertView.findViewById(R.id.draglist_value);
                switch_drag.tv_listview_bottom_border = (TextView) convertView.findViewById(R.id.listrow_bottom_border);
                convertView.setTag(switch_drag);
            } else {
                switch_drag = (ParamConst.ViewHolderDrag) convertView.getTag();
            }
            String value = o.getValues().get(0);
            switch_drag.tv_key.setText(key);
            switch_drag.tv_alias.setText(alias);
            switch_drag.tv_value.setText(value);
            if (position == (list.size() - 1)) {
                switch_drag.tv_listview_bottom_border.setVisibility(View.VISIBLE);
            } else {
                switch_drag.tv_listview_bottom_border.setVisibility(View.GONE);
            }
            if (list.size() == 2) {
                switch_drag.tv_listview_bottom_border.setVisibility(View.GONE);
            }
            int disable_titile_pos = IpUIManager.getInListDisableTitlePosition();
            if (position > disable_titile_pos) {
                switch_drag.tv_key.setTextColor(Color.GRAY);
                switch_drag.tv_alias.setTextColor(Color.GRAY);
                switch_drag.tv_value.setTextColor(Color.GRAY);
            } else {
                switch_drag.tv_key.setTextColor(Color.WHITE);
                switch_drag.tv_alias.setTextColor(Color.WHITE);
                switch_drag.tv_value.setTextColor(Color.WHITE);
            }
            break;
    }
    return convertView;
}
Also used : InPara(com.tencent.wstt.gt.InPara) ParamConst(com.tencent.wstt.gt.manager.ParamConst)

Example 24 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class DefaultInParaManager method getInPara.

@Override
public int getInPara(String paraName, int origVal) {
    InPara iv = inParaMap.get(paraName);
    int value = origVal;
    if (null != iv) {
        List<String> vals = iv.getValues();
        String val = vals.get(0);
        if (matchInParaType(val, "int")) {
            value = Integer.parseInt(val);
        }
    }
    return value;
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Example 25 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class DefaultInParaManager method getInPara.

@Override
public float getInPara(String paraName, float origVal) {
    InPara iv = inParaMap.get(paraName);
    float value = origVal;
    if (null != iv) {
        List<String> vals = iv.getValues();
        String val = vals.get(0);
        if (matchInParaType(val, "float")) {
            value = Float.parseFloat(val);
        }
    }
    return value;
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Aggregations

InPara (com.tencent.wstt.gt.InPara)30 ArrayList (java.util.ArrayList)4 ParamConst (com.tencent.wstt.gt.manager.ParamConst)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 OutPara (com.tencent.wstt.gt.OutPara)1