CUTR-at-USF / OpenTripPlanner-for-Android

An Android app for multi-modal trip planning and navigation using any OpenTripPlanner server.
Other
129 stars 91 forks source link

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

Open vreixo opened 9 years ago

vreixo commented 9 years ago

...ptions and removing options-button menu.

barbeau commented 9 years ago

@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 commented 9 years ago

@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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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" notifications@github.com 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 https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/pull/460#issuecomment-77948598 .

vreixo commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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

barbeau commented 8 years ago

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 commented 8 years ago

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

barbeau commented 8 years ago

@vreixo Sure, just updated it.

CLAassistant commented 3 years ago

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.

:white_check_mark: barbeau
:x: vreixo
You have signed the CLA already but the status is still pending? Let us recheck it.