hide the notification card if there's no nearby location (#2396)

* hide the notification card if there's no nearby location

* some minor changes
This commit is contained in:
Shubham Pinjwani 2019-02-06 01:59:44 +05:30 committed by Vivek Maskara
parent ea45335b4f
commit 29bea33035
2 changed files with 6 additions and 11 deletions

View file

@ -615,10 +615,11 @@ public class ContributionsFragment
Place closestNearbyPlace = nearbyPlacesInfo.placeList.get(0);
String distance = formatDistanceBetween(curLatLng, closestNearbyPlace.location);
closestNearbyPlace.setDistance(distance);
nearbyNotificationCardView.updateContent (true, closestNearbyPlace);
nearbyNotificationCardView.updateContent(closestNearbyPlace);
nearbyNotificationCardView.setVisibility(View.VISIBLE);
} else {
// Means that no close nearby place is found
nearbyNotificationCardView.updateContent (false, null);
nearbyNotificationCardView.setVisibility(View.GONE);
}
}

View file

@ -116,10 +116,9 @@ public class NearbyNotificationCardView extends SwipableCardView {
/**
* Pass place information to views.
* @param isClosestNearbyPlaceFound false if there are no close place
* @param place Closes place where we will get information from
*/
public void updateContent(boolean isClosestNearbyPlaceFound, Place place) {
public void updateContent(Place place) {
Timber.d("Update nearby card notification content");
this.setVisibility(VISIBLE);
cardViewVisibilityState = CardViewVisibilityState.READY;
@ -131,14 +130,9 @@ public class NearbyNotificationCardView extends SwipableCardView {
notificationTitle.setVisibility(VISIBLE);
notificationDistance.setVisibility(VISIBLE);
notificationIcon.setVisibility(VISIBLE);
notificationTitle.setText(place.name);
notificationDistance.setText(place.distance);
if (isClosestNearbyPlaceFound) {
notificationTitle.setText(place.name);
notificationDistance.setText(place.distance);
} else {
notificationDistance.setText("");
notificationTitle.setText(R.string.no_close_nearby);
}
}
@Override