-
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.
- Loading branch information
Showing
9 changed files
with
215 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
60 changes: 60 additions & 0 deletions
60
app/src/main/java/hous/release/android/presentation/feedback/FeedbackActivity.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,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() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...main/java/hous/release/android/presentation/feedback/feedbackDone/FeedbackDoneFragment.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,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() | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -68,5 +68,4 @@ class WithdrawActivity : BindingActivity<ActivityWithdrawBinding>(R.layout.activ | |
} | ||
} | ||
} | ||
|
||
} |
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,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> |
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,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> |
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,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> |
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