mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add callback for slightly change option to listener
This commit is contained in:
parent
581483e4ca
commit
cda75348d2
3 changed files with 20 additions and 8 deletions
|
|
@ -136,11 +136,11 @@ public class LocationServiceManager implements LocationListener {
|
|||
} else {
|
||||
return LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED;
|
||||
}
|
||||
// If the new location is more than two minutes older, it must be worse
|
||||
// If the new location is more than two minutes older, it must be worse
|
||||
} else{
|
||||
Log.d("deneme","distance:"+results[0]);
|
||||
return LocationChangeType.LOCATION_NOT_CHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -178,14 +178,20 @@ public class LocationServiceManager implements LocationListener {
|
|||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
Log.d("deneme","location changed");
|
||||
if (isBetterLocation(location, lastLocation)) {
|
||||
if (isBetterLocation(location, lastLocation)
|
||||
.equals(LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED)) {
|
||||
Log.d("deneme","location changed better location");
|
||||
lastLocation = location;
|
||||
for (LocationUpdateListener listener : locationListeners) {
|
||||
listener.onLocationChanged(LatLng.from(lastLocation));
|
||||
listener.onLocationChangedSignificantly(LatLng.from(lastLocation));
|
||||
}
|
||||
} else if (isBetterLocation(location, lastLocation)
|
||||
.equals(LocationChangeType.LOCATION_SLIGHTLY_CHANGED)) {
|
||||
Log.d("deneme","location changed better location");
|
||||
lastLocation = location;
|
||||
for (LocationUpdateListener listener : locationListeners) {
|
||||
listener.onLocationChangedSlightly(LatLng.from(lastLocation));
|
||||
}
|
||||
} else {
|
||||
Log.d("deneme","location changed worse location");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.location;
|
||||
|
||||
public interface LocationUpdateListener {
|
||||
void onLocationChanged(LatLng latLng);
|
||||
void onLocationChangedSignificantly(LatLng latLng);
|
||||
void onLocationChangedSlightly(LatLng latLng);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -392,7 +392,12 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(LatLng latLng) {
|
||||
public void onLocationChangedSignificantly(LatLng latLng) {
|
||||
refreshView(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChangedSlightly(LatLng latLng) {
|
||||
refreshView(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue