From bf2347d02070735d5a6b398af2b18e2a2111f6dc Mon Sep 17 00:00:00 2001 From: ki960213 Date: Wed, 13 Dec 2023 22:11:41 +0900 Subject: [PATCH] =?UTF-8?q?feat(EventInfoFragment):=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=20=EC=95=B1=EC=97=90=20=EC=9E=A5=EC=86=8C=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/eventDetailInfo/EventInfoFragment.kt | 31 ++++++++++++++++- .../res/drawable/ic_eventinformation_map.xml | 5 +++ .../res/layout/fragment_event_information.xml | 34 ++++++++++++++++--- .../app/src/main/res/values/strings.xml | 3 ++ 4 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 android/2023-emmsale/app/src/main/res/drawable/ic_eventinformation_map.xml diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetailInfo/EventInfoFragment.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetailInfo/EventInfoFragment.kt index f90c104c4..de2973e7c 100644 --- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetailInfo/EventInfoFragment.kt +++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetailInfo/EventInfoFragment.kt @@ -1,6 +1,9 @@ package com.emmsale.presentation.ui.eventDetailInfo +import android.content.ActivityNotFoundException import android.content.Context +import android.content.Intent +import android.net.Uri import android.os.Bundle import android.view.View import androidx.fragment.app.activityViewModels @@ -9,6 +12,7 @@ import com.emmsale.databinding.FragmentEventInformationBinding import com.emmsale.presentation.base.BaseFragment import com.emmsale.presentation.common.firebase.analytics.FirebaseAnalyticsDelegate import com.emmsale.presentation.common.firebase.analytics.FirebaseAnalyticsDelegateImpl +import com.emmsale.presentation.common.views.InfoDialog import com.emmsale.presentation.ui.eventDetail.EventDetailViewModel import com.emmsale.presentation.ui.eventDetailInfo.recyclerView.EventInfoImageAdapter import dagger.hilt.android.AndroidEntryPoint @@ -27,10 +31,35 @@ class EventInfoFragment : override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - binding.vm = viewModel + + setupDataBinding() setUpInformationUrls() } + private fun setupDataBinding() { + binding.vm = viewModel + binding.onMapSearchButtonClick = ::navigateToMapApp + } + + private fun navigateToMapApp(location: String) { + val uri = Uri.parse("geo:0,0?q=$location") + val intent = Intent(Intent.ACTION_VIEW, uri) + + runCatching { startActivity(intent) } + .onFailure { + if (it is ActivityNotFoundException) showNotFoundMapAppDialog() + } + } + + private fun showNotFoundMapAppDialog() { + InfoDialog( + context = requireContext(), + title = getString(R.string.eventInfo_not_found_map_app_dialog_title), + message = getString(R.string.eventInfo_not_found_map_app_dialog_message), + buttonLabel = getString(R.string.all_okay), + ).show() + } + private fun setUpInformationUrls() { viewModel.event.observe(viewLifecycleOwner) { event -> binding.rvEventInfoImages.setHasFixedSize(true) diff --git a/android/2023-emmsale/app/src/main/res/drawable/ic_eventinformation_map.xml b/android/2023-emmsale/app/src/main/res/drawable/ic_eventinformation_map.xml new file mode 100644 index 000000000..34bc17b88 --- /dev/null +++ b/android/2023-emmsale/app/src/main/res/drawable/ic_eventinformation_map.xml @@ -0,0 +1,5 @@ + + + diff --git a/android/2023-emmsale/app/src/main/res/layout/fragment_event_information.xml b/android/2023-emmsale/app/src/main/res/layout/fragment_event_information.xml index e547c3436..cbabbc9fc 100644 --- a/android/2023-emmsale/app/src/main/res/layout/fragment_event_information.xml +++ b/android/2023-emmsale/app/src/main/res/layout/fragment_event_information.xml @@ -7,11 +7,19 @@ + + + + + + + tools:text="삼성동 코엑스 몰 2층 101" + app:layout_constraintHorizontal_chainStyle="packed" /> + + 비용 장소 일시 + 지도 앱에 행사 장소 검색하는 버튼 + 지도 앱 없음 + 검색할 수 있는 지도 앱이 없습니다. 글을 불러올 수 없습니다. 관리자에게 문의하세요. 모집글은 한 번만 작성이 가능합니다!!