From f244519c698bc45b0aae569e3e2a096c8ba8ad52 Mon Sep 17 00:00:00 2001 From: Donghyeon-Kim Date: Tue, 19 Sep 2023 01:24:38 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A9=94=EB=89=B4=20=ED=83=AD=EC=97=90?= =?UTF-8?q?=20=EB=B3=91=EC=9B=90=20=EC=A7=80=EB=8F=84=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80(#193)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../smiley/hospital/HospitalMapFragment.kt | 16 ++++++++-------- .../java/com/example/smiley/main/MainActivity.kt | 9 ++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/presentation/src/main/java/com/example/smiley/hospital/HospitalMapFragment.kt b/presentation/src/main/java/com/example/smiley/hospital/HospitalMapFragment.kt index 7190f55..e3a72d3 100644 --- a/presentation/src/main/java/com/example/smiley/hospital/HospitalMapFragment.kt +++ b/presentation/src/main/java/com/example/smiley/hospital/HospitalMapFragment.kt @@ -20,6 +20,7 @@ import com.example.smiley.common.extension.setCustomColorStatusBarAndNavigationB import com.example.smiley.common.extension.showConfirmDialog import com.example.smiley.common.extension.showToast import com.example.smiley.common.extension.visibleWithAnimation +import com.example.smiley.common.listener.FragmentVisibilityListener import com.example.smiley.common.listener.TransparentTouchListener import com.example.smiley.databinding.FragmentHospitalMapBinding import com.example.smiley.hospital.viewmodel.HospitalMapFragmentState @@ -47,7 +48,7 @@ private const val ARG_PARAM2 = "param2" * create an instance of this fragment. */ @AndroidEntryPoint -class HospitalMapFragment : Fragment(), OnMapReadyCallback { +class HospitalMapFragment : Fragment(), FragmentVisibilityListener, OnMapReadyCallback { private var _bind:FragmentHospitalMapBinding? = null private val bind get() = _bind!! @@ -252,7 +253,9 @@ class HospitalMapFragment : Fragment(), OnMapReadyCallback { // 지도에 추가하는 부분은 별도로 해야할 수도 this.tag = tag - map = naverMap + if(::naverMap.isInitialized){ + map = naverMap + } onClickListener = markerClickListener }.also(markerList::add) } @@ -265,15 +268,11 @@ class HospitalMapFragment : Fragment(), OnMapReadyCallback { override fun onResume() { super.onResume() mapView.onResume() - - this.setCustomColorStatusBarAndNavigationBar(R.color.transparent, R.color.white, true) } override fun onPause() { super.onPause() mapView.onPause() - - this.resetStatusBarAndNavigationBar() } override fun onStop() { @@ -324,6 +323,9 @@ class HospitalMapFragment : Fragment(), OnMapReadyCallback { } } + override fun onShowFragment() = Unit + override fun onHideFragment() = Unit + /** * 마커 클릭 이벤트 리스너 */ @@ -358,6 +360,4 @@ class HospitalMapFragment : Fragment(), OnMapReadyCallback { } } } - - } \ No newline at end of file diff --git a/presentation/src/main/java/com/example/smiley/main/MainActivity.kt b/presentation/src/main/java/com/example/smiley/main/MainActivity.kt index 1bab9a2..bf1baac 100644 --- a/presentation/src/main/java/com/example/smiley/main/MainActivity.kt +++ b/presentation/src/main/java/com/example/smiley/main/MainActivity.kt @@ -8,6 +8,7 @@ import com.example.smiley.R import com.example.smiley.common.extension.setCustomColorStatusBarAndNavigationBar import com.example.smiley.common.listener.FragmentVisibilityListener import com.example.smiley.databinding.ActivityMainBinding +import com.example.smiley.hospital.HospitalMapFragment import com.example.smiley.main.home.HomeFragment import com.example.smiley.main.profile.ProfileFragment import com.example.smiley.main.reserv.ReservFragment @@ -24,12 +25,14 @@ class MainActivity : AppCompatActivity() { private var profileFragment: ProfileFragment? = null private var reservFragment: ReservFragment? = null private var statsFragment: StatsFragment? = null + private var hospitalMapFragment: HospitalMapFragment? = null private var fragmentMap: HashMap? = hashMapOf( R.id.menu_home to homeFragment, R.id.menu_reserv to reservFragment, - R.id.menu_profile to profileFragment, + R.id.menu_map to hospitalMapFragment, R.id.menu_stats to statsFragment, + R.id.menu_profile to profileFragment, ) override fun onCreate(savedInstanceState: Bundle?) { @@ -47,7 +50,7 @@ class MainActivity : AppCompatActivity() { when (it.itemId) { R.id.menu_home -> changeFragment(R.id.menu_home) R.id.menu_reserv -> changeFragment(R.id.menu_reserv) - R.id.menu_inspect -> changeFragment(R.id.menu_inspect) + R.id.menu_map -> changeFragment(R.id.menu_map) R.id.menu_stats -> changeFragment(R.id.menu_stats) R.id.menu_profile -> changeFragment(R.id.menu_profile) else -> changeFragment(R.id.menu_home) @@ -78,7 +81,7 @@ class MainActivity : AppCompatActivity() { return when (fragmentId) { R.id.menu_home -> HomeFragment() R.id.menu_reserv -> ReservFragment() - R.id.menu_inspect -> HomeFragment() + R.id.menu_map -> HospitalMapFragment.newInstance() R.id.menu_stats -> StatsFragment() R.id.menu_profile -> ProfileFragment() else -> HomeFragment()