Skip to content

Commit

Permalink
[feat/#135] 유저 리뷰 리스트 선택 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
kkk5474096 committed Feb 13, 2024
1 parent 6dc7fe6 commit 753f416
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.fragment.app.commit
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.teumteum.base.BindingActivity
import com.teumteum.base.component.appbar.AppBarLayout
import com.teumteum.base.component.appbar.AppBarMenu
Expand All @@ -15,8 +13,6 @@ import com.teumteum.base.util.extension.longExtra
import com.teumteum.teumteum.R
import com.teumteum.teumteum.databinding.ActivityReviewBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class ReviewActivity: BindingActivity<ActivityReviewBinding>(R.layout.activity_review), AppBarLayout {
Expand Down Expand Up @@ -50,7 +46,18 @@ class ReviewActivity: BindingActivity<ActivityReviewBinding>(R.layout.activity_r

private fun initView() {
supportFragmentManager.commit {
add(R.id.fragment_container,ReviewFriendSelectFragment())
replace(R.id.fragment_container, ReviewFriendSelectFragment())
}
}

fun nextFriendDetailFragment() {
if (viewModel.currentFriendIndex >= viewModel.selectFriendList.size) return
with(viewModel.selectFriendList[viewModel.currentFriendIndex++]) {
val fragment = ReviewFriendDetailFragment.newInstance(id, characterId, name, job)

supportFragmentManager.commit {
replace(R.id.fragment_container, fragment)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
package com.teumteum.teumteum.presentation.group.review

import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.teumteum.base.BindingFragment
import com.teumteum.base.util.extension.deepCopyList
import com.teumteum.base.util.extension.setOnSingleClickListener
import com.teumteum.domain.entity.Friend
import com.teumteum.domain.entity.ReviewFriend
import com.teumteum.teumteum.R
import com.teumteum.teumteum.databinding.FragmentReviewFriendSelectBinding
import kotlin.reflect.typeOf
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json


class ReviewFriendSelectFragment: BindingFragment<FragmentReviewFriendSelectBinding>(R.layout.fragment_review_friend_select) {
Expand Down Expand Up @@ -56,7 +50,14 @@ class ReviewFriendSelectFragment: BindingFragment<FragmentReviewFriendSelectBind

private fun initEvent() {
binding.btnReview.setOnSingleClickListener {
val selectFriendList = adapter?.currentList?.filter {
it.isSelected
}
selectFriendList?.let {
viewModel.setSelectFriendList(it)
}

(requireActivity() as? ReviewActivity)?.nextFriendDetailFragment()
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_review_friend_select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="12dp"
android:background="#D6D6D6"
android:background="@color/divider_level02"
app:layout_constraintBottom_toTopOf="@id/btn_review" />

<androidx.appcompat.widget.AppCompatButton
Expand Down

0 comments on commit 753f416

Please sign in to comment.