Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #3

Merged
merged 24 commits into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bb1953a
[ADD/#23] 회고 상세조회 activity 생성
gaeun5744 Jul 14, 2023
5879f3a
[MOVE/#11] myPage 패키지 home에서 present 패키지 아래로 이동
gaeun5744 Jul 14, 2023
1ce4939
[RENAME/#11] adapter class 이름 변경
gaeun5744 Jul 14, 2023
5aac9cd
[FIX/#11] 코드리뷰 반영
gaeun5744 Jul 14, 2023
9cdbb64
[RENAME/#11] viewHolder 이름 변경
gaeun5744 Jul 14, 2023
87ebb5b
[Delete/#23] 중복 string 제거
gaeun5744 Jul 15, 2023
29b6093
[ADD/#23] 상세 회고 activity 생성
gaeun5744 Jul 15, 2023
149e455
[ADD/#23] tablayout drawable 생성
gaeun5744 Jul 15, 2023
f868811
[FEAT/#23] taplayout - fragment 연결
gaeun5744 Jul 15, 2023
c2e8e59
[UI/#23] 선택된 cell 파란 oval background 적용
gaeun5744 Jul 15, 2023
7b83eea
[UI/#23] drawable 사이즈 수정
gaeun5744 Jul 15, 2023
0343e5a
[ADD/#23] tap layout theme 추가
gaeun5744 Jul 15, 2023
fb6e61c
[CHORE/#23] ktlint 적용
gaeun5744 Jul 15, 2023
8bb2494
[REFACTOR/#23] week taplayout -> linearLayout으로 수정
gaeun5744 Jul 15, 2023
f53da67
[UI/#23] marginHorizontal 16dp 추가
gaeun5744 Jul 15, 2023
526017a
[MOVE/#23] tabTheme 이동
gaeun5744 Jul 15, 2023
717df11
[RENAME/#23] 컨벤션에 맞게 xml file name 수정
gaeun5744 Jul 15, 2023
5c7461b
[ADD/#23] 회고 작성 유무 표시 drawable 추가
gaeun5744 Jul 15, 2023
a71b973
[ADD/#23] 선택시 text color 변경
gaeun5744 Jul 15, 2023
10c187d
[UI/#23] default padding 제거
gaeun5744 Jul 15, 2023
a5c8747
[ADD/#23] drawable selector 및 textView 추가
gaeun5744 Jul 15, 2023
1f7ac8e
[ADD/#23] 상세 회고 조회 Dto 추가
gaeun5744 Jul 15, 2023
d41e018
[FEAT/#23] 회고 주기 및 회고 작성 유무에 따른 color 분기처리 구현
gaeun5744 Jul 15, 2023
273114d
[FEAT/#23] invitationCode viewModelFactory 적용
gaeun5744 Jul 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.puzzling.puzzlingaos.data.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class ResponseDetailRetroDto(
@SerialName("reviewId")
val reviewId: Int?,
@SerialName("reviewDay")
val reviewDay: String,
@SerialName("reviewDate")
val reviewDate: String,
@SerialName("contents")
val contents: List<Content>?,
) {
@Serializable
data class Content(
@SerialName("title")
val title: String,
@SerialName("content")
val content: String,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package com.puzzling.puzzlingaos.presentation.detailRetrospect

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseActivity
import com.puzzling.puzzlingaos.data.model.response.ResponseDetailRetroDto
import com.puzzling.puzzlingaos.databinding.ActivityDetailRetroBinding
import java.time.DayOfWeek
import java.time.LocalDate
import java.time.format.DateTimeFormatter

class DetailRetroActivity :
BaseActivity<ActivityDetailRetroBinding>(R.layout.activity_detail_retro) {

private val tabTitle = getWeekDatesWithToday()

val week = listOf(
"월",
"화",
"수",
"목",
"금",
"토",
"일",
)

var num = mutableListOf(0, 0, 0, 0, 0, 0, 0)

companion object {
const val BLACK_TEXT = 1
const val BG_BLUE_100 = 2
}

private val dummyList = mutableListOf<ResponseDetailRetroDto>(
ResponseDetailRetroDto(null, "월", "2023-07-10", null),
ResponseDetailRetroDto(
4,
"화",
"2023-07-11",
listOf(
ResponseDetailRetroDto.Content("잘한점...", "잘한점 어쩌구...."),
ResponseDetailRetroDto.Content("아쉬운점...", "아쉬운점 어쩌구...."),
ResponseDetailRetroDto.Content("배운점...", "배운점 어쩌구...."),
),
),
ResponseDetailRetroDto(
9,
"목",
"2023-07-13",
listOf(
ResponseDetailRetroDto.Content("잘한점...", "잘한점 어쩌구...."),
ResponseDetailRetroDto.Content("아쉬운점...", "아쉬운점 어쩌구...."),
ResponseDetailRetroDto.Content("배운점...", "배운점 어쩌구...."),
),
),
ResponseDetailRetroDto(null, "금", "2023-07-10", null),
)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding.viewPager.adapter = WeekTapAdapter(this)
TabLayoutMediator(binding.tlDetailRetroDate, binding.viewPager) { tab, position ->
tab.text = tabTitle[position]
}.attach()

for (day in dummyList) {
if (day.reviewId != null) {
num[week.indexOf(day.reviewDay)] = BG_BLUE_100
} else {
Log.d("회고 주기", "day : $day")
Log.d("회고 주기", "${day.reviewDay}")
Log.d("회고 주기", "${week.indexOf(day.reviewDay)}")
num[week.indexOf(day.reviewDay)] = BLACK_TEXT
}
}

for (i in 0..6) {
when (num[i]) {
BG_BLUE_100 -> {
val tapItem = LayoutInflater.from(this)
.inflate(R.layout.tab_text_color_blue100, null) as ConstraintLayout
binding.tlDetailRetroDate.getTabAt(i)?.customView =
tapItem
}
BLACK_TEXT -> {
val tapItem =
LayoutInflater.from(this)
.inflate(R.layout.tab_title_text_black, null) as ConstraintLayout
binding.tlDetailRetroDate.getTabAt(i)?.customView =
tapItem
}
else -> {
val tapItem =
LayoutInflater.from(this)
.inflate(R.layout.tab_title, null) as ConstraintLayout
binding.tlDetailRetroDate.getTabAt(i)?.customView = tapItem
}
}
}
}

fun getWeekDatesWithToday(): List<String> {
val today = LocalDate.now()
val startOfWeek = today.with(DayOfWeek.MONDAY) // 해당 주의 시작일
val endOfWeek = today.with(DayOfWeek.SUNDAY) // 해당 주의 종료일

val dates = mutableListOf<String>()
var currentDate = startOfWeek

val dateFormatter = DateTimeFormatter.ofPattern("dd")

while (!currentDate.isAfter(endOfWeek)) {
val formattedDate = currentDate.format(dateFormatter)
dates.add(formattedDate)
currentDate = currentDate.plusDays(1)
}

return dates
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.puzzling.puzzlingaos.presentation.detailRetrospect

import android.os.Bundle
import android.view.View
import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseFragment
import com.puzzling.puzzlingaos.databinding.FragmentDetailRetroBinding

class DetailRetroFragment(private val date: String) :
BaseFragment<FragmentDetailRetroBinding>(R.layout.fragment_detail_retro) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.puzzling.puzzlingaos.presentation.detailRetrospect

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

class WeekTapAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
override fun getItemCount(): Int {
return 7
}

override fun createFragment(position: Int): Fragment {
return when (position) {
0 -> DetailRetroFragment("5")
1 -> DetailRetroFragment("6")
2 -> DetailRetroFragment("7")
3 -> DetailRetroFragment("8")
4 -> DetailRetroFragment("9")
5 -> DetailRetroFragment("10")
6 -> DetailRetroFragment("11")
else -> DetailRetroFragment("5")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class InputCodeFragment : BaseFragment<FragmentInputCodeBinding>(R.layout.fragme
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

viewModel = ViewModelProvider(requireActivity(), ViewModelFactory(requireContext()))[InvitationCodeViewModel::class.java]
viewModel = ViewModelProvider(
requireActivity(),
ViewModelFactory(requireContext()),
)[InvitationCodeViewModel::class.java]

binding.vm = viewModel
binding.lifecycleOwner = viewLifecycleOwner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModelProvider
import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseFragment
import com.puzzling.puzzlingaos.databinding.FragmentInputProfileBinding
import com.puzzling.puzzlingaos.util.ViewModelFactory

class InputProfileFragment :
BaseFragment<FragmentInputProfileBinding>(R.layout.fragment_input_profile) {
Expand All @@ -14,7 +15,11 @@ class InputProfileFragment :

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel = ViewModelProvider(requireActivity())[InvitationCodeViewModel::class.java]
viewModel = ViewModelProvider(
requireActivity(),
ViewModelFactory(requireContext()),
)[InvitationCodeViewModel::class.java]

binding.lifecycleOwner = viewLifecycleOwner
binding.vm = viewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import androidx.fragment.app.viewModels
import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseActivity
import com.puzzling.puzzlingaos.databinding.ActivityInvitationCodeBinding
import com.puzzling.puzzlingaos.util.ViewModelFactory

class InvitationCodeActivity :
BaseActivity<ActivityInvitationCodeBinding>(R.layout.activity_invitation_code) {

private val viewModel by viewModels<InvitationCodeViewModel>()
private val viewModel: InvitationCodeViewModel by viewModels { ViewModelFactory(this) }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseActivity
import com.puzzling.puzzlingaos.databinding.ActivityMainBinding
import com.puzzling.puzzlingaos.presentation.home.HomeFragment
import com.puzzling.puzzlingaos.presentation.home.mypage.MyPageFragment
import com.puzzling.puzzlingaos.presentation.mypage.MyPageFragment

class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.puzzling.puzzlingaos.presentation.home.mypage
package com.puzzling.puzzlingaos.presentation.mypage

import android.os.Bundle
import android.view.View
import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BottomSheetDialogFragment
import com.puzzling.puzzlingaos.data.model.response.ResponseMyPageProjectDto
import com.puzzling.puzzlingaos.databinding.FragmentBottomChooseProjectBinding
import com.puzzling.puzzlingaos.presentation.home.mypage.adapter.ChooseProjectAdapter
import com.puzzling.puzzlingaos.presentation.mypage.adapter.ChooseProjectAdapter

class ChooseProjectBottomFragment :
BottomSheetDialogFragment<FragmentBottomChooseProjectBinding>(R.layout.fragment_bottom_choose_project) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.puzzling.puzzlingaos.presentation.home.mypage
package com.puzzling.puzzlingaos.presentation.mypage

import android.os.Bundle
import android.view.View
Expand All @@ -8,9 +8,9 @@ import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseFragment
import com.puzzling.puzzlingaos.data.model.response.ResponseMyPageProjectDto
import com.puzzling.puzzlingaos.databinding.FragmentMyPageBinding
import com.puzzling.puzzlingaos.presentation.home.mypage.adapter.MyProjectAdapter
import com.puzzling.puzzlingaos.presentation.home.mypage.adapter.MyProjectBottomAdapter
import com.puzzling.puzzlingaos.presentation.home.mypage.adapter.MyProjectTopAdapter
import com.puzzling.puzzlingaos.presentation.mypage.adapter.MyProjectContentAdapter
import com.puzzling.puzzlingaos.presentation.mypage.adapter.MyProjectBottomAdapter
import com.puzzling.puzzlingaos.presentation.mypage.adapter.MyProjectTitleAdapter

class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_page) {

Expand All @@ -30,17 +30,17 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_
}

private fun initAdapter() {
val myProjectAdapter = MyProjectAdapter()
val myProjectContentAdapter = MyProjectContentAdapter()
val concatAdapter =
ConcatAdapter(MyProjectTopAdapter("지니"), myProjectAdapter, MyProjectBottomAdapter())
ConcatAdapter(MyProjectTitleAdapter("지니"), myProjectContentAdapter, MyProjectBottomAdapter())

with(binding) {
rcvMyPageMain.adapter = concatAdapter
rcvMyPageMain.layoutManager = LinearLayoutManager(activity)
}
myProjectAdapter.submitList(dummyItemList)
myProjectContentAdapter.submitList(dummyItemList)

myProjectAdapter.setOnItemClickListener(object : MyProjectAdapter.OnItemClickListener {
myProjectContentAdapter.setOnItemClickListener(object : MyProjectContentAdapter.OnItemClickListener {
override fun onItemClick(v: View, data: ResponseMyPageProjectDto, pos: Int) {
requireActivity().supportFragmentManager.beginTransaction()
.replace(R.id.fcv_main_container, MyRetrospectFragment()).addToBackStack(null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.puzzling.puzzlingaos.presentation.home.mypage
package com.puzzling.puzzlingaos.presentation.mypage

import android.os.Bundle
import android.view.View
Expand All @@ -9,8 +9,8 @@ import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseFragment
import com.puzzling.puzzlingaos.data.model.response.ResponseMyRetroListDto
import com.puzzling.puzzlingaos.databinding.FragmentMyRetrospectBinding
import com.puzzling.puzzlingaos.presentation.home.mypage.adapter.MyRetroAdapter
import com.puzzling.puzzlingaos.presentation.home.mypage.adapter.MyRetroTopAdapter
import com.puzzling.puzzlingaos.presentation.mypage.adapter.MyRetroContentAdapter
import com.puzzling.puzzlingaos.presentation.mypage.adapter.MyRetroTitleAdapter

class MyRetrospectFragment :
BaseFragment<FragmentMyRetrospectBinding>(R.layout.fragment_my_retrospect) {
Expand Down Expand Up @@ -44,22 +44,22 @@ class MyRetrospectFragment :
}

private fun initAdapter() {
val myRetroAdapter = MyRetroAdapter()
val myRetroTopAdapter = MyRetroTopAdapter("Piickle")
val myRetroContentAdapter = MyRetroContentAdapter()
val myRetroTitleAdapter = MyRetroTitleAdapter("Piickle")

myRetroAdapter.submitList(dummyItemList)
myRetroContentAdapter.submitList(dummyItemList)

myRetroTopAdapter.setOnItemClickListener(object : MyRetroTopAdapter.OnItemClickListener {
myRetroTitleAdapter.setOnItemClickListener(object : MyRetroTitleAdapter.OnItemClickListener {
override fun onItemClick(v: View, data: String, pos: Int) {
val chooseProjectBottomFragment = ChooseProjectBottomFragment()
chooseProjectBottomFragment.show(requireActivity().supportFragmentManager, "show")
}
})
val concatAdapter = ConcatAdapter(myRetroTopAdapter, myRetroAdapter)
val concatAdapter = ConcatAdapter(myRetroTitleAdapter, myRetroContentAdapter)

with(binding) {
rcvMyRetroMain.adapter = concatAdapter
rcvMyRetroMain.layoutManager = LinearLayoutManager(activity)
with(binding.rcvMyRetroMain) {
adapter = concatAdapter
layoutManager = LinearLayoutManager(activity)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.puzzling.puzzlingaos.presentation.home.mypage.adapter
package com.puzzling.puzzlingaos.presentation.mypage.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package com.puzzling.puzzlingaos.presentation.home.mypage.adapter
package com.puzzling.puzzlingaos.presentation.mypage.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.puzzling.puzzlingaos.databinding.ItemBottomLogoutBinding

class MyProjectBottomAdapter() :
RecyclerView.Adapter<MyProjectBottomAdapter.BottomViewHolder>() {
RecyclerView.Adapter<MyProjectBottomAdapter.MyProjectBottomViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BottomViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyProjectBottomViewHolder {
val binding: ItemBottomLogoutBinding =
ItemBottomLogoutBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return BottomViewHolder(binding)
return MyProjectBottomViewHolder(binding)
}

override fun getItemCount(): Int {
return 1
}

override fun onBindViewHolder(holder: BottomViewHolder, position: Int) {
override fun onBindViewHolder(holder: MyProjectBottomViewHolder, position: Int) {
}

class BottomViewHolder(private val binding: ItemBottomLogoutBinding) :
class MyProjectBottomViewHolder(private val binding: ItemBottomLogoutBinding) :
RecyclerView.ViewHolder(binding.root)
}
Loading
Loading