@@ -118,7 +118,6 @@ public class ContributionsFragment
118
118
119
119
private LatLng curLatLng ;
120
120
121
- private boolean firstLocationUpdate = true ;
122
121
private boolean isFragmentAttachedBefore = false ;
123
122
private View checkBoxView ;
124
123
private CheckBox checkBox ;
@@ -453,7 +452,6 @@ public void onSaveInstanceState(Bundle outState) {
453
452
public void onResume () {
454
453
super .onResume ();
455
454
contributionsPresenter .onAttachView (this );
456
- firstLocationUpdate = true ;
457
455
locationManager .addLocationListener (this );
458
456
nearbyNotificationCardView .permissionRequestButton .setOnClickListener (v -> {
459
457
showNearbyCardPermissionRationale ();
@@ -572,22 +570,17 @@ public void onDestroy() {
572
570
@ Override
573
571
public void onLocationChangedSignificantly (LatLng latLng ) {
574
572
// Will be called if location changed more than 1000 meter
575
- // Do nothing on slight changes for using network efficiently
576
- firstLocationUpdate = false ;
577
573
updateClosestNearbyCardViewInfo ();
578
574
}
579
575
580
576
@ Override
581
577
public void onLocationChangedSlightly (LatLng latLng ) {
582
578
/* Update closest nearby notification card onLocationChangedSlightly
583
- If first time to update location after onResume, then no need to wait for significant
584
- location change. Any closest location is better than no location
585
579
*/
586
- if ( firstLocationUpdate ) {
580
+ try {
587
581
updateClosestNearbyCardViewInfo ();
588
- // Turn it to false, since it is not first location update anymore. To change closest location
589
- // notification, we need to wait for a significant location change.
590
- firstLocationUpdate = false ;
582
+ } catch (Exception e ) {
583
+ Timber .e (e );
591
584
}
592
585
}
593
586
0 commit comments