/** {@inheritDoc} */ public boolean onItemLongClick( final AdapterView<?> parent, final View view, final int position, final long id) { final Conversation c = Conversation.getConversation(this, (Cursor) parent.getItemAtPosition(position), true); final Uri target = c.getUri(); Builder builder = new Builder(this); String[] items = this.longItemClickDialog; final Contact contact = c.getContact(); final String a = contact.getNumber(); Log.d(TAG, "p: " + a); final String n = contact.getName(); if (TextUtils.isEmpty(n)) { builder.setTitle(a); items = items.clone(); items[WHICH_VIEW_CONTACT] = this.getString(R.string.add_contact_); } else { builder.setTitle(n); } final SpamDB db = new SpamDB(this.getApplicationContext()); db.open(); if (db.isInDB(a)) { items = items.clone(); items[WHICH_MARK_SPAM] = this.getString(R.string.dont_filter_spam_); } db.close(); builder.setItems( items, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { Intent i = null; switch (which) { case WHICH_ANSWER: ConversationListActivity.this.startActivity( getComposeIntent(ConversationListActivity.this, a)); break; case WHICH_CALL: i = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:" + a)); ConversationListActivity.this.startActivity(i); break; case WHICH_VIEW_CONTACT: if (n == null) { i = ContactsWrapper.getInstance().getInsertPickIntent(a); Conversation.flushCache(); } else { final Uri uri = c.getContact().getUri(); i = new Intent(Intent.ACTION_VIEW, uri); } ConversationListActivity.this.startActivity(i); break; case WHICH_VIEW: i = new Intent( ConversationListActivity.this, // . MessageListActivity.class); i.setData(target); ConversationListActivity.this.startActivity(i); break; case WHICH_DELETE: ConversationListActivity.deleteMessages( ConversationListActivity.this, target, R.string.delete_thread_, R.string.delete_thread_question, null); break; case WHICH_MARK_SPAM: ConversationListActivity.addToOrRemoveFromSpamlist( ConversationListActivity.this, c.getContact().getNumber()); break; default: break; } } }); builder.create().show(); return true; }
/* * * /** {@inheritDoc} */ @Override public final void bindView(final View view, final Context context, final Cursor cursor) { final Conversation c = Conversation.getConversation(context, cursor, false); final Contact contact = c.getContact(); ViewHolder holder = (ViewHolder) view.getTag(); if (holder == null) { holder = new ViewHolder(); holder.tvPerson = (TextView) view.findViewById(R.id.addr); holder.tvCount = (TextView) view.findViewById(R.id.count); holder.tvBody = (TextView) view.findViewById(R.id.body); holder.tvDate = (TextView) view.findViewById(R.id.date); holder.ivPhoto = (ImageView) view.findViewById(R.id.photo); holder.vRead = view.findViewById(R.id.read); view.setTag(holder); } if (useGridLayout) { holder.tvCount.setVisibility(View.GONE); } else { final int count = c.getCount(); if (count < 0) { holder.tvCount.setText(""); } else { holder.tvCount.setText("(" + c.getCount() + ")"); } } if (textSize > 0) { holder.tvBody.setTextSize(textSize); } final int col = textColor; if (col != 0) { holder.tvPerson.setTextColor(col); holder.tvBody.setTextColor(col); holder.tvCount.setTextColor(col); holder.tvDate.setTextColor(col); } if (useGridLayout || ConversationListActivity.showContactPhoto) { holder.ivPhoto.setImageDrawable(contact.getAvatar(activity, defaultContactAvatar)); holder.ivPhoto.setVisibility(View.VISIBLE); if (!useGridLayout) { holder.ivPhoto.setOnClickListener( WRAPPER.getQuickContact( context, holder.ivPhoto, contact.getLookUpUri(context.getContentResolver()), 2, null)); } } else { holder.ivPhoto.setVisibility(View.GONE); } if (isBlocked(contact.getNumber())) { holder.tvPerson.setText("[" + contact.getDisplayName() + "]"); } else { holder.tvPerson.setText(contact.getDisplayName()); } // read status if (c.getRead() == 0) { holder.vRead.setVisibility(View.VISIBLE); } else { holder.vRead.setVisibility(View.INVISIBLE); } // body CharSequence text = c.getBody(); if (text == null) { text = context.getString(R.string.mms_conversation); } if (convertNCR) { text = Converter.convertDecNCR2Char(text); } if (showEmoticons) { text = SmileyParser.getInstance(context).addSmileySpans(text); } holder.tvBody.setText(text); // date long time = c.getDate(); holder.tvDate.setText(ConversationListActivity.getDate(context, time)); // presence ImageView ivPresence = (ImageView) view.findViewById(R.id.presence); if (contact.getPresenceState() > 0) { ivPresence.setImageResource(Contact.getPresenceRes(contact.getPresenceState())); ivPresence.setVisibility(View.VISIBLE); } else { ivPresence.setVisibility(View.GONE); } }