[bubble merge] Some cleanup
Change-Id: I51bebb93dd4fbf154807be7ac1239516a7b15f64
This commit is contained in:
parent
4f4381a325
commit
08ac537518
|
@ -54,7 +54,6 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
|
||||||
override fun onFinishInflate() {
|
override fun onFinishInflate() {
|
||||||
super.onFinishInflate()
|
super.onFinishInflate()
|
||||||
views = ViewMessageBubbleScBinding.bind(this)
|
views = ViewMessageBubbleScBinding.bind(this)
|
||||||
// SC-TODO ... ?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <H : VectorEpoxyHolder> customBind(
|
fun <H : VectorEpoxyHolder> customBind(
|
||||||
|
|
|
@ -246,6 +246,6 @@ class VectorSettingsPreferencesFragment @Inject constructor(
|
||||||
|
|
||||||
private fun updateBubbleDependencies(bubbleStyle: String) {
|
private fun updateBubbleDependencies(bubbleStyle: String) {
|
||||||
//bubbleTimeLocationPref?.setEnabled(BubbleThemeUtils.isBubbleTimeLocationSettingAllowed(bubbleStyle))
|
//bubbleTimeLocationPref?.setEnabled(BubbleThemeUtils.isBubbleTimeLocationSettingAllowed(bubbleStyle))
|
||||||
alwaysShowTimestampsPref?.setEnabled(!bubbleThemeUtils.forceAlwaysShowTimestamps(bubbleStyle))
|
alwaysShowTimestampsPref?.setEnabled(bubbleStyle in listOf(BubbleThemeUtils.BUBBLE_STYLE_NONE, BubbleThemeUtils.BUBBLE_STYLE_START))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import javax.inject.Inject
|
||||||
class BubbleThemeUtils @Inject constructor(private val context: Context) {
|
class BubbleThemeUtils @Inject constructor(private val context: Context) {
|
||||||
companion object {
|
companion object {
|
||||||
const val BUBBLE_STYLE_KEY = "BUBBLE_STYLE_KEY"
|
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_NONE = "none"
|
||||||
const val BUBBLE_STYLE_ELEMENT = "element"
|
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 {
|
fun getBubbleStyle(): String {
|
||||||
val bubbleStyle = PreferenceManager.getDefaultSharedPreferences(context).getString(BUBBLE_STYLE_KEY, BUBBLE_STYLE_BOTH)!!
|
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)) {
|
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()
|
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 {
|
fun guessTextWidth(view: TextView): Float {
|
||||||
|
|
Loading…
Reference in New Issue