本文整理汇总了Java中android.widget.QuickContactBadge类的典型用法代码示例。如果您正苦于以下问题:Java QuickContactBadge类的具体用法?Java QuickContactBadge怎么用?Java QuickContactBadge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QuickContactBadge类属于android.widget包,在下文中一共展示了QuickContactBadge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newView
import android.widget.QuickContactBadge; //导入依赖的package包/类
/**
* 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;
}
示例2: getFallbackText
import android.widget.QuickContactBadge; //导入依赖的package包/类
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 "";
}
示例3: init
import android.widget.QuickContactBadge; //导入依赖的package包/类
/**
* 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
}
}
示例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.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} catch (RejectedExecutionException e) {
// We flooded the thread pool queue... use a fallback picture
badge.setImageBitmap(calculateFallbackBitmap(address));
}
}
}
示例5: cancelPotentialWork
import android.widget.QuickContactBadge; //导入依赖的package包/类
/**
* 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;
}
示例6: 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);
}
示例7: 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);
}
示例8: onFinishInflate
import android.widget.QuickContactBadge; //导入依赖的package包/类
@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);
}
示例9: onFinishInflate
import android.widget.QuickContactBadge; //导入依赖的package包/类
@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);
}
示例10: 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));
}
}
}
示例11: onCreate
import android.widget.QuickContactBadge; //导入依赖的package包/类
@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);
}
示例12: onPostExecute
import android.widget.QuickContactBadge; //导入依赖的package包/类
@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);
}
}
}
示例13: onCreateView
import android.widget.QuickContactBadge; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View result = inflater.inflate(R.layout.buttons, null);
View coloredButton = result.findViewById(R.id.coloredButton);
coloredButton.setLongClickable(true);
// registerForContextMenu(coloredButton);
// mListPopupButton = result.findViewById(R.id.listPopupButton);
// mListPopupButton.setOnLongClickListener(mPopupListener);
QuickContactBadge badge = (QuickContactBadge)result.findViewById(R.id.badge);
badge.assignContactFromEmail("[email protected]", false);
return result;
}
示例14: onCreate
import android.widget.QuickContactBadge; //导入依赖的package包/类
@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();
}
}
示例15: newView
import android.widget.QuickContactBadge; //导入依赖的package包/类
@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;
}