Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Integrate electric bikes #53

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

Conversation

francoisfds
Copy link

Hello.

As stated in #45, CityBikes API does support electric bikes. I suggest this integration built on top of #52. Please ask if you have any question with the way it is handled.
Thank you in advance.

@francoisfds francoisfds changed the title Issue/#45 Integrate electric bikes Sep 13, 2020
This commit aims to get Mapnik working for newer Android versions,
which is done by upgrading osmdroid to latest. This update implies
some porting work :

- use Double instead of int argument when calling setMinZoomLevel.

- enhance osmdroid configuration : call 'load' to ensure config
(github.com/osmdroid/osmdroid/wiki/How-to-use-the-osmdroid-library)
and customize user-agent to access tiles following recommendations
(github.com/osmdroid/osmdroid/wiki/Important-notes-on-using-osmdroid-
in-your-app#set-the-http-user-agent-variable).

- replace the discarded OpenCycleMap tile source by HikeBikeMap.
Currently on CityBikes API, electric bikes seem to be supported on
4 networks only, as evidenced in these files :

- pybikes/bicing.py
- pybikes/smovengo.py
- pybikes/keolis.py
- pybikes/smartbike.py

It's not clear if it's standard but every one of them use the same
architecture : the 'extra' JSON item of a station contains the two
following sub-items :
- 'has_ebikes' : boolean
- 'ebikes' : integer
Since on some networks the 'has_bikes' value is computed from the
'ebikes' value being 0 or not 0, only this very data is relevant.

This commit add the 'ebikes' data as Station class's attributes as
well as stations table's columns (upgrade database to version 2).
It's copied from remote object if it exists, otherwise it is null.
This commit handles display of electric bikes by adding an 'ebikes'
area to the 'free bikes' and 'empty slots' legacy areas of the GUI.
By default this additional area is non visible, and it shows up only
if the bike system supports it. In this case, the 'free bikes' area
is turned into a 'regular bikes' area : it displays the number of
non-electric bikes only, and the icon is replaced by a green one.

This update is done on 4 pieces of GUI's code :
- StationActivity.java which inflates activity_station.xml
- StationsListAdapter.java which inflates station_list_item.xml
- MapActivity.java which inflates bonuspack_bubble.xml
- StationsListAppWidgetService.java which inflates app_widget_item.xml
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.

1 participant