-
Notifications
You must be signed in to change notification settings - Fork 782
Nick color #4826
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
Nick color #4826
Conversation
- allow changing the nick color by clicking the dispay-name in the room member detail page. - the ovirride-color can be specified as a hex string (#rrggbb) or as palette index (2) - entering an invalid color code or leaving the field blank reverts to the default hash-based nick color - the setting is stored in `account_data` as `im.vector.setting.override_colors` - future improvements / notes: - replace the text-based color entry with a proper color picker dialog - make the feature more discoverable - the color change listener is now in AppStateHandler, not sure if this is the best place - implement override color support in element-web / element-desktop, too Signed-off-by: Péter Radics <[email protected]>
…ndroid into feature/issue-2610-override-nick-color-via-user-account-data
…lement-android into feature/issue-2610-override-nick-color-via-user-account-data
Remove the click handler that opens the override color dialog from the display-name part on the member profile page, as this is not really discoverable and we have a proper menu item for it now.
…lement-android into feature/issue-2610-override-nick-color-via-user-account-data
…lement-android into feature/issue-2610-override-nick-color-via-user-account-data
…lement-android into feature/issue-2610-override-nick-color-via-user-account-data
…lement-android into feature/issue-2610-override-nick-color-via-user-account-data
…erge branch 'develop' of https://github.com./vector-im/element-android into feature/issue-2610-override-nick-color-via-user-account-data
…develop' of github.com.:mitchnull/element-android into feature/issue-2610-override-nick-color-via-user-account-data
…ndroid into feature/issue-2610-override-nick-color-via-user-account-data
…ndroid into feature/issue-2610-override-nick-color-via-user-account-data
…a-user-account-data
…ick-color-via-user-account-data [issue-2610] implement setting to override nick color
null | ||
} else { | ||
try { | ||
if (colorText.length == 1) { |
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.
This will break if/when the palette is extended to 16 or more colors. Maybe it would be better to just try to parse it as int
, and if that works then it's a color index (from the palette) otherwise parse with Color.parseColor
. Another option would be to check if the text starts with a digit to select the palette version.
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 agree, but the plan is to change this dialog to do something more user friendly, so it's acceptable like that to me.
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.
OK, cool, thanks.
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.
being able to set the colour by index is quite cryptic, I wouldn't have expected an input with a hex string hint to also allow a 0-9 index
something a UI iteration could help to improve
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, this is really a hidden feature. Sort of easter egg.
I see in my dream a nice dialog with all the 8 predefined colors, a color picker and a field to manually enter a html color. Even a reset button, instead of validating a empty dialog to reset the color.
Also note that now using the word "black" or any other color that Color.parse()
understand will also work, not sure for the other non Android-Element Matrix clients compatibility though.
@ouchadam can you have a quick look on this PR please? Thanks. |
@@ -27,4 +27,5 @@ object UserAccountDataTypes { | |||
const val TYPE_ALLOWED_WIDGETS = "im.vector.setting.allowed_widgets" | |||
const val TYPE_IDENTITY_SERVER = "m.identity_server" | |||
const val TYPE_ACCEPTED_TERMS = "m.accepted_terms" | |||
const val TYPE_OVERRIDE_COLORS = "im.vector.setting.override_colors" |
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.
does this type need to be added to the matrix spec somewhere?
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 have another PR that implements the same functionality in element-desktop (matrix-org/matrix-react-sdk#5626). As far as I understand keys under im.vector.setting
are free-to-use by clients, so I don't think it's absolutely necessary to include it in the matrix spec (apart from maybe documenting its existence so that other clients can pick this up if they wish)
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, you are right, using domain prefixed type is fine. Nowadays we should maybe consider using io.element.
prefix.
More details here: https://spec.matrix.org/latest/#namespacing
views.editText.setText(state.userColorOverride) | ||
views.editText.hint = "#000000" | ||
|
||
MaterialAlertDialogBuilder(requireContext()) |
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.
allowing the user to provide a hex string is quite verbose, perhaps another iteration of this could use a colour wheel UI
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 didn't include a full-fledged UI for this in my original PR because I didn't have the necessary expertise to do it quickly, and it wasn't clear that the PR / idea would be accepted at all (this is mostly a PoC and a working solution for us). I do agree that a proper color selector should be created for this (that can select a color from the current palette or select an arbitrary RGB color)
.liveUserAccountData(UserAccountDataTypes.TYPE_OVERRIDE_COLORS) | ||
.unwrap() | ||
.map { it.content.toModel<Map<String, String>>() } | ||
.map { userColorAccountDataContent -> |
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.
nit: could merge these maps
.map {
val userColorAccountDataContent = it.content.toModel<Map<String, String>>()
userColorAccountDataContent?.get(initialState.userId)
}
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.
Due to rework, thanks, will update
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.
@@ -2812,6 +2812,8 @@ | |||
<string name="direct_room_profile_section_more_leave">Leave</string> | |||
<string name="room_profile_leaving_room">"Leaving the room…"</string> | |||
|
|||
<string name="room_member_override_nick_color">Override nick color</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.
is the nick
terminology used in other places, or should this be display name
?
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.
Nick is used in the slash command /myroomnick
but nowhere else AFAIK. The color will be used to tint the display name but also for the background of the default avatar. So not only the display name.
Maybe using "Override user color" is fine. Please vote with 👍 and 👎 !
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.
no strong opinions from me on this 😄 maybe one for product cc @daniellekirkwood
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.
LGTM 💯 small comment about the field UI label but we can always update it later
Replacement for #2614 (see details there).
Fixes #2610