微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.provider.ContactsContract.QuickContact的实例源码

项目:q-mail    文件ContactBadge.java   
@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);
    }
}
项目:SOS-The-Healthcare-Companion    文件ContactBadge.java   
@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(),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);
    }

}
项目:SOS-The-Healthcare-Companion    文件ContactBadge.java   
@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(),mContactUri,mExcludeMimes);
    } else if (mContactEmail != null && mQueryHandler != null) {
        extras.putString(Constants.EXTRA_URI_CONTENT,mContactEmail);
        mQueryHandler.startQuery(Constants.TOKEN_EMAIL_LOOKUP_AND_TRIGGER,Uri.encode(mContactEmail)),mContactQueryHandlerCallback);
    } else if (mContactPhone != null && mQueryHandler != null) {
        extras.putString(Constants.EXTRA_URI_CONTENT,mContactPhone);
        mQueryHandler.startQuery(Constants.TOKEN_PHONE_LOOKUP_AND_TRIGGER,Uri.withAppendedpath(PhoneLookup.CONTENT_FILTER_URI,mContactPhone),PHONE_LOOKUP_PROJECTION,mContactQueryHandlerCallback);
    } else {
        // If a contact hasn't been assigned,don't react to click.
        return;
    }
}
项目:templated-messaging    文件ContactBadge.java   
@Override
public void onQueryComplete(int token,createUri);
        if (extras != null) {
            extras.remove(Constants.EXTRA_URI_CONTENT);
            intent.putExtras(extras);
        }
        getContext().startActivity(intent);
    }

}
项目:templated-messaging    文件ContactBadge.java   
@Override
public void onClick(View v) {
    // If contact has been assigned,don't react to click.
        return;
    }
}
项目:TextSecure    文件ConversationListItem.java   
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(),null);
        } else {
          Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT,Uri.fromParts("tel",recipient.getNumber(),null));
          context.startActivity(intent);
        }
      }
    });
  } else {
    contactPhotoImage.setonClickListener(null);
  }
}
项目:Android-ContactPicker    文件ContactBadge.java   
@Override
public void onClick(View v) {
    // If contact has been assigned,don't react to click.
        return;
    }
}
项目:Android-ContactPicker    文件ContactBadge.java   
@Override
public void onQueryComplete(int token,createUri);
        if (extras != null) {
            extras.remove(Constants.EXTRA_URI_CONTENT);
            intent.putExtras(extras);
        }
        getContext().startActivity(intent);
    }

}
项目: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);
}
项目:Securecom-Messaging    文件ConversationItem.java   
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,null);
      } else {
        Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT,null));
        context.startActivity(intent);
      }
    }
  });

  contactPhoto.setVisibility(View.VISIBLE);
}
项目:Securecom-Messaging    文件ConversationListItem.java   
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,null));
          context.startActivity(intent);
        }
      }
    });
  } else {
    contactPhotoImage.setonClickListener(null);
  }
}
项目:Securecom-Text    文件ConversationItem.java   
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,null));
        context.startActivity(intent);
      }
    }
  });

  contactPhoto.setVisibility(View.VISIBLE);
}
项目:Securecom-Text    文件ConversationListItem.java   
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,null));
          context.startActivity(intent);
        }
      }
    });
  } else {
    contactPhotoImage.setonClickListener(null);
  }
}
项目:android-aosp-mms    文件ComposeMessageActivity.java   
@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();
    }
}
项目:TextSecure    文件ConversationItem.java   
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,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);
}
项目:china-missed-calls    文件QuickContactBadge.java   
@Override
public void onClick(View v) {
    // If contact has been assigned,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,mExcludeMimes,mPrioritizedMimeType);
        } else {
            QuickContact.showQuickContact(getContext(),mExcludeMimes);
        }
    } else if (mContactEmail != null && mQueryHandler != null) {
        extras.putString(EXTRA_URI_CONTENT,mContactEmail);
        mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER,null);
    } else if (mContactPhone != null && mQueryHandler != null) {
        extras.putString(EXTRA_URI_CONTENT,mContactPhone);
        mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP_AND_TRIGGER,null);
    } else {
        // If a contact hasn't been assigned,don't react to click.
        return;
    }
}
项目:Calendar_lunar    文件EventInfoFragment.java   
/**
 * 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);
    }
}
项目:q-mail    文件ContactBadge.java   
@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(),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);
    }
}
项目:Poker-Director    文件PlayersListActivity.java   
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();
  }
项目:Poker-Director    文件RunningTournamentActivity.java   
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;
  }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。