Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact lookup by phone number added. #2233

Merged
merged 3 commits into from
Aug 15, 2017
Merged

Conversation

dstefanox
Copy link
Contributor

…ved license handling in sample

Description

Added support to contact lookup by phone number. Since Android offers highly optimized way to lookup for contacts by their number, this extension allows us to use it. Also, I updated sample application to better handle permissions and added part which demonstrates searching contacts based on phone number and showing contact image.

Motivation and Context

My use-case is that I have application which shows information about missed calls on another phone, I just pass information about caller number to this application and I want to show profile thumbnail of a caller in a list, in which I use glide to handle images. Change that I am committing here allows me fetch contact image using glide, where contact phone number is used to find contact.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@dstefanox
Copy link
Contributor Author

I signed CLA.

@googlebot
Copy link

CLAs look good, thanks!

Fixing issues reported by checkstyle on travis
@dstefanox dstefanox changed the title Added phone lookup for local URIs and updated sample to use it. Impro… Contact lookup by phone number added. Aug 10, 2017
Copy link
Collaborator

@sjudd sjudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me other than a couple of small nits. Thanks!

GlideRequests glideRequests = GlideApp.with(MainActivity.this);
RequestOptions originalSize = new RequestOptions().override(Target.SIZE_ORIGINAL);

glideRequests.load(uri).apply(originalSize).into(imageViewLookup);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can inline this:

GlideApp.with(MainActivity.this)
.load(uri)
.override(Target.SIZE_ORIGINAL)
.into(imageView);

@@ -40,6 +48,17 @@ protected void onCreate(Bundle savedInstanceState) {
imageViewLookup = (ImageView) findViewById(R.id.image_lookup);
imageViewPhoto = (ImageView) findViewById(R.id.image_photo);
imageViewDisplayPhoto = (ImageView) findViewById(R.id.image_display_photo);
numberEntry = (EditText) findViewById(R.id.number_entry);
if (ContextCompat.checkSelfPermission(this.getApplication(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing looks a bit weird, maybe:

if (ContextCompat.checkSelfPermission(
getApplication(),
Manifeset.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
...
}

Updated formatting after code review. Removed line of code that was commented-out. Added comment for permission request.
@dstefanox
Copy link
Contributor Author

Updated code according to comments and submitted updates.

@sjudd
Copy link
Collaborator

sjudd commented Aug 15, 2017

Thanks!

@sjudd sjudd merged commit 31a911e into bumptech:master Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants