Java 类android.widget.QuickContactBadge 实例源码

项目:Applozic-Android-Chat-Sample    文件:ContactsListFragment.java   
/**
 * Overrides newView() to inflate the list item views.
 */
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
    // Inflates the list item layout.
    final View itemLayout =
            mInflater.inflate(R.layout.contact_list_item, viewGroup, false);

    // Creates a new ViewHolder in which to store handles to each view resource. This
    // allows bindView() to retrieve stored references instead of calling findViewById for
    // each instance of the layout.
    final ViewHolder holder = new ViewHolder();
    holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
    holder.text2 = (TextView) itemLayout.findViewById(android.R.id.text2);
    holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);

    // Stores the resourceHolder instance in itemLayout. This makes resourceHolder
    // available to bindView and other methods that receive a handle to the item view.
    itemLayout.setTag(holder);

    // Returns the item layout view
    return itemLayout;
}
项目:Applozic-Android-Chat-Sample    文件:ContactsListFragment.java   
/**
 * Overrides newView() to inflate the list item views.
 */
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
    // Inflates the list item layout.
    final View itemLayout =
            mInflater.inflate(R.layout.contact_list_item, viewGroup, false);

    // Creates a new ViewHolder in which to store handles to each view resource. This
    // allows bindView() to retrieve stored references instead of calling findViewById for
    // each instance of the layout.
    final ViewHolder holder = new ViewHolder();
    holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
    holder.text2 = (TextView) itemLayout.findViewById(android.R.id.text2);
    holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);

    // Stores the resourceHolder instance in itemLayout. This makes resourceHolder
    // available to bindView and other methods that receive a handle to the item view.
    itemLayout.setTag(holder);

    // Returns the item layout view
    return itemLayout;
}
项目:brailleback    文件:DefaultBrailleRule.java   
private CharSequence getFallbackText(
    Context context,
    AccessibilityNodeInfoCompat node) {
    // Order is important below because of class inheritance.
    if (matchesAny(context, node, Button.class, ImageButton.class)) {
        return context.getString(R.string.type_button);
    }
    if (matchesAny(context, node, QuickContactBadge.class)) {
        return context.getString(R.string.type_quickcontact);
    }
    if (matchesAny(context, node, ImageView.class)) {
        return context.getString(R.string.type_image);
    }
    if (matchesAny(context, node, EditText.class)) {
        return context.getString(R.string.type_edittext);
    }
    if (matchesAny(context, node, AbsSeekBar.class)) {
        return context.getString(R.string.type_seekbar);
    }
    return "";
}
项目:K9-MailClient    文件:RoundedQuickContactBadge.java   
/**
 * Initialize our stuff
 */
private void init() {

    //Use reflection to reset the default triangular overlay from default quick contact badge
    try {
        Field field = QuickContactBadge.class.getDeclaredField("mOverlay");
        field.setAccessible(true);

        //Using a drawable that draws a white circle. This could be set as null to not draw anything at all
        field.set(this, getResources().getDrawable(R.drawable.ic_circle));

    } catch (Exception e) {
        //No-op, just well off with the default overlay
    }

}
项目:margarita    文件:ContactFragment.java   
/**
 * Overrides newView() to inflate the list item views.
 */
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
    // Inflates the list item layout.
    final View itemLayout =
            mInflater.inflate(R.layout.contact_list_item, viewGroup, false);

    // Creates a new ViewHolder in which to store handles to each view resource. This
    // allows bindView() to retrieve stored references instead of calling findViewById for
    // each instance of the layout.
    final ViewHolder holder = new ViewHolder();
    holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
    holder.text2 = (TextView) itemLayout.findViewById(android.R.id.text2);
    holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);

    // Stores the resourceHolder instance in itemLayout. This makes resourceHolder
    // available to bindView and other methods that receive a handle to the item view.
    itemLayout.setTag(holder);

    // Returns the item layout view
    return itemLayout;
}
项目:daxSmail    文件:ContactPictureLoader.java   
/**
 * Load a contact picture and display it using the supplied {@link QuickContactBadge} instance.
 *
 * <p>
 * If a picture is found in the cache, it is displayed in the {@code QuickContactBadge}
 * immediately. Otherwise a {@link ContactPictureRetrievalTask} is started to try to load the
 * contact picture in a background thread. Depending on the result the contact picture or a
 * fallback picture is then stored in the bitmap cache.
 * </p>
 *
 * @param address
 *         The {@link Address} instance holding the email address that is used to search the
 *         contacts database.
 * @param badge
 *         The {@code QuickContactBadge} instance to receive the picture.
 *
 * @see #mBitmapCache
 * @see #calculateFallbackBitmap(Address)
 */
public void loadContactPicture(Address address, QuickContactBadge badge) {
    Bitmap bitmap = getBitmapFromCache(address);
    if (bitmap != null) {
        // The picture was found in the bitmap cache
        badge.setImageBitmap(bitmap);
    } else if (cancelPotentialWork(address, badge)) {
        // Query the contacts database in a background thread and try to load the contact
        // picture, if there is one.
        ContactPictureRetrievalTask task = new ContactPictureRetrievalTask(badge, address);
        AsyncDrawable asyncDrawable = new AsyncDrawable(mResources,
                calculateFallbackBitmap(address), task);
        badge.setImageDrawable(asyncDrawable);
        try {
            task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        } catch (RejectedExecutionException e) {
            // We flooded the thread pool queue... use a fallback picture
            badge.setImageBitmap(calculateFallbackBitmap(address));
        }
    }
}
项目:daxSmail    文件:ContactPictureLoader.java   
/**
 * Checks if a {@code ContactPictureRetrievalTask} was already created to load the contact
 * picture for the supplied {@code Address}.
 *
 * @param address
 *         The {@link Address} instance holding the email address that is used to search the
 *         contacts database.
 * @param badge
 *         The {@code QuickContactBadge} instance that will receive the picture.
 *
 * @return {@code true}, if the contact picture should be loaded in a background thread.
 *         {@code false}, if another {@link ContactPictureRetrievalTask} was already scheduled
 *         to load that contact picture.
 */
private boolean cancelPotentialWork(Address address, QuickContactBadge badge) {
    final ContactPictureRetrievalTask task = getContactPictureRetrievalTask(badge);

    if (task != null && address != null) {
        if (!address.equals(task.getAddress())) {
            // Cancel previous task
            task.cancel(true);
        } else {
            // The same work is already in progress
            return false;
        }
    }

    // No task associated with the QuickContactBadge, or an existing task was cancelled
    return true;
}
项目:Poker-Director    文件:TournamentEndingActivity.java   
private void addContact(final Player contact, int place) {
    final View v = LayoutInflater.from(this).inflate(R.layout.player_prize_item, null);
    TextView p = (TextView) v.findViewById(R.id.playerPlace);
    p.setText((place + 1) + "");

    TextView name = (TextView) v.findViewById(R.id.playerName);
    name.setText(contact.getDisplayName());

    TextView spend = (TextView) v.findViewById(R.id.playerSpend);
    spend.setText(contact.getMoneySpend(Helper.getSelectedTournament(this)) + " " + Helper.getCurrency(this));

    if (contact.getUri() != null) {
     QuickContactBadge badge =  (QuickContactBadge) v.findViewById(R.id.playerBadge);
     badge.assignContactUri(contact.getUri());
     badge.setMode(QuickContact.MODE_MEDIUM);
     if (contact.getPhoto() != null) {
        badge.setImageBitmap(contact.getPhoto());
     } 
    }

    list.addView(v);
}
项目:Poker-Director    文件:RunningTournamentActivity.java   
private void addContactPayout(final Player contact, int place, LinearLayout list) {
    final View v = LayoutInflater.from(this).inflate(R.layout.player_prize_item, null);
    TextView p = (TextView) v.findViewById(R.id.playerPlace);
    p.setText((place + 1) + "");

    TextView name = (TextView) v.findViewById(R.id.playerName);
    if (contact.isOut()) {
        name.setText(contact.getDisplayName());
    } else {
        name.setText("???");
    }

    if (contact.isOut() && contact.getUri() != null) {
     QuickContactBadge badge =  (QuickContactBadge) v.findViewById(R.id.playerBadge);
     badge.assignContactUri(contact.getUri());
     badge.setMode(QuickContact.MODE_MEDIUM);
     if (contact.getPhoto() != null) {
        badge.setImageBitmap(contact.getPhoto());
     } 
    }

    list.addView(v);
}
项目:Applozic-Android-SDK    文件:ContactsListFragment.java   
/**
 * Overrides newView() to inflate the list item views.
 */
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
    // Inflates the list item layout.
    final View itemLayout =
            mInflater.inflate(R.layout.contact_list_item, viewGroup, false);

    // Creates a new ViewHolder in which to store handles to each view resource. This
    // allows bindView() to retrieve stored references instead of calling findViewById for
    // each instance of the layout.
    final ViewHolder holder = new ViewHolder();
    holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
    holder.text2 = (TextView) itemLayout.findViewById(android.R.id.text2);
    holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);

    // Stores the resourceHolder instance in itemLayout. This makes resourceHolder
    // available to bindView and other methods that receive a handle to the item view.
    itemLayout.setTag(holder);

    // Returns the item layout view
    return itemLayout;
}
项目:CampusFeedv2    文件:ContactsListFragment.java   
/**
 * Overrides newView() to inflate the list item views.
 */
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
    // Inflates the list item layout.
    final View itemLayout =
            mInflater.inflate(R.layout.contact_list_item, viewGroup, false);

    // Creates a new ViewHolder in which to store handles to each view resource. This
    // allows bindView() to retrieve stored references instead of calling findViewById for
    // each instance of the layout.
    final ViewHolder holder = new ViewHolder();
    holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
    holder.text2 = (TextView) itemLayout.findViewById(android.R.id.text2);
    holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);

    // Stores the resourceHolder instance in itemLayout. This makes resourceHolder
    // available to bindView and other methods that receive a handle to the item view.
    itemLayout.setTag(holder);

    // Returns the item layout view
    return itemLayout;
}
项目:sms_DualCard    文件:ConversationListItem1.java   
@Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        mCheckBox = (CheckBox)findViewById(R.id.choose);

        ConversationListItem1.mCheckBox.setVisibility(0);
       ConversationListItem.mImageView.setImageResource(R.drawable.choose);
//        Log.v("firstset","firstset");

       mCheckBox.setOnCheckedChangeListener(new CheckBoxListener());  




        mFromView = (TextView) findViewById(R.id.from);
        mSubjectView = (TextView) findViewById(R.id.subject);
        mType = (TextView) findViewById(R.id.simType);
        mDateView = (TextView) findViewById(R.id.date);
        mAttachmentView = findViewById(R.id.attachment);
        mErrorIndicator = findViewById(R.id.error);
        mAvatarView = (QuickContactBadge) findViewById(R.id.avatar);
    }
项目:sms_DualCard    文件:ConversationListItem.java   
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    mImageView = (ImageView) findViewById(R.id.choose);

    ConversationListItem.mImageView.setVisibility(8);
    // ConversationListItem.mImageView.setImageResource(R.drawable.choose);
    // Log.v("firstset","firstset");

    mFromView = (TextView) findViewById(R.id.from);
    mSubjectView = (TextView) findViewById(R.id.subject);
    mType = (TextView) findViewById(R.id.simType);
    mDateView = (TextView) findViewById(R.id.date);
    mAttachmentView = findViewById(R.id.attachment);
    mErrorIndicator = findViewById(R.id.error);
    mAvatarView = (QuickContactBadge) findViewById(R.id.avatar);
}
项目:k-9    文件:ContactPictureLoader.java   
/**
 * Load a contact picture and display it using the supplied {@link QuickContactBadge} instance.
 *
 * <p>
 * If a picture is found in the cache, it is displayed in the {@code QuickContactBadge}
 * immediately. Otherwise a {@link ContactPictureRetrievalTask} is started to try to load the
 * contact picture in a background thread. Depending on the result the contact picture or a
 * fallback picture is then stored in the bitmap cache.
 * </p>
 *
 * @param address
 *         The {@link Address} instance holding the email address that is used to search the
 *         contacts database.
 * @param badge
 *         The {@code QuickContactBadge} instance to receive the picture.
 *
 * @see #mBitmapCache
 * @see #calculateFallbackBitmap(Address)
 */
public void loadContactPicture(Address address, QuickContactBadge badge) {
    Bitmap bitmap = getBitmapFromCache(address);
    if (bitmap != null) {
        // The picture was found in the bitmap cache
        badge.setImageBitmap(bitmap);
    } else if (cancelPotentialWork(address, badge)) {
        // Query the contacts database in a background thread and try to load the contact
        // picture, if there is one.
        ContactPictureRetrievalTask task = new ContactPictureRetrievalTask(badge, address);
        AsyncDrawable asyncDrawable = new AsyncDrawable(mResources,
                calculateFallbackBitmap(address), task);
        badge.setImageDrawable(asyncDrawable);
        try {
            task.exec();
        } catch (RejectedExecutionException e) {
            // We flooded the thread pool queue... use a fallback picture
            badge.setImageBitmap(calculateFallbackBitmap(address));
        }
    }
}
项目:k-9    文件:ContactPictureLoader.java   
/**
 * Checks if a {@code ContactPictureRetrievalTask} was already created to load the contact
 * picture for the supplied {@code Address}.
 *
 * @param address
 *         The {@link Address} instance holding the email address that is used to search the
 *         contacts database.
 * @param badge
 *         The {@code QuickContactBadge} instance that will receive the picture.
 *
 * @return {@code true}, if the contact picture should be loaded in a background thread.
 *         {@code false}, if another {@link ContactPictureRetrievalTask} was already scheduled
 *         to load that contact picture.
 */
private boolean cancelPotentialWork(Address address, QuickContactBadge badge) {
    final ContactPictureRetrievalTask task = getContactPictureRetrievalTask(badge);

    if (task != null && address != null) {
        if (!address.equals(task.getAddress())) {
            // Cancel previous task
            task.cancel(true);
        } else {
            // The same work is already in progress
            return false;
        }
    }

    // No task associated with the QuickContactBadge, or an existing task was cancelled
    return true;
}
项目:SyncChatAndroid    文件:ContactDetailsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getIntent().getAction().equals(ACTION_VIEW_CONTACT)) {
        this.accountJid = getIntent().getExtras().getString("account");
        this.contactJid = getIntent().getExtras().getString("contact");
    }
    setContentView(R.layout.activity_contact_details);

    contactJidTv = (TextView) findViewById(R.id.details_contactjid);
    accountJidTv = (TextView) findViewById(R.id.details_account);
    status = (TextView) findViewById(R.id.details_contactstatus);
    lastseen = (TextView) findViewById(R.id.details_lastseen);
    send = (CheckBox) findViewById(R.id.details_send_presence);
    receive = (CheckBox) findViewById(R.id.details_receive_presence);
    askAgain = (TextView) findViewById(R.id.ask_again);
    badge = (QuickContactBadge) findViewById(R.id.details_contact_badge);
    keys = (LinearLayout) findViewById(R.id.details_contact_keys);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);

}
项目:EngLishReminder    文件:SmsPopupFragment.java   
@Override
protected void onPostExecute(Bitmap photo) {
    if (BuildConfig.DEBUG)
        Log.v("Done loading contact photo");
    if (photo != null && viewReference != null) {
        final QuickContactBadge badge = viewReference.get();
        if (badge != null && isAdded()) {
         TransitionDrawable mTd =
                 new TransitionDrawable(new Drawable[] {
                         getResources().getDrawable(R.drawable.ic_contact_picture),
                         new BitmapDrawable(getResources(), photo) });
         badge.setImageDrawable(mTd);
         mTd.setCrossFadeEnabled(false);
         mTd.startTransition(CONTACT_IMAGE_FADE_DURATION);
        }
    }
}
项目:FridgeCheckup    文件:WriteTagActivity.java   
@Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_write_tag);
nfcAdapter = NfcAdapter.getDefaultAdapter(this);
dispatchIntent = PendingIntent.getActivity(this, 0,
    new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
tagBtn = (ImageButton) findViewById(R.id.tagButton);
infoTxt = (TextView) findViewById(R.id.infoLabel);
scanTxt = (TextView) findViewById(R.id.scanLabel);
contactBadge = (QuickContactBadge) findViewById(R.id.contactBadge);
accountName = getAccountName();

loaderCallbacks = new MyLoaderCallback();
// select an account
if (TextUtils.isEmpty(accountName)) {
    selectAccount();
}
   }
项目:k-9-master    文件:ContactPictureLoader.java   
/**
 * Load a contact picture and display it using the supplied {@link QuickContactBadge} instance.
 *
 * <p>
 * If a picture is found in the cache, it is displayed in the {@code QuickContactBadge}
 * immediately. Otherwise a {@link ContactPictureRetrievalTask} is started to try to load the
 * contact picture in a background thread. Depending on the result the contact picture or a
 * fallback picture is then stored in the bitmap cache.
 * </p>
 *
 * @param address
 *         The {@link Address} instance holding the email address that is used to search the
 *         contacts database.
 * @param badge
 *         The {@code QuickContactBadge} instance to receive the picture.
 *
 * @see #mBitmapCache
 * @see #calculateFallbackBitmap(Address)
 */
public void loadContactPicture(Address address, QuickContactBadge badge) {
    Bitmap bitmap = getBitmapFromCache(address);
    if (bitmap != null) {
        // The picture was found in the bitmap cache
        badge.setImageBitmap(bitmap);
    } else if (cancelPotentialWork(address, badge)) {
        // Query the contacts database in a background thread and try to load the contact
        // picture, if there is one.
        ContactPictureRetrievalTask task = new ContactPictureRetrievalTask(badge, address);
        AsyncDrawable asyncDrawable = new AsyncDrawable(mResources,
                calculateFallbackBitmap(address), task);
        badge.setImageDrawable(asyncDrawable);
        try {
            task.exec();
        } catch (RejectedExecutionException e) {
            // We flooded the thread pool queue... use a fallback picture
            badge.setImageBitmap(calculateFallbackBitmap(address));
        }
    }
}
项目:k-9-master    文件:ContactPictureLoader.java   
/**
 * Checks if a {@code ContactPictureRetrievalTask} was already created to load the contact
 * picture for the supplied {@code Address}.
 *
 * @param address
 *         The {@link Address} instance holding the email address that is used to search the
 *         contacts database.
 * @param badge
 *         The {@code QuickContactBadge} instance that will receive the picture.
 *
 * @return {@code true}, if the contact picture should be loaded in a background thread.
 *         {@code false}, if another {@link ContactPictureRetrievalTask} was already scheduled
 *         to load that contact picture.
 */
private boolean cancelPotentialWork(Address address, QuickContactBadge badge) {
    final ContactPictureRetrievalTask task = getContactPictureRetrievalTask(badge);

    if (task != null && address != null) {
        if (!address.equals(task.getAddress())) {
            // Cancel previous task
            task.cancel(true);
        } else {
            // The same work is already in progress
            return false;
        }
    }

    // No task associated with the QuickContactBadge, or an existing task was cancelled
    return true;
}
项目:GitHub    文件:SampleContactsAdapter.java   
@Override public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
  View itemLayout = inflater.inflate(R.layout.sample_contacts_activity_item, viewGroup, false);

  ViewHolder holder = new ViewHolder();
  holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
  holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);

  itemLayout.setTag(holder);

  return itemLayout;
}
项目:K9-MailClient    文件:Utility.java   
/**
 * Assign the contact to the badge.
 *
 * On 4.3, we pass the address name as extra info so that if the contact doesn't exist
 * the name is auto-populated.
 *
 * @param contactBadge the badge to the set the contact for
 * @param address the address to look for a contact for.
 */
public static void setContactForBadge(QuickContactBadge contactBadge,
                                      Address address) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        Bundle extraContactInfo = new Bundle();
        extraContactInfo.putString(ContactsContract.Intents.Insert.NAME, address.getPersonal());
        contactBadge.assignContactFromEmail(address.getAddress(), true, extraContactInfo);
    } else {
        contactBadge.assignContactFromEmail(address.getAddress(), true);
    }
}
项目:K9-MailClient    文件:AlternateRecipientAdapter.java   
public RecipientTokenHolder(View view) {
    layoutHeader = view.findViewById(R.id.alternate_container_header);
    layoutItem = view.findViewById(R.id.alternate_container_item);

    headerName = (TextView) view.findViewById(R.id.alternate_header_name);
    headerAddressLabel = (TextView) view.findViewById(R.id.alternate_header_label);
    headerPhoto = (QuickContactBadge) view.findViewById(R.id.alternate_contact_photo);
    headerRemove = view.findViewById(R.id.alternate_remove);

    itemAddress = (TextView) view.findViewById(R.id.alternate_address);
    itemAddressLabel = (TextView) view.findViewById(R.id.alternate_address_label);
    itemCryptoStatus = view.findViewById(R.id.alternate_crypto_status);
    itemCryptoStatusIcon = (ImageView) view.findViewById(R.id.alternate_crypto_status_icon);
}
项目:daxSmail    文件:MessageHeader.java   
@Override
protected void onFinishInflate() {
    mAnsweredIcon = findViewById(R.id.answered);
    mForwardedIcon = findViewById(R.id.forwarded);
    mFromView = (TextView) findViewById(R.id.from);
    mToView = (TextView) findViewById(R.id.to);
    mToLabel = (TextView) findViewById(R.id.to_label);
    mCcView = (TextView) findViewById(R.id.cc);
    mCcLabel = (TextView) findViewById(R.id.cc_label);

    mContactBadge = (QuickContactBadge) findViewById(R.id.contact_badge);

    mSubjectView = (TextView) findViewById(R.id.subject);
    mAdditionalHeadersView = (TextView) findViewById(R.id.additional_headers_view);
    mChip = findViewById(R.id.chip);
    mDateView = (TextView) findViewById(R.id.date);
    mFlagged = (CheckBox) findViewById(R.id.flagged);

    defaultSubjectColor = mSubjectView.getCurrentTextColor();
    mFontSizes.setViewTextSize(mSubjectView, mFontSizes.getMessageViewSubject());
    mFontSizes.setViewTextSize(mDateView, mFontSizes.getMessageViewDate());
    mFontSizes.setViewTextSize(mAdditionalHeadersView, mFontSizes.getMessageViewAdditionalHeaders());

    mFontSizes.setViewTextSize(mFromView, mFontSizes.getMessageViewSender());
    mFontSizes.setViewTextSize(mToView, mFontSizes.getMessageViewTo());
    mFontSizes.setViewTextSize(mToLabel, mFontSizes.getMessageViewTo());
    mFontSizes.setViewTextSize(mCcView, mFontSizes.getMessageViewCC());
    mFontSizes.setViewTextSize(mCcLabel, mFontSizes.getMessageViewCC());

    mFromView.setOnClickListener(this);
    mToView.setOnClickListener(this);
    mCcView.setOnClickListener(this);

    mMessageHelper = MessageHelper.getInstance(mContext);

    mSubjectView.setVisibility(VISIBLE);
    hideAdditionalHeaders();
}
项目:daxSmail    文件:ContactPictureLoader.java   
private ContactPictureRetrievalTask getContactPictureRetrievalTask(QuickContactBadge badge) {
    if (badge != null) {
       Drawable drawable = badge.getDrawable();
       if (drawable instanceof AsyncDrawable) {
           AsyncDrawable asyncDrawable = (AsyncDrawable) drawable;
           return asyncDrawable.getContactPictureRetrievalTask();
       }
    }

    return null;
}
项目:daxSmail    文件:ContactPictureLoader.java   
@Override
protected void onPostExecute(Bitmap bitmap) {
    if (mQuickContactBadgeReference != null) {
        QuickContactBadge badge = mQuickContactBadgeReference.get();
        if (badge != null && getContactPictureRetrievalTask(badge) == this) {
            badge.setImageBitmap(bitmap);
        }
    }
}
项目:Poker-Director    文件:TablesListActivity.java   
private View getPlayerView(Player player) {
    final View v = LayoutInflater.from(this).inflate(R.layout.player_simple_item, null);

    TextView name = (TextView) v.findViewById(R.id.playerName);
    name.setText(player.getDisplayName());

    QuickContactBadge badge =  (QuickContactBadge) v.findViewById(R.id.playerBadge);
    if (player.getPhoto() != null) {
        badge.setImageBitmap(player.getPhoto());
    }

    v.setTag(player);
    return v;
}
项目:ApkLauncher    文件:QuickContactsDemo.java   
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = super.newView(context, cursor, parent);
    ContactListItemCache cache = new ContactListItemCache();
    cache.nameView = (TextView) view.findViewById(R.id.name);
    cache.photoView = (QuickContactBadge) view.findViewById(R.id.badge);
    view.setTag(cache);

    return view;
}
项目:ApiDemos    文件:QuickContactsDemo.java   
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = super.newView(context, cursor, parent);
    ContactListItemCache cache = new ContactListItemCache();
    cache.nameView = (TextView) view.findViewById(R.id.name);
    cache.photoView = (QuickContactBadge) view.findViewById(R.id.badge);
    view.setTag(cache);

    return view;
}
项目:picasso    文件:SampleContactsAdapter.java   
@Override public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
  View itemLayout = inflater.inflate(R.layout.sample_contacts_activity_item, viewGroup, false);

  ViewHolder holder = new ViewHolder();
  holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1);
  holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon);

  itemLayout.setTag(holder);

  return itemLayout;
}
项目:sms_DualCard    文件:ComposeMessageActivity.java   
private void addQuickContactActionBar(ActionBar actionBar) {

        Drawable avatarDrawable;
        sDefaultContactImage = ComposeMessageActivity.this.getResources()
                .getDrawable(R.drawable.ic_contact_picture);

        ViewGroup v = (ViewGroup) LayoutInflater.from(this).inflate(
                R.layout.test_actionbar, null);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setCustomView(v);

        mAvatar = (QuickContactBadge) v.findViewById(R.id.test_avatar);

        Contact contact = mConversation.getRecipients().get(0);
        avatarDrawable = contact.getAvatar(ComposeMessageActivity.this,
                sDefaultContactImage);

        if (contact.existsInDatabase()) {// 010
            mAvatar.assignContactUri(contact.getUri());
        } else {
            mAvatar.assignContactFromPhone(contact.getNumber(), true);
        }
        mAvatar.setImageDrawable(avatarDrawable);
        mAvatar.setVisibility(View.VISIBLE);
        // mAvatar.assignContactUri(contactUri)

        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
                | ActionBar.DISPLAY_SHOW_TITLE);

    }
项目:Chatting-App-    文件:AvatarListItem.java   
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mAvatarView = (QuickContactBadge) findViewById(R.id.avatar);

    if (isInEditMode()) {
        mAvatarView.setImageDrawable(sDefaultContactImage);
        mAvatarView.setVisibility(VISIBLE);
    }
}
项目:QuickContactBadge    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    badge = (QuickContactBadge) findViewById(R.id.badge);
    badge.assignContactFromPhone("021-88888888", false);
}
项目:k-9    文件:MessageHeader.java   
@Override
protected void onFinishInflate() {
    mAnsweredIcon = findViewById(R.id.answered);
    mForwardedIcon = findViewById(R.id.forwarded);
    mFromView = (TextView) findViewById(R.id.from);
    mToView = (TextView) findViewById(R.id.to);
    mToLabel = (TextView) findViewById(R.id.to_label);
    mCcView = (TextView) findViewById(R.id.cc);
    mCcLabel = (TextView) findViewById(R.id.cc_label);

    mContactBadge = (QuickContactBadge) findViewById(R.id.contact_badge);

    mSubjectView = (TextView) findViewById(R.id.subject);
    mAdditionalHeadersView = (TextView) findViewById(R.id.additional_headers_view);
    mChip = findViewById(R.id.chip);
    mDateView = (TextView) findViewById(R.id.date);
    mFlagged = (CheckBox) findViewById(R.id.flagged);

    defaultSubjectColor = mSubjectView.getCurrentTextColor();
    mFontSizes.setViewTextSize(mSubjectView, mFontSizes.getMessageViewSubject());
    mFontSizes.setViewTextSize(mDateView, mFontSizes.getMessageViewDate());
    mFontSizes.setViewTextSize(mAdditionalHeadersView, mFontSizes.getMessageViewAdditionalHeaders());

    mFontSizes.setViewTextSize(mFromView, mFontSizes.getMessageViewSender());
    mFontSizes.setViewTextSize(mToView, mFontSizes.getMessageViewTo());
    mFontSizes.setViewTextSize(mToLabel, mFontSizes.getMessageViewTo());
    mFontSizes.setViewTextSize(mCcView, mFontSizes.getMessageViewCC());
    mFontSizes.setViewTextSize(mCcLabel, mFontSizes.getMessageViewCC());

    mFromView.setOnClickListener(this);
    mToView.setOnClickListener(this);
    mCcView.setOnClickListener(this);

    mMessageHelper = MessageHelper.getInstance(mContext);

    mSubjectView.setVisibility(VISIBLE);
    hideAdditionalHeaders();
}
项目:k-9    文件:ContactPictureLoader.java   
private ContactPictureRetrievalTask getContactPictureRetrievalTask(QuickContactBadge badge) {
    if (badge != null) {
       Drawable drawable = badge.getDrawable();
       if (drawable instanceof AsyncDrawable) {
           AsyncDrawable asyncDrawable = (AsyncDrawable) drawable;
           return asyncDrawable.getContactPictureRetrievalTask();
       }
    }

    return null;
}
项目:k-9    文件:ContactPictureLoader.java   
@Override
protected void onPostExecute(Bitmap bitmap) {
    if (mQuickContactBadgeReference != null) {
        QuickContactBadge badge = mQuickContactBadgeReference.get();
        if (badge != null && getContactPictureRetrievalTask(badge) == this) {
            badge.setImageBitmap(bitmap);
        }
    }
}
项目:SyncChatAndroid    文件:UIHelper.java   
public static void prepareContactBadge(final Activity activity,
        QuickContactBadge badge, final Contact contact, Context context) {
    if (contact.getSystemAccount() != null) {
        String[] systemAccount = contact.getSystemAccount().split("#");
        long id = Long.parseLong(systemAccount[0]);
        badge.assignContactUri(Contacts.getLookupUri(id, systemAccount[1]));
    }
    badge.setImageBitmap(UIHelper.getContactPicture(contact, 72, context,
            false));
}
项目:felix-on-android    文件:QuickContactsDemo.java   
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = super.newView(context, cursor, parent);
    ContactListItemCache cache = new ContactListItemCache();
    cache.nameView = (TextView) view.findViewById(R.id.name);
    cache.photoView = (QuickContactBadge) view.findViewById(R.id.badge);
    view.setTag(cache);

    return view;
}
项目:MEng    文件:QuickContactsDemo.java   
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = super.newView(context, cursor, parent);
    ContactListItemCache cache = new ContactListItemCache();
    cache.nameView = (TextView) view.findViewById(R.id.name);
    cache.photoView = (QuickContactBadge) view.findViewById(R.id.badge);
    view.setTag(cache);

    return view;
}