mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
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:
parent
ea45335b4f
commit
29bea33035
2 changed files with 6 additions and 11 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
if (isClosestNearbyPlaceFound) {
|
||||
notificationTitle.setText(place.name);
|
||||
notificationDistance.setText(place.distance);
|
||||
} else {
|
||||
notificationDistance.setText("");
|
||||
notificationTitle.setText(R.string.no_close_nearby);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue