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

[AN] feat: 바텀 내비게이션 연결 #103

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Expand Up @@ -27,7 +27,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {

navController.addOnDestinationChangedListener { _, destination, _ ->
when (destination.id) {
R.id.homeFragment, R.id.woofFragment, R.id.chatFragment, R.id.myPageFragment -> showBottomNav()
R.id.groupListFragment, R.id.woofFragment, R.id.chatListFragment, R.id.myPageFragment -> showBottomNav()
else -> hideBottomNav()
}
}
Expand All @@ -49,7 +49,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
super.onBackPressed()
} else {
when (navController.currentDestination?.id) {
R.id.homeFragment -> {
R.id.groupListFragment -> {
if (System.currentTimeMillis() - waitTime >= 1500) {
waitTime = System.currentTimeMillis()
showToastMessage(getString(R.string.on_back_pressed_Message))
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
android:id="@+id/bottom_navi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:clipChildren="false"
app:elevation="0dp"
app:itemActiveIndicatorStyle="@android:color/transparent"
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/res/menu/menu_main_bottom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/homeFragment"
android:id="@+id/groupListFragment"
android:enabled="true"
android:icon="@drawable/ic_home"
android:title="@string/bottom_home" />
Expand All @@ -14,7 +14,7 @@
android:title="@string/bottom_woof" />

<item
android:id="@+id/chatFragment"
android:id="@+id/chatListFragment"
android:enabled="true"
android:icon="@drawable/ic_chat"
android:title="@string/bottom_chat" />
Expand Down
31 changes: 29 additions & 2 deletions android/app/src/main/res/navigation/navigation_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,45 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navigation_graph"
app:startDestination="@id/myPageFragment">
app:startDestination="@id/groupListFragment">

<action
android:id="@+id/action_home_fragment"
app:destination="@id/myPageFragment"
app:destination="@id/groupListFragment"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:popUpTo="@id/navigation_graph"
app:popUpToInclusive="true" />


<fragment
android:id="@+id/groupListFragment"
android:name="com.woowacourse.friendogly.presentation.ui.group.list.GroupListFragment"
android:label="GroupListFragment"
tools:layout="@layout/fragment_group_list">

<action
android:id="@+id/action_groupListFragment_to_myPageFragment"
app:destination="@id/myPageFragment" />
<action
android:id="@+id/action_groupListFragment_to_chatListFragment"
app:destination="@id/chatListFragment" />

</fragment>


<fragment
android:id="@+id/chatListFragment"
android:name="com.woowacourse.friendogly.presentation.ui.chatlist.ChatListFragment"
android:label="ChatListFragment"
tools:layout="@layout/fragment_chat_list">


</fragment>


<fragment
android:id="@+id/myPageFragment"
android:name="com.woowacourse.friendogly.presentation.ui.mypage.MyPageFragment"
Expand Down
Loading