[bubble merge] Some cleanup

Change-Id: I51bebb93dd4fbf154807be7ac1239516a7b15f64
This commit is contained in:
SpiritCroc 2022-02-20 14:59:59 +01:00
parent 4f4381a325
commit 08ac537518
3 changed files with 1 additions and 37 deletions

View File

@ -54,7 +54,6 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
override fun onFinishInflate() {
super.onFinishInflate()
views = ViewMessageBubbleScBinding.bind(this)
// SC-TODO ... ?
}
fun <H : VectorEpoxyHolder> customBind(

View File

@ -246,6 +246,6 @@ class VectorSettingsPreferencesFragment @Inject constructor(
private fun updateBubbleDependencies(bubbleStyle: String) {
//bubbleTimeLocationPref?.setEnabled(BubbleThemeUtils.isBubbleTimeLocationSettingAllowed(bubbleStyle))
alwaysShowTimestampsPref?.setEnabled(!bubbleThemeUtils.forceAlwaysShowTimestamps(bubbleStyle))
alwaysShowTimestampsPref?.setEnabled(bubbleStyle in listOf(BubbleThemeUtils.BUBBLE_STYLE_NONE, BubbleThemeUtils.BUBBLE_STYLE_START))
}
}

View File

@ -16,7 +16,6 @@ import javax.inject.Inject
class BubbleThemeUtils @Inject constructor(private val context: Context) {
companion object {
const val BUBBLE_STYLE_KEY = "BUBBLE_STYLE_KEY"
const val BUBBLE_TIME_LOCATION_KEY = "BUBBLE_TIME_LOCATION_KEY"
const val BUBBLE_STYLE_NONE = "none"
const val BUBBLE_STYLE_ELEMENT = "element"
@ -49,15 +48,6 @@ class BubbleThemeUtils @Inject constructor(private val context: Context) {
}
}
// Special case of BUBBLE_STYLE_BOTH, to allow non-bubble items align to the sender either way
// (not meant for user setting, but internal use)
//const val BUBBLE_STYLE_BOTH_HIDDEN = "both_hidden"
// As above, so for single bubbles side
//const val BUBBLE_STYLE_START_HIDDEN = "start_hidden"
//private var mBubbleStyle: String = ""
//private var mBubbleTimeLocation: String = ""
fun getBubbleStyle(): String {
val bubbleStyle = PreferenceManager.getDefaultSharedPreferences(context).getString(BUBBLE_STYLE_KEY, BUBBLE_STYLE_BOTH)!!
if (bubbleStyle !in listOf(BUBBLE_STYLE_NONE, BUBBLE_STYLE_START, BUBBLE_STYLE_BOTH, BUBBLE_STYLE_ELEMENT)) {
@ -72,31 +62,6 @@ class BubbleThemeUtils @Inject constructor(private val context: Context) {
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(BUBBLE_STYLE_KEY, value).apply()
}
/* SC-TODO
fun drawsActualBubbles(bubbleStyle: String): Boolean {
return bubbleStyle == BUBBLE_STYLE_START || bubbleStyle == BUBBLE_STYLE_BOTH
}
fun drawsDualSide(bubbleStyle: String): Boolean {
return bubbleStyle == BUBBLE_STYLE_BOTH || bubbleStyle == BUBBLE_STYLE_BOTH_HIDDEN
}
*/
fun forceAlwaysShowTimestamps(bubbleStyle: String): Boolean {
return isBubbleTimeLocationSettingAllowed(bubbleStyle)
}
fun isBubbleTimeLocationSettingAllowed(bubbleStyle: String): Boolean {
return bubbleStyle == BUBBLE_STYLE_BOTH // SC-TODO? || bubbleStyle == BUBBLE_STYLE_BOTH_HIDDEN
}
fun forceAlwaysShowTimestamps(): Boolean {
return forceAlwaysShowTimestamps(getBubbleStyle())
}
fun isBubbleTimeLocationSettingAllowed(): Boolean {
return isBubbleTimeLocationSettingAllowed(getBubbleStyle())
}
}
fun guessTextWidth(view: TextView): Float {