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

Fix #215 - Add occupancy #948

Merged
merged 24 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ce318f5
Initial work towards adding occupancy
barbeau Dec 2, 2018
d87c537
Add occupancy to arrival list item layout
barbeau Dec 2, 2018
e88473a
Make occupancy person icon color the same as scheduled arrival time
barbeau Dec 2, 2018
5b5856c
Fill out full scheduled time color value
barbeau Dec 2, 2018
c877d23
Add occupancy to vehicle info window
barbeau Dec 2, 2018
1607907
Refactor occupancy layout name, cleanup tool text references, add icon
barbeau Dec 6, 2018
679dc50
Merge branch 'master' into occupancy
barbeau Dec 8, 2018
50899f6
Merge branch 'master' into occupancy
barbeau Dec 14, 2018
69a08a1
Convert to ConstraintLayout, whitespace formatting
barbeau Dec 14, 2018
6846a31
Add occupancy layout to trip details
barbeau Dec 14, 2018
6e38480
Realign chevron in vehicle marker balloon
barbeau Dec 14, 2018
a2139d1
Add occupancy to style B arrivals (under Status view)
barbeau Dec 17, 2018
979ead8
Parse occupancy from API responses with unit tests
barbeau Dec 27, 2018
63371cd
Add occupancy to trip details header
barbeau Dec 27, 2018
adf834b
Add utility method to set occupancy icon visibility (and unit tests)
barbeau Dec 31, 2018
4f46e06
Add occupancy content description utility method and unit tests
barbeau Dec 31, 2018
5c36e46
Fix comments
barbeau Dec 31, 2018
faf3de7
Convert background color to be solid without transparency
barbeau Jan 5, 2019
743fad6
Set occupancy visibility, content description, and color
barbeau Jan 6, 2019
32fd910
Set occupancy for arrival list style B and trip problem reporting
barbeau Jan 6, 2019
367757c
Make occupancy silhouettes views stay left justified when not full
barbeau Jan 6, 2019
ec69b05
Add "About occupancy" menu option for arrivals list
barbeau Jan 7, 2019
aea0575
Add real-time occupancy About placeholder text
barbeau Jan 7, 2019
10cc406
Fix unit test
barbeau Jan 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions icons/occupancy_icons/occupancy-24px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions onebusaway-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ android {

multiDexEnabled true

vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -423,6 +425,7 @@ dependencies {
}
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'android.arch.lifecycle:common-java8:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'commons-io:commons-io:2.4'
// Open311 client library
implementation 'edu.usf.cutr:open311client:1.0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@
*/
package org.onebusaway.android.map.googlemapsv2;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.GradientDrawable;
import android.location.Location;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.amazon.geo.mapsv2.AmazonMap;
import com.amazon.geo.mapsv2.model.BitmapDescriptor;
import com.amazon.geo.mapsv2.model.BitmapDescriptorFactory;
Expand All @@ -39,27 +54,14 @@
import org.onebusaway.android.io.elements.ObaTrip;
import org.onebusaway.android.io.elements.ObaTripDetails;
import org.onebusaway.android.io.elements.ObaTripStatus;
import org.onebusaway.android.io.elements.OccupancyState;
import org.onebusaway.android.io.request.ObaTripsForRouteResponse;
import org.onebusaway.android.ui.TripDetailsActivity;
import org.onebusaway.android.ui.TripDetailsListFragment;
import org.onebusaway.android.util.ArrivalInfoUtils;
import org.onebusaway.android.util.MathUtils;
import org.onebusaway.android.util.UIUtils;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.GradientDrawable;
import android.location.Location;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
Expand Down Expand Up @@ -901,6 +903,7 @@ public View getInfoContents(Marker marker) {
TextView lastUpdatedView = (TextView) view.findViewById(R.id.last_updated);
ImageView moreView = (ImageView) view.findViewById(R.id.trip_more_info);
moreView.setColorFilter(r.getColor(R.color.switch_thumb_normal_material_dark));
ViewGroup occupancyView = view.findViewById(R.id.occupancy);

// Get route/trip details
ObaTrip trip = mLastResponse.getTrip(status.getActiveTripId());
Expand Down Expand Up @@ -967,6 +970,16 @@ public View getInfoContents(Marker marker) {
mMarkerRefreshHandler.postDelayed(mMarkerRefresh, MARKER_REFRESH_PERIOD);
}

if (status.getRealtimeOccupancy() != null) {
// Real-time occupancy data
UIUtils.setOccupancyVisibilityAndColor(occupancyView, status.getRealtimeOccupancy(), OccupancyState.REALTIME);
UIUtils.setOccupancyContentDescription(occupancyView, status.getRealtimeOccupancy(), OccupancyState.REALTIME);
} else {
// Hide occupancy by setting null value
UIUtils.setOccupancyVisibilityAndColor(occupancyView, null, OccupancyState.REALTIME);
UIUtils.setOccupancyContentDescription(occupancyView, null, OccupancyState.REALTIME);
}

return view;
}

Expand Down
Loading