Fixed flickering of nearby banner compass (#5486)

This commit is contained in:
Shashwat Kedia 2024-01-29 05:32:30 +05:30 committed by GitHub
parent 9e970123fd
commit 5661e8c332
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View file

@ -542,7 +542,7 @@ public class ContributionsFragment
String distance = formatDistanceBetween(curLatLng, closestNearbyPlace.location); String distance = formatDistanceBetween(curLatLng, closestNearbyPlace.location);
closestNearbyPlace.setDistance(distance); closestNearbyPlace.setDistance(distance);
direction = (float) computeBearing(curLatLng, closestNearbyPlace.location); direction = (float) computeBearing(curLatLng, closestNearbyPlace.location);
nearbyNotificationCardView.updateContent(closestNearbyPlace, direction); nearbyNotificationCardView.updateContent(closestNearbyPlace);
} else { } else {
// Means that no close nearby place is found // Means that no close nearby place is found
nearbyNotificationCardView.setVisibility(View.GONE); nearbyNotificationCardView.setVisibility(View.GONE);

View file

@ -113,11 +113,11 @@ public class NearbyNotificationCardView extends SwipableCardView {
} }
/** /**
* Pass place information to views and set compass arrow direction * Pass place information to views
*
* @param place Closes place where we will get information from * @param place Closes place where we will get information from
* @param direction Direction in which compass arrow needs to be set
*/ */
public void updateContent(Place place, float direction) { public void updateContent(Place place) {
Timber.d("Update nearby card notification content"); Timber.d("Update nearby card notification content");
this.setVisibility(VISIBLE); this.setVisibility(VISIBLE);
cardViewVisibilityState = CardViewVisibilityState.READY; cardViewVisibilityState = CardViewVisibilityState.READY;
@ -132,7 +132,6 @@ public class NearbyNotificationCardView extends SwipableCardView {
notificationIcon.setVisibility(VISIBLE); notificationIcon.setVisibility(VISIBLE);
notificationTitle.setText(place.name); notificationTitle.setText(place.name);
notificationDistance.setText(place.distance); notificationDistance.setText(place.distance);
notificationCompass.setRotation(direction);
} }
@Override @Override