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
This commit is contained in:
SpiritCroc 2021-03-14 11:44:20 +01:00
parent 507a9575fc
commit fa8fac6bca
3 changed files with 15 additions and 6 deletions

View File

@ -30,6 +30,7 @@ import im.vector.app.core.preference.VectorSwitchPreference
import im.vector.app.databinding.DialogSelectTextSizeBinding import im.vector.app.databinding.DialogSelectTextSizeBinding
import im.vector.app.features.configuration.VectorConfiguration import im.vector.app.features.configuration.VectorConfiguration
import im.vector.app.features.themes.BubbleThemeUtils 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 im.vector.app.features.themes.ThemeUtils
import javax.inject.Inject import javax.inject.Inject
@ -41,7 +42,7 @@ class VectorSettingsPreferencesFragment @Inject constructor(
override var titleRes = R.string.settings_preferences override var titleRes = R.string.settings_preferences
override val preferenceXmlRes = R.xml.vector_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 var alwaysShowTimestampsPref: VectorSwitchPreference? = null
private val selectedLanguagePreference by lazy { private val selectedLanguagePreference by lazy {
@ -94,13 +95,14 @@ class VectorSettingsPreferencesFragment @Inject constructor(
BubbleThemeUtils.invalidateBubbleStyle() BubbleThemeUtils.invalidateBubbleStyle()
updateBubbleDependencies( updateBubbleDependencies(
bubbleStyle = newValue as String, bubbleStyle = newValue as String,
bubbleTimeLocation = bubbleTimeLocationPref!!.value BUBBLE_TIME_BOTTOM //bubbleTimeLocation = bubbleTimeLocationPref!!.value
) )
true true
} }
bubbleTimeLocationPref = findPreference<VectorListPreference>(BubbleThemeUtils.BUBBLE_TIME_LOCATION_KEY) //bubbleTimeLocationPref = findPreference<VectorListPreference>(BubbleThemeUtils.BUBBLE_TIME_LOCATION_KEY)
alwaysShowTimestampsPref = findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_ALWAYS_SHOW_TIMESTAMPS_KEY) alwaysShowTimestampsPref = findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_ALWAYS_SHOW_TIMESTAMPS_KEY)
/*
bubbleTimeLocationPref!!.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> bubbleTimeLocationPref!!.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
BubbleThemeUtils.invalidateBubbleStyle() BubbleThemeUtils.invalidateBubbleStyle()
updateBubbleDependencies( updateBubbleDependencies(
@ -109,9 +111,10 @@ class VectorSettingsPreferencesFragment @Inject constructor(
) )
true true
} }
*/
updateBubbleDependencies( updateBubbleDependencies(
bubbleStyle = bubbleStylePreference.value, bubbleStyle = bubbleStylePreference.value,
bubbleTimeLocation = bubbleTimeLocationPref!!.value bubbleTimeLocation = BUBBLE_TIME_BOTTOM //bubbleTimeLocationPref!!.value
) )
// Url preview // Url preview
@ -221,7 +224,7 @@ class VectorSettingsPreferencesFragment @Inject constructor(
} }
private fun updateBubbleDependencies(bubbleStyle: String, bubbleTimeLocation: String) { private fun updateBubbleDependencies(bubbleStyle: String, bubbleTimeLocation: String) {
bubbleTimeLocationPref?.setEnabled(BubbleThemeUtils.isBubbleTimeLocationSettingAllowed(bubbleStyle)) //bubbleTimeLocationPref?.setEnabled(BubbleThemeUtils.isBubbleTimeLocationSettingAllowed(bubbleStyle))
alwaysShowTimestampsPref?.setEnabled(!BubbleThemeUtils.forceAlwaysShowTimestamps(bubbleStyle, bubbleTimeLocation)) alwaysShowTimestampsPref?.setEnabled(!BubbleThemeUtils.forceAlwaysShowTimestamps(bubbleStyle, bubbleTimeLocation))
} }
} }

View File

@ -35,7 +35,10 @@ object BubbleThemeUtils {
return mBubbleStyle 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 == "") { if (mBubbleTimeLocation == "") {
mBubbleTimeLocation = PreferenceManager.getDefaultSharedPreferences(context).getString(BUBBLE_TIME_LOCATION_KEY, BUBBLE_TIME_BOTTOM)!! mBubbleTimeLocation = PreferenceManager.getDefaultSharedPreferences(context).getString(BUBBLE_TIME_LOCATION_KEY, BUBBLE_TIME_BOTTOM)!!
} }
@ -43,6 +46,7 @@ object BubbleThemeUtils {
return BUBBLE_TIME_TOP; return BUBBLE_TIME_TOP;
} }
return mBubbleTimeLocation return mBubbleTimeLocation
*/
} }
fun getVisibleAnonymousReadReceipts(context: Context, readReceipt: AnonymousReadReceipt, sentByMe: Boolean): AnonymousReadReceipt { fun getVisibleAnonymousReadReceipts(context: Context, readReceipt: AnonymousReadReceipt, sentByMe: Boolean): AnonymousReadReceipt {

View File

@ -46,6 +46,7 @@
android:title="@string/bubble_style" android:title="@string/bubble_style"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<!--
<im.vector.app.core.preference.VectorListPreference <im.vector.app.core.preference.VectorListPreference
android:key="BUBBLE_TIME_LOCATION_KEY" android:key="BUBBLE_TIME_LOCATION_KEY"
android:defaultValue="bottom" android:defaultValue="bottom"
@ -54,6 +55,7 @@
android:entryValues="@array/bubble_time_location_values" android:entryValues="@array/bubble_time_location_values"
android:summary="%s" android:summary="%s"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
-->
<im.vector.app.core.preference.VectorPreference <im.vector.app.core.preference.VectorPreference
android:dialogTitle="@string/font_size" android:dialogTitle="@string/font_size"