Skip to content

Commit

Permalink
feat: 메뉴 탭에 병원 지도 화면 추가(#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
dongx0915 committed Sep 18, 2023
1 parent d5aa8d2 commit f244519
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!!
Expand Down Expand Up @@ -252,7 +253,9 @@ class HospitalMapFragment : Fragment(), OnMapReadyCallback {
// 지도에 추가하는 부분은 별도로 해야할 수도
this.tag = tag

map = naverMap
if(::naverMap.isInitialized){
map = naverMap
}
onClickListener = markerClickListener
}.also(markerList::add)
}
Expand All @@ -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() {
Expand Down Expand Up @@ -324,6 +323,9 @@ class HospitalMapFragment : Fragment(), OnMapReadyCallback {
}
}

override fun onShowFragment() = Unit
override fun onHideFragment() = Unit

/**
* 마커 클릭 이벤트 리스너
*/
Expand Down Expand Up @@ -358,6 +360,4 @@ class HospitalMapFragment : Fragment(), OnMapReadyCallback {
}
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Int, Fragment?>? = 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?) {
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit f244519

Please sign in to comment.