diff --git a/CHANGES.md b/CHANGES.md index 5125d158ec..79bd629fcb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Improvements 🙌: - Fetch homeserver type and version and display in a new setting screen and add info in rageshakes (#2831) - Improve initial sync performance (#983) - PIP support for Jitsi call (#2418) + - Add tooltip for room quick actions Bugfix 🐛: - Try to fix crash about UrlPreview (#2640) diff --git a/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetRoomPreviewItem.kt b/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetRoomPreviewItem.kt index 1c80e6a85c..819669c8f4 100644 --- a/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetRoomPreviewItem.kt +++ b/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetRoomPreviewItem.kt @@ -20,6 +20,7 @@ import android.content.res.ColorStateList import android.view.View import android.widget.ImageView import android.widget.TextView +import androidx.appcompat.widget.TooltipCompat import androidx.core.content.ContextCompat import androidx.core.widget.ImageViewCompat import com.airbnb.epoxy.EpoxyAttribute @@ -78,33 +79,46 @@ abstract class BottomSheetRoomPreviewItem : VectorEpoxyModel<BottomSheetRoomPrev // And do the action favoriteClickListener?.invoke() } - holder.roomSettings.onClick(settingsClickListener) + holder.roomSettings.apply { + onClick(settingsClickListener) + TooltipCompat.setTooltipText(this, stringProvider.getString(R.string.room_list_quick_actions_room_settings)) + } } private fun setLowPriorityState(holder: Holder, isLowPriority: Boolean) { + val description: String val tintColor: Int if (isLowPriority) { - holder.roomLowPriority.contentDescription = stringProvider.getString(R.string.room_list_quick_actions_low_priority_remove) + description = stringProvider.getString(R.string.room_list_quick_actions_low_priority_remove) tintColor = ContextCompat.getColor(holder.view.context, R.color.riotx_accent) } else { - holder.roomLowPriority.contentDescription = stringProvider.getString(R.string.room_list_quick_actions_low_priority_add) + description = stringProvider.getString(R.string.room_list_quick_actions_low_priority_add) tintColor = ThemeUtils.getColor(holder.view.context, R.attr.riotx_text_secondary) } - ImageViewCompat.setImageTintList(holder.roomLowPriority, ColorStateList.valueOf(tintColor)) + holder.roomLowPriority.apply { + contentDescription = description + ImageViewCompat.setImageTintList(this, ColorStateList.valueOf(tintColor)) + TooltipCompat.setTooltipText(this, description) + } } private fun setFavoriteState(holder: Holder, isFavorite: Boolean) { + val description: String val tintColor: Int if (isFavorite) { - holder.roomFavorite.contentDescription = stringProvider.getString(R.string.room_list_quick_actions_favorite_remove) + description = stringProvider.getString(R.string.room_list_quick_actions_favorite_remove) holder.roomFavorite.setImageResource(R.drawable.ic_star_green_24dp) tintColor = ContextCompat.getColor(holder.view.context, R.color.riotx_accent) } else { - holder.roomFavorite.contentDescription = stringProvider.getString(R.string.room_list_quick_actions_favorite_add) + description = stringProvider.getString(R.string.room_list_quick_actions_favorite_add) holder.roomFavorite.setImageResource(R.drawable.ic_star_24dp) tintColor = ThemeUtils.getColor(holder.view.context, R.attr.riotx_text_secondary) } - ImageViewCompat.setImageTintList(holder.roomFavorite, ColorStateList.valueOf(tintColor)) + holder.roomFavorite.apply { + contentDescription = description + ImageViewCompat.setImageTintList(this, ColorStateList.valueOf(tintColor)) + TooltipCompat.setTooltipText(this, description) + } } class Holder : VectorEpoxyHolder() { diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 320f14eccd..65c5abaa2d 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -1990,6 +1990,8 @@ <string name="room_list_quick_actions_low_priority_add">"Add to low priority"</string> <string name="room_list_quick_actions_low_priority_remove">"Remove from low priority"</string> <string name="room_list_quick_actions_leave">"Leave the room"</string> + <string name="room_list_quick_actions_room_settings">"Room settings"</string> + <string name="notice_member_no_changes">"%1$s made no changes"</string> <string name="notice_member_no_changes_by_you">"You made no changes"</string> <string name="command_description_spoiler">Sends the given message as a spoiler</string>