-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…s-view [ui] 행복루틴 진행 뷰
- Loading branch information
Showing
10 changed files
with
405 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/sopetit/softie/domain/entity/HappyProgress.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.sopetit.softie.domain.entity | ||
|
||
import androidx.annotation.DrawableRes | ||
|
||
data class HappyProgress( | ||
val routineId: Int, | ||
@DrawableRes val imageUrl: Int, | ||
val title: String, | ||
val content: String, | ||
val detailTitle: String, | ||
val detailContent: String, | ||
val detailTime: String, | ||
val detailPlace: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
app/src/main/java/com/sopetit/softie/ui/happyroutine/progress/HappyProgressFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.sopetit.softie.ui.happyroutine.progress | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.activityViewModels | ||
import com.sopetit.softie.R | ||
import com.sopetit.softie.databinding.FragmentHappyProgressBinding | ||
import com.sopetit.softie.domain.entity.HappyProgress | ||
import com.sopetit.softie.ui.main.home.HomeFragment | ||
import com.sopetit.softie.util.binding.BindingFragment | ||
|
||
class HappyProgressFragment : | ||
BindingFragment<FragmentHappyProgressBinding>(R.layout.fragment_happy_progress) { | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
val viewModel: HappyProgressViewModel by activityViewModels() | ||
val happyProgress = viewModel.mockHappyProgress | ||
|
||
setCardBinding(happyProgress) | ||
setCardEnter() | ||
setEditEnter() | ||
setClearEnter() | ||
} | ||
|
||
private fun setCardBinding(happyProgress: HappyProgress) { | ||
with(binding) { | ||
tvHappyProgressSubtitle.text = happyProgress.title | ||
ivHappyProgressCardFront.setImageResource(happyProgress.imageUrl) | ||
tvHappyProgressCardFrontTitle.text = happyProgress.content | ||
tvHappyProgressCardBackTitle.text = happyProgress.detailTitle | ||
tvHappyProgressCardBackContent.text = happyProgress.detailContent | ||
tvHappyProgressCardBackTime.text = happyProgress.detailTime | ||
tvHappyProgressCardBackPlace.text = happyProgress.detailPlace | ||
} | ||
} | ||
|
||
private fun setCardEnter() { | ||
with(binding) { | ||
clHappyProgressCardFront.setOnClickListener { | ||
setCardFlip(clHappyProgressCardFront, clHappyProgressCardBack) | ||
} | ||
clHappyProgressCardBack.setOnClickListener { | ||
setCardFlip(clHappyProgressCardBack, clHappyProgressCardFront) | ||
} | ||
} | ||
} | ||
|
||
private fun setEditEnter() { | ||
binding.tvHappyProgressEdit.setOnClickListener { | ||
val homeFragment = HomeFragment() | ||
requireActivity().supportFragmentManager.beginTransaction() | ||
.replace(R.id.fcv_main, homeFragment) | ||
.commit() | ||
} | ||
} | ||
|
||
private fun setCardFlip(viewFront: View, viewToBack: View) { | ||
val isVisible = viewFront.visibility == View.VISIBLE | ||
if (isVisible) { | ||
viewFront.visibility = View.INVISIBLE | ||
viewToBack.visibility = View.VISIBLE | ||
} else { | ||
viewFront.visibility = View.VISIBLE | ||
viewToBack.visibility = View.INVISIBLE | ||
} | ||
} | ||
|
||
private fun setClearEnter() { | ||
binding.btnHappyProgressClear.setOnClickListener { | ||
val homeFragment = HomeFragment() | ||
requireActivity().supportFragmentManager.beginTransaction() | ||
.replace(R.id.fcv_main, homeFragment) | ||
.commit() | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/sopetit/softie/ui/happyroutine/progress/HappyProgressViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.sopetit.softie.ui.happyroutine.progress | ||
|
||
import androidx.lifecycle.ViewModel | ||
import com.sopetit.softie.R | ||
import com.sopetit.softie.domain.entity.HappyProgress | ||
|
||
class HappyProgressViewModel : ViewModel() { | ||
|
||
val mockHappyProgress: HappyProgress = HappyProgress( | ||
routineId = 1, | ||
imageUrl = R.drawable.ic_happycard_up_purple, | ||
title = "성숙한 사람을 만나기 위한", | ||
content = "이상형의 특성 10가지 적어보고,\n절대 포기 못할 2가지와\n나와 비슷한 3가지 찾아보기 앞면", | ||
detailTitle = "이상형의 특성 10가지 적어보고,\n절대 포기 못할 2가지와\n나와 비슷한 3가지 찾아보기 뒷면", | ||
detailContent = "평소에 바빠서 연락하지 못한 사람이 있다면 안부인사 개인톡을 보내 봐. 꼭 만나서 밥을 먹거나 하지 않아도 연락 한 통이 나와 그 사람을 연결하는 방법이 될 수 있어. 난 너를 믿", | ||
detailTime = "5~10분", | ||
detailPlace = "회사 옥상, 점심식사 후 돌아가는 길" | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="88dp" | ||
android:height="46dp" | ||
android:viewportWidth="88" | ||
android:viewportHeight="46"> | ||
<path | ||
android:pathData="M21.039,0C9.419,0 0,9.419 0,21.039C0,32.658 9.419,42.078 21.039,42.078H42.029L43.039,45.299C43.332,46.234 44.654,46.234 44.947,45.299L45.958,42.078H66.961C78.581,42.078 88,32.658 88,21.039C88,9.419 78.581,0 66.961,0H21.039Z" | ||
android:fillColor="#ffffff" | ||
android:fillType="evenOdd" /> | ||
<group> | ||
<clip-path | ||
android:pathData="M21.039,0C9.419,0 0,9.419 0,21.039C0,32.658 9.419,42.078 21.039,42.078H42.029L43.039,45.299C43.332,46.234 44.654,46.234 44.947,45.299L45.958,42.078H66.961C78.581,42.078 88,32.658 88,21.039C88,9.419 78.581,0 66.961,0H21.039Z" | ||
android:fillType="evenOdd" /> | ||
<path | ||
android:pathData="M42.029,42.078L42.983,41.778L42.764,41.078H42.029V42.078ZM43.039,45.299L42.085,45.598V45.598L43.039,45.299ZM44.947,45.299L43.993,45L44.947,45.299ZM45.958,42.078V41.078H45.223L45.003,41.778L45.958,42.078ZM1,21.039C1,9.972 9.972,1 21.039,1V-1C8.867,-1 -1,8.867 -1,21.039H1ZM21.039,41.078C9.972,41.078 1,32.106 1,21.039H-1C-1,33.21 8.867,43.078 21.039,43.078V41.078ZM42.029,41.078H21.039V43.078H42.029V41.078ZM43.993,45L42.983,41.778L41.075,42.377L42.085,45.598L43.993,45ZM43.993,45V45L42.085,45.598C42.671,47.467 45.316,47.467 45.902,45.598L43.993,45ZM45.003,41.778L43.993,45L45.902,45.598L46.912,42.377L45.003,41.778ZM66.961,41.078H45.958V43.078H66.961V41.078ZM87,21.039C87,32.106 78.028,41.078 66.961,41.078V43.078C79.133,43.078 89,33.21 89,21.039H87ZM66.961,1C78.028,1 87,9.972 87,21.039H89C89,8.867 79.133,-1 66.961,-1V1ZM21.039,1H66.961V-1H21.039V1Z" | ||
android:fillColor="#CACDD2" /> | ||
</group> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.