Skip to content

Commit

Permalink
Renamed LayerUtils.isBikeshareLayerActive() to LayerUtils.isBikeshare…
Browse files Browse the repository at this point in the history
…Enabled()
  • Loading branch information
carvalhorr committed Aug 11, 2017
1 parent 80c9ba9 commit 8f38538
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
Expand Down Expand Up @@ -155,7 +154,7 @@ public TripRequestBuilder setModeSetById(int id) {

switch (id) {
case R.string.transit_mode_transit:
if (LayerUtils.isBikeshareLayerActive()) {
if (LayerUtils.isBikeshareEnabled()) {
modes = Arrays.asList(TraverseMode.TRANSIT.toString(),
TraverseMode.WALK.toString(),
Application.get().getString(R.string.traverse_mode_bicycle_rent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.onebusaway.android.map.bike;

import org.onebusaway.android.R;
import org.onebusaway.android.app.Application;
import org.onebusaway.android.map.BaseMapController;
import org.onebusaway.android.map.MapParams;
import org.onebusaway.android.util.LayerUtils;
Expand All @@ -26,7 +24,6 @@
import org.opentripplanner.api.model.VertexType;
import org.opentripplanner.routing.core.TraverseMode;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.content.Loader;

Expand Down Expand Up @@ -104,7 +101,7 @@ protected Loader getLoader() {

@Override
protected void updateData() {
boolean isBikeActivated = LayerUtils.isBikeshareLayerActive();
boolean isBikeActivated = LayerUtils.isBikeshareEnabled();
if (isBikeActivated) {
if (mapMode != null) {
if (mapMode.equals(MapParams.MODE_DIRECTIONS) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ private void setupLayersSpeedDial() {
LAYERS_FAB_DEFAULT_BOTTOM_MARGIN = p.bottomMargin;


if (LayerUtils.isBikeshareLayerActive()) {
if (LayerUtils.isBikeshareEnabled()) {

This comment has been minimized.

Copy link
@barbeau

barbeau Aug 12, 2017

Could you move isBikeshareEnabled() out of LayerUtils and into Application?


mLayersFab.setVisibility(View.VISIBLE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public void onClick(DialogInterface dialogInterface, int which) {

ArrayList<String> travelByOptions = new ArrayList<String>(Arrays.asList(getResources().getStringArray(R.array.transit_mode_array)));

if (!LayerUtils.isBikeshareLayerActive()) {
if (!LayerUtils.isBikeshareEnabled()) {
travelByOptions.remove(getString(R.string.transit_mode_bikeshare));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.onebusaway.android.R;
import org.onebusaway.android.app.Application;
import org.onebusaway.android.map.googlemapsv2.LayerInfo;
import org.onebusaway.android.map.googlemapsv2.bike.BikeStationOverlay;

/**
* Utility methods related to creating layers. Currently only methods related to the bikeshare layer
Expand Down Expand Up @@ -71,12 +70,12 @@ public String getSharedPreferenceKey() {
};

/**
* Method to check whether bikeshare layer is active or not.
* Method to check whether bikeshare layer is enabled or not.
*
* @return true if the bikeshare layer is an option that can be toggled on/off
*/
public static boolean isBikeshareLayerActive() {
// Bike layer is active if either the current region
public static boolean isBikeshareEnabled() {
// Bike layer is enabled if either the current region
// supports it or a custom otp url is set. The custom otp url is used to make the testing
// process easier
return ((Application.get().getCurrentRegion() != null
Expand All @@ -88,7 +87,7 @@ public static boolean isBikeshareLayerActive() {
* @return true if the bikeshare layer is active and visible
*/
public static boolean isBikeshareLayerVisible() {
return isBikeshareLayerActive() && Application.getPrefs().getBoolean(
return isBikeshareEnabled() && Application.getPrefs().getBoolean(
Application.get().getString(R.string.preference_key_layer_bikeshare_visible), true);
}
}

0 comments on commit 8f38538

Please sign in to comment.