From fa8fac6bca302344620eb04834d249e2948e51a7 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Sun, 14 Mar 2021 11:44:20 +0100 Subject: [PATCH] Remove time location setting, always use bottom if possible Issues with dual-side bubbles with top time: - Not well tested, extra complexity, extra maintenance hassle - Media: no send time without footer - Media: currently showing empty footer shade - Adding further footer items would need extra handling --- .../settings/VectorSettingsPreferencesFragment.kt | 13 ++++++++----- .../vector/app/features/themes/BubbleThemeUtils.kt | 6 +++++- .../main/res/xml/vector_settings_preferences.xml | 2 ++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt index 69b5d4fd75..d794ff0f4b 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt @@ -30,6 +30,7 @@ import im.vector.app.core.preference.VectorSwitchPreference import im.vector.app.databinding.DialogSelectTextSizeBinding import im.vector.app.features.configuration.VectorConfiguration import im.vector.app.features.themes.BubbleThemeUtils +import im.vector.app.features.themes.BubbleThemeUtils.BUBBLE_TIME_BOTTOM import im.vector.app.features.themes.ThemeUtils import javax.inject.Inject @@ -41,7 +42,7 @@ class VectorSettingsPreferencesFragment @Inject constructor( override var titleRes = R.string.settings_preferences override val preferenceXmlRes = R.xml.vector_settings_preferences - private var bubbleTimeLocationPref: VectorListPreference? = null + //private var bubbleTimeLocationPref: VectorListPreference? = null private var alwaysShowTimestampsPref: VectorSwitchPreference? = null private val selectedLanguagePreference by lazy { @@ -94,13 +95,14 @@ class VectorSettingsPreferencesFragment @Inject constructor( BubbleThemeUtils.invalidateBubbleStyle() updateBubbleDependencies( bubbleStyle = newValue as String, - bubbleTimeLocation = bubbleTimeLocationPref!!.value + BUBBLE_TIME_BOTTOM //bubbleTimeLocation = bubbleTimeLocationPref!!.value ) true } - bubbleTimeLocationPref = findPreference(BubbleThemeUtils.BUBBLE_TIME_LOCATION_KEY) + //bubbleTimeLocationPref = findPreference(BubbleThemeUtils.BUBBLE_TIME_LOCATION_KEY) alwaysShowTimestampsPref = findPreference(VectorPreferences.SETTINGS_ALWAYS_SHOW_TIMESTAMPS_KEY) + /* bubbleTimeLocationPref!!.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> BubbleThemeUtils.invalidateBubbleStyle() updateBubbleDependencies( @@ -109,9 +111,10 @@ class VectorSettingsPreferencesFragment @Inject constructor( ) true } + */ updateBubbleDependencies( bubbleStyle = bubbleStylePreference.value, - bubbleTimeLocation = bubbleTimeLocationPref!!.value + bubbleTimeLocation = BUBBLE_TIME_BOTTOM //bubbleTimeLocationPref!!.value ) // Url preview @@ -221,7 +224,7 @@ class VectorSettingsPreferencesFragment @Inject constructor( } private fun updateBubbleDependencies(bubbleStyle: String, bubbleTimeLocation: String) { - bubbleTimeLocationPref?.setEnabled(BubbleThemeUtils.isBubbleTimeLocationSettingAllowed(bubbleStyle)) + //bubbleTimeLocationPref?.setEnabled(BubbleThemeUtils.isBubbleTimeLocationSettingAllowed(bubbleStyle)) alwaysShowTimestampsPref?.setEnabled(!BubbleThemeUtils.forceAlwaysShowTimestamps(bubbleStyle, bubbleTimeLocation)) } } diff --git a/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt b/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt index 5e658538d8..02a8473e27 100644 --- a/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt +++ b/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt @@ -35,7 +35,10 @@ object BubbleThemeUtils { return mBubbleStyle } - fun getBubbleTimeLocation(context: Context): String { + fun getBubbleTimeLocation(@Suppress("UNUSED_PARAMETER") context: Context): String { + // Always use bottom when allowed + return if (isBubbleTimeLocationSettingAllowed(context)) BUBBLE_TIME_BOTTOM else BUBBLE_TIME_TOP + /* if (mBubbleTimeLocation == "") { mBubbleTimeLocation = PreferenceManager.getDefaultSharedPreferences(context).getString(BUBBLE_TIME_LOCATION_KEY, BUBBLE_TIME_BOTTOM)!! } @@ -43,6 +46,7 @@ object BubbleThemeUtils { return BUBBLE_TIME_TOP; } return mBubbleTimeLocation + */ } fun getVisibleAnonymousReadReceipts(context: Context, readReceipt: AnonymousReadReceipt, sentByMe: Boolean): AnonymousReadReceipt { diff --git a/vector/src/main/res/xml/vector_settings_preferences.xml b/vector/src/main/res/xml/vector_settings_preferences.xml index 80e03a22c5..b1a73b8be5 100644 --- a/vector/src/main/res/xml/vector_settings_preferences.xml +++ b/vector/src/main/res/xml/vector_settings_preferences.xml @@ -46,6 +46,7 @@ android:title="@string/bubble_style" app:iconSpaceReserved="false" /> +