Exemplo n.º 1
0
 private void UpdateCameraAltitude(GpsLocation location)
 {
     if (GpsUtils.HasAltitude(location))
     {
         _editTextAltitude.Text = $"{location.Altitude:F0}";
     }
     else
     {
         _editTextAltitude.Text = "";
     }
 }
Exemplo 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);
        }
Exemplo n.º 3
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);
                });
            }
        }