From 9f033ed6233e46438d1a856ea987e862bbceb33f Mon Sep 17 00:00:00 2001
From: chagai95 <31655082+chagai95@users.noreply.github.com>
Date: Fri, 13 May 2022 13:55:10 +0200
Subject: [PATCH 1/3] add presence indicator busy and away
---
.../ui-styles/src/main/res/values/colors.xml | 8 +++++++
.../ui-styles/src/main/res/values/palette.xml | 1 +
.../src/main/res/values/theme_dark.xml | 2 ++
.../src/main/res/values/theme_light.xml | 2 ++
.../session/presence/model/PresenceEnum.kt | 5 +++-
.../sdk/internal/session/sync/SyncPresence.kt | 2 ++
.../core/ui/views/PresenceStateImageView.kt | 6 ++++-
.../main/res/drawable/ic_presence_away.xml | 24 +++++++++++++++++++
.../main/res/drawable/ic_presence_busy.xml | 24 +++++++++++++++++++
9 files changed, 72 insertions(+), 2 deletions(-)
create mode 100644 vector/src/main/res/drawable/ic_presence_away.xml
create mode 100644 vector/src/main/res/drawable/ic_presence_busy.xml
diff --git a/library/ui-styles/src/main/res/values/colors.xml b/library/ui-styles/src/main/res/values/colors.xml
index d887e7774e..2104b49ab5 100644
--- a/library/ui-styles/src/main/res/values/colors.xml
+++ b/library/ui-styles/src/main/res/values/colors.xml
@@ -126,6 +126,14 @@
@color/palette_element_green
@color/palette_element_green
+
+ @color/element_alert_light
+ @color/element_alert_dark
+
+
+ @color/palette_element_orange
+ @color/palette_element_orange
+
@color/palette_prune
diff --git a/library/ui-styles/src/main/res/values/palette.xml b/library/ui-styles/src/main/res/values/palette.xml
index e6cee80b59..73ac768919 100644
--- a/library/ui-styles/src/main/res/values/palette.xml
+++ b/library/ui-styles/src/main/res/values/palette.xml
@@ -17,6 +17,7 @@
#FF812D
#0DBD8B
+ #D9B072
#FFFFFF
#FF5B55
diff --git a/library/ui-styles/src/main/res/values/theme_dark.xml b/library/ui-styles/src/main/res/values/theme_dark.xml
index 7177687fdd..eeff039b71 100644
--- a/library/ui-styles/src/main/res/values/theme_dark.xml
+++ b/library/ui-styles/src/main/res/values/theme_dark.xml
@@ -44,6 +44,8 @@
- @color/vctr_presence_indicator_offline_dark
- @color/vctr_presence_indicator_online_dark
+ - @color/vctr_presence_indicator_busy_dark
+ - @color/vctr_presence_indicator_away_dark
- ?vctr_system
diff --git a/library/ui-styles/src/main/res/values/theme_light.xml b/library/ui-styles/src/main/res/values/theme_light.xml
index c90c021591..0c363b583d 100644
--- a/library/ui-styles/src/main/res/values/theme_light.xml
+++ b/library/ui-styles/src/main/res/values/theme_light.xml
@@ -44,6 +44,8 @@
- @color/vctr_presence_indicator_offline_light
- @color/vctr_presence_indicator_online_light
+ - @color/vctr_presence_indicator_busy_light
+ - @color/vctr_presence_indicator_away_light
- ?vctr_system
diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/presence/model/PresenceEnum.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/presence/model/PresenceEnum.kt
index 6d9994ef1c..c678e2a706 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/presence/model/PresenceEnum.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/presence/model/PresenceEnum.kt
@@ -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 }
diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt
index 42cd972e0c..ce41a4568c 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt
@@ -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
}
}
diff --git a/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt b/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt
index 82675e8c11..0024f706b6 100644
--- a/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt
+++ b/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt
@@ -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
}
}
diff --git a/vector/src/main/res/drawable/ic_presence_away.xml b/vector/src/main/res/drawable/ic_presence_away.xml
new file mode 100644
index 0000000000..617fe735b6
--- /dev/null
+++ b/vector/src/main/res/drawable/ic_presence_away.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vector/src/main/res/drawable/ic_presence_busy.xml b/vector/src/main/res/drawable/ic_presence_busy.xml
new file mode 100644
index 0000000000..9155a6b4a5
--- /dev/null
+++ b/vector/src/main/res/drawable/ic_presence_busy.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
From 491b3c351b7b54c12e7ed9c3e84496490aa2db0c Mon Sep 17 00:00:00 2001
From: chagai95 <31655082+chagai95@users.noreply.github.com>
Date: Fri, 13 May 2022 14:00:32 +0200
Subject: [PATCH 2/3] Create 6047.feature
---
changelog.d/6047.feature | 1 +
1 file changed, 1 insertion(+)
create mode 100644 changelog.d/6047.feature
diff --git a/changelog.d/6047.feature b/changelog.d/6047.feature
new file mode 100644
index 0000000000..59d37e21e9
--- /dev/null
+++ b/changelog.d/6047.feature
@@ -0,0 +1 @@
+Add presence indicator busy and away.
From c27958d77279a558a1e70976a871d527c59f00f9 Mon Sep 17 00:00:00 2001
From: chagai95 <31655082+chagai95@users.noreply.github.com>
Date: Mon, 16 May 2022 10:50:58 +0200
Subject: [PATCH 3/3] Add Busy string and change Unavailable to Away
---
vector/src/main/res/values/strings.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml
index 1868d1ff5b..923c19dbb4 100644
--- a/vector/src/main/res/values/strings.xml
+++ b/vector/src/main/res/values/strings.xml
@@ -2729,7 +2729,8 @@
Public room
Online
Offline
- Unavailable
+ Busy
+ Away
Dev Tools
Explore Room State