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

Nearby/Recent List shows null for trees with species missing #1

Closed
kbornhorst opened this issue Aug 27, 2013 · 0 comments
Closed

Nearby/Recent List shows null for trees with species missing #1

kbornhorst opened this issue Aug 27, 2013 · 0 comments

Comments

@kbornhorst
Copy link
Contributor

image

shalperin added a commit that referenced this issue Oct 1, 2013
mmcfarland pushed a commit that referenced this issue Mar 18, 2014
RobinIsTheBird added a commit to RobinIsTheBird/otm-android that referenced this issue Jan 4, 2017
Rollbar registered the following error:
```
java.lang.NullPointerException: Attempt to invoke virtual method
'void com.google.android.gms.maps.GoogleMap.moveCamera(
    com.google.android.gms.maps.CameraUpdate)'
on a null object reference

at org.azavea.otm.ui.MainMapFragment.lambda$null$3
    (MainMapFragment.java:488)
```

It's probably a race condition.
Tame the asynchronous control flow to eliminate race conditions.

AFAIK, this fixes all race conditions except open question OpenTreeMap#1 below.
Unknown how many rollbar errors it will eliminate, but should
eliminate the original npe.

Refer to
* [MapView](https://developers.google.com/android/reference/com/google/android/gms/maps/MapView)
* [GoogleMap](https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap)
* [MapsInitializer](https://developers.google.com/android/reference/com/google/android/gms/maps/MapsInitializer)
* [GoogleApiAvailability](https://developers.google.com/android/reference/com/google/android/gms/common/GoogleApiAvailability)
* [Fragment Life Cycle](https://developer.android.com/guide/components/fragments.html)

Changes:

- Use jDeferred to synchronize between asynchronous flows
- Move most initialization from onCreateView to `onActivityCreated`
- Move google api connect, map fetch, and add mode cancel to `onStart`
- Update `MapHelper` to use current google availability api

Open questions:

1. Need a way to manage the `MapHelper` google api dialog to determine
   whether the play store services problem gets resolved,
   and fail catastrophically if it doesn't.
2. Need a way to test missing play store services without wrecking my phone.
3. Fails to fix OpenTreeMap#297, clearing the filter repositions the camera
4. Probably shouldn't create new `Deferred` objects if they
   already exist, but haven't noticed any negative effects of doing so
5. I don't know enough about the tile cache to be sure when it needs
   to be cleared.

--

Connects to OpenTreeMap#294
RobinIsTheBird added a commit to RobinIsTheBird/otm-android that referenced this issue Jan 10, 2017
The motivation for this commit is when
Rollbar registered the following error:
```
java.lang.NullPointerException: Attempt to invoke virtual method
'void com.google.android.gms.maps.GoogleMap.moveCamera(
    com.google.android.gms.maps.CameraUpdate)'
on a null object reference

at org.azavea.otm.ui.MainMapFragment.lambda$null$3
    (MainMapFragment.java:488)
```

It's undoubtedly a race condition, one of several.
Tame the asynchronous control flow to eliminate race conditions.

AFAIK, this fixes all race conditions except open question OpenTreeMap#1 below.
Unknown how many rollbar errors it will eliminate, but should
eliminate the original npe.

Refer to
* [MapView](https://developers.google.com/android/reference/com/google/android/gms/maps/MapView)
* [GoogleMap](https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap)
* [MapsInitializer](https://developers.google.com/android/reference/com/google/android/gms/maps/MapsInitializer)
* [GoogleApiAvailability](https://developers.google.com/android/reference/com/google/android/gms/common/GoogleApiAvailability)
* [Fragment Life Cycle](https://developer.android.com/guide/components/fragments.html)

Changes:

- Follow instructions on the Android Fragment life cycle
- Follow instructions on the Google API state machine
- Consolidate most initialization in `onActivityCreated`
  from `onCreateView` and `onResume`
- Use jDeferred to synchronize between asynchronous flows
- Eliminate mMap member variable in favor of the deferred.
- Thanks to all of the above, eliminate checks for whether
  the map, the instance, and the location have been initialized
- Replace `clearTileCache`, which no longer worked (OpenTreeMap#291),
  with `reloadTiles`
- Eliminate `MainMapFragment.onHiddenChanged`
- Fix pre-existing bug on Back Stack pop out of step 3 of add tree
- Move some string literals used in toasts into `strings.xml`
- Remove unnecessary `public` declarations
- Better `Logger` messages
- Use `lambda`s more extensively
- Fix pre-existing bug in `TreeEditDisplay` to update the rev
  on the correct plot variable
- Update `MapHelper` to use current google availability api

--

Connects to OpenTreeMap#294
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

No branches or pull requests

3 participants