Skip to content
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

add presence indicator busy and away #6047

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6047.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add presence indicator busy and away.
8 changes: 8 additions & 0 deletions library/ui-styles/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@
<color name="vctr_presence_indicator_online_light">@color/palette_element_green</color>
<color name="vctr_presence_indicator_online_dark">@color/palette_element_green</color>

<attr name="vctr_presence_indicator_busy" format="color" />
<color name="vctr_presence_indicator_busy_light">@color/element_alert_light</color>
<color name="vctr_presence_indicator_busy_dark">@color/element_alert_dark</color>

<attr name="vctr_presence_indicator_away" format="color" />
<color name="vctr_presence_indicator_away_light">@color/palette_element_orange</color>
<color name="vctr_presence_indicator_away_dark">@color/palette_element_orange</color>

<!-- Location sharing colors -->
<attr name="vctr_live_location" format="color" />
<color name="vctr_live_location_light">@color/palette_prune</color>
Expand Down
1 change: 1 addition & 0 deletions library/ui-styles/src/main/res/values/palette.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<color name="palette_melon">#FF812D</color>

<color name="palette_element_green">#0DBD8B</color>
<color name="palette_element_orange">#D9B072</color>
<color name="palette_white">#FFFFFF</color>
<color name="palette_vermilion">#FF5B55</color>
<!-- (unused) -->
Expand Down
2 changes: 2 additions & 0 deletions library/ui-styles/src/main/res/values/theme_dark.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<!-- Presence Indicator colors -->
<item name="vctr_presence_indicator_offline">@color/vctr_presence_indicator_offline_dark</item>
<item name="vctr_presence_indicator_online">@color/vctr_presence_indicator_online_dark</item>
<item name="vctr_presence_indicator_busy">@color/vctr_presence_indicator_busy_dark</item>
<item name="vctr_presence_indicator_away">@color/vctr_presence_indicator_away_dark</item>

<!-- Some aliases -->
<item name="vctr_header_background">?vctr_system</item>
Expand Down
2 changes: 2 additions & 0 deletions library/ui-styles/src/main/res/values/theme_light.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<!-- Presence Indicator colors -->
<item name="vctr_presence_indicator_offline">@color/vctr_presence_indicator_offline_light</item>
<item name="vctr_presence_indicator_online">@color/vctr_presence_indicator_online_light</item>
<item name="vctr_presence_indicator_busy">@color/vctr_presence_indicator_busy_light</item>
<item name="vctr_presence_indicator_away">@color/vctr_presence_indicator_away_light</item>

<!-- Some aliases -->
<item name="vctr_header_background">?vctr_system</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ enum class PresenceEnum(val value: String) {
OFFLINE("offline"),

@Json(name = "unavailable")
UNAVAILABLE("unavailable");
UNAVAILABLE("unavailable"),

@Json(name = "org.matrix.msc3026.busy")
BUSY("busy");

companion object {
fun from(s: String): PresenceEnum? = values().find { it.value == s }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ import org.matrix.android.sdk.api.session.presence.model.PresenceEnum
internal enum class SyncPresence(val value: String) {
Offline("offline"),
Online("online"),
Busy("busy"),
Unavailable("unavailable");

companion object {
fun from(presenceEnum: PresenceEnum): SyncPresence {
return when (presenceEnum) {
PresenceEnum.ONLINE -> Online
PresenceEnum.OFFLINE -> Offline
PresenceEnum.BUSY -> Busy
PresenceEnum.UNAVAILABLE -> Unavailable
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ class PresenceStateImageView @JvmOverloads constructor(
contentDescription = context.getString(R.string.a11y_presence_online)
}
PresenceEnum.UNAVAILABLE -> {
setImageResource(R.drawable.ic_presence_offline)
setImageResource(R.drawable.ic_presence_away)
contentDescription = context.getString(R.string.a11y_presence_unavailable)
}
PresenceEnum.OFFLINE -> {
setImageResource(R.drawable.ic_presence_offline)
contentDescription = context.getString(R.string.a11y_presence_offline)
}
PresenceEnum.BUSY -> {
setImageResource(R.drawable.ic_presence_busy)
contentDescription = context.getString(R.string.a11y_presence_busy)
}
null -> Unit
}
}
Expand Down
24 changes: 24 additions & 0 deletions vector/src/main/res/drawable/ic_presence_away.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="11.89dp"
android:height="12dp"
android:viewportWidth="11.89"
android:viewportHeight="12"
>

<group>

<clip-path
android:pathData="M11.8857 6C11.8857 9.31371 9.225 12 5.94286 12C2.66071 12 0 9.31371 0 6C0 2.68629 2.66071 0 5.94286 0C9.225 0 11.8857 2.68629 11.8857 6Z"
/>

<path
android:pathData="M0 0V12H11.8857V0"
android:fillColor="?vctr_presence_indicator_away"
/>

</group>

</vector>
24 changes: 24 additions & 0 deletions vector/src/main/res/drawable/ic_presence_busy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="11.89dp"
android:height="12dp"
android:viewportWidth="11.89"
android:viewportHeight="12"
>

<group>

<clip-path
android:pathData="M11.8857 6C11.8857 9.31371 9.225 12 5.94286 12C2.66071 12 0 9.31371 0 6C0 2.68629 2.66071 0 5.94286 0C9.225 0 11.8857 2.68629 11.8857 6Z"
/>

<path
android:pathData="M0 0V12H11.8857V0"
android:fillColor="?vctr_presence_indicator_busy"
/>

</group>

</vector>
3 changes: 2 additions & 1 deletion vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,8 @@
<string name="a11y_public_room">Public room</string>
<string name="a11y_presence_online">Online</string>
<string name="a11y_presence_offline">Offline</string>
<string name="a11y_presence_unavailable">Unavailable</string>
<string name="a11y_presence_busy">Busy</string>
<string name="a11y_presence_unavailable">Away</string>

<string name="dev_tools_menu_name">Dev Tools</string>
<string name="dev_tools_explore_room_state">Explore Room State</string>
Expand Down