diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListHeader.java b/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListHeader.java index d7a512cef..f0db7e4dc 100644 --- a/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListHeader.java +++ b/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListHeader.java @@ -52,6 +52,7 @@ import androidx.fragment.app.FragmentManager; +import com.google.android.material.snackbar.Snackbar; import com.google.firebase.analytics.FirebaseAnalytics; import org.onebusaway.android.R; @@ -437,6 +438,7 @@ public void onClick(View v) { mStopFavorite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + notifyStopFavoriteChanged(mController.isFavoriteStop()); mController.setFavoriteStop(!mController.isFavoriteStop()); refreshStopFavorite(); } @@ -1008,6 +1010,7 @@ public void onClick(View v) { @Override public void onSelectionComplete(boolean savedFavorite) { if (savedFavorite) { + notifyRouteFavoriteChanged(isRouteFavorite); mController.refreshLocal(); } } @@ -1073,6 +1076,7 @@ public void onClick(View v) { @Override public void onSelectionComplete(boolean savedFavorite) { if (savedFavorite) { + notifyRouteFavoriteChanged(isRouteFavorite2); mController.refreshLocal(); } } @@ -1470,4 +1474,14 @@ public void showProgress(boolean visibility) { mProgressBar.setVisibility(View.GONE); } } + + private void notifyRouteFavoriteChanged(boolean isRouteSaved) { + int message = isRouteSaved ? R.string.route_removed_from_favorites : R.string.route_added_to_favorites; + Snackbar.make(mView, message, Snackbar.LENGTH_SHORT).show(); + } + + private void notifyStopFavoriteChanged(boolean isStopSaved) { + int message = isStopSaved ? R.string.stop_removed_from_favorites : R.string.stop_added_to_favorites; + Snackbar.make(mView, message, Snackbar.LENGTH_SHORT).show(); + } } diff --git a/onebusaway-android/src/main/res/layout/arrivals_list_header.xml b/onebusaway-android/src/main/res/layout/arrivals_list_header.xml index ce30a7c96..0a41db25e 100644 --- a/onebusaway-android/src/main/res/layout/arrivals_list_header.xml +++ b/onebusaway-android/src/main/res/layout/arrivals_list_header.xml @@ -1,5 +1,4 @@ - - + android:id="@+id/arrivals_list_header" + android:layout_width="match_parent" + android:layout_height="@dimen/arrival_header_height_two_arrivals" + android:orientation="vertical"> - + + android:imeOptions="actionDone" /> + android:layout_weight="1" />