Exemple #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final String textString = (String) getItem(position);
    ViewHolder holder;
    int type = types[position];
    if (convertView == null || ((ViewHolder) convertView.getTag()).type != type) {
      holder = new ViewHolder();
      if (type == TYPE_CANCEL) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_cancel, null);
      } else if (type == TYPE_BUTTON) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout, null);
      } else if (type == TYPE_TITLE) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_title, null);
      } else if (type == TYPE_EXIT) {
        convertView = View.inflate(context, R.layout.alert_dialog_menu_list_layout_special, null);
      }

      // holder.view = (LinearLayout) convertView.findViewById(R.id.popup_layout);
      holder.text = (TextView) convertView.findViewById(R.id.popup_text);
      holder.type = type;

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

    holder.text.setText(textString);
    return convertView;
  }
Exemple #2
0
    @SuppressLint("NewApi")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;
      if (convertView == null) {
        holder = new ViewHolder();
        convertView = mInflater.inflate(R.layout.order_item, null);
        holder.date = (TextView) convertView.findViewById(R.id.item_date);
        holder.location = (TextView) convertView.findViewById(R.id.item_location);
        holder.name = (TextView) convertView.findViewById(R.id.item_name);
        holder.time = (TextView) convertView.findViewById(R.id.item_time);
        holder.type = (TextView) convertView.findViewById(R.id.item_type);
        holder.company = (TextView) convertView.findViewById(R.id.item_company);
        holder.isDone = (TextView) convertView.findViewById(R.id.item_isDone);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      TaskInfo taskInfo = tasklist.get(position);
      String ServiceDate = null;
      String serviceBegin = taskInfo.ServiceBegin();
      String serviceEnd = taskInfo.ServiceEnd();
      if (serviceBegin.equals(serviceEnd)) {
        ServiceDate = serviceBegin;
      } else {
        ServiceDate = serviceBegin + "-" + serviceEnd;
      }
      holder.time.setText(taskInfo.OnboardTime());
      holder.date.setText(ServiceDate);
      holder.location.setText(taskInfo.PickupAddress());
      holder.name.setText(taskInfo.Customer());
      holder.type.setText(taskInfo.ServiceTypeName());
      holder.company.setText(taskInfo.getCustomerCompany());
      String isUpdate = taskInfo.getIsUpdate();
      int readmark = taskInfo.getReadmark();
      if (taskInfo.getRouteNoteCount() > 0) {
        holder.isDone.setVisibility(View.VISIBLE);
        holder.isDone.setText("已完成");
        holder.isDone.setBackgroundColor(Color.parseColor("#009944"));
      } else if (null != pauseNote && pauseNote.getTaskID().equals(taskInfo.TaskID())) {
        holder.isDone.setVisibility(View.VISIBLE);
        holder.isDone.setText("暂停中");
        holder.isDone.setBackgroundColor(Color.parseColor("#eb6100"));

        //				holder.isDone.setBackground(getResources().getColor(R.color.colorYellow));
      } else if (readmark == 1) {
        holder.isDone.setVisibility(View.GONE);
      } else if (readmark == 0) {
        holder.isDone.setVisibility(View.VISIBLE);
        holder.isDone.setBackground(getResources().getDrawable(R.drawable.bg_red));
        if (isUpdate.equals("0")) {
          holder.isDone.setText("新增");
        } else {
          holder.isDone.setText("修改");
        }
      } else {
        holder.isDone.setVisibility(View.GONE);
      }
      return convertView;
    }
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder;
   if (convertView == null) {
     convertView = inflater.inflate(R.layout.equipment_list_item, null);
     holder = new ViewHolder();
     holder.name = (TextView) convertView.findViewById(R.id.equipment_name_text_view);
     holder.code = (TextView) convertView.findViewById(R.id.equipment_code_text_view);
     holder.type = (TextView) convertView.findViewById(R.id.equipment_type_text_view);
     holder.data = (TextView) convertView.findViewById(R.id.equipment_data_text_view);
     holder.state = (TextView) convertView.findViewById(R.id.equipment_state_text_view);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   final EquipmentData equipmentData = equipmentList.get(position);
   holder.name.setText(equipmentData.getName());
   holder.code.setText(equipmentData.getCode());
   holder.type.setText(equipmentData.getType());
   holder.data.setText(
       equipmentData.getData() != null ? equipmentData.getData().toString() : "--");
   final EquipmentState state = getEquipmentState(equipmentData);
   holder.state.setText(equipmentStateAsString(state));
   return convertView;
 }
  @Override
  public View getView(int i, View convertView, ViewGroup viewGroup) {
    View rowView = convertView;
    final PasswordItem pass = values.get(i);

    // reuse for performance, holder pattern!
    if (rowView == null) {
      LayoutInflater inflater =
          (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.password_row_layout, viewGroup, false);

      ViewHolder viewHolder = new ViewHolder();
      viewHolder.name = (TextView) rowView.findViewById(R.id.label);
      viewHolder.back_name = (TextView) rowView.findViewById(R.id.label_back);
      viewHolder.type = (TextView) rowView.findViewById(R.id.type);
      rowView.setTag(viewHolder);
    }

    ViewHolder holder = (ViewHolder) rowView.getTag();

    holder.name.setText(pass.toString());
    holder.back_name.setText(pass.toString());

    if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
      holder.name.setTextColor(
          this.activity.getResources().getColor(android.R.color.holo_blue_dark));
      holder.name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
      holder.type.setText("Category: ");
    } else {
      holder.type.setText("Password: ");
      holder.name.setTextColor(
          this.activity.getResources().getColor(android.R.color.holo_orange_dark));
      holder.name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));

      holder.back_name.setTextColor(this.activity.getResources().getColor(android.R.color.white));
      holder.back_name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC));

      View.OnClickListener onClickListener =
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              switch (view.getId()) {
                case R.id.crypto_show_button:
                  activity.decryptPassword(pass);
                  break;
                case R.id.crypto_delete_button:
                  activity.deletePassword(pass);
                  break;
              }
            }
          };

      ((ImageButton) rowView.findViewById(R.id.crypto_show_button))
          .setOnClickListener(onClickListener);
      ((ImageButton) rowView.findViewById(R.id.crypto_delete_button))
          .setOnClickListener(onClickListener);
    }

    return rowView;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    // Si la vue n'est pas recyclée
    if (convertView == null) {

      // On récupère le layout
      convertView = inflater.inflate(R.layout.item_notification, null);

      holder = new ViewHolder();
      // On place les widgets de notre layout dans le holder
      holder.username = (TextView) convertView.findViewById(R.id.username);
      holder.message = (TextView) convertView.findViewById(R.id.message);
      holder.type = (ImageView) convertView.findViewById(R.id.type);

      // puis on insère le holder en tant que tag dans le layout
      convertView.setTag(holder);

    } else {

      // Si on recycle la vue, on récupère son holder en tag
      holder = (ViewHolder) convertView.getTag();
    }

    // Dans tous les cas, on récupère la notification concerné.
    Notification notification = (Notification) getItem(position);
    // Si cet élément existe vraiment…
    if (notification != null) {
      // On place dans le holder les informations sur la notification.
      holder.username.setText(notification.getUserFrom());
      holder.message.setText(adaptString(notification.getMessage()));
      if (notification.getType().equals(TYPE.INFO)) {
        holder.type.setImageResource(R.drawable.info);
      } else if (notification.getType().equals(TYPE.FUEL)) {
        holder.type.setImageResource(R.drawable.fuel);
      } else if (notification.getType().equals(TYPE.INVITATION)) {
        holder.type.setImageResource(R.drawable.invitation);
      }
    }
    return convertView;
  }
  @Override
  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
    ViewHolder vh = null;
    if (paramView == null) {
      LayoutInflater infl =
          (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      paramView = infl.inflate(R.layout.manual_list_item, null);
      vh = new ViewHolder();
      vh.item = (TextView) paramView.findViewById(R.id.ml_item_title);
      vh.type = (TextView) paramView.findViewById(R.id.ml_item_type);
      vh.val = (TextView) paramView.findViewById(R.id.ml_item_value);
      vh.desc = (TextView) paramView.findViewById(R.id.ml_item_desc);
      vh.packagename = (TextView) paramView.findViewById(R.id.ml_item_pack);
      vh.cb = (CheckBox) paramView.findViewById(R.id.ml_item_cb);
      vh.cb.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              CheckBox cb = (CheckBox) view;
              ManualItemData d = (ManualItemData) cb.getTag();
              d.setCek(cb.isChecked() ? 1 : 0);
            }
          });

      paramView.setTag(vh);
    } else {
      vh = (ViewHolder) paramView.getTag();
    }

    ManualItemData md = data.get(paramInt);
    vh.item.setText(md.getNamaField());
    vh.type.setText(md.getTipe());
    vh.val.setText(md.getNilai());
    vh.desc.setText(md.getCatatan());
    vh.packagename.setText(md.getNamaPaket());
    vh.cb.setChecked(md.isCek() == 1);
    vh.cb.setTag(md);

    return paramView;
  }
    public View getView(int position, View convertView, ViewGroup parent) {

      View sv = null;

      // get data
      connectionInfo item = data.get(position);

      // prepare view
      if (convertView == null) {

        sv = (View) itemInflater.inflate(R.layout.ui_connection_item, parent, false);

        holder = new ViewHolder();
        holder.type = ((TextView) sv.findViewById(R.id.id_connection_type));
        holder.src = ((TextView) sv.findViewById(R.id.id_connection_src));
        holder.dst = ((TextView) sv.findViewById(R.id.id_connection_dst));
        holder.owner = ((TextView) sv.findViewById(R.id.id_connection_owner));
        holder.status = ((TextView) sv.findViewById(R.id.id_connection_status));

        sv.setTag(holder);
      } else {
        sv = (View) convertView;
        holder = (ViewHolder) sv.getTag();
      }

      // draw current color for each item
      if (position % 2 == 0)
        sv.setBackgroundColor(getResources().getColor(R.color.dkgrey_osmonitor));
      else sv.setBackgroundColor(getResources().getColor(R.color.black_osmonitor));

      // prepare main information
      switch (item.getType().getNumber()) {
        case connectionInfo.connectionType.TCPv4_VALUE:
          holder.type.setText("TCP4");
          break;
        case connectionInfo.connectionType.TCPv6_VALUE:
          holder.type.setText("TCP6");
          break;
        case connectionInfo.connectionType.UDPv4_VALUE:
          holder.type.setText("UDP4");
          break;
        case connectionInfo.connectionType.UDPv6_VALUE:
          holder.type.setText("UDP6");
          break;
        case connectionInfo.connectionType.RAWv4_VALUE:
          holder.type.setText("RAW4");
          break;
        case connectionInfo.connectionType.RAWv6_VALUE:
          holder.type.setText("RAW6");
          break;
      }

      holder.src.setText(convertFormat(item.getLocalIP(), item.getLocalPort()));
      holder.dst.setText(convertFormat(item.getRemoteIP(), item.getRemotePort()));

      switch (item.getStatus().getNumber()) {
        case connectionInfo.connectionStatus.CLOSE_VALUE:
          holder.status.setText("CLOSE");
          break;
        case connectionInfo.connectionStatus.CLOSE_WAIT_VALUE:
          holder.status.setText("CLOSE_WAIT");
          break;
        case connectionInfo.connectionStatus.CLOSING_VALUE:
          holder.status.setText("CLOSING");
          break;
        case connectionInfo.connectionStatus.ESTABLISHED_VALUE:
          holder.status.setText("ESTABLISHED");
          break;
        case connectionInfo.connectionStatus.FIN_WAIT1_VALUE:
          holder.status.setText("FIN_WAIT1");
          break;
        case connectionInfo.connectionStatus.FIN_WAIT2_VALUE:
          holder.status.setText("FIN_WAIT2");
          break;
        case connectionInfo.connectionStatus.LAST_ACK_VALUE:
          holder.status.setText("LAST_ACK");
          break;
        case connectionInfo.connectionStatus.LISTEN_VALUE:
          holder.status.setText("LISTEN");
          break;
        case connectionInfo.connectionStatus.SYN_RECV_VALUE:
          holder.status.setText("SYN_RECV");
          break;
        case connectionInfo.connectionStatus.SYN_SENT_VALUE:
          holder.status.setText("SYN_SENT");
          break;
        case connectionInfo.connectionStatus.TIME_WAIT_VALUE:
          holder.status.setText("TIME_WAIT");
          break;
        case connectionInfo.connectionStatus.UNKNOWN_VALUE:
          holder.status.setText("UNKNOWN");
          break;
      }

      if (item.getUid() == 0) holder.owner.setText("System");
      else if (map.containsKey(item.getUid())) holder.owner.setText(map.get(item.getUid()));
      else holder.owner.setText(item.getUid() + "(UID)");

      return sv;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      index = position;
      ViewHolder holder = null;
      Info info = (Info) mList.get(position);

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.join_info_listview_item, null);
        holder = new ViewHolder();
        holder.type = (TextView) convertView.findViewById(R.id.join_info_item_text_name);
        holder.ding = (TextView) convertView.findViewById(R.id.join_info_item_text_ding);
        holder.name = (TextView) convertView.findViewById(R.id.join_info_item_text_faqiren);
        holder.starNum = (LinearLayout) convertView.findViewById(R.id.join_info_item_linear_star);
        holder.progress = (TextView) convertView.findViewById(R.id.join_info_item_text_progress);
        holder.allAtm = (TextView) convertView.findViewById(R.id.join_info_item_text_all_amt);
        holder.layoutLeft =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_left);
        holder.layoutCenter =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_center);
        holder.layoutRight =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_right);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      if (info.getIsTop().equals("true")) {
        holder.ding.setBackgroundResource(R.drawable.join_top);
        holder.ding.setVisibility(view.VISIBLE);
      } else {
        holder.ding.setVisibility(view.GONE);
      }
      int with = PublicMethod.getDisplayWidth(JoinInfoActivity.this);
      if (with == 800) {
        LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(
                PublicMethod.getPxInt(110, JoinInfoActivity.this),
                PublicMethod.getPxInt(28, JoinInfoActivity.this));
        holder.type.setLayoutParams(params);
        LinearLayout.LayoutParams paramsLayout =
            new LinearLayout.LayoutParams(250, LayoutParams.WRAP_CONTENT);
        holder.layoutLeft.setLayoutParams(paramsLayout);
        holder.layoutCenter.setLayoutParams(paramsLayout);
        holder.layoutRight.setLayoutParams(paramsLayout);
      }
      holder.type.setText(info.getLottype());
      holder.name.setText("发起人:" + getusername(info.getName()));
      holder.progress.setText(info.getProgress() + "(" + info.getSafe() + ")");
      holder.allAtm.setText(info.getAllAtm() + "元");
      // holder.atm.setText("¥"+info.getAtm());
      // holder.safe.setText(info.getSafe());
      PublicMethod.createStar(
          holder.starNum,
          info.getCrown(),
          info.getGrayCrown(),
          info.getCup(),
          info.getGrayCup(),
          info.getDiamond(),
          info.getGrayDiamond(),
          info.getStarNum(),
          info.getGrayStarNum(),
          JoinInfoActivity.this,
          4);
      return convertView;
    }