Skip to content

Commit

Permalink
Merge pull request #77 from gaeun5744/develop
Browse files Browse the repository at this point in the history
[FIX] 서버통신 및 UI 수정
  • Loading branch information
gaeun5744 authored Jul 21, 2023
2 parents e0ba4e0 + 938bbda commit 6bbd2c5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class HomeFragment :
}

private fun getPopupContent() {
viewModel.getProjectWeekCycle()
viewModel.selectedProjectId.observe(this) {
viewModel.getProjectWeekCycle(it)
}

viewModel.retroWeek.observe(this) {
val reviewCycleText = "매주 ${it?.projectReviewCycle} \n회고를 작성해주세요"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.puzzling.puzzlingaos.domain.entity.Project
import com.puzzling.puzzlingaos.domain.repository.MyBoardRepository
import com.puzzling.puzzlingaos.domain.repository.ProjectRepository
import com.puzzling.puzzlingaos.util.UserInfo
import com.puzzling.puzzlingaos.util.UserInfo.GET_PROJECT_ID
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject
Expand Down Expand Up @@ -47,11 +48,11 @@ class HomeViewModel @Inject constructor(
val isProjectNameSelected: LiveData<Boolean>
get() = _isProjectNameSelected

private val _selectedProjectName = MutableLiveData("PUZZLING")
private val _selectedProjectName = MutableLiveData("찌릿")
val selectedProjectName: LiveData<String>
get() = _selectedProjectName

private val _selectedProjectId = MutableLiveData<Int>()
private val _selectedProjectId = MutableLiveData<Int>(GET_PROJECT_ID)
val selectedProjectId: LiveData<Int>
get() = _selectedProjectId

Expand Down Expand Up @@ -104,9 +105,9 @@ class HomeViewModel @Inject constructor(
return selectedProject?.projectId
}

fun getProjectWeekCycle() = viewModelScope.launch {
fun getProjectWeekCycle(projectId: Int) = viewModelScope.launch {
kotlin.runCatching {
projectRepository.getProjectWeekCycle(UserInfo.GET_PROJECT_ID)
projectRepository.getProjectWeekCycle(projectId)
}.onSuccess { response ->
_retroWeek.value = response.data
Log.d("회고 주기", "$response")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_
super.onViewCreated(view, savedInstanceState)
viewModel = ViewModelProvider(requireActivity())[MyRetrospectViewModel::class.java]
viewModel.getMyProjectList()
viewModel.getProjectWeekCycle()
homeViewModel.selectedProjectId.observe(this) {
viewModel.getProjectWeekCycle(it)
}
initAdapter()
showPopupMessage()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class MyRetrospectViewModel @Inject constructor(
}
}

fun getProjectWeekCycle() = viewModelScope.launch {
fun getProjectWeekCycle(projectId: Int) = viewModelScope.launch {
kotlin.runCatching {
projectRepository.getProjectWeekCycle(GET_PROJECT_ID)
projectRepository.getProjectWeekCycle(projectId)
}.onSuccess { response ->
_retroWeek.value = response.data
Log.d("회고 주기", "$response")
Expand Down
23 changes: 12 additions & 11 deletions app/src/main/res/layout/activity_detail_retro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,22 @@
android:id="@+id/tv_detailRetro_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="프로젝트1"
android:textAppearance="@style/Kor.Heading4"
tools:ignore="NotSibling" />

<ImageButton
android:id="@+id/ib_detailRetro_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cancel"
android:background="@color/transparent"
android:layout_marginTop="10dp"
android:layout_gravity="end"
android:layout_marginEnd="8dp"/>
android:layout_marginTop="10dp"
android:layout_marginEnd="8dp"
android:background="@color/transparent"
android:src="@drawable/ic_cancel" />

</androidx.appcompat.widget.Toolbar>

Expand All @@ -50,12 +51,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginStart="23dp"
android:layout_marginTop="12dp"
android:text="2023년 7월"
android:textAppearance="@style/Kor.Heading2"
android:textColor="@color/black_000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/tl_detailRetro_week"
app:layout_constraintStart_toStartOf="@id/tl_detailRetro_week"
app:layout_constraintTop_toBottomOf="@id/tb_detailRetro_main" />

<LinearLayout
Expand Down Expand Up @@ -143,13 +144,13 @@
android:background="@drawable/tab_background"
android:includeFontPadding="false"
android:theme="@style/TabTheme"
app:tabTextColor="@color/gray_400"
app:tabSelectedTextColor="@color/white_000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tl_detailRetro_week"
app:tabIndicatorColor="@color/white_000"
app:tabTextAppearance="@style/Kor.Body2.Bold">
app:tabSelectedTextColor="@color/white_000"
app:tabTextAppearance="@style/Kor.Body2.Bold"
app:tabTextColor="@color/gray_400">


</com.google.android.material.tabs.TabLayout>
Expand All @@ -162,7 +163,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tl_detailRetro_date"/>
app:layout_constraintTop_toBottomOf="@id/tl_detailRetro_date" />


</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down

0 comments on commit 6bbd2c5

Please sign in to comment.