Adding other options

This commit is contained in:
Maxime Naturel 2022-03-01 18:02:38 +01:00
parent 55c6383074
commit 4586426958
4 changed files with 47 additions and 9 deletions

View File

@ -60,8 +60,9 @@ class LocationSharingFragment @Inject constructor(
} }
// TODO change the options dynamically depending on the current chosen location // TODO change the options dynamically depending on the current chosen location
views.shareLocationContainer.setOptions(LocationSharingOption.PINNED) // set correct click listener on each option
views.shareLocationContainer.debouncedClicks { views.shareLocationOptionsPicker.setOptions(LocationSharingOption.PINNED)
views.shareLocationOptionsPicker.debouncedClicks {
viewModel.handle(LocationSharingAction.OnShareLocation) viewModel.handle(LocationSharingAction.OnShareLocation)
} }

View File

@ -37,6 +37,11 @@ class LocationSharingOptionPickerView @JvmOverloads constructor(
) )
fun setOptions(vararg options: LocationSharingOption) { fun setOptions(vararg options: LocationSharingOption) {
binding.locationSharingOptionPinned.isVisible = options.contains(LocationSharingOption.PINNED) binding.locationSharingOptionUserCurrentLocation.isVisible =
options.contains(LocationSharingOption.USER_CURRENT)
binding.locationSharingOptionUserLiveLocation.isVisible =
options.contains(LocationSharingOption.USER_LIVE)
binding.locationSharingOptionPinned.isVisible =
options.contains(LocationSharingOption.PINNED)
} }
} }

View File

@ -9,13 +9,13 @@
android:id="@+id/mapView" android:id="@+id/mapView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/shareLocationContainer" app:layout_constraintBottom_toTopOf="@id/shareLocationOptionsPicker"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:mapbox_renderTextureMode="true" app:mapbox_renderTextureMode="true"
tools:background="#4F00" /> tools:background="#4F00" />
<im.vector.app.features.location.view.LocationSharingOptionPickerView <im.vector.app.features.location.view.LocationSharingOptionPickerView
android:id="@+id/shareLocationContainer" android:id="@+id/shareLocationOptionsPicker"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -27,8 +27,8 @@
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_marginEnd="@dimen/layout_horizontal_margin" android:layout_marginEnd="@dimen/layout_horizontal_margin"
app:layout_constraintBottom_toBottomOf="@id/shareLocationContainer" android:layout_marginBottom="@dimen/layout_vertical_margin"
app:layout_constraintEnd_toEndOf="@id/shareLocationContainer" app:layout_constraintBottom_toBottomOf="@id/shareLocationOptionsPicker"
app:layout_constraintTop_toTopOf="@id/shareLocationContainer" /> app:layout_constraintEnd_toEndOf="@id/shareLocationOptionsPicker" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -6,17 +6,49 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"> tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<!-- TODO add strings and correct icons -->
<!-- TODO add dividers -->
<im.vector.app.features.location.view.LocationSharingOptionView <im.vector.app.features.location.view.LocationSharingOptionView
android:id="@+id/locationSharingOptionPinned" android:id="@+id/locationSharingOptionPinned"
android:layout_height="wrap_content"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content"
app:icon="@drawable/ic_attachment_location_white" app:icon="@drawable/ic_attachment_location_white"
app:iconBackground="@drawable/circle" app:iconBackground="@drawable/circle"
app:iconBackgroundTint="?colorPrimary" app:iconBackgroundTint="?colorPrimary"
app:iconDescription="@string/a11y_location_share_icon" app:iconDescription="@string/a11y_location_share_icon"
app:layout_constraintBottom_toTopOf="@id/locationSharingOptionUserCurrentLocation"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:title="@string/location_share" /> app:title="@string/location_share" />
<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_icon"
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" />
<im.vector.app.features.location.view.LocationSharingOptionView
android:id="@+id/locationSharingOptionUserLiveLocation"
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_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/locationSharingOptionUserCurrentLocation"
app:title="@string/location_share" />
</merge> </merge>