Program: 39381
Project: 39381
Buggy source:
@Override public View getView(final int position,View convertView,final ViewGroup parent){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=mInflater.inflate(R.layout.record_item,null);
    holder.icon=(ImageView)convertView.findViewById(R.id.record_icon);
    holder.inLy=convertView.findViewById(R.id.shouru_ly);
    holder.outLY=convertView.findViewById(R.id.zhichu_ly);
    holder.outTv=(TextView)convertView.findViewById(R.id.out_tv);
    holder.inTv=(TextView)convertView.findViewById(R.id.in_tv);
    holder.outRemarkTv=(TextView)convertView.findViewById(R.id.out_remark_tv);
    holder.inRemarkTv=(TextView)convertView.findViewById(R.id.in_remark_tv);
    holder.recordDateTv=(TextView)convertView.findViewById(R.id.record_date);
    holder.delV=convertView.findViewById(R.id.icon_del);
    holder.editV=convertView.findViewById(R.id.icon_edit);
    holder.lineV=convertView.findViewById(R.id.record_line);
    holder.myRoundColorView=(MyRoundColorView)convertView.findViewById(R.id.myRound);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  final RecordDetailDO recordDetailDO=recordDetailDOs.get(position);
  if (recordDetailDO.isDayFirstDay()) {
    recordDetailDOMap.put(recordDetailDO.getRecordDate(),recordDetailDO);
  }
  int color=mContext.getResources().getColor(ThemeUtil.getTheme(mContext).getMainColorID());
  holder.lineV.setBackgroundColor(color);
  holder.myRoundColorView.setMyRoundColor(color);
  holder.inTv.setTextColor(color);
  holder.outTv.setTextColor(color);
  holder.inRemarkTv.setTextColor(color);
  holder.outRemarkTv.setTextColor(color);
  holder.inLy.setVisibility(recordDetailDO.getRecordMoney() > 0 || (recordDetailDO.isDayFirstDay() && recordDetailDO.getTodayAllInMoney() > 0) || (recordDetailDO.isMonthFirstDay()) ? View.VISIBLE : View.INVISIBLE);
  holder.outLY.setVisibility(recordDetailDO.getRecordMoney() < 0 || (recordDetailDO.isDayFirstDay() && recordDetailDO.getTodayAllOutMoney() < 0) ? View.VISIBLE : View.INVISIBLE);
  holder.icon.setVisibility(recordDetailDO.isDayFirstDay() || recordDetailDO.isMonthFirstDay() ? View.INVISIBLE : View.VISIBLE);
  holder.recordDateTv.setVisibility(recordDetailDO.isDayFirstDay() || recordDetailDO.isMonthFirstDay() ? View.VISIBLE : View.INVISIBLE);
  resetOptBt();
  if (recordDetailDO.getRecordMoney() < 0) {
    holder.outTv.setText(recordDetailDO.getRecordDesc() + "String_Node_Str" + String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getRecordMoney())));
    holder.outRemarkTv.setText(recordDetailDO.getRemark());
  }
  if (recordDetailDO.getRecordMoney() > 0) {
    holder.inTv.setText(recordDetailDO.getRecordDesc() + "String_Node_Str" + String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getRecordMoney())));
    holder.inRemarkTv.setText("String_Node_Str");
  }
  if (recordDetailDO.isMonthFirstDay()) {
    DateFormat format=new SimpleDateFormat("String_Node_Str");
    holder.inTv.setText(DateTimeUtil.isThisYear(recordDetailDO.getRecordDate()) ? "String_Node_Str" : format.format(recordDetailDO.getRecordDate()));
  }
 else {
    if (recordDetailDO.getTodayAllInMoney() >= 0 && recordDetailDO.isDayFirstDay()) {
      holder.inTv.setText(String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getTodayAllInMoney())) + "String_Node_Str");
      holder.outRemarkTv.setText("String_Node_Str");
    }
  }
  if (recordDetailDO.getTodayAllOutMoney() <= 0 && recordDetailDO.isDayFirstDay()) {
    holder.outTv.setText("String_Node_Str" + String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getTodayAllOutMoney())));
    holder.inRemarkTv.setText("String_Node_Str");
  }
  if (recordDetailDO.isMonthFirstDay()) {
    DateFormat format=new SimpleDateFormat("String_Node_Str");
    holder.recordDateTv.setText(format.format(recordDetailDO.getRecordDate()));
  }
 else {
    if (DateTimeUtil.isToday(recordDetailDO.getRecordDate())) {
      holder.recordDateTv.setText("String_Node_Str");
    }
 else {
      DateFormat format=new SimpleDateFormat("String_Node_Str");
      holder.recordDateTv.setText(format.format(recordDetailDO.getRecordDate()));
    }
  }
  holder.icon.setImageResource(IconTypeUtil.getTypeIcon(recordDetailDO.getIconId()));
  final ViewHolder finalHolder=holder;
  if (!recordDetailDO.isDayFirstDay() && !recordDetailDO.isMonthFirstDay()) {
    holder.icon.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        resetOptBt();
        if (lastSelOpt != position) {
          optViews.add(finalHolder.delV);
          optViews.add(finalHolder.editV);
          finalHolder.delV.setVisibility(View.VISIBLE);
          finalHolder.editV.setVisibility(View.VISIBLE);
          YoYo.with(Techniques.SlideInUp).duration(200).playOn(finalHolder.delV);
          YoYo.with(Techniques.SlideInDown).duration(200).playOn(finalHolder.editV);
          lastSelOpt=position;
        }
 else {
          lastSelOpt=-1;
        }
      }
    }
);
  }
  holder.delV.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      final MaterialDialog materialDialog=new MaterialDialog(mContext);
      materialDialog.setTitle("String_Node_Str").setMessage("String_Node_Str").setPositiveButton("String_Node_Str",new View.OnClickListener(){
        @Override public void onClick(        View v){
          final Record record=recordLocalDAO.getRecordById(mContext,recordDetailDO.getRecordID());
          record.setIsDel(true);
          recordManager.updateOldRecord(record,new Handler(){
            @Override public void handleMessage(            Message msg){
              super.handleMessage(msg);
              accountManager.updateAccountMoney(record.getAccountID(),-record.getRecordMoney(),new Handler(){
                @Override public void handleMessage(                Message msg){
                  super.handleMessage(msg);
                  ((MainActivity)mContext).getReloadAccountCallBack().reload(true);
                  ((MainActivity)mContext).getReloadAnalysisCallBack().reload(true);
                }
              }
);
            }
          }
);
          RecordDetailDO todayRecordDetailDO=recordDetailDOMap.get(recordDetailDO.getRecordDate());
          if (recordDetailDO.getRecordMoney() < 0) {
            todayRecordDetailDO.setTodayAllOutMoney(todayRecordDetailDO.getTodayAllOutMoney() - recordDetailDO.getRecordMoney());
          }
 else {
            todayRecordDetailDO.setTodayAllInMoney(todayRecordDetailDO.getTodayAllInMoney() - recordDetailDO.getRecordMoney());
          }
          if (recordDetailDOs.get(position - 1).isDayFirstDay() && (position == recordDetailDOs.size() - 1 || recordDetailDOs.get(position + 1).isDayFirstDay() || recordDetailDOs.get(position + 1).isMonthFirstDay())) {
            if (recordDetailDOs.get(position - 2).isMonthFirstDay() && (position == recordDetailDOs.size() - 1 || recordDetailDOs.get(position + 1).isMonthFirstDay())) {
              recordDetailDOs.remove(position - 2);
              recordDetailDOs.remove(position - 2);
              recordDetailDOs.remove(position - 2);
            }
 else {
              recordDetailDOs.remove(position - 1);
              recordDetailDOs.remove(position - 1);
            }
          }
 else {
            recordDetailDOs.remove(position);
          }
          if (recordDetailDOs.size() == 0) {
            recordFrg.resetFoot();
          }
          notifyDataSetChanged();
          materialDialog.dismiss();
        }
      }
).setNegativeButton("String_Node_Str",new View.OnClickListener(){
        @Override public void onClick(        View v){
          materialDialog.dismiss();
        }
      }
).show();
    }
  }
);
  holder.editV.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(mContext,CreateOrEditRecordActivity.class);
      intent.putExtra(IntentConstant.OLD_RECORD,recordLocalDAO.getRecordById(mContext,recordDetailDO.getRecordID()));
      resetOptBt();
      lastSelOpt=-1;
      ((MainActivity)mContext).startActivityForResult(intent,MainActivity.REQUEST_RECORD);
    }
  }
);
  convertView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      lastSelOpt=-1;
      resetOptBt();
    }
  }
);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(final int position,View convertView,final ViewGroup parent){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=mInflater.inflate(R.layout.record_item,null);
    holder.icon=(ImageView)convertView.findViewById(R.id.record_icon);
    holder.inLy=convertView.findViewById(R.id.shouru_ly);
    holder.outLY=convertView.findViewById(R.id.zhichu_ly);
    holder.outTv=(TextView)convertView.findViewById(R.id.out_tv);
    holder.inTv=(TextView)convertView.findViewById(R.id.in_tv);
    holder.outRemarkTv=(TextView)convertView.findViewById(R.id.out_remark_tv);
    holder.inRemarkTv=(TextView)convertView.findViewById(R.id.in_remark_tv);
    holder.recordDateTv=(TextView)convertView.findViewById(R.id.record_date);
    holder.delV=convertView.findViewById(R.id.icon_del);
    holder.editV=convertView.findViewById(R.id.icon_edit);
    holder.lineV=convertView.findViewById(R.id.record_line);
    holder.myRoundColorView=(MyRoundColorView)convertView.findViewById(R.id.myRound);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  final RecordDetailDO recordDetailDO=recordDetailDOs.get(position);
  if (recordDetailDO.isDayFirstDay()) {
    recordDetailDOMap.put(recordDetailDO.getRecordDate(),recordDetailDO);
  }
  int color=mContext.getResources().getColor(ThemeUtil.getTheme(mContext).getMainColorID());
  holder.lineV.setBackgroundColor(color);
  holder.myRoundColorView.setMyRoundColor(color);
  holder.inTv.setTextColor(color);
  holder.outTv.setTextColor(color);
  holder.inRemarkTv.setTextColor(color);
  holder.outRemarkTv.setTextColor(color);
  holder.inLy.setVisibility(recordDetailDO.getRecordMoney() > 0 || (recordDetailDO.isDayFirstDay() && recordDetailDO.getTodayAllInMoney() > 0) || (recordDetailDO.isMonthFirstDay()) ? View.VISIBLE : View.INVISIBLE);
  holder.outLY.setVisibility(recordDetailDO.getRecordMoney() < 0 || (recordDetailDO.isDayFirstDay() && recordDetailDO.getTodayAllOutMoney() < 0) ? View.VISIBLE : View.INVISIBLE);
  holder.icon.setVisibility(recordDetailDO.isDayFirstDay() || recordDetailDO.isMonthFirstDay() ? View.INVISIBLE : View.VISIBLE);
  holder.recordDateTv.setVisibility(recordDetailDO.isDayFirstDay() || recordDetailDO.isMonthFirstDay() ? View.VISIBLE : View.INVISIBLE);
  holder.delV.setVisibility(lastSelOpt == position ? View.VISIBLE : View.INVISIBLE);
  holder.editV.setVisibility(lastSelOpt == position ? View.VISIBLE : View.INVISIBLE);
  if (recordDetailDO.getRecordMoney() < 0) {
    holder.outTv.setText(recordDetailDO.getRecordDesc() + "String_Node_Str" + String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getRecordMoney())));
    holder.outRemarkTv.setText(recordDetailDO.getRemark());
  }
  if (recordDetailDO.getRecordMoney() > 0) {
    holder.inTv.setText(recordDetailDO.getRecordDesc() + "String_Node_Str" + String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getRecordMoney())));
    holder.inRemarkTv.setText("String_Node_Str");
  }
  if (recordDetailDO.isMonthFirstDay()) {
    DateFormat format=new SimpleDateFormat("String_Node_Str");
    holder.inTv.setText(DateTimeUtil.isThisYear(recordDetailDO.getRecordDate()) ? "String_Node_Str" : format.format(recordDetailDO.getRecordDate()));
  }
 else {
    if (recordDetailDO.getTodayAllInMoney() >= 0 && recordDetailDO.isDayFirstDay()) {
      holder.inTv.setText(String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getTodayAllInMoney())) + "String_Node_Str");
      holder.outRemarkTv.setText("String_Node_Str");
    }
  }
  if (recordDetailDO.getTodayAllOutMoney() <= 0 && recordDetailDO.isDayFirstDay()) {
    holder.outTv.setText("String_Node_Str" + String.format(mContext.getResources().getString(R.string.record_money_format),Math.abs(recordDetailDO.getTodayAllOutMoney())));
    holder.inRemarkTv.setText("String_Node_Str");
  }
  if (recordDetailDO.isMonthFirstDay()) {
    DateFormat format=new SimpleDateFormat("String_Node_Str");
    holder.recordDateTv.setText(format.format(recordDetailDO.getRecordDate()));
  }
 else {
    if (DateTimeUtil.isToday(recordDetailDO.getRecordDate())) {
      holder.recordDateTv.setText("String_Node_Str");
    }
 else {
      DateFormat format=new SimpleDateFormat("String_Node_Str");
      holder.recordDateTv.setText(format.format(recordDetailDO.getRecordDate()));
    }
  }
  holder.icon.setImageResource(IconTypeUtil.getTypeIcon(recordDetailDO.getIconId()));
  final ViewHolder finalHolder=holder;
  if (!recordDetailDO.isDayFirstDay() && !recordDetailDO.isMonthFirstDay()) {
    holder.icon.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        if (lastSelOpt != position) {
          lastSelOpt=position;
          notifyDataSetChanged();
          YoYo.with(Techniques.SlideInUp).duration(200).playOn(finalHolder.delV);
          YoYo.with(Techniques.SlideInDown).duration(200).playOn(finalHolder.editV);
        }
 else {
          resetOptStatus();
        }
      }
    }
);
  }
  holder.delV.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      final MaterialDialog materialDialog=new MaterialDialog(mContext);
      materialDialog.setTitle(mContext.getResources().getString(R.string.delete_record)).setMessage("String_Node_Str").setPositiveButton(mContext.getResources().getString(R.string.ok),new View.OnClickListener(){
        @Override public void onClick(        View v){
          final Record record=recordLocalDAO.getRecordById(mContext,recordDetailDO.getRecordID());
          record.setIsDel(true);
          recordManager.updateOldRecord(record,new Handler(){
            @Override public void handleMessage(            Message msg){
              super.handleMessage(msg);
              accountManager.updateAccountMoney(record.getAccountID(),-record.getRecordMoney(),new Handler(){
                @Override public void handleMessage(                Message msg){
                  super.handleMessage(msg);
                  ((MainActivity)mContext).getReloadAccountCallBack().reload(true);
                  ((MainActivity)mContext).getReloadAnalysisCallBack().reload(true);
                }
              }
);
            }
          }
);
          RecordDetailDO todayRecordDetailDO=recordDetailDOMap.get(recordDetailDO.getRecordDate());
          if (recordDetailDO.getRecordMoney() < 0) {
            todayRecordDetailDO.setTodayAllOutMoney(todayRecordDetailDO.getTodayAllOutMoney() - recordDetailDO.getRecordMoney());
          }
 else {
            todayRecordDetailDO.setTodayAllInMoney(todayRecordDetailDO.getTodayAllInMoney() - recordDetailDO.getRecordMoney());
          }
          if (recordDetailDOs.get(position - 1).isDayFirstDay() && (position == recordDetailDOs.size() - 1 || recordDetailDOs.get(position + 1).isDayFirstDay() || recordDetailDOs.get(position + 1).isMonthFirstDay())) {
            if (recordDetailDOs.get(position - 2).isMonthFirstDay() && (position == recordDetailDOs.size() - 1 || recordDetailDOs.get(position + 1).isMonthFirstDay())) {
              recordDetailDOs.remove(position - 2);
              recordDetailDOs.remove(position - 2);
              recordDetailDOs.remove(position - 2);
            }
 else {
              recordDetailDOs.remove(position - 1);
              recordDetailDOs.remove(position - 1);
            }
          }
 else {
            recordDetailDOs.remove(position);
          }
          if (recordDetailDOs.size() == 0) {
            recordFrg.resetFoot();
          }
          notifyDataSetChanged();
          materialDialog.dismiss();
        }
      }
).setNegativeButton(mContext.getResources().getString(R.string.cancel),new View.OnClickListener(){
        @Override public void onClick(        View v){
          materialDialog.dismiss();
        }
      }
).show();
    }
  }
);
  holder.editV.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(mContext,CreateOrEditRecordActivity.class);
      intent.putExtra(IntentConstant.OLD_RECORD,recordLocalDAO.getRecordById(mContext,recordDetailDO.getRecordID()));
      resetOptStatus();
      ((MainActivity)mContext).startActivityForResult(intent,MainActivity.REQUEST_RECORD);
    }
  }
);
  convertView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      resetOptStatus();
    }
  }
);
  return convertView;
}