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

Timob 6101: Android: Contacts: Rhino/v8, get image from picker does not display an image #778

Merged
merged 13 commits into from Nov 30, 2011

Conversation

pingwang2011
Copy link
Contributor

Jira http://jira.appcelerator.org/browse/TIMOB-6101
To test it:

  1. Launch KS
  2. Phone > Contacts > Contact images
  3. Click get image from picker
  4. Pick a contact with an image

Activity launchingActivity = TiApplication.getInstance().getRootActivity();
Activity launchingActivity = TiApplication.getInstance().getCurrentActivity();
if (launchingActivity == null) {
Log.d(LCAT, "Couldn't showContacts, current activity is null.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use "error" level for log here.

@joshthecoder
Copy link
Contributor

Functional tested. Accepted

Device: Xoom (Android 3.2.1)

Cursor cursor = TiApplication.getInstance().getCurrentActivity().managedQuery(
Activity rootActivity = TiApplication.getInstance().getRootActivity();
if (rootActivity == null) {
rootActivity = TiApplication.getInstance().getCurrentActivity();
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a null check for the return from getCurrentActivity as this can be null.

@rusticphilosopher
Copy link
Contributor

Not sure from a terminology standpoint what makes the most sense, but in the modified files we now use rootActivity as a variable to reference activities other than our TiRootActivity instance which is slightly confusing. While not holding up this PR, it might be worthwhile to change that to something a bit more clear.

@joshthecoder
Copy link
Contributor

Perhaps adding a private method (ex: getActivity()) that returns the activity we then use to execute the query.

@joshthecoder
Copy link
Contributor

Code reviewed and function tested. Accepted.

Uri uri = ContentUris.withAppendedId(ContactsUri, id);
ContentResolver cr = TiApplication.getInstance().getCurrentActivity().getContentResolver();
ContentResolver cr = TiApplication.getInstance().getContentResolver();
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't need to be within the scope of this request, but we might consider adding geContentResolver() as a static method on TiApplication so we can wrap the getInstance() check in a single place much like was done with getRootOrCurrentActivity().

@billdawson
Copy link
Contributor

Code review accepted. +1 Opie's comment re getContentResolver(), but doesn't need to be now.

@rusticphilosopher
Copy link
Contributor

Code reviewed and Accepted. Merging

rusticphilosopher pushed a commit that referenced this pull request Nov 30, 2011
Timob 6101: Android: Contacts: Rhino/v8, get image from picker does not display an image
@rusticphilosopher rusticphilosopher merged commit 6a8f5bc into tidev:master Nov 30, 2011
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.

None yet

4 participants