@Override public void bindView(View view, Context context, Cursor cursor) { Filter filter = new Filter(); filter.createFromDb(cursor); String filterDesc = filter.getRepresentation(context); TextView tv = (TextView) view.findViewById(R.id.line1); ImageView icon = (ImageView) view.findViewById(R.id.action_icon); tv.setText(filterDesc); icon.setContentDescription(filterDesc); switch (filter.action) { case Filter.ACTION_CAN_CALL: icon.setImageResource(R.drawable.ic_menu_goto); break; case Filter.ACTION_CANT_CALL: icon.setImageResource(R.drawable.ic_menu_blocked_user); break; case Filter.ACTION_REPLACE: icon.setImageResource(android.R.drawable.ic_menu_edit); break; case Filter.ACTION_DIRECTLY_CALL: icon.setImageResource(R.drawable.ic_menu_answer_call); break; case Filter.ACTION_AUTO_ANSWER: icon.setImageResource(R.drawable.ic_menu_auto_answer); break; default: break; } }
@Override public final CharSequence convertToString(Cursor cursor) { CharSequence number = ContactsWrapper.getInstance().transformToSipUri(mContext, cursor); if (!TextUtils.isEmpty(number)) { return Filter.rewritePhoneNumber(mContext, currentAccId, number.toString()); } return number; }
@Override public void onItemClick(AdapterView<?> ad, View view, int position, long arg3) { String number = (String) view.getTag(); SipProfile account = accountChooserButtonText.getSelectedAccount(); String rewritten = Filter.rewritePhoneNumber(getContext(), account.id, number); setTextValue(rewritten); Log.d(THIS_FILE, "Clicked contact " + number); }