Adding dividers
This commit is contained in:
parent
0707877b3c
commit
fb764028c9
@ -37,11 +37,15 @@ class LocationSharingOptionPickerView @JvmOverloads constructor(
|
||||
)
|
||||
|
||||
fun setOptions(vararg options: LocationSharingOption) {
|
||||
binding.locationSharingOptionUserCurrentLocation.isVisible =
|
||||
options.contains(LocationSharingOption.USER_CURRENT)
|
||||
binding.locationSharingOptionUserLiveLocation.isVisible =
|
||||
options.contains(LocationSharingOption.USER_LIVE)
|
||||
binding.locationSharingOptionPinned.isVisible =
|
||||
options.contains(LocationSharingOption.PINNED)
|
||||
val optionsNumber = options.toSet().size
|
||||
val isPinnedVisible = options.contains(LocationSharingOption.PINNED)
|
||||
val isUserCurrentVisible = options.contains(LocationSharingOption.USER_CURRENT)
|
||||
val isUserLiveVisible = options.contains(LocationSharingOption.USER_LIVE)
|
||||
|
||||
binding.locationSharingOptionPinned.isVisible = isPinnedVisible
|
||||
binding.locationSharingOptionsDivider1.isVisible = isPinnedVisible && optionsNumber > 1
|
||||
binding.locationSharingOptionUserCurrentLocation.isVisible = isUserCurrentVisible
|
||||
binding.locationSharingOptionsDivider2.isVisible = isUserCurrentVisible && isUserLiveVisible
|
||||
binding.locationSharingOptionUserLiveLocation.isVisible = isUserLiveVisible
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ package im.vector.app.features.location.view
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.TypedArray
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
@ -57,6 +58,14 @@ class LocationSharingOptionView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun setIcon(icon: Drawable) {
|
||||
binding.shareLocationOptionIcon.setImageDrawable(icon)
|
||||
}
|
||||
|
||||
fun setIconBackground(bkg: Drawable) {
|
||||
binding.shareLocationOptionIcon.background = bkg
|
||||
}
|
||||
|
||||
private fun applyRipple() {
|
||||
val outValue = TypedValue()
|
||||
context.theme.resolveAttribute(
|
||||
|
@ -23,20 +23,42 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:title="@string/location_share_option_pinned" />
|
||||
|
||||
<View
|
||||
android:id="@+id/locationSharingOptionsDivider1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:alpha="0.15"
|
||||
android:background="?vctr_content_secondary"
|
||||
app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserCurrentLocation"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/locationSharingOptionPinned" />
|
||||
|
||||
<im.vector.app.features.location.view.LocationSharingOptionView
|
||||
android:id="@+id/locationSharingOptionUserCurrentLocation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_attachment_location_white"
|
||||
app:iconBackground="@drawable/circle"
|
||||
app:iconBackgroundTint="?colorPrimary"
|
||||
app:iconDescription="@string/a11y_location_share_option_user_current_icon"
|
||||
app:iconPadding="3dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserLiveLocation"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/locationSharingOptionPinned"
|
||||
app:title="@string/location_share_option_user_current" />
|
||||
|
||||
<View
|
||||
android:id="@+id/locationSharingOptionsDivider2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:alpha="0.15"
|
||||
android:background="?vctr_content_secondary"
|
||||
app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserLiveLocation"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/locationSharingOptionUserCurrentLocation" />
|
||||
|
||||
<im.vector.app.features.location.view.LocationSharingOptionView
|
||||
android:id="@+id/locationSharingOptionUserLiveLocation"
|
||||
android:layout_width="0dp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user