From 32e72f54b3906a7d95361f39452e0af5452916c9 Mon Sep 17 00:00:00 2001 From: ganfra Date: Wed, 12 Jan 2022 19:01:13 +0100 Subject: [PATCH] Bubbles: add quick settings (temporary) --- .../timeline/style/TimelineLayoutSettingsProvider.kt | 9 +++++++-- .../vector/app/features/settings/VectorPreferences.kt | 10 ++++++++++ .../src/main/res/xml/vector_settings_preferences.xml | 5 +++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineLayoutSettingsProvider.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineLayoutSettingsProvider.kt index a10c95befe..9e351a706d 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineLayoutSettingsProvider.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineLayoutSettingsProvider.kt @@ -16,11 +16,16 @@ package im.vector.app.features.home.room.detail.timeline.style +import im.vector.app.features.settings.VectorPreferences import javax.inject.Inject -class TimelineLayoutSettingsProvider @Inject constructor() { +class TimelineLayoutSettingsProvider @Inject constructor(private val vectorPreferences: VectorPreferences) { fun getLayoutSettings(): TimelineLayoutSettings { - return TimelineLayoutSettings.BUBBLE + return if (vectorPreferences.useMessageBubblesLayout()) { + TimelineLayoutSettings.BUBBLE + } else { + TimelineLayoutSettings.MODERN + } } } diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt index 3436c20ce3..9c472a387c 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt @@ -83,6 +83,7 @@ class VectorPreferences @Inject constructor(private val context: Context) { // interface const val SETTINGS_INTERFACE_LANGUAGE_PREFERENCE_KEY = "SETTINGS_INTERFACE_LANGUAGE_PREFERENCE_KEY" const val SETTINGS_INTERFACE_TEXT_SIZE_KEY = "SETTINGS_INTERFACE_TEXT_SIZE_KEY" + const val SETTINGS_INTERFACE_BUBBLE_KEY = "SETTINGS_INTERFACE_BUBBLE_KEY" const val SETTINGS_SHOW_URL_PREVIEW_KEY = "SETTINGS_SHOW_URL_PREVIEW_KEY" private const val SETTINGS_SEND_TYPING_NOTIF_KEY = "SETTINGS_SEND_TYPING_NOTIF_KEY" private const val SETTINGS_ENABLE_MARKDOWN_KEY = "SETTINGS_ENABLE_MARKDOWN_KEY" @@ -852,6 +853,15 @@ class VectorPreferences @Inject constructor(private val context: Context) { return defaultPrefs.getBoolean(SETTINGS_SHOW_EMOJI_KEYBOARD, true) } + /** + * Tells if the emoji keyboard button should be visible or not. + * + * @return true to show emoji keyboard button. + */ + fun useMessageBubblesLayout(): Boolean { + return defaultPrefs.getBoolean(SETTINGS_INTERFACE_BUBBLE_KEY, false) + } + /** * Tells if the rage shake is used. * diff --git a/vector/src/main/res/xml/vector_settings_preferences.xml b/vector/src/main/res/xml/vector_settings_preferences.xml index 14c7dc7b80..ac8a48fb2e 100644 --- a/vector/src/main/res/xml/vector_settings_preferences.xml +++ b/vector/src/main/res/xml/vector_settings_preferences.xml @@ -22,6 +22,11 @@ android:title="@string/settings_theme" app:iconSpaceReserved="false" /> + +