diff --git a/app/build.gradle b/app/build.gradle index 8ec065d..ecbc86f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -59,6 +59,9 @@ android { kotlinOptions { jvmTarget = '1.8' } + buildFeatures { + viewBinding true + } } dependencies { diff --git a/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/CustomContentDialogFragment.kt b/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/CustomContentDialogFragment.kt new file mode 100644 index 0000000..2614326 --- /dev/null +++ b/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/CustomContentDialogFragment.kt @@ -0,0 +1,82 @@ +package com.moyerun.moyeorun_android.common.dialog + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.moyerun.moyeorun_android.R +import com.moyerun.moyeorun_android.common.extension.getStringFromArgument +import com.moyerun.moyeorun_android.common.extension.putStringToArgument +import com.moyerun.moyeorun_android.databinding.DialogCustomContentBinding + +abstract class CustomContentDialogFragment : BaseDialogFragment() { + + final override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + return DialogCustomContentBinding.inflate(inflater, container, false).apply { + contentCustomDialog.addView( + onCreateContentView( + inflater, + contentCustomDialog, + savedInstanceState + ) + ) + }.root + } + + final override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + val binding = DialogCustomContentBinding.bind(view) + binding.headerTextDialog.textDialogHeader.text = getStringFromArgument(ARG_TITLE) + with(binding.footerTextDialog) { + buttonNegativeDialogFooter.text = + getStringFromArgument(ARG_LABEL_NEGATIVE, getString(R.string.cancel)) + buttonPositiveDialogFooter.text = + getStringFromArgument(ARG_LABEL_POSITIVE, getString(R.string.ok)) + + buttonNegativeDialogFooter.setOnClickListener { + onNegativeClick() + dismissAllowingStateLoss() + } + + buttonPositiveDialogFooter.setOnClickListener { + onPositiveClick() + dismissAllowingStateLoss() + } + } + onContentViewCreated(view, savedInstanceState) + } + + abstract fun onCreateContentView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View + + abstract fun onContentViewCreated(view: View, savedInstanceState: Bundle?) + + protected open fun onPositiveClick() { } + + protected open fun onNegativeClick() { } + + protected fun setTitle(title: String?) { + putStringToArgument(ARG_TITLE, title) + } + + protected fun setPositiveLabel(label: String?) { + putStringToArgument(ARG_LABEL_POSITIVE, label) + } + + protected fun setNegativeLabel(label: String?) { + putStringToArgument(ARG_LABEL_NEGATIVE, label) + } + + companion object { + private const val ARG_TITLE = "title" + private const val ARG_LABEL_NEGATIVE = "negativeLabel" + private const val ARG_LABEL_POSITIVE = "positiveLabel" + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/round_background_12.xml b/app/src/main/res/drawable/round_background_12.xml new file mode 100644 index 0000000..e7fec68 --- /dev/null +++ b/app/src/main/res/drawable/round_background_12.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/round_background_4.xml b/app/src/main/res/drawable/round_background_4.xml new file mode 100644 index 0000000..ddba8d4 --- /dev/null +++ b/app/src/main/res/drawable/round_background_4.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/round_border_background_4.xml b/app/src/main/res/drawable/round_border_background_4.xml new file mode 100644 index 0000000..db74438 --- /dev/null +++ b/app/src/main/res/drawable/round_border_background_4.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_custom_content.xml b/app/src/main/res/layout/dialog_custom_content.xml new file mode 100644 index 0000000..def9fbd --- /dev/null +++ b/app/src/main/res/layout/dialog_custom_content.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_footer_two_button.xml b/app/src/main/res/layout/dialog_footer_two_button.xml new file mode 100644 index 0000000..5f607a5 --- /dev/null +++ b/app/src/main/res/layout/dialog_footer_two_button.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_header_text.xml b/app/src/main/res/layout/dialog_header_text.xml new file mode 100644 index 0000000..5a923f2 --- /dev/null +++ b/app/src/main/res/layout/dialog_header_text.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..c53993b --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,4 @@ + + + 17dp + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6f6e6ef..7358fc5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,8 @@ MoyeoRun-android + + + 취소 + 확인 + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 01953d4..c0aec0a 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -14,4 +14,58 @@ @color/main_white + + + + + + + + + + + + + + + + + + + \ No newline at end of file