Skip to content

Commit fa2fd99

Browse files
committed
feat : 최근 검색 insert && delete 구현 및 키워드 초기화
1 parent 6eec923 commit fa2fd99

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

data/src/main/java/com/stop/data/local/model/RecentPlaceSearchEntity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com.stop.data.model.nearplace.PlaceRepositoryItem
77
@Entity
88
data class RecentPlaceSearchEntity(
99
@PrimaryKey(autoGenerate = true)
10-
val id: Long = -1,
10+
val id: Long = 0,
1111
val name: String,
1212
val radius: String,
1313
val fullAddressRoad: String,

presentation/src/main/java/com/stop/ui/placesearch/PlaceSearchFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class PlaceSearchFragment : Fragment() {
6161
nearPlaceAdapter.onItemClick = {
6262
placeSearchViewModel.setClickPlace(it)
6363
placeSearchViewModel.setNearPlacesEmpty()
64-
64+
placeSearchViewModel.insertRecentSearchPlace(it)
6565

6666
binding.root.findNavController().navigate(R.id.action_placeSearchFragment_to_mapFragment)
6767
}

presentation/src/main/java/com/stop/ui/placesearch/PlaceSearchViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class PlaceSearchViewModel @Inject constructor(
101101

102102
fun setNearPlacesEmpty() {
103103
_nearPlaces.value = emptyList()
104+
_searchKeyword.value = ""
104105
_isNearPlacesNotEmpty.value = false
105106
}
106107

presentation/src/main/res/layout/layout_recent_search.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
<androidx.recyclerview.widget.RecyclerView
3131
android:id="@+id/recycler_view_recent_search"
32+
items="@{viewModel.recentPlaceSearch}"
3233
android:layout_width="0dp"
3334
android:layout_height="0dp"
3435
android:layout_marginVertical="12dp"
@@ -43,6 +44,7 @@
4344
android:layout_width="0dp"
4445
android:layout_height="wrap_content"
4546
android:layout_marginBottom="12dp"
47+
android:onClick="@{() -> viewModel.deleteRecentSearchPlace()}"
4648
android:text="@string/delete_recent_search_text"
4749
android:textColor="@color/black"
4850
android:textSize="24sp"

0 commit comments

Comments
 (0)