Bubbles: add quick settings (temporary)

This commit is contained in:
ganfra 2022-01-12 19:01:13 +01:00
parent f7df0b891e
commit 32e72f54b3
3 changed files with 22 additions and 2 deletions

View file

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

View file

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

View file

@ -22,6 +22,11 @@
android:title="@string/settings_theme"
app:iconSpaceReserved="false" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_INTERFACE_BUBBLE_KEY"
android:title="Message bubbles" />
<im.vector.app.core.preference.VectorPreference
android:dialogTitle="@string/font_size"
android:key="SETTINGS_INTERFACE_TEXT_SIZE_KEY"