File tree Expand file tree Collapse file tree 8 files changed +75
-7
lines changed
domain/src/main/java/com/whyranoid/domain/model
java/com/whyranoid/presentation Expand file tree Collapse file tree 8 files changed +75
-7
lines changed Original file line number Diff line number Diff line change 1
1
package com.whyranoid.domain.model
2
2
3
- import java.io.Serializable
4
-
5
3
data class GroupInfo (
6
4
val name : String ,
7
5
val groupId : String ,
8
6
val introduce : String ,
9
7
val rules : List <Rule >,
10
8
val headCount : Int ,
11
9
val leader : User
12
- ) : Serializable
10
+ )
Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ internal class CommunityFragment :
68
68
}
69
69
70
70
override fun onDestroyView () {
71
-
72
71
// 뷰페이저 메모리 누수 해결
73
72
binding.viewPager.adapter = null
74
73
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import androidx.navigation.fragment.findNavController
10
10
import com.whyranoid.presentation.R
11
11
import com.whyranoid.presentation.base.BaseFragment
12
12
import com.whyranoid.presentation.databinding.FragmentCommunityItemBinding
13
+ import com.whyranoid.presentation.model.toGroupInfoUiModel
13
14
import com.whyranoid.presentation.util.repeatWhenUiStarted
14
15
import dagger.hilt.android.AndroidEntryPoint
15
16
import kotlinx.coroutines.launch
@@ -63,7 +64,7 @@ internal class CommunityItemFragment :
63
64
when (event) {
64
65
is Event .CategoryItemClick -> {
65
66
val action =
66
- CommunityFragmentDirections .actionCommunityFragmentToGroupDetailFragment(event.groupInfo)
67
+ CommunityFragmentDirections .actionCommunityFragmentToGroupDetailFragment(event.groupInfo.toGroupInfoUiModel() )
67
68
findNavController().navigate(action)
68
69
}
69
70
}
Original file line number Diff line number Diff line change
1
+ package com.whyranoid.presentation.model
2
+
3
+ import android.os.Parcelable
4
+ import com.whyranoid.domain.model.GroupInfo
5
+ import kotlinx.parcelize.Parcelize
6
+
7
+ @Parcelize
8
+ data class GroupInfoUiModel (
9
+ val name : String ,
10
+ val groupId : String ,
11
+ val introduce : String ,
12
+ val rules : List <RuleUiModel >,
13
+ val headCount : Int ,
14
+ val leader : UserUiModel
15
+ ) : Parcelable
16
+
17
+ fun GroupInfo.toGroupInfoUiModel () =
18
+ GroupInfoUiModel (
19
+ name = this .name,
20
+ groupId = this .groupId,
21
+ introduce = this .introduce,
22
+ rules = this .rules.map { rule ->
23
+ rule.toRuleUiModel()
24
+ },
25
+ headCount = this .headCount,
26
+ leader = this .leader.toUserUiModel()
27
+ )
Original file line number Diff line number Diff line change
1
+ package com.whyranoid.presentation.model
2
+
3
+ import android.os.Parcelable
4
+ import com.whyranoid.domain.model.DayOfWeek
5
+ import com.whyranoid.domain.model.Rule
6
+ import kotlinx.parcelize.Parcelize
7
+
8
+ @Parcelize
9
+ data class RuleUiModel (
10
+ val dayOfWeek : DayOfWeek ,
11
+ val hour : Int ,
12
+ val minute : Int
13
+ ) : Parcelable {
14
+ override fun toString (): String {
15
+ return " ${dayOfWeek.dayResId} -$hour -$minute "
16
+ }
17
+ }
18
+
19
+ fun Rule.toRuleUiModel () =
20
+ RuleUiModel (
21
+ dayOfWeek = this .dayOfWeek,
22
+ hour = this .hour,
23
+ minute = this .minute
24
+ )
Original file line number Diff line number Diff line change
1
+ package com.whyranoid.presentation.model
2
+
3
+ import android.os.Parcelable
4
+ import com.whyranoid.domain.model.User
5
+ import kotlinx.parcelize.Parcelize
6
+
7
+ @Parcelize
8
+ data class UserUiModel (
9
+ val uid : String ,
10
+ val name : String? ,
11
+ val profileUrl : String?
12
+ ) : Parcelable
13
+
14
+ fun User.toUserUiModel () =
15
+ UserUiModel (
16
+ uid = this .uid,
17
+ name = this .name,
18
+ profileUrl = this .profileUrl
19
+ )
Original file line number Diff line number Diff line change 13
13
14
14
<variable
15
15
name =" groupInfo"
16
- type =" com.whyranoid.domain .model.GroupInfo " />
16
+ type =" com.whyranoid.presentation .model.GroupInfoUiModel " />
17
17
18
18
<variable
19
19
name =" viewModel"
Original file line number Diff line number Diff line change 52
52
tools : layout =" @layout/fragment_group_detail" >
53
53
<argument
54
54
android : name =" groupInfo"
55
- app : argType =" com.whyranoid.domain .model.GroupInfo " />
55
+ app : argType =" com.whyranoid.presentation .model.GroupInfoUiModel " />
56
56
</fragment >
57
57
58
58
</navigation >
You can’t perform that action at this time.
0 commit comments