Skip to content

Commit

Permalink
#6 feat/메인화면 : 메인화면의 BottomNavigation 아이템이 선택될 때 노출될 Fragment 추가
Browse files Browse the repository at this point in the history
- HomeFragment : 홈
- MapFragment : 지도
- FavoriteFragment : 찜하기
- MyPageFragment : MY
  • Loading branch information
HayleyKim0716 committed Aug 1, 2022
1 parent ba1d9b1 commit bb7c698
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.ftw.hometerview.ui.main.favorite

import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ftw.hometerview.R

class FavoriteFragment : Fragment() {

companion object {
fun newInstance() = FavoriteFragment()
}

private lateinit var viewModel: FavoriteViewModel

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_favorite, container, false)
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(this).get(FavoriteViewModel::class.java)
// TODO: Use the ViewModel
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ftw.hometerview.ui.main.favorite

import androidx.lifecycle.ViewModel

class FavoriteViewModel : ViewModel() {
// TODO: Implement the ViewModel
}
32 changes: 32 additions & 0 deletions app/src/main/java/com/ftw/hometerview/ui/main/home/HomeFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.ftw.hometerview.ui.main.home

import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ftw.hometerview.R

class HomeFragment : Fragment() {

companion object {
fun newInstance() = HomeFragment()
}

private lateinit var viewModel: HomeViewModel

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_home, container, false)
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(this).get(HomeViewModel::class.java)
// TODO: Use the ViewModel
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ftw.hometerview.ui.main.home

import androidx.lifecycle.ViewModel

class HomeViewModel : ViewModel() {
// TODO: Implement the ViewModel
}
32 changes: 32 additions & 0 deletions app/src/main/java/com/ftw/hometerview/ui/main/map/MapFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.ftw.hometerview.ui.main.map

import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ftw.hometerview.R

class MapFragment : Fragment() {

companion object {
fun newInstance() = MapFragment()
}

private lateinit var viewModel: MapViewModel

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_map, container, false)
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(this).get(MapViewModel::class.java)
// TODO: Use the ViewModel
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ftw.hometerview.ui.main.map

import androidx.lifecycle.ViewModel

class MapViewModel : ViewModel() {
// TODO: Implement the ViewModel
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.ftw.hometerview.ui.main.mypage

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.ftw.hometerview.R

class MyPageFragment : Fragment() {

companion object {
fun newInstance() = MyPageFragment()
}

private lateinit var viewModel: MyPageViewModel

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_my_page, container, false)
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(this).get(MyPageViewModel::class.java)
// TODO: Use the ViewModel
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ftw.hometerview.ui.main.mypage

import androidx.lifecycle.ViewModel

class MyPageViewModel : ViewModel() {
// TODO: Implement the ViewModel
}
15 changes: 15 additions & 0 deletions app/src/main/res/layout/fragment_favorite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.favorite.FavoriteFragment"
>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="FavoriteFragment"
/>

</FrameLayout>
15 changes: 15 additions & 0 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.home.HomeFragment"
>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="HomeFragment"
/>

</FrameLayout>
15 changes: 15 additions & 0 deletions app/src/main/res/layout/fragment_map.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.map.MapFragment"
>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="MapFragment"
/>

</FrameLayout>
15 changes: 15 additions & 0 deletions app/src/main/res/layout/fragment_my_page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.mypage.MyPageFragment"
>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="MyPageFragment"
/>

</FrameLayout>

0 comments on commit bb7c698

Please sign in to comment.