Repository navigation
feat: search nearby locations - #835
Conversation
Syn-McJ
left a comment
There was a problem hiding this comment.
This breaks behavior of the bottom sheet somewhat, please review the requested changes.
|
|
||
|
|
||
| open class OffsetDialogFragment<T: ViewGroup> : BottomSheetDialogFragment() { | ||
| open class OffsetDialogFragment<T: ViewGroup> : BaseBottomSheetDialogFragment() { |
There was a problem hiding this comment.
This change won't make much sense once we move from having a viewModel in the dialogs to dismissing them by enumerating all fragments as I've suggested. OffsetDialogFragment and BaseBottomSheetDialogFragment have different logic for handling height and there isn't anything else they share, and so this relationship is invalid. OffsetDialogFragment is intended as a replacement for the BaseBottomSheetDialogFragment for cases where the new design of bottom dialog is used.
Therefore, I would prefer if we add viewModel and the dismissing logic to OffsetDialogFragment directly for now instead of deriving it from BaseBottomSheetDialogFragment.
| bottomSheet.isDraggable = false | ||
| bottomSheet.state = BottomSheetBehavior.STATE_EXPANDED | ||
| bottomSheetWasExpanded = true | ||
| } |
There was a problem hiding this comment.
Unfortunately, this creates some problems. First of all, resolveAppliedFilters method is only for setting up the bottom panel that shows what filters are applied, it shouldn't contain any other logic (maybe we should rename this method if its purpose isn't clear).
Second, there are numerous other places in the SearchFragment that change isDraggable and state and those places will ignore territory and this snippet completely.
The way I think this should be set up is we should have a single method that checks all conditions for the bottom sheet draggable status (similar to the shouldShowFiltersPanel method). Then, all assignments like bottomSheet.isDraggable = should use this method instead of a direct assignment. Conditions that should be checked are:
- is location enabled
- is online filter mode
- screen state
Similar method can be added for the bottomSheet.state. There, apart from the above-mentioned conditions merchant type should also be checked, since the sheet is always expanded for Online merchants.
Changes in the territory can continue to be observed through appliedFilters, or you can add a livedata for territory and observe it directly.
| <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||
| <corners android:radius="8dp"/> | ||
| <solid android:color="@color/dash_white"/> | ||
| </shape> No newline at end of file |
There was a problem hiding this comment.
This resource already exists in the wallet module, perhaps it's better to move it to the common instead of duplicating. Or you can use rounded_background with a theme, the purpose of rounded_background is to avoid creating multiple rounded background resources but instead use just one with different themes.
| android:viewportHeight="20" android:viewportWidth="20" | ||
| android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <path android:fillColor="#008DE4" android:pathData="M10.0007,6.6666C8.159,6.6666 6.6673,8.1582 6.6673,9.9999C6.6673,11.8416 8.159,13.3333 10.0007,13.3333C11.8423,13.3333 13.334,11.8416 13.334,9.9999C13.334,8.1582 11.8423,6.6666 10.0007,6.6666ZM17.4506,9.1666C17.0673,5.6916 14.309,2.9332 10.834,2.5499V0.8333H9.1673V2.5499C5.6923,2.9332 2.934,5.6916 2.5506,9.1666H0.834V10.8333H2.5506C2.934,14.3083 5.6923,17.0666 9.1673,17.4499V19.1666H10.834V17.4499C14.309,17.0666 17.0673,14.3083 17.4506,10.8333H19.1673V9.1666H17.4506ZM10.0007,15.8333C6.7757,15.8333 4.1673,13.2249 4.1673,9.9999C4.1673,6.7749 6.7757,4.1666 10.0007,4.1666C13.2256,4.1666 15.834,6.7749 15.834,9.9999C15.834,13.2249 13.2256,15.8333 10.0007,15.8333Z"/> | ||
| </vector> |
There was a problem hiding this comment.
This icon is already added as ic_current_location, you can reuse that instead by applying a blue tint to it.
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:background="@drawable/round_corners_bgd_white" | ||
| android:src="@drawable/ic_compass" |
There was a problem hiding this comment.
Can reuse ic_current_location instead with app:tint
- delete duplicate round_corners_bgd_white.xml drawable - make round_corners_white_bg.xml available to all modules
…ide OffsetDialogFragment.kt
- centralize workflow to set/change bottom sheet behaviors in SearchFragment.kt - update workflow to change bottom sheet behavior for selected territory
| import org.dash.wallet.common.R | ||
| import org.dash.wallet.common.UserInteractionAwareCallback | ||
|
|
||
| @AndroidEntryPoint |
There was a problem hiding this comment.
@AndroidEntryPoint-annotated classes cannot have type parameters
So we had to get the LockScreenViewModel using the provider
| } | ||
|
|
||
| private fun applyFilters() { | ||
| viewModel.selectedTerritory = selectedTerritory |
There was a problem hiding this comment.
had to define a custom setter to update the territory
|
@Syn-McJ I took upon your suggestion to update my work:
|
| val currentUserLocation = _currentUserLocation.asLiveData() | ||
|
|
||
| private val _selectedTerritory = MutableStateFlow("") | ||
| var selectedTerritory: String |
There was a problem hiding this comment.
We needed to observe the changes in the territory on it's own, and since it's value is updated in FiltersDialog class, we needed to define a custom setter for it
This task is all about displaying the list of nearby locations on the map. Most of the AC's required have already been done in a previous story
Issue being fixed or feature implemented
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist: