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

Task 705 allowing starring route from route header on map view #1205

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TextView;

Expand Down Expand Up @@ -282,6 +283,10 @@ private class RoutePopup {
// Prevents completely hiding vehicle markers at top of route
private int VEHICLE_MARKER_PADDING;

private ImageButton mHeaderRouteStar;

private boolean mFavorite = false;

RoutePopup() {
mActivity = mFragment.getActivity();
float paddingDp =
Expand All @@ -295,7 +300,16 @@ private class RoutePopup {
mRouteLongName = (TextView) mView.findViewById(R.id.long_name);
mAgencyName = (TextView) mView.findViewById(R.id.agency);
mProgressBar = (ProgressBar) mView.findViewById(R.id.route_info_loading_spinner);

mHeaderRouteStar = mView.findViewById(R.id.header_route_star);
mHeaderRouteStar.setColorFilter(mView.getResources().getColor(R.color.header_text_color));
mHeaderRouteStar.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mHeaderRouteStar.setImageResource(!mFavorite ?
R.drawable.focus_star_on :
R.drawable.focus_star_off);
mFavorite = !mFavorite;
}
});
// Make sure the cancel button is shown
View cancel = mView.findViewById(R.id.cancel_route_mode);
cancel.setVisibility(View.VISIBLE);
Expand Down
12 changes: 11 additions & 1 deletion onebusaway-android/src/main/res/layout/route_info_head.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
android:elevation="3dp"
android:layout_height="wrap_content"
style="@style/HeaderItem">
<ImageButton
android:id="@+id/header_route_star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_toggle_star_outline"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackground"/>
<ProgressBar
android:id="@+id/route_info_loading_spinner"
style="?android:progressBarStyleLarge"
Expand Down Expand Up @@ -46,7 +55,8 @@
android:singleLine="true"
android:maxLength="6"
android:maxLines="1"
android:ellipsize="end">
android:ellipsize="end"
android:layout_marginStart="30dp">
</TextView>
<LinearLayout
android:orientation="vertical"
Expand Down