本文整理汇总了Java中android.widget.QuickContactBadge.setImageBitmap方法的典型用法代码示例。如果您正苦于以下问题:Java QuickContactBadge.setImageBitmap方法的具体用法?Java QuickContactBadge.setImageBitmap怎么用?Java QuickContactBadge.setImageBitmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.QuickContactBadge
的用法示例。
在下文中一共展示了QuickContactBadge.setImageBitmap方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadContactPicture
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
/**
* 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));
}
}
}
示例2: addContact
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
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);
}
示例3: addContactPayout
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
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);
}
示例4: loadContactPicture
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
/**
* 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));
}
}
}
示例5: onPostExecute
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
@Override
protected void onPostExecute(Bitmap bitmap) {
if (mQuickContactBadgeReference != null) {
QuickContactBadge badge = mQuickContactBadgeReference.get();
if (badge != null && getContactPictureRetrievalTask(badge) == this) {
badge.setImageBitmap(bitmap);
}
}
}
示例6: getPlayerView
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
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;
}
示例7: prepareContactBadge
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
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));
}
示例8: addContact
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
private void addContact(final Player contact) {
final View v = LayoutInflater.from(this).inflate(R.layout.player_item, null);
this.registerForContextMenu(v);
TextView name = (TextView) v.findViewById(R.id.playerName);
name.setText(contact.getDisplayName());
TextView table = (TextView) v.findViewById(R.id.tableTextView);
if (contact.getTable() >= 0) {
table.setText("table " + (contact.getTable() + 1));
} else {
table.setText("");
}
TextView seat = (TextView) v.findViewById(R.id.seatTextView);
if (contact.getSeat() >= 0) {
seat.setText("seat " + (contact.getSeat() + 1));
} else {
seat.setText("");
}
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());
}
}
v.setTag(contact);
list.addView(v);
View remove = v.findViewById(R.id.list_button);
remove.setOnClickListener(new OnClickListener() {
public void onClick(View theButton) {
list.removeView(v);
players.remove(contact);
refreshTitle();
}
});
refreshTitle();
}
示例9: getPlayerView1
import android.widget.QuickContactBadge; //导入方法依赖的package包/类
private View getPlayerView1(final Player contact, final boolean buyIn) {
final View v = LayoutInflater.from(this).inflate(R.layout.player_check_item, null);
TextView val = (TextView) v.findViewById(R.id.buyIn);
if (buyIn) {
val.setText(tournament.getBuyin() + " " + Helper.getCurrency(this) + " : ");
} else {
val.setText(tournament.getAddon() + " " + Helper.getCurrency(this) + " : ");
}
TextView name = (TextView) v.findViewById(R.id.playerName);
name.setText(contact.getDisplayName());
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());
}
}
CheckBox checkbox = (CheckBox) v.findViewById(R.id.CheckBox);
checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (buyIn) {
contact.setPlace(0);
contact.setOut(false);
contact.setBuyinUsed(true);
totalMoney = totalMoney + tournament.getBuyin();
chipsTotal = chipsTotal + tournament.getChipsBuyin();
} else {
contact.setAddonUsed(contact.getAddonUsed() + 1);
totalMoney = totalMoney + tournament.getAddon();
chipsTotal = chipsTotal + tournament.getChipsAddon();
}
} else {
if (buyIn) {
contact.setPlace(tournament.getRemainingPlayer());
contact.setOut(true);
contact.setBuyinUsed(false);
totalMoney = totalMoney - tournament.getBuyin();
chipsTotal = chipsTotal - tournament.getChipsBuyin();
} else {
contact.setAddonUsed(contact.getAddonUsed() - 1);
totalMoney = totalMoney - tournament.getAddon();
chipsTotal = chipsTotal - tournament.getChipsAddon();
}
}
}
});
v.setTag(contact);
return v;
}