Skip to content

Commit

Permalink
[feat] : #15 Find Friend Fragment Back Button Add
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed Jun 13, 2023
1 parent ac88178 commit ebe3667
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,6 +26,9 @@ import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class AddFriendsFragment : BaseFragment<FragmentAddFriendsBinding>(R.layout.fragment_add_friends) {

private val args: AddFriendsFragmentArgs by navArgs()

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand All @@ -42,6 +48,12 @@ class AddFriendsFragment : BaseFragment<FragmentAddFriendsBinding>(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) {
Expand Down Expand Up @@ -170,6 +182,10 @@ class AddFriendsFragment : BaseFragment<FragmentAddFriendsBinding>(R.layout.frag
binding.addFriendsFindDeleteAtv.setOnClickListener {
binding.addFriendsNameEt.setText("")
}

binding.addFriendsBackIv.setOnClickListener {
findNavController().popBackStack()
}
}

private fun bindEmptyFriendData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class FriendFragment : BaseFragment<FragmentFriendBinding>(R.layout.fragment_fri
}

binding.friendAddIv.setOnClickListener {
val action = FriendFragmentDirections.actionFriendFragmentToAddFriendsFragment()
val action = FriendFragmentDirections.actionFriendFragmentToAddFriendsFragment(true)
findNavController().navigate(action)
}
}
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/fragment_add_friends.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
android:layout_height="match_parent"
android:background="@color/white">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/add_friends_back_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="16dp"
android:src="@drawable/ic_arrow_left_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/add_friends_title_tv"
style="@style/Pome.SemiBold.14"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/navigation/pome_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
android:id="@+id/action_addFriendsFragment_to_record_fragment"
app:destination="@id/record_fragment"
app:popUpTo="@id/splash_fragment"/>
<argument
android:name="addFriendType"
app:argType="boolean"
android:defaultValue="false" />
</fragment>
<fragment
android:id="@+id/registerFragment"
Expand Down

0 comments on commit ebe3667

Please sign in to comment.