Skip to content

Commit 2c86a54

Browse files
committed
fix: 경로 검색 화면 출발지, 도착지의 이름이 없을 때, 주소를 입력하도록 수정
1 parent ebb040e commit 2c86a54

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.stop.bindingadapter
2+
3+
import android.widget.TextView
4+
import androidx.databinding.BindingAdapter
5+
import com.stop.model.route.Place
6+
7+
@BindingAdapter("set_place_name")
8+
fun TextView.setPlaceName(place: Place?) {
9+
if (place == null) return
10+
11+
if (place.name.isEmpty()) {
12+
text = place.roadAddress
13+
return
14+
}
15+
text = place.name
16+
}

presentation/src/main/java/com/stop/model/route/Place.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ import kotlinx.parcelize.Parcelize
77
data class Place(
88
val name: String,
99
val coordinate: Coordinate,
10+
val roadAddress: String? = null,
1011
) : Parcelable

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ class PlaceSearchViewModel @Inject constructor(
110110

111111
panelInfo = com.stop.model.route.Place(
112112
clickedValue.title,
113-
Coordinate(latitude.toString(), longitude.toString())
113+
Coordinate(latitude.toString(), longitude.toString()),
114+
clickedValue.roadAddress,
114115
)
115116
}
116117

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
3232
android:layout_width="0dp"
3333
android:layout_height="wrap_content"
34-
android:paddingVertical="10dp"
35-
android:text="@{viewModel.origin.name}"
3634
android:background="@drawable/round_border"
35+
android:paddingVertical="10dp"
3736
app:layout_constraintEnd_toStartOf="@id/button_swap_origin_with_destination"
3837
app:layout_constraintStart_toStartOf="@id/guideline_start_vertical"
3938
app:layout_constraintTop_toBottomOf="@id/button_back_to_home"
39+
app:set_place_name="@{viewModel.origin}"
4040
tools:text="이앤씨벤쳐드림타워3차" />
4141

4242
<androidx.appcompat.widget.AppCompatButton
@@ -56,12 +56,12 @@
5656
android:layout_width="0dp"
5757
android:layout_height="wrap_content"
5858
android:layout_marginTop="10dp"
59-
android:paddingVertical="10dp"
6059
android:background="@drawable/round_border"
61-
android:text="@{viewModel.destination.name}"
60+
android:paddingVertical="10dp"
6261
app:layout_constraintEnd_toStartOf="@id/button_swap_origin_with_destination"
6362
app:layout_constraintStart_toStartOf="@id/guideline_start_vertical"
6463
app:layout_constraintTop_toBottomOf="@id/text_view_origin"
64+
app:set_place_name="@{viewModel.destination}"
6565
tools:text="Naver1784" />
6666

6767

0 commit comments

Comments
 (0)