Fix #5246: map icon in Upload Wizard indicating if location is included in the EXIF data (#5343)

* Add XML map icons with a tick/question mark for the Upload Wizard
The existing map icon may not be intuitive enough to indicate
whether the location EXIF data will be included
The two new XML map icons are intended to indicate the status of
location sharing with the location data in the Upload Wizard

* Label the map icon in the Upload Wizard if location is included
If an image is capture with the in-app camera, the location in the
image metadata by default
If so, the map icon in the Upload Wizard should be labelled with
a green tick during initialisation of its UploadMediaDetailFragment instance

* Update the map icon in Upload Wizard if location is pin-pointed
If the user selects images from the device storage
to upload, the location EXIF data might originally not be included
The map icon is labelled with a red question mark
After pin-pointing the location manully, the map icon should be
labelled with a green tick instead

* Fix Upload Wizard map icon XML rendering failure
SVG path is invalid, resulting in failure to render the icons
Also imports are required for UploadMediaDetailFragment to
use Drawable objects and R objects

* Add hasLocation() to UploadableFile to indicate existence of EXIF
When an image is chosen from the album to the Upload Wizard,
its EXIF might contain location data. hasLocation() and fix of init()
in UploadMediaDetailFragment ensures that the map icon is shown
correctly

* Fix init() NullPointerException in UploadMediaDetailFragment

* Fix comment typo in UploadMediaDetailFragment
Fix the comment about red and green labels for the map icon

* Use SLF4J logging for try-catch clauses in UploadableFile class
Instead of using printStackTrace(), error directed to logcat

* Use Timber for logging in UploadableFile
Clean up the catch clause in hasLocation() and getDataTimeFromExif()
This commit is contained in:
Alvin Tang 2023-10-19 00:42:01 +11:00 committed by GitHub
parent 64652b987d
commit f7164d0b78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 90 additions and 13 deletions

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/half_standard_height"
android:height="@dimen/half_standard_height"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/button_background_dark"
android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
<path
android:fillColor="#FF0000"
android:pathData="m16.544673,17.112357 q 0,-0.811828 0.149547,-1.388654 0.170911,-0.598188 0.555461,-1.132286 0.405915,-0.534097 1.08956,-1.110923 0.833191,-0.705008 1.281834,-1.175014 0.470006,-0.470006 0.66228,-0.918647 0.192275,-0.448643 0.192275,-1.08956 0,-1.0254662 -0.662281,-1.580927 -0.66228,-0.5554621 -1.922751,-0.5554621 -1.04683,0 -1.858659,0.2777304 -0.811828,0.256367 -1.559564,0.6195535 L 13.810094,7.562695 q 0.854556,-0.4486413 1.880023,-0.7477364 1.046831,-0.2990947 2.328665,-0.2990947 2.02957,0 3.140493,1.0041031 1.110922,1.0041034 1.110922,2.734578 0,0.961377 -0.320458,1.64502 -0.299094,0.662282 -0.87592,1.239107 -0.555461,0.555461 -1.324562,1.196378 -0.705008,0.598189 -1.089558,1.046832 -0.363186,0.448641 -0.49137,0.897283 -0.128183,0.427278 -0.128183,1.046831 v 0.363186 h -1.495473 z m -0.491369,3.717318 q 0,-0.790464 0.363186,-1.110923 0.38455,-0.320458 0.961375,-0.320458 0.534098,0 0.918648,0.320458 0.38455,0.320459 0.38455,1.110923 0,0.7691 -0.38455,1.110923 -0.38455,0.341822 -0.918648,0.341822 -0.576825,0 -0.961375,-0.341822 -0.363186,-0.341823 -0.363186,-1.110923z" />
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/half_standard_height"
android:height="@dimen/half_standard_height"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
<path
android:fillColor="#FF0000"
android:pathData="m 16.544673,17.112357 q 0,-0.811828 0.149547,-1.388654 0.170911,-0.598188 0.555461,-1.132286 0.405915,-0.534097 1.08956,-1.110923 0.833191,-0.705008 1.281834,-1.175014 0.470006,-0.470006 0.66228,-0.918647 0.192275,-0.448643 0.192275,-1.08956 0,-1.0254662 -0.662281,-1.580927 -0.66228,-0.5554621 -1.922751,-0.5554621 -1.04683,0 -1.858659,0.2777304 -0.811828,0.256367 -1.559564,0.6195535 L 13.810094,7.562695 q 0.854556,-0.4486413 1.880023,-0.7477364 1.046831,-0.2990947 2.328665,-0.2990947 2.02957,0 3.140493,1.0041031 1.110922,1.0041034 1.110922,2.734578 0,0.961377 -0.320458,1.64502 -0.299094,0.662282 -0.87592,1.239107 -0.555461,0.555461 -1.324562,1.196378 -0.705008,0.598189 -1.089558,1.046832 -0.363186,0.448641 -0.49137,0.897283 -0.128183,0.427278 -0.128183,1.046831 v 0.363186 h -1.495473 z m -0.491369,3.717318 q 0,-0.790464 0.363186,-1.110923 0.38455,-0.320458 0.961375,-0.320458 0.534098,0 0.918648,0.320458 0.38455,0.320459 0.38455,1.110923 0,0.7691 -0.38455,1.110923 -0.38455,0.341822 -0.918648,0.341822 -0.576825,0 -0.961375,-0.341822 -0.363186,-0.341823 -0.363186,-1.110923 z" />
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/half_standard_height"
android:height="@dimen/half_standard_height"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/button_background_dark"
android:pathData="M20.5,3m-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
<path
android:fillColor="#00FF00"
android:pathData="m 11.168943,16.76403 q 0.481743,0 0.728791,0.790553 0.494095,1.482287 0.704086,1.482287 0.160581,0 0.333515,-0.247048 3.471022,-5.558576 6.423244,-8.9925417 Q 20.124427,8.907908 21.792,8.907908 q 0.395277,0 0.531153,0.074114 0.135877,0.074114 0.135877,0.1852859 0,0.1729335 -0.407629,0.6793817 -4.768024,5.7315104 -8.844314,12.1053454 -0.284105,0.444686 -1.161125,0.444686 -0.889372,0 -1.049953,-0.07411 -0.419981,-0.185286 -0.988191,-1.889916 -0.6423249,-1.889916 -0.6423249,-2.37166 0,-0.5188 0.8646679,-1.000544 0.531153,-0.296457 0.938782,-0.296457 z"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/half_standard_height"
android:height="@dimen/half_standard_height"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M20.5,3m-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
<path
android:fillColor="#00FF00"
android:pathData="m 11.168943,16.76403 q 0.481743,0 0.728791,0.790553 0.494095,1.482287 0.704086,1.482287 0.160581,0 0.333515,-0.247048 3.471022,-5.558576 6.423244,-8.9925417 Q 20.124427,8.907908 21.792,8.907908 q 0.395277,0 0.531153,0.074114 0.135877,0.074114 0.135877,0.1852859 0,0.1729335 -0.407629,0.6793817 -4.768024,5.7315104 -8.844314,12.1053454 -0.284105,0.444686 -1.161125,0.444686 -0.889372,0 -1.049953,-0.07411 -0.419981,-0.185286 -0.988191,-1.889916 -0.6423249,-1.889916 -0.6423249,-2.37166 0,-0.5188 0.8646679,-1.000544 0.531153,-0.296457 0.938782,-0.296457 z"/>
</vector>