-
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
…iewmodel #68 [feat] 룸메이트 카드 성향결과 / 기능 구현
- Loading branch information
Showing
19 changed files
with
118 additions
and
94 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
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
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.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,34 @@ | ||
package com.hous.hous_aos.ui.profile | ||
|
||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class ResultViewModel : ViewModel() { | ||
private val _resultData = MutableLiveData( | ||
ResultData( | ||
userName = "이영주", | ||
typeName = "룰 세터 육각이", | ||
typeColor = "GREEN", | ||
typeImg = "https://team-hous.s3.ap-northeast-2.amazonaws.com/Type/test/type_test_1.png", | ||
typeOneComment = "한번 더 생각하고 배려하기", | ||
typeDesc = "여러 생활영역에 대해 존중의 기준이\n" + | ||
"대체로 높은 편이에요. 함께 생활하는\n" + | ||
"룸메이트에 대해 미리 살펴보고 배려한다면\n" + | ||
"더 편안한 공동생활이 이루어질 수 있을 거예요.", | ||
typeRulesTitle = "오각이와 함께 정하면 좋은 Rule!", | ||
typeRules = listOf( | ||
"미사용 전자제품 코드 뽑아두기", | ||
"외출 시 가스벨브,전등 확인하기", | ||
), | ||
good = ResultData.Homie( | ||
typeName = "동글이", | ||
typeImg = "https://team-hous.s3.ap-northeast-2.amazonaws.com/Type/test/type_test_1.png", | ||
), | ||
bad = ResultData.Homie( | ||
typeName = "사각이", | ||
typeImg = "https://team-hous.s3.ap-northeast-2.amazonaws.com/Type/test/type_test_1.png", | ||
), | ||
) | ||
) | ||
val resultData get() = _resultData | ||
} |
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/hous/hous_aos/ui/profile/TendencyResultActivity.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 |
---|---|---|
@@ -1,16 +1,52 @@ | ||
package com.hous.hous_aos.ui.profile | ||
|
||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.content.ContextCompat | ||
import androidx.databinding.DataBindingUtil | ||
import com.hous.hous_aos.R | ||
import com.hous.hous_aos.databinding.ActivityTendencyResultBinding | ||
import com.hous.hous_aos.util.setDrawable | ||
|
||
class TendencyResultActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityTendencyResultBinding | ||
val viewModel: ResultViewModel by viewModels() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = DataBindingUtil.setContentView(this, R.layout.activity_tendency_result) | ||
setContentView(binding.root) | ||
init() | ||
} | ||
|
||
private fun init() { | ||
binding.vm = viewModel | ||
binding.lifecycleOwner = this | ||
|
||
binding.tvEnd.setOnClickListener { | ||
finish() | ||
} | ||
|
||
viewModel.resultData.observe(this) { data -> | ||
if (data.good.typeName == "동글이") { | ||
binding.tvGoodName.text = "행복한 동글이" | ||
binding.clGood.backgroundTintList = this.getColorStateList(R.color.hous_yellow_bg) | ||
} | ||
if (data.bad.typeName == "사각이") { | ||
binding.tvBadName.text = "불행한 사각이" | ||
binding.clBad.backgroundTintList = this.getColorStateList(R.color.hous_blue_bg) | ||
} | ||
if (data.typeColor == "GREEN") { | ||
binding.tvComment.setTextColor(ContextCompat.getColor(this, R.color.hous_green)) | ||
binding.tvRulesTitle.setTextColor(ContextCompat.getColor(this, R.color.hous_green)) | ||
binding.tvRulesTitle.backgroundTintList = | ||
this.getColorStateList(R.color.hous_green_bg) | ||
binding.clComment.backgroundTintList = this.getColorStateList(R.color.hous_green_bg) | ||
binding.clRules.backgroundTintList = this.getColorStateList(R.color.hous_green_bg) | ||
binding.ivShape1.setDrawable(R.drawable.ic_hexagon) | ||
binding.ivShape2.setDrawable(R.drawable.ic_hexagon) | ||
} | ||
} | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
...s/drawable/shape_blug_bg_fill_15_rect.xml → app/src/main/res/drawable/shape_15_rect.xml
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/hous_blue_bg" /> | ||
<corners android:radius="15dp" /> | ||
|
||
</shape> |
1 change: 0 additions & 1 deletion
1
...s/drawable/shape_blue_bg_fill_21_rect.xml → app/src/main/res/drawable/shape_21_rect.xml
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/hous_blue_bg" /> | ||
<corners android:radius="21dp" /> | ||
|
||
</shape> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.