Skip to content

Commit

Permalink
#292 [ui] 피드백보내기 뷰 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
2zerozu committed Sep 23, 2023
1 parent 6bed968 commit 6423ffa
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".presentation.feedback.FeedbackActivity"
android:exported="false"
android:screenOrientation="portrait"/>
<activity
android:name=".presentation.todo.add.AddToDoActivity"
android:exported="false"
Expand Down Expand Up @@ -137,9 +141,7 @@
<activity
android:name=".presentation.practice.GalleryPracticeActivity"
android:exported="false"
android:screenOrientation="portrait">

</activity>
android:screenOrientation="portrait"/>

<service
android:name=".HousMessageService"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package hous.release.android.presentation.feedback

import android.os.Bundle
import androidx.activity.viewModels
import androidx.navigation.fragment.NavHostFragment
import dagger.hilt.android.AndroidEntryPoint
import hous.release.android.R
import hous.release.android.databinding.ActivityFeedbackBinding
import hous.release.android.presentation.feedback.feedback.FeedbackViewModel
import hous.release.android.util.UiEvent
import hous.release.android.util.binding.BindingActivity
import hous.release.android.util.dialog.LoadingDialogFragment
import hous.release.android.util.extension.repeatOnStarted

@AndroidEntryPoint
class FeedbackActivity : BindingActivity<ActivityFeedbackBinding>(R.layout.activity_feedback) {
private val feedbackViewModel by viewModels<FeedbackViewModel>()

private val navController by lazy {
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.fc_feedback) as NavHostFragment
navHostFragment.navController
}

private val loadingDialogFragment by lazy {
supportFragmentManager.findFragmentByTag(LoadingDialogFragment.TAG) as? LoadingDialogFragment
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initIsDeleting()
collectFeedbackUiEvent()
}

private fun initIsDeleting() {
feedbackViewModel.initIsDeleting(false)
}

private fun collectFeedbackUiEvent() {
repeatOnStarted {
feedbackViewModel.uiEvent.collect { uiEvent ->
when (uiEvent) {
UiEvent.LOADING -> {
loadingDialogFragment?.show(
supportFragmentManager,
LoadingDialogFragment.TAG
)
}
UiEvent.SUCCESS -> {
loadingDialogFragment?.dismiss()
navController.navigate(R.id.action_feedbackFragment_to_feedbackDoneFragment)
}
UiEvent.ERROR -> {
loadingDialogFragment?.dismiss()
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package hous.release.android.presentation.feedback.feedbackDone

import android.os.Bundle
import android.view.View
import androidx.activity.addCallback
import dagger.hilt.android.AndroidEntryPoint
import hous.release.android.R
import hous.release.android.databinding.FragmentFeedbackDoneBinding
import hous.release.android.util.binding.BindingFragment
import hous.release.android.util.extension.setOnSingleClickListener

@AndroidEntryPoint
class FeedbackDoneFragment :
BindingFragment<FragmentFeedbackDoneBinding>(R.layout.fragment_feedback_done) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initReturnBtnClickListener()
initBackPressedCallback()
}

private fun initReturnBtnClickListener() {
binding.tvFeedbackDoneReturn.setOnSingleClickListener {
requireActivity().finish()
}
}

private fun initBackPressedCallback() {
requireActivity().onBackPressedDispatcher.addCallback {
requireActivity().finish()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.activity.viewModels
import dagger.hilt.android.AndroidEntryPoint
import hous.release.android.R
import hous.release.android.databinding.ActivitySettingsBinding
import hous.release.android.presentation.feedback.FeedbackActivity
import hous.release.android.presentation.login.LoginActivity
import hous.release.android.presentation.out_room.OutRoomActivity
import hous.release.android.presentation.withdraw.WithdrawActivity
Expand Down Expand Up @@ -70,7 +71,7 @@ class SettingsActivity : BindingActivity<ActivitySettingsBinding>(R.layout.activ

private fun initFeedbackClickListener() {
binding.tvSettingsFeedback.setOnClickListener {
// TODO by 이빵주 : FeedbackActivity 만들어서 띄우기
startActivity(Intent(this, FeedbackActivity::class.java))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ class WithdrawActivity : BindingActivity<ActivityWithdrawBinding>(R.layout.activ
}
}
}

}
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_feedback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".presentation.feedback.FeedbackActivity">

<androidx.fragment.app.FragmentContainerView
android:id="@+id/fc_feedback"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_feedback" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
65 changes: 65 additions & 0 deletions app/src/main/res/layout/fragment_feedback_done.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".presentation.feedback.feedbackDone.FeedbackDoneFragment">

<TextView
android:id="@+id/tv_feedback_done_return"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="14dp"
android:clickable="true"
android:padding="10dp"
android:text="@string/feedback_done_return"
android:textColor="@color/hous_blue"
android:theme="@style/B2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/iv_feedback_done_graphic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="208dp"
android:src="@drawable/ic_feedback_done"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_feedback_done_return" />

<TextView
android:id="@+id/tv_feedback_done_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/feedback_done_title"
android:textColor="@color/hous_black"
android:theme="@style/H3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_feedback_done_graphic" />

<TextView
android:id="@+id/tv_feedback_done_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/feedback_done_desc"
android:textColor="@color/hous_g_6"
android:theme="@style/B1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_feedback_done_title" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
24 changes: 24 additions & 0 deletions app/src/main/res/navigation/nav_feedback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_withdraw"
app:startDestination="@id/feedbackFragment">

<fragment
android:id="@+id/feedbackFragment"
android:name="hous.release.android.presentation.feedback.feedback.FeedbackFragment"
android:label="FeedbackFragment"
tools:layout="@layout/fragment_feedback">
<action
android:id="@+id/action_feedbackFragment_to_feedbackDoneFragment"
app:destination="@id/feedbackDoneFragment" />
</fragment>

<fragment
android:id="@+id/feedbackDoneFragment"
android:name="hous.release.android.presentation.feedback.feedbackDone.FeedbackDoneFragment"
android:label="FeedbackDoneFragment"
tools:layout="@layout/fragment_feedback_done" />

</navigation>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@
<string name="withdraw_done_title">그동안 사용해주셔서 감사합니다.</string>
<string name="withdraw_done_desc">정상적으로 회원 탈퇴 되었습니다.\n언제든 돌아오세요!</string>
<string name="withdraw_done_return">처음으로</string>

<!-- FeedbackDone -->
<string name="feedback_done_return">완료하기</string>
<string name="feedback_done_title">피드백 접수가 완료되었어요!</string>
<string name="feedback_done_desc">열심히 반영하여 더 좋은 Hous-가 되겠습니다.</string>
Expand Down

0 comments on commit 6423ffa

Please sign in to comment.