Add UI for image-attachment "focus" (#2620)

* Attempt-zero implementation of a "focus" feature for image attachments. Choose "Set focus" in the attachment menu, tap once to select focus point (no visual feedback currently), tap "OK". Works in tests.

* Remove code duplication between 'update description' and 'update focus'

* Fix ktlint/bitrise failures

* Make updateMediaItem private

* When focus is set on a post attachment the preview focuses correctly. ProgressImageView now inherits from MediaPreviewImageView.

* Replace use of PointF for Focus where focus is represented, fix ktlint

* Substitute 'focus' for 'focus point' in strings

* First attempt draw focus point. Only updates on initial load. Modeled on code from RoundedCorners builtin from Glide

* Redraw focus after each tap

* Dark curtain where focus isn't (now looks like mastosoc)

* Correct ktlint for FocusDialog

* draft: switch to overlay for focus indicator

* Draw focus circle, but ImageView and FocusIndicatorView seem to share a single canvas

* Switch focus circle to path approach

* Correctly scale, save and load focuses. Clamp to visible area. Focus editor looks and feels right

* ktlint fixes and comments

* Focus indicator drawing should use device-independent pixels

* Shrink focus window when it gets unattractively tall (no linting, misbehaves on wide aspect ratio screens)

* Correct max-height behavior for screens in landscape mode

* Focus attachment result is are flipped on x axis; fix this

* Correctly thread focus through on scheduled posts, redrafted posts, and drafts (but draft focus is lost on post)

* More focus ktlint fixes

* Fix specific case where a draft is given a focus, then deleted, then posted in that order

* Fix accidental file change in focus PR

* ktLint fix

* Fix property style warnings in focus

* Fix remaining style warnings from focus PR

Co-authored-by: Conny Duck <k.pozniak@gmx.at>
This commit is contained in:
mcclure 2022-09-21 14:28:06 -04:00 committed by GitHub
commit 7684f06938
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 358 additions and 26 deletions

View file

@ -404,10 +404,12 @@
<string name="compose_active_account_description">Posting as %1$s</string>
<string name="error_failed_set_caption">Failed to set caption</string>
<string name="error_failed_set_focus">Failed to set focus point</string>
<plurals name="hint_describe_for_visually_impaired">
<item quantity="other">Describe for visually impaired\n(%d character limit)</item>
</plurals>
<string name="action_set_caption">Set caption</string>
<string name="action_set_focus">Set focus point</string>
<string name="action_edit_image">Edit image</string>
<string name="action_remove">Remove</string>
<string name="lock_account_label">Lock account</string>