Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Fix #449 - Targeted latest API version and updated looks using new API o... #460

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

vreixo
Copy link
Contributor

@vreixo vreixo commented Dec 23, 2014

...ptions and removing options-button menu.

…sing new API options and removing options-button menu.
@barbeau
Copy link
Member

barbeau commented Feb 11, 2015

@vreixo Thanks for this PR, and sorry for the long delay reviewing this. I've been tied up in a number of things. I hope to get back to reviewing this over the next week or so.

@barbeau
Copy link
Member

barbeau commented Mar 9, 2015

@vreixo Finally getting around to this - if I run the code as-is (minus a conflict or two in build.gradle that is easy to resolve), I get:

java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.usf.cutr.opentripplanner.android/edu.usf.cutr.opentripplanner.android.MyActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.SupportMapFragment.getMap()' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368)
            at android.app.ActivityThread.access$800(ActivityThread.java:149)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5299)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.SupportMapFragment.getMap()' on a null object reference
            at edu.usf.cutr.opentripplanner.android.fragments.MainFragment.retrieveMap(MainFragment.java:2055)
            at edu.usf.cutr.opentripplanner.android.fragments.MainFragment.onActivityCreated(MainFragment.java:605)
            at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1794)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:967)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
            at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:548)
            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)
            at android.app.Activity.performStart(Activity.java:6036)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368)
            at android.app.ActivityThread.access$800(ActivityThread.java:149)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5299)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

Looks like you moved mMap = retrieveMap(mMap); later in onActivityCreated(), maybe related to this?

But reverting this code to its original position above mOTPApp = ((OTPApp) getActivity().getApplication()); (line 570) doesn't fix this either?

Do you recall getting this error, or why you moved mMap = retrieveMap(mMap);?

@barbeau
Copy link
Member

barbeau commented Mar 9, 2015

Looking at some of the other changes that are related to main.xml on different screen densities/sizes, I'm guessing that this has something to do with the LG G3 w/ Android 5.0 I'm testing on and a map XML element missing from a main.xml file?

In Android Studio here are the implementations of main.xml I see:

image

I'll see if I have time to look at this further later.

@barbeau
Copy link
Member

barbeau commented Mar 9, 2015

There is also a chance that this is related to using the newest Android Support library with the old Google Play Services for Froyo, since that also changed in this PR (i.e., the Android Support library version was bumped to newest).

@vreixo
Copy link
Contributor Author

vreixo commented Mar 9, 2015

Hi @barbeau! Has been a while since I have done this and, unfortunately, I
don't recall why I had moved that. In my phone I had this working when
launching but later on I have discovered that something was incorrect with
life cycle because the app eventually crashes when coming from the
background.

I'll probably have some time these days to take a look and to see the lines
that you point out and let's hope that we find out the problem :-)
El 9/3/2015 22:37, "Sean Barbeau" [email protected] escribió:

There is also a change that this is related to using the newest Android
Support library with the old Google Play Services for Froyo, since that
also changed in this PR (i.e., the Android Support library version was
bumped to newest).


Reply to this email directly or view it on GitHub
#460 (comment)
.

barbeau and others added 13 commits March 13, 2015 16:31
… latest plugins/libraries

In the process of looking to fix CUTR-at-USF#477, we need to change minSdkVersion to 9 to use the android-maps-util library.  This also means increasing the Google Play Services version to the latest, which means we have to fix CUTR-at-USF#320 to switch from the LocationClient to FusedLocationApi.  Also bumps the Android Gradle Plugin version and support library vresion to match our compileSdkVersion.  Also removes an unused PNG file that was flagged by the Gradle plugin as an invalid name (it includes a ".").
…calculations

* Our code for bounding box calculations was complex to handle the scenario where a bounding box crosses the IDL.  However, apparently there was at least one bug, as the point (28.05866283764341,-82.41802878677845) wasn't detected as within the bounding box (24.5454892,-124.16933,49.273757,-69.965541).
* To avoid maintaining this complex code, I'm switching to using the android-maps-util, which has a PolyUtil.containsLocation() method.  I've also added a test for the case that was previously failing.  Currently all bounds test pass when using the android-maps-util library.
* PolyUtil.containsLocation() does NOT include a tolerance parameter, while our old code did.  So, I've removed the tolerance parameter from our code.  We'll see if this causes any problems in real world scenarios.
* This avoids including a bunch of code we're not using, and also avoids adding more permissions we don't need in the manifest.
It appears to have been working again for at least months (circa beginning 2015)
…for-Android

# Conflicts:
#	gradle/wrapper/gradle-wrapper.properties
#	opentripplanner-android/build.gradle
@vreixo
Copy link
Contributor Author

vreixo commented Jan 26, 2016

Hi @barbeau !

I have updated this branch and gradle file and on my nexus 5 with 6.0.1 is working ok. If it would pass Travis and work for your tests would be great to launch another update!

@barbeau
Copy link
Member

barbeau commented Jan 26, 2016

@vreixo Awesome, great to see you working on this again :)!

To get Travis to build, you'll need to update the .travis.yml in the root directory to use API 23, and whatever build tools version is being used in build.gradle:
https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/blob/master/.travis.yml#L11

If you push that commit here it should trigger Travis to rebuild.

@barbeau
Copy link
Member

barbeau commented Jan 26, 2016

Also, could you please rebase your branch on the current master? Looks like some of my commits snuck into this PR.

@barbeau
Copy link
Member

barbeau commented Jan 26, 2016

You'll also need to force-push to your remote branch on Github to erase the current commits in this PR, and start over with your new rebased commit.

@vreixo
Copy link
Contributor Author

vreixo commented Jan 27, 2016

Great! I'll update my branch. Btw, could you update the spreadsheet
enabling bike rental for Coruña? Thanks!

@barbeau
Copy link
Member

barbeau commented Jan 27, 2016

@vreixo Sure, just updated it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ barbeau
❌ vreixo
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants