当前位置: 首页>>代码示例>>Java>>正文


Java QuickContact类代码示例

本文整理汇总了Java中android.provider.ContactsContract.QuickContact的典型用法代码示例。如果您正苦于以下问题:Java QuickContact类的具体用法?Java QuickContact怎么用?Java QuickContact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QuickContact类属于android.provider.ContactsContract包,在下文中一共展示了QuickContact类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClick

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
@Override
public void onClick(View v) {
    // If contact has been assigned, extras should no longer be null, but do a null check
    // anyway just in case assignContactFromPhone or Email was called with a null bundle or
    // wasn't assigned previously.
    final Bundle extras = (this.extras == null) ? new Bundle() : this.extras;
    if (contactUri != null) {
        QuickContact.showQuickContact(getContext(), ContactBadge.this, contactUri,
                QuickContact.MODE_LARGE, null);
    } else if (contactEmail != null) {
        extras.putString(EXTRA_URI_CONTENT, contactEmail);
        queryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(contactEmail)),
                EMAIL_LOOKUP_PROJECTION, null, null, null);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:17,代码来源:ContactBadge.java

示例2: onQueryComplete

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
@Override
public void onQueryComplete(int token, Uri uri, Bundle extras, boolean trigger, Uri createUri) {
    assignContactUri(uri);
    if (trigger && uri != null) {
        // Found contact, so trigger QuickContact
        ContactsContract.QuickContact.showQuickContact(getContext(),
                ContactBadge.this, uri, ContactsContract.QuickContact.MODE_LARGE, mExcludeMimes);
    } else if (createUri != null) {
        // Prompt user to add this person to contacts
        final Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, createUri);
        if (extras != null) {
            extras.remove(Constants.EXTRA_URI_CONTENT);
            intent.putExtras(extras);
        }
        getContext().startActivity(intent);
    }

}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:19,代码来源:ContactBadge.java

示例3: onClick

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
@Override
public void onClick(View v) {
    // If contact has been assigned, mExtras should no longer be null, but do a null check
    // anyway just in case assignContactFromPhone or Email was called with a null bundle or
    // wasn't assigned previously.
    final Bundle extras = (mExtras == null) ? new Bundle() : mExtras;
    if (mContactUri != null) {
        QuickContact.showQuickContact(getContext(), ContactBadge.this, mContactUri, QuickContact.MODE_LARGE, mExcludeMimes);
    } else if (mContactEmail != null && mQueryHandler != null) {
        extras.putString(Constants.EXTRA_URI_CONTENT, mContactEmail);
        mQueryHandler.startQuery(Constants.TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(mContactEmail)),
                EMAIL_LOOKUP_PROJECTION, null, null, null, mContactQueryHandlerCallback);
    } else if (mContactPhone != null && mQueryHandler != null) {
        extras.putString(Constants.EXTRA_URI_CONTENT, mContactPhone);
        mQueryHandler.startQuery(Constants.TOKEN_PHONE_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
                PHONE_LOOKUP_PROJECTION, null, null, null, mContactQueryHandlerCallback);
    } else {
        // If a contact hasn't been assigned, don't react to click.
        return;
    }
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:24,代码来源:ContactBadge.java

示例4: setContactPhoto

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
private void setContactPhoto(final Recipient recipient) {
  if (recipient == null) return;

  contactPhotoImage.setImageBitmap(recipient.getCircleCroppedContactPhoto());

  if (!recipient.isGroupRecipient()) {
    contactPhotoImage.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        if (recipient.getContactUri() != null) {
          QuickContact.showQuickContact(context, contactPhotoImage, recipient.getContactUri(), QuickContact.MODE_LARGE, null);
        } else {
          Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT,  Uri.fromParts("tel", recipient.getNumber(), null));
          context.startActivity(intent);
        }
      }
    });
  } else {
    contactPhotoImage.setOnClickListener(null);
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:22,代码来源:ConversationListItem.java

示例5: addContact

import android.provider.ContactsContract.QuickContact; //导入依赖的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);
}
 
开发者ID:lebesnec,项目名称:Poker-Director,代码行数:23,代码来源:TournamentEndingActivity.java

示例6: addContactPayout

import android.provider.ContactsContract.QuickContact; //导入依赖的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);
}
 
开发者ID:lebesnec,项目名称:Poker-Director,代码行数:24,代码来源:RunningTournamentActivity.java

示例7: setContactPhotoForRecipient

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
private void setContactPhotoForRecipient(final Recipient recipient) {
  if (contactPhoto == null) return;

  contactPhoto.setImageBitmap(recipient.getCircleCroppedContactPhoto());

  contactPhoto.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      if (recipient.getContactUri() != null) {
        QuickContact.showQuickContact(context, contactPhoto, recipient.getContactUri(), QuickContact.MODE_LARGE, null);
      } else {
        Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT, Uri.fromParts("tel", recipient.getNumber(), null));
        context.startActivity(intent);
      }
    }
  });

  contactPhoto.setVisibility(View.VISIBLE);
}
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:20,代码来源:ConversationItem.java

示例8: startActivityForResult

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
@Override
public void startActivityForResult(Intent intent, int requestCode)
{
    // requestCode >= 0 means the activity in question is a sub-activity.
    if (requestCode >= 0) {
        mWaitingForSubActivity = true;
    }
    // The camera and other activities take a long time to hide the keyboard so we pre-hide
    // it here. However, if we're opening up the quick contact window while typing, don't
    // mess with the keyboard.
    if (mIsKeyboardOpen && !QuickContact.ACTION_QUICK_CONTACT.equals(intent.getAction())) {
        hideKeyboard();
    }

    try {
        super.startActivityForResult(intent, requestCode);
    } catch (Exception e) {
        Toast.makeText(this, "Activity not available", Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:slvn,项目名称:android-aosp-mms,代码行数:21,代码来源:ComposeMessageActivity.java

示例9: setContactPhotoForRecipient

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
private void setContactPhotoForRecipient(final Recipient recipient) {
  if (contactPhoto == null) return;

  Bitmap contactPhotoBitmap;

  if ((recipient.getContactPhoto() == ContactPhotoFactory.getDefaultContactPhoto(context)) && (groupThread)) {
    contactPhotoBitmap = recipient.getGeneratedAvatar(context);
  } else {
    contactPhotoBitmap = recipient.getCircleCroppedContactPhoto();
  }

  contactPhoto.setImageBitmap(contactPhotoBitmap);

  contactPhoto.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      if (recipient.getContactUri() != null) {
        QuickContact.showQuickContact(context, contactPhoto, recipient.getContactUri(), QuickContact.MODE_LARGE, null);
      } else {
        final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
        intent.putExtra(ContactsContract.Intents.Insert.PHONE, recipient.getNumber());
        intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
        context.startActivity(intent);
      }
    }
  });

  contactPhoto.setVisibility(View.VISIBLE);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:30,代码来源:ConversationItem.java

示例10: onClick

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
@Override
public void onClick(View v) {
    // If contact has been assigned, mExtras should no longer be null, but do a null check
    // anyway just in case assignContactFromPhone or Email was called with a null bundle or
    // wasn't assigned previously.
    final Bundle extras = (mExtras == null) ? new Bundle() : mExtras;
    if (mContactUri != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            QuickContact.showQuickContact(getContext(), QuickContactBadge.this, mContactUri,
                    mExcludeMimes, mPrioritizedMimeType);
        } else {
            QuickContact.showQuickContact(getContext(), QuickContactBadge.this, mContactUri,
                    QuickContact.MODE_LARGE, mExcludeMimes);
        }
    } else if (mContactEmail != null && mQueryHandler != null) {
        extras.putString(EXTRA_URI_CONTENT, mContactEmail);
        mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(mContactEmail)),
                EMAIL_LOOKUP_PROJECTION, null, null, null);
    } else if (mContactPhone != null && mQueryHandler != null) {
        extras.putString(EXTRA_URI_CONTENT, mContactPhone);
        mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
                PHONE_LOOKUP_PROJECTION, null, null, null);
    } else {
        // If a contact hasn't been assigned, don't react to click.
        return;
    }
}
 
开发者ID:plusCubed,项目名称:china-missed-calls,代码行数:30,代码来源:QuickContactBadge.java

示例11: showContactInfo

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
/**
 * Taken from com.google.android.gm.HtmlConversationActivity
 * 
 * Send the intent that shows the Contact info corresponding to the email
 * address.
 */
public void showContactInfo(Attendee attendee, Rect rect) {
    // First perform lookup query to find existing contact
    final ContentResolver resolver = getActivity().getContentResolver();
    final String address = attendee.mEmail;
    final Uri dataUri = Uri.withAppendedPath(
            CommonDataKinds.Email.CONTENT_FILTER_URI, Uri.encode(address));
    final Uri lookupUri = ContactsContract.Data.getContactLookupUri(
            resolver, dataUri);

    if (lookupUri != null) {
        // Found matching contact, trigger QuickContact
        QuickContact.showQuickContact(getActivity(), rect, lookupUri,
                QuickContact.MODE_MEDIUM, null);
    } else {
        // No matching contact, ask user to create one
        final Uri mailUri = Uri.fromParts("mailto", address, null);
        final Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT,
                mailUri);

        // Pass along full E-mail string for possible create dialog
        Rfc822Token sender = new Rfc822Token(attendee.mName,
                attendee.mEmail, null);
        intent.putExtra(Intents.EXTRA_CREATE_DESCRIPTION, sender.toString());

        // Only provide personal name hint if we have one
        final String senderPersonal = attendee.mName;
        if (!TextUtils.isEmpty(senderPersonal)) {
            intent.putExtra(Intents.Insert.NAME, senderPersonal);
        }

        startActivity(intent);
    }
}
 
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:40,代码来源:EventInfoFragment.java

示例12: onQueryComplete

import android.provider.ContactsContract.QuickContact; //导入依赖的package包/类
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
    Uri lookupUri = null;
    Uri createUri = null;
    boolean trigger = false;
    Bundle extras = (cookie != null) ? (Bundle) cookie : new Bundle();
    try {
        switch (token) {
            case TOKEN_EMAIL_LOOKUP_AND_TRIGGER:
                trigger = true;
                createUri = Uri.fromParts("mailto",
                        extras.getString(EXTRA_URI_CONTENT), null);

                //$FALL-THROUGH$
            case TOKEN_EMAIL_LOOKUP: {
                if (cursor != null && cursor.moveToFirst()) {
                    long contactId = cursor.getLong(EMAIL_ID_COLUMN_INDEX);
                    String lookupKey = cursor.getString(EMAIL_LOOKUP_STRING_COLUMN_INDEX);
                    lookupUri = Contacts.getLookupUri(contactId, lookupKey);
                }
                break;
            }
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }

    contactUri = lookupUri;
    onContactUriChanged();

    if (trigger && lookupUri != null) {
        // Found contact, so trigger QuickContact
        QuickContact.showQuickContact(
                getContext(), ContactBadge.this, lookupUri, QuickContact.MODE_LARGE, null);
    } else if (createUri != null) {
        // Prompt user to add this person to contacts
        final Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT, createUri);
        extras.remove(EXTRA_URI_CONTENT);
        intent.putExtras(extras);
        getContext().startActivity(intent);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:45,代码来源:ContactBadge.java

示例13: addContact

import android.provider.ContactsContract.QuickContact; //导入依赖的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();
  }
 
开发者ID:lebesnec,项目名称:Poker-Director,代码行数:42,代码来源:PlayersListActivity.java

示例14: getPlayerView1

import android.provider.ContactsContract.QuickContact; //导入依赖的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;
  }
 
开发者ID:lebesnec,项目名称:Poker-Director,代码行数:57,代码来源:RunningTournamentActivity.java


注:本文中的android.provider.ContactsContract.QuickContact类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。