Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Design/#26] 답변 취소 Dialog 구현 #27

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.sopt.umbba_android.presentation.qna

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.fragment.app.DialogFragment
import com.sopt.umbba_android.databinding.FragmentConfirmAnswerDialogBinding

class BackAnswerDialogFragment : DialogFragment() {

private var _binding: FragmentConfirmAnswerDialogBinding? = null
private val binding get() = requireNotNull(_binding) { "BackAnswerDialogFragment is null" }

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentConfirmAnswerDialogBinding.inflate(inflater, container, false)
return binding.root
}

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

}

override fun onResume() {
super.onResume()
dialog?.window?.setLayout(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT
)
}

override fun onDestroy() {
super.onDestroy()
_binding = null
}
}
63 changes: 63 additions & 0 deletions app/src/main/res/layout/fragment_back_answer_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/inset_dialog_background">

<TextView
android:id="@+id/tv_confirm"
style="@style/AndroidBody1_2Regular16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="24dp"
android:gravity="center"
android:text="@string/back_confirm"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="33dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="23dp"
app:layout_constraintTop_toBottomOf="@id/tv_confirm"
app:layout_constraintBottom_toBottomOf="parent">

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_cancel"
style="@style/AndroidBody1_2Regular16"
android:layout_width="124dp"
android:layout_height="48dp"
android:background="@drawable/shape_grey_btn_r50_stroke_rect"
android:text="@string/cancel"
android:textColor="@color/grey_btn_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_save"
style="@style/AndroidBody1_2Regular16"
android:layout_width="124dp"
android:layout_height="48dp"
android:layout_marginStart="13dp"
android:background="@drawable/shape_grey74_btn_r50_rect"
android:text="@string/confirm"
android:textColor="@color/white"
app:layout_constraintStart_toEndOf="@id/btn_cancel"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
7 changes: 6 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,10 @@
<string name="save_answer">답변을 저장하시겠어요?</string>
<string name="back">돌아가기</string>
<string name="save">저장</string>


<!-- back answer dialog fragment-->
<string name="back_confirm">답변 작성을 취소하시겠습니까?\n 작성 중인 답변은 저장되지 않습니다.</string>
<string name="cancel">취소</string>
<string name="confirm">확인</string>

</resources>