Skip to content

Commit

Permalink
[#8] 기본 다이얼로그 추가
Browse files Browse the repository at this point in the history
- 디자인 가이드 변경으로 CustomContentDialogFragment, RoundDialogFragment 제거
- 해당 공용 다이얼로그 없이는 BaseDialogFragment 명칭이 애매해지므로 RoundDialogFragment 로 수정
- 버튼 스타일 수정 (배경 X, 글자 색 수정)
  • Loading branch information
ethan-223 committed Apr 19, 2022
1 parent 128da7a commit bc19c9a
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 188 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<color name="text_default_black">#333333</color>
<color name="text_gray">#828282</color>
<color name="text_hint_gray">#A9A9A9</color>
<color name="text_black">#000000</color>
<color name="text_white">#FFFFFF</color>

<!-- Line colors -->
<color name="line_dialog_divider">#EBECEF</color>
Expand Down
16 changes: 3 additions & 13 deletions app/src/main/res/values/styles_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,19 @@
<item name="android:gravity">center</item>
</style>

<style name="Dialog.Content">
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@color/text_default_black</item>
<item name="android:textSize">18dp</item>
</style>

<style name="Dialog.Button">
<item name="android:minWidth">0dp</item>
<item name="android:minHeight">0dp</item>
<item name="android:paddingTop">16dp</item>
<item name="android:paddingBottom">16dp</item>
<item name="android:paddingVertical">21dp</item>
<item name="android:textSize">16dp</item>
</style>

<style name="Dialog.Button.Negative">
<item name="android:background">@drawable/round_border_background_4</item>
<item name="android:textColor">@color/text_default_black</item>
</style>

<style name="Dialog.Button.Positive">
<item name="android:background">@drawable/round_background_4</item>
<item name="android:backgroundTint">@color/main_blue</item>
<item name="android:textColor">@color/main_white</item>
<item name="android:textColor">@color/main_blue</item>
</style>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
<item name="android:textColorHint">@color/text_hint_gray</item>
<item name="android:textSize">18dp</item>
</style>

</resources>

0 comments on commit bc19c9a

Please sign in to comment.