Display distance, average and maximum speed#58
Display distance, average and maximum speed#58ars3niy wants to merge 5 commits intolabexp:masterfrom
Conversation
|
I didn't really want to use global variables but I couldn't find a place to put a non-static member that would be accessible from TrackManager, TracklistAdapter, TrackDetail and DataHelper. Is there a better way? |
|
Thanks, I'll have a look tomorrow it's bed time for me ;) For the GPS the emulator has controls to simulate GPS events either via the command line or DDMS. It's a bit rudimentary but it beats walking in the snow. |
There was a problem hiding this comment.
For those it would be preferable to use a placeholder as we do here because in some languages that may not be expressed as "12 km" but perhaps "km 12"...
|
That doesn't look too bad for a first shot at Java ;) The most problematic parts are:
|
|
Thanks for replies! The rest was quite obvious. |
Updating details for the active track
|
Here's a new version. I don't really like that TrackManager and TrackDetail don't share TrackStatistics, it causes an unnecessary delay upon opening details for a long track. Is there a way for TrackDetail to have a reference to TrackManager who created it? This way, I could use TrackManager's getTrackStatistics() similar to what I now do in TracklistAdapter. TrackDetail appears to be created indirectly through Intent so I don't know how to pass a parameter to it. |
|
Hi Nicolas, how're you doin'? :) I've found a way to share data between TrackManager and TrackDetail spawned by it. Actually it's the same way you pass the track ID to TrackDetail, I just pass total distance, total time, etc. along with it. With that, I'm totally satisfied with everything, but are you satisfied with the code? |
|
Sorry I'm lacking the time to review the code, I'll try to get back to it as soon as I can. |
|
|
||
| public TracklistAdapter(Context context, Cursor c) { | ||
| super(context, c); | ||
| owner = (TrackManager) context; |
There was a problem hiding this comment.
That adds a dependency against the container of the view, meaning that we can't use TracklistAdapter from another activity. It would be nice to avoid
|
I think that looks pretty good, it's just the dependency between Perhaps the map of statistics could be passed in the constructor of |
Yep, only I encapsulated the map into a new class to avoid duplicating the code of what is now TrackStatisticsCollection.get |
|
C'mon you can do this, it's so close! Let's do this in the name of the free software movement! |
|
This PR could be the reason to close #38 ? :) |
While I'm working on the other patch, please have a look at this one. Also, note that this is the second time I ever encountered Java in any way (the previous patch being the first one) so I could have done something really stupid, watch out :)
Incidentally, is there a way to test GPS tracking that doesn't involve getting my arse on a tram? Running around my apartment doesn't help, and it's cold outside.