Skip to content

Commit

Permalink
[Add] #4 Community 카테고리 별 Fragment 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seohyeon121 committed Jul 11, 2024
1 parent be63497 commit 8cdcf37
Show file tree
Hide file tree
Showing 21 changed files with 317 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.energy.presentation.view.community

import com.example.energy.databinding.FragmentCommunityCuriousBinding
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.energy.R
import com.example.energy.presentation.view.base.BaseFragment

class CommunityCuriousFragment : BaseFragment<FragmentCommunityCuriousBinding>({ FragmentCommunityCuriousBinding.inflate(it)}) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.energy.presentation.view.community

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.energy.R
import com.example.energy.databinding.FragmentCommunityDailyBinding
import com.example.energy.presentation.view.base.BaseFragment

class CommunityDailyFragment : BaseFragment<FragmentCommunityDailyBinding>({ FragmentCommunityDailyBinding.inflate(it)}) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ import android.view.ViewGroup
import com.example.energy.R
import com.example.energy.databinding.FragmentCommunityBinding
import com.example.energy.presentation.view.base.BaseFragment
import com.google.android.material.tabs.TabLayoutMediator

class CommunityFragment : BaseFragment<FragmentCommunityBinding>({ FragmentCommunityBinding.inflate(it)}) {

private val information = arrayListOf("전체보기", "일상", "궁금해요", "도와줘요", "휠체어", "스쿠터")

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

// community viewpager adapter 연결 및 초기화
val communityAdapter = CommunityVPAdapter(this)
binding.communityViewpage.adapter = communityAdapter
TabLayoutMediator(binding.communityCategoryTabLayout, binding.communityViewpage){ // tab item과 viewpage fragment 연결
tab, position ->
tab.text = information[position]
}.attach()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.energy.presentation.view.community

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.energy.R
import com.example.energy.databinding.FragmentCommunityHelpBinding
import com.example.energy.presentation.view.base.BaseFragment

class CommunityHelpFragment : BaseFragment<FragmentCommunityHelpBinding>({ FragmentCommunityHelpBinding.inflate(it)}) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.energy.presentation.view.community

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.energy.R
import com.example.energy.databinding.FragmentCommunityScooterBinding
import com.example.energy.presentation.view.base.BaseFragment

class CommunityScooterFragment : BaseFragment<FragmentCommunityScooterBinding>({ FragmentCommunityScooterBinding.inflate(it)}) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example.energy.presentation.view.community

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter

class CommunityVPAdapter(fragment: Fragment) : FragmentStateAdapter(fragment){
override fun getItemCount(): Int = 6

override fun createFragment(position: Int): Fragment {
return when(position){
0 -> CommunityWholeFragment() // 전체보기
1 -> CommunityDailyFragment() // 일상
2 -> CommunityCuriousFragment() // 궁금해요
3 -> CommunityHelpFragment() // 도와줘요
4 -> CommunityWheelchairFragment() // 휠체어
else -> CommunityScooterFragment() // 스쿠터
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.energy.presentation.view.community

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.energy.R
import com.example.energy.databinding.FragmentCommunityWheelchairBinding
import com.example.energy.presentation.view.base.BaseFragment

class CommunityWheelchairFragment : BaseFragment<FragmentCommunityWheelchairBinding>({ FragmentCommunityWheelchairBinding.inflate(it)}) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.energy.presentation.view.community

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.energy.R
import com.example.energy.databinding.FragmentCommunityWholeBinding
import com.example.energy.presentation.view.base.BaseFragment

class CommunityWholeFragment : BaseFragment<FragmentCommunityWholeBinding>({ FragmentCommunityWholeBinding.inflate(it)}) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/community_sos_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 79 additions & 5 deletions app/src/main/res/layout/fragment_community.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,84 @@
android:layout_height="match_parent"
tools:context=".presentation.view.community.CommunityFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="community" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<ImageView
android:id="@+id/community_search_iv"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/community_search_icon"
android:layout_marginTop="30dp"
android:layout_marginEnd="15dp"
app:layout_constraintEnd_toStartOf="@id/community_notify_iv"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/community_notify_iv"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/community_notify_icon"
android:layout_marginTop="30dp"
android:layout_marginEnd="15dp"
app:layout_constraintEnd_toStartOf="@id/community_sos_iv"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/community_sos_iv"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/community_sos_icon"
android:layout_marginTop="30dp"
android:layout_marginEnd="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<com.google.android.material.tabs.TabLayout
android:id="@+id/community_category_tab_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center"
app:tabMaxWidth="0dp"
app:tabGravity="start"
app:tabMode="scrollable"
app:tabIndicatorFullWidth="false"
app:tabRippleColor="@android:color/transparent"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/community_search_iv"
app:layout_constraintBottom_toTopOf="@id/community_viewpage"
app:tabIndicatorColor="@color/black"
app:tabIndicatorGravity="bottom"
app:tabSelectedTextColor="@color/white"/>

<com.google.android.material.tabs.TabLayout
android:id="@+id/community_tab_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center"
app:tabMaxWidth="0dp"
app:tabGravity="start"
app:tabMode="scrollable"
app:tabIndicatorFullWidth="false"
app:tabRippleColor="@android:color/transparent"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/community_search_iv"
app:layout_constraintBottom_toTopOf="@id/community_viewpage"
app:tabIndicatorColor="@color/black"
app:tabIndicatorGravity="bottom"
app:tabSelectedTextColor="@color/white"/>

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/community_viewpage"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/community_tab_layout"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

</FrameLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_community_curious.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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=".presentation.view.list.ListFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="궁금해요" />

</FrameLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_community_daily.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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=".presentation.view.list.ListFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="일상" />

</FrameLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_community_help.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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=".presentation.view.list.ListFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="도와줘요" />

</FrameLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_community_scooter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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=".presentation.view.list.ListFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="스쿠터" />

</FrameLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_community_wheelchair.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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=".presentation.view.list.ListFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="휠체어" />

</FrameLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_community_whole.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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=".presentation.view.list.ListFragment">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="전체보기" />

</FrameLayout>

0 comments on commit 8cdcf37

Please sign in to comment.