-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#5395: Location sharing options view #5411
Conversation
Hi @gaelledel , can you please review the design? I have added some relevant screenshots of the added modifications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ace! Looking forward to see future developments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Job with the custom views, it seems fine to me
// TODO | ||
} | ||
views.shareLocationOptionsPicker.optionUserLive.debouncedClicks { | ||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we plan to do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the live location sharing, the app will send location of the user periodically during a certain amount of time until the user stops sharing its location. And in timeline we will also be able to see locations of different several users currently live sharing their location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
A few (small) remarks
@@ -142,6 +142,9 @@ | |||
<item name="vctr_keyword_style">@style/Widget.Vector.Keyword</item> | |||
|
|||
<item name="vctr_toast_background">@color/vctr_toast_background_light</item> | |||
|
|||
<!-- Location sharing --> | |||
<item name="vctr_live_location">@color/vctr_live_location_dark</item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean vctr_live_location_light
(even if the actual value is the same)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly, thanks! I missed that, I will fix this.
enum class LocationSharingOption { | ||
USER_CURRENT, // current user's location | ||
USER_LIVE, // user's location during a certain amount of time | ||
PINNED // static location pinned by the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the form I prefer to have comment above the value, using KDoc for better integration with IDE. So like
/**
* static location pinned by the user
*/
PINNED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I will update it.
applyBackground() | ||
} | ||
|
||
fun setOptions(vararg options: LocationSharingOption) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally those methods are called render
in the codebase.
Also maybe passing a List
as parameter could be better than vararg
, but I do not have a strong opinion on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay for the naming. I was wondering about a Set
instead of vararg
but I have chosen vararg
because it easier to use and read (no extra setOf()
).
vector/src/main/res/values/attrs.xml
Outdated
@@ -0,0 +1,11 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move and rename this file to the same location and spirit than https://github.com/vector-im/element-android/blob/main/library/ui-styles/src/main/res/values/stylable_badge_floating_action_button.xml please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I see. We declare one file per view. I will do the update.
@@ -2924,9 +2924,17 @@ | |||
<!-- Location --> | |||
<string name="location_activity_title_static_sharing">Share location</string> | |||
<string name="location_activity_title_preview">Location</string> | |||
<!-- TODO delete --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Related lint issue about unused resourced could be ignore. Maybe add a lint ignore in the tag to please lint and not break develop once merged. I will update the recipe to delete strings if it works (or you can do it if you want to!).
Thanks for the review! I have fixed all discussions, can you check again? I will need this work to move on #5417. |
We may have a quick win here to share the location as a pin by extending
Timeline already handles the asset type and renders as a pin if it is different than |
Thanks for the info! I will try to use it on my next PR to handle static pinned location sharing. |
4718c00
to
2bdafde
Compare
<attr name="locShareIconBackgroundTint" format="color" /> | ||
<attr name="locShareIconPadding" format="dimension" /> | ||
<attr name="locShareIconDescription" format="string" /> | ||
<attr name="locShareTitle" format="string" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for using a prefix, it's far better when attributes are used in the XML!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
(static review only)
Type of change
Content
Adding a new custom view named
LocationSharingOptionPickerView
to be able to show different options of location sharing.The only visible changes we can see now in the app is the icon and text displayed to confirm sharing and the avatar display in timeline and map (see captures below).
In fact, we only have user current location option available for now. Icon is now the user avatar with background color corresponding to the user color both in the pins of the map and in the confirmation view. Ripple effect has also been added when the confirmation view is pressed.
Motivation and context
Closes #5395.
Screenshots / GIFs
Current visible changes in the app
Changes not currently visible in the app
For UI validation, only the option picker view is relevant, the map view has not been updated for now)
Tests
To test the other options, go to
LocationSharingFragment
atinitOptionsPicker()
method and set the options as you want. For example,views.shareLocationOptionsPicker.render(LocationSharingOption.USER_CURRENT, LocationSharingOption.USER_LIVE)
orviews.shareLocationOptionsPicker.render(LocationSharingOption.PINNED)
Tested devices
Checklist