mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Setting colorSurface for background
This commit is contained in:
parent
d36409d475
commit
e4c9acde77
1 changed files with 20 additions and 0 deletions
|
@ -18,10 +18,13 @@ package im.vector.app.features.location.option
|
|||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import im.vector.app.R
|
||||
import im.vector.app.databinding.ViewLocationSharingOptionPickerBinding
|
||||
|
||||
/**
|
||||
|
@ -51,6 +54,10 @@ class LocationSharingOptionPickerView @JvmOverloads constructor(
|
|||
this
|
||||
)
|
||||
|
||||
init {
|
||||
applyBackground()
|
||||
}
|
||||
|
||||
fun setOptions(vararg options: LocationSharingOption) {
|
||||
val optionsNumber = options.toSet().size
|
||||
val isPinnedVisible = options.contains(LocationSharingOption.PINNED)
|
||||
|
@ -63,4 +70,17 @@ class LocationSharingOptionPickerView @JvmOverloads constructor(
|
|||
divider2.isVisible = isUserCurrentVisible && isUserLiveVisible
|
||||
optionUserLive.isVisible = isUserLiveVisible
|
||||
}
|
||||
|
||||
private fun applyBackground() {
|
||||
val outValue = TypedValue()
|
||||
context.theme.resolveAttribute(
|
||||
R.attr.colorSurface,
|
||||
outValue,
|
||||
true
|
||||
)
|
||||
binding.root.background = ContextCompat.getDrawable(
|
||||
context,
|
||||
outValue.resourceId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue