Skip to content

Commit bce6482

Browse files
committed
refactor: home_panel을 별도의 layout으로 분리
1 parent e852488 commit bce6482

File tree

5 files changed

+165
-153
lines changed

5 files changed

+165
-153
lines changed

presentation/src/main/java/com/stop/AlarmWorker.kt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ class AlarmWorker @AssistedInject constructor(
2424
private val getNearPlacesUseCase: GetNearPlacesUseCase
2525
) : CoroutineWorker(context, workerParameters) {
2626

27-
lateinit var resultList: List<Place>
28-
2927
override suspend fun doWork(): Result {
3028
return try {
3129
callApi()
32-
val output: Data = workDataOf("WORK_RESULT" to resultList.toString())
30+
val output: Data = workDataOf("WORK_RESULT" to "result")
3331
Result.success(output)
3432
} catch (e: Exception) {
3533
Log.e("ABC", e.toString())
@@ -39,17 +37,14 @@ class AlarmWorker @AssistedInject constructor(
3937

4038
private suspend fun callApi() {
4139
withContext(Dispatchers.IO) {
42-
getNearPlacesUseCase.getNearPlaces(
40+
val list = getNearPlacesUseCase.getNearPlaces(
4341
1,
4442
"아남타워",
4543
126.969652,
4644
37.553836,
4745
BuildConfig.TMAP_APP_KEY
48-
).collectLatest {
49-
resultList = it
50-
}
46+
)
47+
Log.e("ABC", list.toString())
5148
}
52-
5349
}
54-
5550
}

presentation/src/main/java/com/stop/ui/map/MapFragment.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ class MapFragment : Fragment(), MapHandler {
104104
}
105105

106106
private fun clickEndLocation() {
107-
binding.viewPanelEnd.setOnClickListener {
108-
binding.root.findNavController().navigate(R.id.action_mapFragment_to_routeFragment)
109-
}
107+
//binding.viewPanelEnd.setOnClickListener {
108+
// binding.root.findNavController().navigate(R.id.action_mapFragment_to_routeFragment)
109+
//}
110110
}
111111

112112
private fun initBottomSheetBehavior() {

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

Lines changed: 7 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<layout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
4-
xmlns:tools="http://schemas.android.com/tools"
54
xmlns:bind="http://schemas.android.com/apk/res-auto">
65

76
<data>
@@ -62,145 +61,16 @@
6261
android:layout_marginEnd="15dp"
6362
android:layout_marginTop="30dp"
6463
android:elevation="15dp"
65-
android:background="@drawable/background_panel"
6664
android:visibility="@{placeSearchViewModel.panelVisibility}"
6765
app:layout_constraintStart_toStartOf="@id/guideline_start"
6866
app:layout_constraintEnd_toStartOf="@id/layout_compass"
6967
app:layout_constraintTop_toTopOf="@id/layout_compass"
7068
app:layout_constraintBottom_toBottomOf="@id/guideline_bottom">
7169

72-
<ImageView
73-
android:id="@+id/image_view_panel_point"
74-
android:layout_width="30dp"
75-
android:layout_height="30dp"
76-
android:layout_marginStart="17dp"
77-
android:layout_marginTop="20dp"
78-
app:layout_constraintStart_toStartOf="parent"
79-
app:layout_constraintTop_toTopOf="parent"
80-
app:srcCompat="@drawable/ic_point_marker" />
81-
82-
<TextView
83-
android:id="@+id/text_view_panel_title"
84-
android:layout_width="0dp"
85-
android:layout_height="30dp"
86-
android:layout_marginStart="10dp"
87-
android:layout_marginEnd="10dp"
88-
android:layout_marginTop="19dp"
89-
android:maxLines="1"
90-
android:ellipsize="end"
91-
android:text="@{placeSearchViewModel.geoLocation.title}"
92-
android:textSize="22sp"
93-
android:textColor="@color/white"
94-
android:gravity="center_vertical"
95-
app:layout_constraintStart_toEndOf="@id/image_view_panel_point"
96-
app:layout_constraintEnd_toStartOf="@id/view_panel_bookmark"
97-
app:layout_constraintTop_toTopOf="parent"
98-
tools:text="성복역" />
99-
100-
<View
101-
android:id="@+id/view_panel_bookmark"
102-
android:layout_width="30dp"
103-
android:layout_height="30dp"
104-
android:layout_marginEnd="20dp"
105-
android:layout_marginTop="20dp"
106-
android:background="@drawable/background_button"
107-
app:layout_constraintEnd_toEndOf="parent"
108-
app:layout_constraintTop_toTopOf="parent" />
109-
110-
<ImageView
111-
android:id="@+id/image_view_panel_bookmark"
112-
android:layout_width="15dp"
113-
android:layout_height="15dp"
114-
app:layout_constraintStart_toStartOf="@id/view_panel_bookmark"
115-
app:layout_constraintEnd_toEndOf="@id/view_panel_bookmark"
116-
app:layout_constraintTop_toTopOf="@id/view_panel_bookmark"
117-
app:layout_constraintBottom_toBottomOf="@id/view_panel_bookmark"
118-
app:srcCompat="@drawable/ic_bookmark" />
119-
120-
<TextView
121-
android:id="@+id/text_view_panel_address"
122-
android:layout_width="0dp"
123-
android:layout_height="wrap_content"
124-
android:layout_marginStart="20dp"
125-
android:layout_marginEnd="20dp"
126-
android:maxLines="1"
127-
android:ellipsize="end"
128-
android:text="@{placeSearchViewModel.geoLocation.roadAddress}"
129-
android:textSize="14sp"
130-
android:textColor="#808590"
131-
app:layout_constraintEnd_toEndOf="parent"
132-
app:layout_constraintStart_toStartOf="parent"
133-
app:layout_constraintTop_toBottomOf="@id/text_view_panel_title"
134-
app:layout_constraintBottom_toTopOf="@id/view_panel_start"
135-
tools:text="서울 구로구 디지털로31길 41" />
136-
137-
<TextView
138-
android:id="@+id/text_view_panel_distance"
139-
android:layout_width="wrap_content"
140-
android:layout_height="wrap_content"
141-
android:layout_marginStart="20dp"
142-
android:layout_marginBottom="16dp"
143-
android:text="@{placeSearchViewModel.distance.toString()}"
144-
android:textSize="40sp"
145-
android:textColor="@color/white"
146-
android:textStyle="bold"
147-
app:layout_constraintStart_toStartOf="parent"
148-
app:layout_constraintBottom_toBottomOf="parent"
149-
tools:text="1.6" />
150-
151-
<TextView
152-
android:id="@+id/text_view_panel_distance_km"
153-
android:layout_width="wrap_content"
154-
android:layout_height="wrap_content"
155-
android:layout_marginStart="10dp"
156-
android:layout_marginBottom="22dp"
157-
android:text="@string/km"
158-
android:textSize="20sp"
159-
android:textColor="@color/white"
160-
android:textStyle="bold"
161-
app:layout_constraintStart_toEndOf="@id/text_view_panel_distance"
162-
app:layout_constraintBottom_toBottomOf="parent"
163-
tools:text="km" />
164-
165-
<View
166-
android:id="@+id/view_panel_start"
167-
android:layout_width="50dp"
168-
android:layout_height="50dp"
169-
android:layout_marginEnd="10dp"
170-
android:layout_marginBottom="20dp"
171-
android:background="@drawable/background_button"
172-
app:layout_constraintEnd_toStartOf="@id/view_panel_end"
173-
app:layout_constraintBottom_toBottomOf="parent" />
174-
175-
<ImageView
176-
android:id="@+id/image_view_panel_start"
177-
android:layout_width="25dp"
178-
android:layout_height="25dp"
179-
app:layout_constraintStart_toStartOf="@id/view_panel_start"
180-
app:layout_constraintEnd_toEndOf="@id/view_panel_start"
181-
app:layout_constraintTop_toTopOf="@id/view_panel_start"
182-
app:layout_constraintBottom_toBottomOf="@id/view_panel_start"
183-
app:srcCompat="@drawable/ic_start" />
184-
185-
<View
186-
android:id="@+id/view_panel_end"
187-
android:layout_width="50dp"
188-
android:layout_height="50dp"
189-
android:layout_marginEnd="20dp"
190-
android:layout_marginBottom="20dp"
191-
android:background="@drawable/background_button"
192-
app:layout_constraintEnd_toEndOf="parent"
193-
app:layout_constraintBottom_toBottomOf="parent" />
194-
195-
<ImageView
196-
android:id="@+id/image_view_panel_end"
197-
android:layout_width="25dp"
198-
android:layout_height="25dp"
199-
app:layout_constraintStart_toStartOf="@id/view_panel_end"
200-
app:layout_constraintEnd_toEndOf="@id/view_panel_end"
201-
app:layout_constraintTop_toTopOf="@id/view_panel_end"
202-
app:layout_constraintBottom_toBottomOf="@id/view_panel_end"
203-
app:srcCompat="@drawable/ic_end" />
70+
<include
71+
android:id="@+id/home_panel"
72+
layout="@layout/home_panel"
73+
bind:placeSearchViewModel="@{placeSearchViewModel}" />
20474
</androidx.constraintlayout.widget.ConstraintLayout>
20575

20676
<androidx.constraintlayout.widget.ConstraintLayout
@@ -209,8 +79,8 @@
20979
android:layout_height="52dp"
21080
android:elevation="15dp"
21181
android:background="@drawable/background_search"
212-
app:layout_constraintStart_toStartOf="@+id/guideline_start"
213-
app:layout_constraintEnd_toStartOf="@+id/guideline_end"
82+
app:layout_constraintStart_toStartOf="@id/guideline_start"
83+
app:layout_constraintEnd_toStartOf="@id/guideline_end"
21484
app:layout_constraintTop_toTopOf="@id/guideline_top">
21585

21686
<TextView
@@ -316,9 +186,7 @@
316186
<include
317187
android:id="@+id/home_bottom_sheet"
318188
layout="@layout/home_bottom_sheet"
319-
bind:alarmViewModel="@{alarmViewModel}"
320-
tools:layout_editor_absoluteX="0dp"
321-
tools:layout_editor_absoluteY="16dp" />
189+
bind:alarmViewModel="@{alarmViewModel}" />
322190
</androidx.constraintlayout.widget.ConstraintLayout>
323191
</androidx.coordinatorlayout.widget.CoordinatorLayout>
324192
</androidx.constraintlayout.widget.ConstraintLayout>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<layout xmlns:tools="http://schemas.android.com/tools"
3-
xmlns:android="http://schemas.android.com/apk/res/android"
2+
<layout xmlns:android="http://schemas.android.com/apk/res/android"
43
xmlns:app="http://schemas.android.com/apk/res-auto">
54

65
<data>
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools">
5+
6+
<data>
7+
<variable
8+
name="placeSearchViewModel"
9+
type="com.stop.ui.placesearch.PlaceSearchViewModel" />
10+
</data>
11+
12+
<androidx.constraintlayout.widget.ConstraintLayout
13+
android:layout_width="match_parent"
14+
android:layout_height="match_parent"
15+
android:background="@drawable/background_panel">
16+
17+
<ImageView
18+
android:id="@+id/image_view_panel_point"
19+
android:layout_width="30dp"
20+
android:layout_height="30dp"
21+
android:layout_marginStart="17dp"
22+
android:layout_marginTop="20dp"
23+
app:layout_constraintStart_toStartOf="parent"
24+
app:layout_constraintTop_toTopOf="parent"
25+
app:srcCompat="@drawable/ic_point_marker" />
26+
27+
<TextView
28+
android:id="@+id/text_view_panel_title"
29+
android:layout_width="0dp"
30+
android:layout_height="30dp"
31+
android:layout_marginStart="10dp"
32+
android:layout_marginEnd="10dp"
33+
android:layout_marginTop="19dp"
34+
android:maxLines="1"
35+
android:ellipsize="end"
36+
android:text="@{placeSearchViewModel.geoLocation.title}"
37+
android:textSize="22sp"
38+
android:textColor="@color/white"
39+
android:gravity="center_vertical"
40+
app:layout_constraintStart_toEndOf="@id/image_view_panel_point"
41+
app:layout_constraintEnd_toStartOf="@id/view_panel_bookmark"
42+
app:layout_constraintTop_toTopOf="parent"
43+
tools:text="성복역" />
44+
45+
<View
46+
android:id="@+id/view_panel_bookmark"
47+
android:layout_width="30dp"
48+
android:layout_height="30dp"
49+
android:layout_marginEnd="20dp"
50+
android:layout_marginTop="20dp"
51+
android:background="@drawable/background_button"
52+
app:layout_constraintEnd_toEndOf="parent"
53+
app:layout_constraintTop_toTopOf="parent" />
54+
55+
<ImageView
56+
android:id="@+id/image_view_panel_bookmark"
57+
android:layout_width="15dp"
58+
android:layout_height="15dp"
59+
app:layout_constraintStart_toStartOf="@id/view_panel_bookmark"
60+
app:layout_constraintEnd_toEndOf="@id/view_panel_bookmark"
61+
app:layout_constraintTop_toTopOf="@id/view_panel_bookmark"
62+
app:layout_constraintBottom_toBottomOf="@id/view_panel_bookmark"
63+
app:srcCompat="@drawable/ic_bookmark" />
64+
65+
<TextView
66+
android:id="@+id/text_view_panel_address"
67+
android:layout_width="0dp"
68+
android:layout_height="wrap_content"
69+
android:layout_marginStart="20dp"
70+
android:layout_marginEnd="20dp"
71+
android:maxLines="1"
72+
android:ellipsize="end"
73+
android:text="@{placeSearchViewModel.geoLocation.roadAddress}"
74+
android:textSize="14sp"
75+
android:textColor="#808590"
76+
app:layout_constraintEnd_toEndOf="parent"
77+
app:layout_constraintStart_toStartOf="parent"
78+
app:layout_constraintTop_toBottomOf="@id/text_view_panel_title"
79+
app:layout_constraintBottom_toTopOf="@id/view_panel_start"
80+
tools:text="서울 구로구 디지털로31길 41" />
81+
82+
<TextView
83+
android:id="@+id/text_view_panel_distance"
84+
android:layout_width="wrap_content"
85+
android:layout_height="wrap_content"
86+
android:layout_marginStart="20dp"
87+
android:layout_marginBottom="16dp"
88+
android:text="@{placeSearchViewModel.distance.toString()}"
89+
android:textSize="40sp"
90+
android:textColor="@color/white"
91+
android:textStyle="bold"
92+
app:layout_constraintStart_toStartOf="parent"
93+
app:layout_constraintBottom_toBottomOf="parent"
94+
tools:text="1.6" />
95+
96+
<TextView
97+
android:id="@+id/text_view_panel_distance_km"
98+
android:layout_width="wrap_content"
99+
android:layout_height="wrap_content"
100+
android:layout_marginStart="10dp"
101+
android:layout_marginBottom="22dp"
102+
android:text="@string/km"
103+
android:textSize="20sp"
104+
android:textColor="@color/white"
105+
android:textStyle="bold"
106+
app:layout_constraintStart_toEndOf="@id/text_view_panel_distance"
107+
app:layout_constraintBottom_toBottomOf="parent"
108+
tools:text="km" />
109+
110+
<View
111+
android:id="@+id/view_panel_start"
112+
android:layout_width="50dp"
113+
android:layout_height="50dp"
114+
android:layout_marginEnd="10dp"
115+
android:layout_marginBottom="20dp"
116+
android:background="@drawable/background_button"
117+
app:layout_constraintEnd_toStartOf="@id/view_panel_end"
118+
app:layout_constraintBottom_toBottomOf="parent" />
119+
120+
<ImageView
121+
android:id="@+id/image_view_panel_start"
122+
android:layout_width="25dp"
123+
android:layout_height="25dp"
124+
app:layout_constraintStart_toStartOf="@id/view_panel_start"
125+
app:layout_constraintEnd_toEndOf="@id/view_panel_start"
126+
app:layout_constraintTop_toTopOf="@id/view_panel_start"
127+
app:layout_constraintBottom_toBottomOf="@id/view_panel_start"
128+
app:srcCompat="@drawable/ic_start" />
129+
130+
<View
131+
android:id="@+id/view_panel_end"
132+
android:layout_width="50dp"
133+
android:layout_height="50dp"
134+
android:layout_marginEnd="20dp"
135+
android:layout_marginBottom="20dp"
136+
android:background="@drawable/background_button"
137+
app:layout_constraintEnd_toEndOf="parent"
138+
app:layout_constraintBottom_toBottomOf="parent" />
139+
140+
<ImageView
141+
android:id="@+id/image_view_panel_end"
142+
android:layout_width="25dp"
143+
android:layout_height="25dp"
144+
app:layout_constraintStart_toStartOf="@id/view_panel_end"
145+
app:layout_constraintEnd_toEndOf="@id/view_panel_end"
146+
app:layout_constraintTop_toTopOf="@id/view_panel_end"
147+
app:layout_constraintBottom_toBottomOf="@id/view_panel_end"
148+
app:srcCompat="@drawable/ic_end" />
149+
</androidx.constraintlayout.widget.ConstraintLayout>
150+
</layout>

0 commit comments

Comments
 (0)