| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- package com.usai.Contacts;
- import android.graphics.Bitmap;
- import android.provider.ContactsContract;
- import java.io.ByteArrayOutputStream;
- public class Contact {
- public static final String NUMBER_TYPE_WORK = String.valueOf(ContactsContract.CommonDataKinds.Phone.TYPE_WORK);
- public static final String NUMBER_TYPE_FAX_WORK = String.valueOf(ContactsContract.CommonDataKinds.Phone.TYPE_FAX_WORK);
- public static final String EMAIL_TYPE_WORK = String.valueOf(ContactsContract.CommonDataKinds.Email.TYPE_WORK);
- public static final String WEB_TYPE_HOMEPAGE = String.valueOf(ContactsContract.CommonDataKinds.Website.TYPE_HOMEPAGE);
- public static final String POSTAL_TYPE_WORK = String.valueOf(ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
- private String id;
- private String name;
- private String number;
- private String numberType;
- private String fax;
- private String faxType;
- private String email;
- private String emailType;
- private String homePage;
- private String homePageType;
- private String address;
- private String addressType;
- private Bitmap photo;
- public Contact(){
- }
- public Contact(Contact contact){
- copyContact(contact);
- }
- public void copyContact(Contact contact) {
- this.name = contact.getName();
- this.number = contact.getNumber();
- this.numberType = contact.getNumberType();
- this.email = contact.getEmail();
- this.emailType = contact.getEmailType();
- this.fax = contact.getFax();
- this.faxType = contact.getFaxType();
- this.homePage = contact.getHomePage();
- this.homePageType = contact.getHomePageType();
- this.address = contact.getAddress();
- this.addressType = contact.getAddressType();
- this.photo = contact.getPhoto();
- }
- public String getEmail() {
- return email;
- }
- public String getEmailType() {
- if (emailType == null) {
- return EMAIL_TYPE_WORK;
- }
- return emailType;
- }
- public String getId() {
- return id;
- }
- public String getName() {
- return name;
- }
- public String getNumber() {
- return number;
- }
- public String getNumberType() {
- if (numberType == null) {
- return NUMBER_TYPE_WORK;
- }
- return numberType;
- }
- public String getFax() {
- return fax;
- }
- public String getFaxType() {
- if (faxType == null) {
- return NUMBER_TYPE_FAX_WORK;
- }
- return faxType;
- }
- public String getAddress() {
- return address;
- }
- public String getAddressType() {
- if (addressType == null) {
- return POSTAL_TYPE_WORK;
- }
- return addressType;
- }
- public String getHomePage() {
- if (homePage == null) {
- return WEB_TYPE_HOMEPAGE;
- }
- return homePage;
- }
- public String getHomePageType() {
- return homePageType;
- }
- public Bitmap getPhoto() {
- return photo;
- }
- public byte[] getPhotoData() {
- if (photo == null) {
- return null;
- }
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- photo.compress(Bitmap.CompressFormat.PNG, 100, baos);
- byte[] data = baos.toByteArray();
- return data;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public void setEmailType(String emailType) {
- this.emailType = emailType;
- }
- public void setId(String id) {
- this.id = id;
- }
- public void setName(String name) {
- this.name = name;
- }
- public void setNumber(String number) {
- this.number = number;
- }
- public void setNumberType(String numberType) {
- this.numberType = numberType;
- }
- public void setFax(String fax) {
- this.fax = fax;
- }
- public void setFaxType(String faxType) {
- this.faxType = faxType;
- }
- public void setHomePage(String homePage) {
- this.homePage = homePage;
- }
- public void setHomePageType(String homePageType) {
- this.homePageType = homePageType;
- }
- public void setAddress(String address) {
- this.address = address;
- }
- public void setAddressType(String addressType) {
- this.addressType = addressType;
- }
- public void setPhoto(Bitmap photo) {
- this.photo = photo;
- }
- }
|