diff --git a/app/src/main/java/com/teampome/pome/presentation/addfriends/AddFriendsFragment.kt b/app/src/main/java/com/teampome/pome/presentation/addfriends/AddFriendsFragment.kt index 418603f5..0cac7fe4 100644 --- a/app/src/main/java/com/teampome/pome/presentation/addfriends/AddFriendsFragment.kt +++ b/app/src/main/java/com/teampome/pome/presentation/addfriends/AddFriendsFragment.kt @@ -9,11 +9,14 @@ import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.viewModels +import androidx.navigation.NavArgs import androidx.navigation.fragment.findNavController +import androidx.navigation.fragment.navArgs import com.teampome.pome.R import com.teampome.pome.databinding.FragmentAddFriendsBinding import com.teampome.pome.presentation.addfriends.recyclerview.AddFriendsListAdapter import com.teampome.pome.presentation.addfriends.recyclerview.OnAddFriendClickListener +import com.teampome.pome.presentation.record.add.AddGoalContentsFragmentArgs import com.teampome.pome.util.common.CommonUtil import com.teampome.pome.util.base.ApiResponse import com.teampome.pome.util.base.BaseFragment @@ -23,6 +26,9 @@ import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class AddFriendsFragment : BaseFragment(R.layout.fragment_add_friends) { + + private val args: AddFriendsFragmentArgs by navArgs() + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -42,6 +48,12 @@ class AddFriendsFragment : BaseFragment(R.layout.frag } override fun initView() { + if(args.addFriendType) { + binding.addFriendsBackIv.visibility = View.VISIBLE + } else { + binding.addFriendsBackIv.visibility = View.GONE + } + binding.addFriendsListRv.adapter = AddFriendsListAdapter().apply { setOnAddFriendClickListener(object : OnAddFriendClickListener { override fun onAddFriendClick(friendId: String, position: Int) { @@ -170,6 +182,10 @@ class AddFriendsFragment : BaseFragment(R.layout.frag binding.addFriendsFindDeleteAtv.setOnClickListener { binding.addFriendsNameEt.setText("") } + + binding.addFriendsBackIv.setOnClickListener { + findNavController().popBackStack() + } } private fun bindEmptyFriendData() { diff --git a/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt b/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt index c70f632d..fb5b2ef1 100644 --- a/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt +++ b/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt @@ -132,7 +132,7 @@ class FriendFragment : BaseFragment(R.layout.fragment_fri } binding.friendAddIv.setOnClickListener { - val action = FriendFragmentDirections.actionFriendFragmentToAddFriendsFragment() + val action = FriendFragmentDirections.actionFriendFragmentToAddFriendsFragment(true) findNavController().navigate(action) } } diff --git a/app/src/main/res/layout/fragment_add_friends.xml b/app/src/main/res/layout/fragment_add_friends.xml index baea09d8..ce3a1a90 100644 --- a/app/src/main/res/layout/fragment_add_friends.xml +++ b/app/src/main/res/layout/fragment_add_friends.xml @@ -18,6 +18,16 @@ android:layout_height="match_parent" android:background="@color/white"> + + +