mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
onResume() method for calling registerLocationManager
This commit is contained in:
parent
e5b746e411
commit
0d188d630c
2 changed files with 13 additions and 10 deletions
|
|
@ -38,12 +38,12 @@ public class GPSExtractor {
|
||||||
return gpsPref;
|
return gpsPref;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerLocationManager() {
|
protected void registerLocationManager() {
|
||||||
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||||
criteria = new Criteria();
|
criteria = new Criteria();
|
||||||
provider = locationManager.getBestProvider(criteria, true);
|
provider = locationManager.getBestProvider(criteria, true);
|
||||||
myLocationListener = new MyLocationListener();
|
myLocationListener = new MyLocationListener();
|
||||||
|
|
||||||
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
|
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ public class ShareActivity
|
||||||
implements SingleUploadFragment.OnUploadActionInitiated,
|
implements SingleUploadFragment.OnUploadActionInitiated,
|
||||||
CategorizationFragment.OnCategoriesSaveHandler {
|
CategorizationFragment.OnCategoriesSaveHandler {
|
||||||
|
|
||||||
|
private static final String TAG = ShareActivity.class.getName();
|
||||||
|
|
||||||
private SingleUploadFragment shareView;
|
private SingleUploadFragment shareView;
|
||||||
private CategorizationFragment categorizationFragment;
|
private CategorizationFragment categorizationFragment;
|
||||||
|
|
||||||
|
|
@ -44,17 +46,14 @@ public class ShareActivity
|
||||||
private String mediaUriString;
|
private String mediaUriString;
|
||||||
|
|
||||||
private Uri mediaUri;
|
private Uri mediaUri;
|
||||||
|
|
||||||
private Contribution contribution;
|
private Contribution contribution;
|
||||||
|
|
||||||
private ImageView backgroundImageView;
|
private ImageView backgroundImageView;
|
||||||
|
|
||||||
private UploadController uploadController;
|
private UploadController uploadController;
|
||||||
|
|
||||||
private CommonsApplication cacheObj;
|
private CommonsApplication cacheObj;
|
||||||
private boolean cacheFound;
|
private boolean cacheFound;
|
||||||
|
|
||||||
private static final String TAG = ShareActivity.class.getName();
|
private GPSExtractor imageObj;
|
||||||
|
|
||||||
public ShareActivity() {
|
public ShareActivity() {
|
||||||
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
|
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
|
||||||
|
|
@ -197,11 +196,10 @@ public class ShareActivity
|
||||||
String filePath = FileUtils.getPath(this, mediaUri);
|
String filePath = FileUtils.getPath(this, mediaUri);
|
||||||
Log.d(TAG, "Filepath: " + filePath);
|
Log.d(TAG, "Filepath: " + filePath);
|
||||||
|
|
||||||
if (filePath != null && !filePath.equals("")) {
|
Log.d(TAG, "Calling GPSExtractor");
|
||||||
//extract the coordinates of image in decimal degrees
|
imageObj = new GPSExtractor(filePath, this);
|
||||||
Log.d(TAG, "Calling GPSExtractor");
|
|
||||||
GPSExtractor imageObj = new GPSExtractor(filePath, this);
|
|
||||||
|
|
||||||
|
if (filePath != null && !filePath.equals("")) {
|
||||||
//Gets image coords if exist, otherwise gets last known coords
|
//Gets image coords if exist, otherwise gets last known coords
|
||||||
String decimalCoords = imageObj.getCoords();
|
String decimalCoords = imageObj.getCoords();
|
||||||
|
|
||||||
|
|
@ -240,6 +238,11 @@ public class ShareActivity
|
||||||
requestAuthToken();
|
requestAuthToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
imageObj.registerLocationManager();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue