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
deleted file mode 100644
index 2614326..0000000
--- a/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/CustomContentDialogFragment.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-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/java/com/moyerun/moyeorun_android/common/dialog/BaseDialogFragment.kt b/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/RoundDialogFragment.kt
similarity index 97%
rename from app/src/main/java/com/moyerun/moyeorun_android/common/dialog/BaseDialogFragment.kt
rename to app/src/main/java/com/moyerun/moyeorun_android/common/dialog/RoundDialogFragment.kt
index 7de8ee9..4eabf6f 100644
--- a/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/BaseDialogFragment.kt
+++ b/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/RoundDialogFragment.kt
@@ -11,7 +11,7 @@ import com.moyerun.moyeorun_android.common.extension.getBooleanFromArgument
import com.moyerun.moyeorun_android.common.extension.isActivityDestroyed
import com.moyerun.moyeorun_android.common.extension.putBooleanToArgument
-open class BaseDialogFragment : DialogFragment() {
+open class RoundDialogFragment : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return object : Dialog(requireContext()) {
diff --git a/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/TextConfirmDialogFragment.kt b/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/TextConfirmDialogFragment.kt
deleted file mode 100644
index 1bf5c35..0000000
--- a/app/src/main/java/com/moyerun/moyeorun_android/common/dialog/TextConfirmDialogFragment.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-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.common.extension.getStringFromArgument
-import com.moyerun.moyeorun_android.common.extension.putStringToArgument
-import com.moyerun.moyeorun_android.databinding.DialogContentTextBinding
-
-class TextConfirmDialogFragment : CustomContentDialogFragment() {
-
- private var onPositiveClick: () -> Unit = {}
- private var onNegativeClick: () -> Unit = {}
-
- override fun onCreateContentView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- return DialogContentTextBinding.inflate(inflater, container, false).root
- }
-
- override fun onContentViewCreated(view: View, savedInstanceState: Bundle?) {
- val binding = DialogContentTextBinding.bind(view)
- binding.textDialogContent.text = getStringFromArgument(ARG_CONTENT)
- }
-
- override fun onPositiveClick() {
- onPositiveClick.invoke()
- }
-
- override fun onNegativeClick() {
- onNegativeClick.invoke()
- }
-
- companion object {
- private const val ARG_CONTENT = "content"
-
- fun newInstance(
- title: String,
- content: String,
- positiveLabel: String? = null,
- negativeLabel: String? = null,
- dismissOnPause: Boolean = false,
- isCancelable: Boolean = false,
- onPositiveClick: () -> Unit = {},
- onNegativeClick: () -> Unit = {}
- ): TextConfirmDialogFragment = TextConfirmDialogFragment().apply {
- putStringToArgument(ARG_CONTENT, content)
- setTitle(title)
- setPositiveLabel(positiveLabel)
- setNegativeLabel(negativeLabel)
- setDismissOnPause(dismissOnPause)
- this.isCancelable = isCancelable
- this.onPositiveClick = onPositiveClick
- this.onNegativeClick = onNegativeClick
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/moyerun/moyeorun_android/common/extension/FragmentExtension.kt b/app/src/main/java/com/moyerun/moyeorun_android/common/extension/FragmentExtension.kt
index a999fc2..e36ee18 100644
--- a/app/src/main/java/com/moyerun/moyeorun_android/common/extension/FragmentExtension.kt
+++ b/app/src/main/java/com/moyerun/moyeorun_android/common/extension/FragmentExtension.kt
@@ -1,7 +1,6 @@
package com.moyerun.moyeorun_android.common.extension
import android.widget.Toast
-import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
@@ -10,36 +9,6 @@ fun Fragment.toast(msg: String, isShort: Boolean = false) {
Toast.makeText(context, msg, if (isShort) Toast.LENGTH_SHORT else Toast.LENGTH_LONG).show()
}
-fun Fragment.putStringToArgument(key: String, value: String?) {
- val args = arguments
- if (args == null) {
- arguments = bundleOf(key to value)
- } else {
- args.apply {
- putString(key, value)
- }
- }
-}
-
-fun Fragment.getStringFromArgument(key: String, defaultValue: String = ""): String {
- return arguments?.getString(key, defaultValue)?: defaultValue
-}
-
-fun Fragment.putBooleanToArgument(key: String, value: Boolean) {
- val args = arguments
- if (args == null) {
- arguments = bundleOf(key to value)
- } else {
- args.apply {
- putBoolean(key, value)
- }
- }
-}
-
-fun Fragment.getBooleanFromArgument(key: String, value: Boolean): Boolean {
- return arguments?.getBoolean(key, value)?: value
-}
-
inline fun FragmentManager?.showAllowingStateLoss(
tag: String?,
dialogFragmentFactory: () -> DialogFragment
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 74fa7ce..bc23f10 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -16,6 +16,8 @@
#333333
#828282
#A9A9A9
+ #000000
+ #FFFFFF
#EBECEF
diff --git a/app/src/main/res/values/styles_dialog.xml b/app/src/main/res/values/styles_dialog.xml
index ad6a78f..2290048 100644
--- a/app/src/main/res/values/styles_dialog.xml
+++ b/app/src/main/res/values/styles_dialog.xml
@@ -22,29 +22,19 @@
- center
-
-
+
\ 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 a2a9a58..166a24c 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -20,5 +20,5 @@
- @color/text_hint_gray
- 18dp
-
+
\ No newline at end of file