Skip to content

Commit

Permalink
[Feat/#109] 엔딩 페이지 팝업 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
ss99x2002 committed Aug 26, 2023
1 parent a4440bb commit 04dee80
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 122 deletions.
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
android:name=".presentation.setting.DeleteAccountActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".presentation.home.EndingActivity"
android:exported="false"
android:screenOrientation="portrait" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.sopt.umbba_android.presentation.home

import android.content.Intent
import android.os.Bundle
import android.util.Log
import com.sopt.umbba_android.R
import com.sopt.umbba_android.databinding.ActivityEndingBinding
import com.sopt.umbba_android.util.binding.BindingActivity

class EndingActivity : BindingActivity<ActivityEndingBinding>(R.layout.activity_ending) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setBtnClickListener()
}

private fun setBtnClickListener() {
with(binding) {
ivClose.setOnClickListener {
Log.e("hyeon","x btn click 됨")
setResult(RESULT_OK)
finish()
}
btnSurvey.setOnClickListener {
TODO("설문조사 링크 넣기")
}
btnDeleteAccount.setOnClickListener {
TODO("회원탈퇴 로직 넣기")
}
}
}

override fun onResume() {
super.onResume()
Log.e("hyeon", "ending = onResume()")
}

override fun onDestroy() {
super.onDestroy()
Log.e("hyeon", "ending = onDestroy()")
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.sopt.umbba_android.presentation.home

import android.app.Activity.RESULT_OK
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.View
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.viewModels
import coil.load
import com.sopt.umbba_android.R
Expand All @@ -21,15 +25,23 @@ import com.sopt.umbba_android.util.setOnSingleClickListener

class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home) {
private val viewModel: HomeViewModel by viewModels { ViewModelFactory(requireActivity()) }

private val startForResult =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
if (it.resultCode == RESULT_OK) {
viewModel.setStateCloseEnding()
}
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.vm = viewModel
observeData()
}


private fun setClickEvent(responseCaseDto: HomeCaseResponseDto.HomeCaseData) {
binding.btnAnswer.setOnSingleClickListener {
viewModel.getResponseCase()
when (responseCaseDto.responseCase) {
1 -> startActivity(Intent(requireActivity(), QuestionAnswerActivity::class.java))
2 -> showInviteDialog(
Expand All @@ -44,6 +56,10 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
private fun observeData() {
viewModel.homeData.observe(viewLifecycleOwner) {
setBackground(it.section)
if (it.index == 8 && viewModel.isCloseEnding.value == false && viewModel.isObserveIndex.value == false) {
viewModel.setStateObserveIndex()
startForResult.launch(Intent(requireActivity(), EndingActivity::class.java))
}
}
viewModel.responseCaseData.observe(viewLifecycleOwner) {
setClickEvent(it)
Expand Down Expand Up @@ -83,6 +99,9 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home

override fun onResume() {
super.onResume()
if (viewModel.isObserveIndex.value != true) {
viewModel.getHomeData()
}
viewModel.getResponseCase()
}
}
246 changes: 125 additions & 121 deletions app/src/main/res/layout/activity_ending.xml
Original file line number Diff line number Diff line change
@@ -1,129 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_ending_gradient">


<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/iv_close"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="11dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<layout>

<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/ic_close_black"
app:layout_constraintBottom_toBottomOf="parent"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_ending_gradient">


<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/iv_close"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="11dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/ic_close_black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="72dp"
android:text="@string/ending_title"
android:textAppearance="@style/AndroidHead1SemiBold24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="72dp"
android:text="@string/ending_title"
android:textAppearance="@style/AndroidHead1SemiBold24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_survey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="40dp"
android:text="@string/ending_survey_title"
android:textAppearance="@style/AndroidSubHead2Regular20"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title" />

<TextView
android:id="@+id/tv_survey_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="8dp"
android:text="@string/ending_survey_caption"
android:textAppearance="@style/AndroidCaptionRegular10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_survey_title" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_survey"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_pri500_btn_r50_rect"
android:stateListAnimator="@null"
android:text="@string/ending_btn_survey"
android:textAppearance="@style/AndroidBody1_1SemiBold16"
android:textColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/tv_survey_caption" />

<View
android:id="@+id/view_dot_line"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_marginHorizontal="18dp"
android:layout_marginTop="28dp"
android:background="@drawable/shape_g800_dot_stroke_rect"
app:layout_constraintTop_toBottomOf="@id/btn_survey" />


<TextView
android:id="@+id/tv_delete_account_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="40dp"
android:text="@string/ending_delete_account"
android:textAppearance="@style/AndroidSubHead2Regular20"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_dot_line" />

<TextView
android:id="@+id/tv_delete_account_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="8dp"
android:text="@string/ending_delete_account_caption"
android:textAppearance="@style/AndroidCaptionRegular10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_delete_account_title" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_delete_account"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_pri500_btn_stroke_r50_rect"
android:stateListAnimator="@null"
android:text="@string/ending_btn_delete_account"
android:textAppearance="@style/AndroidBody1_1SemiBold16"
android:textColor="@color/primary_500"
app:layout_constraintTop_toBottomOf="@id/tv_delete_account_caption" />


<ImageView
android:id="@+id/bg_ending"
android:layout_width="match_parent"
android:layout_height="270dp"
android:scaleType="fitXY"
android:src="@drawable/bg_ending"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/tv_survey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="40dp"
android:text="@string/ending_survey_title"
android:textAppearance="@style/AndroidSubHead2Regular20"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title" />

<TextView
android:id="@+id/tv_survey_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="8dp"
android:text="@string/ending_survey_caption"
android:textAppearance="@style/AndroidCaptionRegular10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_survey_title" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_survey"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_pri500_btn_r50_rect"
android:stateListAnimator="@null"
android:text="@string/ending_btn_survey"
android:textAppearance="@style/AndroidBody1_1SemiBold16"
android:textColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/tv_survey_caption" />

<View
android:id="@+id/view_dot_line"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_marginHorizontal="18dp"
android:layout_marginTop="28dp"
android:background="@drawable/shape_g800_dot_stroke_rect"
app:layout_constraintTop_toBottomOf="@id/btn_survey" />


<TextView
android:id="@+id/tv_delete_account_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="40dp"
android:text="@string/ending_delete_account"
android:textAppearance="@style/AndroidSubHead2Regular20"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_dot_line" />

<TextView
android:id="@+id/tv_delete_account_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="8dp"
android:text="@string/ending_delete_account_caption"
android:textAppearance="@style/AndroidCaptionRegular10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_delete_account_title" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_delete_account"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_pri500_btn_stroke_r50_rect"
android:stateListAnimator="@null"
android:text="@string/ending_btn_delete_account"
android:textAppearance="@style/AndroidBody1_1SemiBold16"
android:textColor="@color/primary_500"
app:layout_constraintTop_toBottomOf="@id/tv_delete_account_caption" />


<ImageView
android:id="@+id/bg_ending"
android:layout_width="match_parent"
android:layout_height="270dp"
android:scaleType="fitXY"
android:src="@drawable/bg_ending"
app:layout_constraintBottom_toBottomOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

0 comments on commit 04dee80

Please sign in to comment.