Skip to content

Commit fc961b1

Browse files
committed
✨ 커뮤니티 탭 -> 게시판 탭에서 +버튼 누르면 운동 내역 선택페이지로 이동하도록 구현
1 parent b528fb0 commit fc961b1

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

presentation/src/main/java/com/whyranoid/presentation/community/CommunityFragment.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ internal class CommunityFragment :
2828
// TODO 게시글, 내가 쓴 글 추가 필요
2929
override fun onTabSelected(tab: TabLayout.Tab?) {
3030
when (tab?.position) {
31+
CommunityCategory.BOARD.ordinal -> {
32+
binding.topAppBar.inflateMenu(R.menu.community_go_to_create_running_post_menu)
33+
}
34+
3135
CommunityCategory.MY_GROUP.ordinal -> {
3236
binding.topAppBar.inflateMenu(R.menu.my_group_menu)
3337
}
@@ -40,6 +44,9 @@ internal class CommunityFragment :
4044
CommunityCategory.MY_GROUP.ordinal -> {
4145
binding.topAppBar.menu.clear()
4246
}
47+
CommunityCategory.BOARD.ordinal -> {
48+
binding.topAppBar.menu.clear()
49+
}
4350
}
4451
}
4552

@@ -60,6 +67,14 @@ internal class CommunityFragment :
6067
findNavController().navigate(action)
6168
true
6269
}
70+
71+
R.id.go_to_create_running_post -> {
72+
val action =
73+
CommunityFragmentDirections.actionCommunityFragmentToSelectRunningHistoryFragment()
74+
findNavController().navigate(action)
75+
true
76+
}
77+
6378
else -> {
6479
false
6580
}

presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupFragment.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ internal class CreateGroupFragment :
118118
viewLifecycleOwner.repeatWhenUiStarted {
119119
viewModel.isGroupCreateButtonEnable.collect { isEnable ->
120120
if (isEnable) {
121-
binding.topAppBar.menu.setGroupVisible(R.id.ready_to_create, true)
122-
binding.topAppBar.menu.setGroupVisible(R.id.not_ready_to_create, false)
121+
binding.topAppBar.menu.setGroupVisible(R.id.ready_to_create_running_post, true)
122+
binding.topAppBar.menu.setGroupVisible(R.id.not_ready_to_create_running_post, false)
123123
} else {
124-
binding.topAppBar.menu.setGroupVisible(R.id.ready_to_create, false)
125-
binding.topAppBar.menu.setGroupVisible(R.id.not_ready_to_create, true)
124+
binding.topAppBar.menu.setGroupVisible(R.id.ready_to_create_running_post, false)
125+
binding.topAppBar.menu.setGroupVisible(R.id.not_ready_to_create_running_post, true)
126126
}
127127
}
128128
}

presentation/src/main/res/menu/community_create_running_post_menu.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto">
44

55
<group
6-
android:id="@+id/not_ready_to_create"
6+
android:id="@+id/not_ready_to_create_running_post"
77
android:visible="false">
88
<item
99
android:id="@+id/warning_about_create_running_post_button"
@@ -14,7 +14,7 @@
1414
</group>
1515

1616
<group
17-
android:id="@+id/ready_to_create"
17+
android:id="@+id/ready_to_create_running_post"
1818
android:visible="false">
1919
<item
2020
android:id="@+id/create_running_post_button"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto">
4+
5+
<item
6+
android:id="@+id/go_to_create_running_post"
7+
android:enabled="true"
8+
android:icon="@drawable/plus_button"
9+
android:title="@string/community_go_to_create_running_post"
10+
app:showAsAction="always"/>
11+
12+
</menu>

presentation/src/main/res/navigation/navigation_graph.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:id="@+id/navigation_graph.xml"
6-
app:startDestination="@id/selectRunningHistoryFragment">
6+
app:startDestination="@id/runningStartFragment">
77

88
<fragment
99
android:id="@+id/myRunFragment"

presentation/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<string name="community_running_post_complete">인증글 작성 완료</string>
2828
<string name="community_select_running_history">운동 내역 선택 완료</string>
2929
<string name="community_select_running_history_snack_bar">운동을 하나 선택해주세요!</string>
30+
<string name="community_go_to_create_running_post">인증글 생성하러 가기</string>
3031

3132
<!-- 마이런 탭 화면 -->
3233
<string name="my_run_tool_bar_menu_setting">설정</string>

0 commit comments

Comments
 (0)