Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 当我选中复选框后滚动时,复选框会被随机选中和取消选中 公共类CustomExpandableListAdapter扩展BaseExpandableListAdapter实现OnCheckedChangeListener{ 私有CoreWorkFlowAct_Java_Android_Expandablelistview_Expandablelistadapter - Fatal编程技术网

Java 当我选中复选框后滚动时,复选框会被随机选中和取消选中 公共类CustomExpandableListAdapter扩展BaseExpandableListAdapter实现OnCheckedChangeListener{ 私有CoreWorkFlowAct

Java 当我选中复选框后滚动时,复选框会被随机选中和取消选中 公共类CustomExpandableListAdapter扩展BaseExpandableListAdapter实现OnCheckedChangeListener{ 私有CoreWorkFlowAct,java,android,expandablelistview,expandablelistadapter,Java,Android,Expandablelistview,Expandablelistadapter,当我选中复选框后滚动时,复选框会被随机选中和取消选中 公共类CustomExpandableListAdapter扩展BaseExpandableListAdapter实现OnCheckedChangeListener{ 私有CoreWorkFlowActivity上下文; 私有列表listDataHeader=new ArrayList();//标题 //标题标题、子标题格式的子数据 ArrayList arrIVRetest=新的ArrayList(); 私有HashMap listData

当我选中复选框后滚动时,复选框会被随机选中和取消选中
公共类CustomExpandableListAdapter扩展BaseExpandableListAdapter实现OnCheckedChangeListener{
私有CoreWorkFlowActivity上下文;
私有列表listDataHeader=new ArrayList();//标题
//标题标题、子标题格式的子数据
ArrayList arrIVRetest=新的ArrayList();
私有HashMap listDataChild=新HashMap();
公共静态整数计数=0;
公共静态int countIVRetest=0;
公共CustomExpandableListAdapter(CoreWorkFlowActivity上下文,ArrayList listDataHeader,
HashMap listDataChild){
this.context=上下文;
this.listDataHeader=listDataHeader;
this.listDataChild=listDataChild;
}
@凌驾
公共对象getChild(int-groupPosition、int-ChildPosition){
返回this.listDataChild.get(this.listDataHeader.get(groupPosition.getName())
.get(childpositionon.getProductName().getValue().toString();
}
@凌驾
公共长getChildId(int-groupPosition,int-childPosition){
返回子位置;
}
ArrayList ArraActivation=新建ArrayList();
@凌驾
公共视图getChildView(最终int groupPosition,最终int childPosition,
布尔值isLastChild、视图转换视图、视图组父级)
{
//listDataHeader.clear();
//arrivreset.clear();
//listDataChild.clear();
final OrderLineItem childObj=this.listDataChild.get(this.listDataHeader.get(groupPosition).getName()).get(childPosition);
最终字符串childText=(字符串)getChild(groupPosition,childPosition);
最后一个字符串groupName=this.listDataHeader.get(groupPosition.getName();
if(convertView==null){
LayoutInflater infalInflater=(LayoutInflater)this.context
.getSystemService(上下文布局\充气机\服务);
convertView=infalInflater.充气(R.layout.olilist_展开,空);
}
TextView txtListChild=(TextView)convertView
.findViewById(R.id.oliexpandedTextView);
setText(childText);
setTypeface(RobotoTypeface.sRobotoRegular(上下文));
TextView txtlistStatus=(TextView)convertView.findViewById(R.id.oliexpandedstatus);
setTypeface(robototype.sRobotoItalic(上下文));
复选框cbChild=(复选框)convertView.findViewById(R.id.checkboxoli);
setOnCheckedChangeListener(新的OnCheckedChangeListener()
{
@凌驾
检查更改后的公共无效(复合按钮视图,布尔值已检查){
//再测试
if(isChecked&&groupName.equals(OLIConstants.IV_重新测试))
{
countIVRetest=countIVRetest+1;
arrIVRetest.add(childPosition);//添加选中的oli
getSummaryFragment().getOli2(arrIVRetest,groupPosition);
如果(!context.getSummaryFragment().ivresetAll.isEnabled())
{
context.getSummaryFragment().enableButtonIVRetest(true);
}
}
如果(!isChecked&&groupName.equals(OLIConstants.IV_reset))
{
countIVRetest=countIVRetest-1;
整数arrv=arrIVRetest.indexOf(childPosition);
arrv重新测试。移除(arrv);
getSummaryFragment().getOli2(arrIVRetest,groupPosition);
if(context.getSummaryFragment().ivresetAll.isEnabled()&&countivreset0)
{context.getSummaryFragment().ivresetAll.setEnabled(true);}
}
否则{
cbChild.setChecked(false);
}
}
}*/
//********************************************************************************
返回视图;
}
@凌驾
公共整数getChildrenCount(整数组位置){
返回this.listDataChild.get(this.listDataHeader.get(groupPosition.getName())
.size();
}
@凌驾
公共对象getGroup(int-groupPosition){
返回此.listDataHeader.get(groupPosition);
}
@凌驾
public int getGroupCount(){
返回此.listDataHeader.size();
}
@凌驾
公共长getGroupId(int-groupPosition){
返回组位置;
}
@凌驾
公共视图getGroupView(int-groupPosition,布尔值isExpanded,
视图(视图、视图组父级){
ActivationType headerTitleValues=(ActivationType)getGroup(groupPosition);
if(convertView==null){
LayoutInflater infalInflater=(LayoutInflater)this.context
.getSystemService(上下文布局\充气机\服务);
convertView=infalInflater.充气(R.layout.summarylist\u布局,null);
}
TextView lblistheader=(TextView)convertView
.findviewbyd(R.id.摘要文本);
lblListHeader.setTypeface(robotype.sRobotoBold(上下文));
lblListHeader.setText(headerTitleValues.getName());
lblListHeader.setTextColor(Color.parseColor(headerTitleValues.getColor());
ImageView lblimage=(ImageView)convertView.findViewById(R.id.summarylist_color);
lblimage.setBackgroundColor(Color.parseColor(headerTitleValues.getColor());
形象
    public class CustomExpandableListAdapter extends BaseExpandableListAdapter implements OnCheckedChangeListener {

        private CoreWorkFlowActivity context;
        private List<ActivationType> listDataHeader=new ArrayList<ActivationType>(); // header titles
        // child data in format of header title, child title
        ArrayList<Integer> arrIVRetest = new ArrayList<Integer>();
        private HashMap<String, List<OrderLineItem>> listDataChild= new HashMap<String, List<OrderLineItem>>();
        public static int count=0;
        public static int countIVRetest=0;
        public CustomExpandableListAdapter(CoreWorkFlowActivity context, ArrayList<ActivationType> listDataHeader,
                HashMap<String, List<OrderLineItem>> listDataChild) {
            this.context = context;
            this.listDataHeader = listDataHeader;
            this.listDataChild = listDataChild;
        }

        @Override
        public Object getChild(int groupPosition, int childPosititon) {

            return this.listDataChild.get(this.listDataHeader.get(groupPosition).getName())
                    .get(childPosititon).getProductName().getValue().toString();
        }

        @Override
        public long getChildId(int groupPosition, int childPosition) {

            return childPosition;
        }
        ArrayList<Integer> arrActivation = new ArrayList<Integer>();

        @Override
        public View getChildView(final int groupPosition, final int childPosition,
                boolean isLastChild, View convertView, ViewGroup parent) 
        {
            //listDataHeader.clear();
            //arrIVRetest.clear();
            //listDataChild.clear();

            final OrderLineItem childObj=this.listDataChild.get(this.listDataHeader.get(groupPosition).getName()).get(childPosition);
            final String childText = (String) getChild(groupPosition, childPosition);
            final String groupName=this.listDataHeader.get(groupPosition).getName();

            if (convertView == null) {
                LayoutInflater infalInflater = (LayoutInflater) this.context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = infalInflater.inflate(R.layout.olilist_expanded, null);
            }

            TextView txtListChild = (TextView) convertView
                    .findViewById(R.id.oliexpandedTextView);

            txtListChild.setText(childText);
            txtListChild.setTypeface(RobotoTypeface.sRobotoRegular(context));
            TextView txtlistStatus=(TextView)convertView.findViewById(R.id.oliexpandedstatus);
            txtlistStatus.setTypeface(RobotoTypeface.sRobotoItalic(context));
            CheckBox cbChild=(CheckBox)convertView.findViewById(R.id.checkboxoli);
            cbChild.setOnCheckedChangeListener(new OnCheckedChangeListener() 
            {


                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                    //IVRETEST
                    if(isChecked && groupName.equals(OLIConstants.IV_RETEST))
                    {

                        countIVRetest=countIVRetest+1;
                        arrIVRetest.add(childPosition);//adding oli which r checked 
                        context.getSummaryFragment().getOli2(arrIVRetest,groupPosition);

                        if(!context.getSummaryFragment().ivretestAll.isEnabled())
                        {
                            context.getSummaryFragment().enableButtonIVRetest(true);
                        }

                    }
                    else if(!isChecked && groupName.equals(OLIConstants.IV_RETEST))
                    {
                        countIVRetest=countIVRetest-1;
                        Integer arrv = arrIVRetest.indexOf(childPosition);
                        arrIVRetest.remove(arrv);
                        context.getSummaryFragment().getOli2(arrIVRetest,groupPosition);
                        if(context.getSummaryFragment().ivretestAll.isEnabled() && countIVRetest<=0)
                        {
                            context.getSummaryFragment().enableButtonIVRetest(false);
                        }
                    }




                    //Activation
                    if(isChecked && groupName.equals(OLIConstants.FAILED_TO_ACTIVATE))
                    {
                        count=count+1;
                        arrActivation.add(childPosition);
                        context.getSummaryFragment().getOli(arrActivation,groupPosition);

                        if(!context.getSummaryFragment().activateSystem.isEnabled())
                        {
                            context.getSummaryFragment().enableButton(true);
                        }

                    }
                    else if(!isChecked && groupName.equals(OLIConstants.FAILED_TO_ACTIVATE))
                    {
                        count=count-1;

                        arrActivation.remove(arrActivation.indexOf(childPosition));
                        context.getSummaryFragment().getOli(arrActivation,groupPosition);
                        if(context.getSummaryFragment().activateSystem.isEnabled() && count<=0)
                        {
                            context.getSummaryFragment().enableButton(false);
                        }


                    }

                }

            });


            ProgressBar pbchild=(ProgressBar)convertView.findViewById(R.id.progressBaroli);
            ImageView backArrow=(ImageView)convertView.findViewById(R.id.backwardArrow);


            if(groupName.equals(OLIConstants.READY_TO_ACTIVATE)||groupName.equals(OLIConstants.ACTIVATED_EQUIPMENT) || groupName.equals(OLIConstants.NO_ACTION)||groupName.equals(OLIConstants.COMPLETED_WORK_ITEMS)||groupName.equals(OLIConstants.PENDING_ITEMS))
            {
                backArrow.setVisibility(View.GONE);

            }
            else//added
            {
                backArrow.setVisibility(View.VISIBLE);
            }

            if(groupName.equals(OLIConstants.IV_RETEST))
            {

                txtlistStatus.setVisibility(View.VISIBLE);
                txtlistStatus.setText(childObj.getStatus().getValue().toString());
            }
            else
            {
                txtlistStatus.setVisibility(View.GONE);
            }
    //


            if(!childObj.isSelectable())
            {
                cbChild.setVisibility(View.GONE);
                pbchild.setVisibility(View.GONE);
            }
            else if(childObj.isSelectable() == true && (groupName.equals(OLIConstants.FAILED_TO_ACTIVATE)||groupName.equals(OLIConstants.IV_RETEST)) )
            {
                cbChild.setVisibility(View.VISIBLE);
                //childObj.setSelectable(false); 
                if(groupName.equals(OLIConstants.IV_RETEST))
                {
                    if(childObj.isChecked()==true)//giving this only for ivretest
                    {
                        if(childObj.getStatus().getValue().toString().equalsIgnoreCase("Open") && childObj.getTechAction().getValue().toString().equalsIgnoreCase("IV Retest"))
                        {
                            cbChild.setChecked(true);
                            childObj.setChecked(false);//for making it not to select again
                        }
                        else{
                            cbChild.setChecked(false);
                        }

                        if(countIVRetest>0)
                        {context.getSummaryFragment().ivretestAll.setEnabled(true);}
                    }
                    else{
                        cbChild.setChecked(false);

                    }
                }

                /*else{
                    cbChild.setChecked(false);
                }*/

            }
            //***************************************************************************************
            /*else if(childObj.isSelectable() == true && groupName.equals(OLIConstants.FAILED_TO_ACTIVATE)) 
            {

                cbChild.setVisibility(View.VISIBLE);
                childObj.setChecked(false);

            }
            else if(childObj.isSelectable() == true && groupName.equals(OLIConstants.IV_RETEST) )
            {
                cbChild.setVisibility(View.VISIBLE);
                if(groupName.equals(OLIConstants.IV_RETEST))
                {
                    if(childObj.isChecked()==true)//giving this only for ivretest
                    {
                        if(childObj.getStatus().getValue().toString().equalsIgnoreCase("Open") && childObj.getTechAction().getValue().toString().equalsIgnoreCase("IV Retest"))
                        {
                            cbChild.setChecked(true);
                            childObj.setChecked(false);//for making it not to select again
                        }
                        else{
                            cbChild.setChecked(false);
                        }

                        if(countIVRetest>0)
                        {context.getSummaryFragment().ivretestAll.setEnabled(true);}
                    }
                    else{
                        cbChild.setChecked(false);

                    }
                }


            }*/
            //********************************************************************************


            return convertView;
        }

        @Override
        public int getChildrenCount(int groupPosition) {
            return this.listDataChild.get(this.listDataHeader.get(groupPosition).getName())
                    .size();
        }

        @Override
        public Object getGroup(int groupPosition) {
            return this.listDataHeader.get(groupPosition);
        }

        @Override
        public int getGroupCount() {
            return this.listDataHeader.size();
        }

        @Override
        public long getGroupId(int groupPosition) {
            return groupPosition;
        }

        @Override
        public View getGroupView(int groupPosition, boolean isExpanded,
                View convertView, ViewGroup parent) {
            ActivationType headerTitleValues = (ActivationType) getGroup(groupPosition);
            if (convertView == null) {
                LayoutInflater infalInflater = (LayoutInflater) this.context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = infalInflater.inflate(R.layout.summarylist_layout, null);
            }

            TextView lblListHeader = (TextView) convertView
                    .findViewById(R.id.summary_text);
            lblListHeader.setTypeface(RobotoTypeface.sRobotoBold(context));
            lblListHeader.setText(headerTitleValues.getName());
            lblListHeader.setTextColor(Color.parseColor(headerTitleValues.getColor()));

            ImageView lblimage=(ImageView)convertView.findViewById(R.id.summarylist_color);
            lblimage.setBackgroundColor(Color.parseColor(headerTitleValues.getColor()));

            ImageView arrowImg=(ImageView)convertView.findViewById(R.id.arrowImg);
            if(isExpanded)
            {
                arrowImg.setBackgroundResource(R.drawable.up_arrow);
            }
            else
            {
                arrowImg.setBackgroundResource(R.drawable.down_arrow);
            }

            return convertView;
        }

        @Override
        public boolean hasStableIds() {
            return false;
        }

        @Override
        public boolean isChildSelectable(int groupPosition, int childPosition) {
            return true;
        }

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub

        }

}