@Override
  public View getView(int pos, View row, ViewGroup parent) {
    if (row == null) {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      row = inflater.inflate(R.layout.conversation_item, parent, false);
    }

    TextView From = (TextView) row.findViewById(R.id.conversation_item_from);
    TextView Message = (TextView) row.findViewById(R.id.conversation_item_message);
    ImageView Photo = (ImageView) row.findViewById(R.id.conversation_item_contact_thumb);
    TextView Date = (TextView) row.findViewById(R.id.conversation_item_date);

    ConversationEntry item = data.get(pos);

    From.setText(item.getName());
    Message.setText(item.getMessage());
    if (item.getImageResourceId() != null) {
      Photo.setImageResource(item.getImageResourceId());
    } else {
      Photo.setImageBitmap(item.getPhoto());
    }
    Date.setText(DateUtils.formatDate(item.getDate()));

    return row;
  }
Esempio n. 2
0
  private void confirmMessagePart(String number, int pos) {
    Log.i(TAG, number + " " + pos);

    MessageConfirmation confirmation = partialConfs.get(number).get(pos);

    if (confirmation.getMessageParts() > 0)
      confirmation.setMessageParts(confirmation.getMessageParts() - 1);

    if (confirmation.getMessageParts() == 0) {
      String time = DateUtils.buildDate();

      if (!confirmTimes.containsKey(number))
        confirmTimes.put(number, new TreeMap<Integer, String>());

      confirmTimes.get(number).put(pos, time);

      dbUtils.confirmMessageSent(time, confirmation.getMessageId());

      Log.i(TAG, "confirmMessagePart Processing status " + processingStatus);
      partialConfs.get(number).remove(pos);
      processingStatus--;
      Log.i(TAG, "confirmMessagePart Processing status " + processingStatus);

      if (ConversationActivity.isActive() && ConversationActivity.currentNumber().equals(number)) {
        Intent in = new Intent(this, ConversationActivity.class);
        in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        in.putExtra(EncrypText.THREAD_POSITION, pos);
        in.putExtra(EncrypText.TIME, time);

        startActivity(in);
      } else if (!ConversationActivity.isActive()
          && ConversationActivity.currentNumber().equals(number))
        ConversationActivity.markNewConfs();
    }
  }