Esempio n. 1
0
 private void UpdateCameraLocation(GpsLocation location)
 {
     if (GpsUtils.HasLocation(location))
     {
         _editTextLongitude.Text = $"{location.Longitude:F7}".Replace(",", ".");
         _editTextLatitude.Text  = $"{location.Latitude:F7}".Replace(",", ".");
     }
     else
     {
         _editTextLongitude.Text = "";
         _editTextLatitude.Text  = "";
     }
 }
Esempio n. 2
0
        public void OnPhotoShowRequest(int position)
        {
            var photoData = _adapter[position];

            if (!GpsUtils.HasLocation(photoData.GetPhotoGpsLocation()) || !GpsUtils.HasAltitude(photoData.GetPhotoGpsLocation()))
            {
                PopupHelper.ErrorDialog(this, Resource.String.PhotoParameters_SetCameraLocationFirst);
                return;
            }
            Intent showIntent = new Intent(this, typeof(PhotoShowActivity));

            showIntent.PutExtra("ID", _adapter[position].Id);
            StartActivity(showIntent);
        }
Esempio n. 3
0
        private void OnCameraLocationClicked()
        {
            GpsLocation location = _photoData.GetPhotoGpsLocation();

            if (!GpsUtils.HasLocation(location))
            {
                location = AppContext.MyLocation;
            }

            Intent intent = new Intent(this, typeof(PoiSelectActivity));

            intent.SetAction(PoiSelectActivity.REQUEST_SELECT_CAMERALOCATION.ToString());
            intent.PutExtra("Longitude", location.Longitude);
            intent.PutExtra("Latitude", location.Latitude);
            intent.PutExtra("SortBy", PoiSelectActivity.SortBy.Name.ToString());
            StartActivityForResult(intent, PoiSelectActivity.REQUEST_SELECT_CAMERALOCATION);
        }
Esempio n. 4
0
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            if (resultCode == Result.Ok && requestCode == REQUEST_IMPORT_PHOTO)
            {
                var uri = data.Data;

                var path = PathUtil.GetPath(this, uri);
                if (path == null)
                {
                    PopupHelper.ErrorDialog(this, Resources.GetText(Resource.String.PhotoParameters_CantLoadImage));
                    return;
                }

                var exifData = ExifDataReader.ReadExifData(path);

                //update altitude
                if (GpsUtils.HasLocation(exifData.location))
                {
                    if (!GpsUtils.HasAltitude(exifData.location))
                    {
                        if (TryGetElevation(exifData.location, out var altitude))
                        {
                            exifData.location.Altitude = altitude;
                        }
                    }
                }

                Task.Run(async() =>
                {
                    var photoData = await ImageSaver.Import(path, exifData, Context);

                    Intent importActivityIntent = new Intent(this, typeof(PhotoParametersActivity));
                    importActivityIntent.PutExtra("Id", photoData.Id);
                    StartActivity(importActivityIntent);
                });
            }
        }