diff --git a/app/src/main/java/campus/tech/kakao/map/view/kakaomap/KakaoMapActivity.kt b/app/src/main/java/campus/tech/kakao/map/view/kakaomap/KakaoMapActivity.kt index e31fb873..a9513359 100644 --- a/app/src/main/java/campus/tech/kakao/map/view/kakaomap/KakaoMapActivity.kt +++ b/app/src/main/java/campus/tech/kakao/map/view/kakaomap/KakaoMapActivity.kt @@ -8,6 +8,7 @@ import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity +import androidx.databinding.DataBindingUtil import campus.tech.kakao.map.BuildConfig import campus.tech.kakao.map.R import campus.tech.kakao.map.databinding.ActivityKakaoMapBinding @@ -40,8 +41,7 @@ class KakaoMapActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = ActivityKakaoMapBinding.inflate(layoutInflater) - setContentView(binding.root) + binding = DataBindingUtil.setContentView(this, R.layout.activity_kakao_map) setUpKakaoMap() getSearchResult() @@ -77,7 +77,7 @@ class KakaoMapActivity : AppCompatActivity() { } override fun onMapError(error: Exception?) { - binding.kakaomapErrDescription.text = error?.message.toString() + binding.errMsg = error?.message.toString() showView(binding.kakaomapErr, true) } }, object : KakaoMapReadyCallback() { @@ -146,8 +146,7 @@ class KakaoMapActivity : AppCompatActivity() { fun displayPlaceInfoBottomSheet(place: Place) { val bottomSheet = binding.placeInfoBottomSheet - bottomSheet.placeName.text = place.place_name - bottomSheet.addressName.text = place.address_name + bottomSheet.place = place val bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet.root) bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED diff --git a/app/src/main/java/campus/tech/kakao/map/view/search/SavedSearchKeywordsAdapter.kt b/app/src/main/java/campus/tech/kakao/map/view/search/SavedSearchKeywordsAdapter.kt index c274eb93..b22c1fd1 100644 --- a/app/src/main/java/campus/tech/kakao/map/view/search/SavedSearchKeywordsAdapter.kt +++ b/app/src/main/java/campus/tech/kakao/map/view/search/SavedSearchKeywordsAdapter.kt @@ -2,7 +2,9 @@ package campus.tech.kakao.map.view.search import android.view.LayoutInflater import android.view.ViewGroup +import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView +import campus.tech.kakao.map.R import campus.tech.kakao.map.databinding.SavedSearchKeywordItemBinding import campus.tech.kakao.map.model.search.SearchKeyword @@ -16,19 +18,24 @@ class SavedSearchKeywordsAdapter( inner class ViewHolder(private val binding: SavedSearchKeywordItemBinding) : RecyclerView.ViewHolder(binding.root) { fun bind(item: SearchKeyword) { - binding.SavedSearchKeyword.text = item.searchKeyword + binding.searchKeyword = item binding.SavedSearchKeyword.setOnClickListener { - itemClickListener?.onClickSavedSearchKeyword(item) + itemClickListener.onClickSavedSearchKeyword(item) } binding.delSavedSearchKeyword.setOnClickListener { - itemClickListener?.onClickDelSavedSearchKeyword(item) + itemClickListener.onClickDelSavedSearchKeyword(item) } } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val view = SavedSearchKeywordItemBinding.inflate(layoutInflater, parent, false) + val view: SavedSearchKeywordItemBinding = DataBindingUtil.inflate( + layoutInflater, + R.layout.saved_search_keyword_item, + parent, + false + ) return ViewHolder(view) } diff --git a/app/src/main/java/campus/tech/kakao/map/view/search/SearchResultsAdapter.kt b/app/src/main/java/campus/tech/kakao/map/view/search/SearchResultsAdapter.kt index 542fcd30..849d0b3b 100644 --- a/app/src/main/java/campus/tech/kakao/map/view/search/SearchResultsAdapter.kt +++ b/app/src/main/java/campus/tech/kakao/map/view/search/SearchResultsAdapter.kt @@ -2,7 +2,9 @@ package campus.tech.kakao.map.view.search import android.view.LayoutInflater import android.view.ViewGroup +import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView +import campus.tech.kakao.map.R import campus.tech.kakao.map.databinding.SearchResultItemBinding import campus.tech.kakao.map.model.search.Place @@ -16,18 +18,21 @@ class SearchResultsAdapter( inner class ViewHolder(private val binding: SearchResultItemBinding) : RecyclerView.ViewHolder(binding.root) { fun bind(item: Place) { - binding.placeName.text = item.place_name - binding.addressName.text = item.address_name - binding.categoryName.text = item.category_name - + binding.place = item binding.root.setOnClickListener { - itemClickListener?.onClick(item) + itemClickListener.onClick(item) } } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val view = SearchResultItemBinding.inflate(layoutInflater, parent, false) + val view: SearchResultItemBinding = + DataBindingUtil.inflate( + layoutInflater, + R.layout.search_result_item, + parent, + false + ) return ViewHolder(view) } diff --git a/app/src/main/java/campus/tech/kakao/map/view/search/SearchWindowActivity.kt b/app/src/main/java/campus/tech/kakao/map/view/search/SearchWindowActivity.kt index bd31ac88..33b9e984 100644 --- a/app/src/main/java/campus/tech/kakao/map/view/search/SearchWindowActivity.kt +++ b/app/src/main/java/campus/tech/kakao/map/view/search/SearchWindowActivity.kt @@ -5,12 +5,16 @@ import android.os.Bundle import android.text.Editable import android.text.TextWatcher import android.view.View +import android.widget.EditText import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity +import androidx.databinding.BindingAdapter +import androidx.databinding.DataBindingUtil import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle import androidx.recyclerview.widget.LinearLayoutManager +import campus.tech.kakao.map.R import campus.tech.kakao.map.model.search.SearchKeyword import campus.tech.kakao.map.databinding.ActivitySearchWindowBinding import campus.tech.kakao.map.model.search.Place @@ -26,8 +30,7 @@ class SearchWindowActivity : AppCompatActivity() { private val viewModel: SearchViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = ActivitySearchWindowBinding.inflate(layoutInflater) - setContentView(binding.root) + binding = DataBindingUtil.setContentView(this, R.layout.activity_search_window) delSearchKeywordListener() detectSearchWindowChangedListener() @@ -37,7 +40,7 @@ class SearchWindowActivity : AppCompatActivity() { private fun delSearchKeywordListener() { binding.delSearchKeyword.setOnClickListener { - binding.searchWindow.text = null + binding.searchKeyword = SearchKeyword("") } } @@ -101,7 +104,7 @@ class SearchWindowActivity : AppCompatActivity() { adapter.setItemClickListener(object : SavedSearchKeywordsAdapter.OnItemClickListener { override fun onClickSavedSearchKeyword(item: SearchKeyword) { - binding.searchWindow.setText(item.searchKeyword) + binding.searchKeyword = item } override fun onClickDelSavedSearchKeyword(item: SearchKeyword) { diff --git a/app/src/main/res/layout/activity_kakao_map.xml b/app/src/main/res/layout/activity_kakao_map.xml index dc0dc436..120da5be 100644 --- a/app/src/main/res/layout/activity_kakao_map.xml +++ b/app/src/main/res/layout/activity_kakao_map.xml @@ -1,95 +1,107 @@ - - - + xmlns:tools="http://schemas.android.com/tools"> + + + + + - - + + + + - - + app:layout_constraintTop_toTopOf="parent"> - + - + - + - - - - - + app:layout_constraintBottom_toBottomOf="parent"> + + + + - + android:layout_height="match_parent" + android:background="@color/white" + android:elevation="10dp" + android:gravity="center" + android:orientation="vertical" + android:padding="30dp" + android:visibility="gone"> + + + + - + - + + + - + diff --git a/app/src/main/res/layout/activity_place_info_bottom_sheet.xml b/app/src/main/res/layout/activity_place_info_bottom_sheet.xml index 56971018..32c44976 100644 --- a/app/src/main/res/layout/activity_place_info_bottom_sheet.xml +++ b/app/src/main/res/layout/activity_place_info_bottom_sheet.xml @@ -1,29 +1,41 @@ - + - + + + + - + android:layout_height="wrap_content" + android:background="@color/white" + android:padding="20dp" + app:behavior_hideable="true" + app:behavior_peekHeight="0dp" + app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_search_window.xml b/app/src/main/res/layout/activity_search_window.xml index 8b84742d..846c323e 100644 --- a/app/src/main/res/layout/activity_search_window.xml +++ b/app/src/main/res/layout/activity_search_window.xml @@ -1,67 +1,75 @@ - + xmlns:tools="http://schemas.android.com/tools"> - - - - - + + + + android:layout_height="match_parent" + android:padding="10dp" + tools:context=".view.search.SearchWindowActivity"> - + + + android:text="X" + app:layout_constraintBottom_toTopOf="@id/savedSearchKeywordsList" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:scrollbars="horizontal" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + app:layout_constraintBottom_toTopOf="@id/searchResults" + app:layout_constraintTop_toBottomOf="@id/searchWindow" /> - + + + - + + + + + + diff --git a/app/src/main/res/layout/saved_search_keyword_item.xml b/app/src/main/res/layout/saved_search_keyword_item.xml index cf52ac47..e7fc1d8c 100644 --- a/app/src/main/res/layout/saved_search_keyword_item.xml +++ b/app/src/main/res/layout/saved_search_keyword_item.xml @@ -1,23 +1,33 @@ - + > - + + + - + android:layout_height="50dp"> - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/search_result_item.xml b/app/src/main/res/layout/search_result_item.xml index 2f0a0fde..2019eb1b 100644 --- a/app/src/main/res/layout/search_result_item.xml +++ b/app/src/main/res/layout/search_result_item.xml @@ -1,57 +1,70 @@ - - - + + + + + + - - + + - - + + + app:layout_constraintWidth_default="spread"> - + - + + + - \ No newline at end of file + + + + \ No newline at end of file