add presence indicator busy and away

This commit is contained in:
chagai95 2022-05-13 13:55:10 +02:00 committed by GitHub
parent cad9d443be
commit 9f033ed623
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 72 additions and 2 deletions

View file

@ -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>

View file

@ -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) -->

View file

@ -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>

View file

@ -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>

View file

@ -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 }

View file

@ -29,6 +29,7 @@ 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 {
@ -36,6 +37,7 @@ internal enum class SyncPresence(val value: String) {
return when (presenceEnum) {
PresenceEnum.ONLINE -> Online
PresenceEnum.OFFLINE -> Offline
PresenceEnum.BUSY -> Busy
PresenceEnum.UNAVAILABLE -> Unavailable
}
}

View file

@ -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
}
}

View file

@ -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>

View file

@ -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>