Skip to content

Commit

Permalink
#176 [feat] dim 다이얼로그 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
pump9918 committed Jun 23, 2024
1 parent ac614b7 commit e634b0b
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,26 @@ class AddListActivity : BindingActivity<ActivityAddListBinding>(R.layout.activit
viewPager = binding.vpAddListMakerCard
setStatusBarColorFromResource(R.color.background)

setBackEnter()
startMakerHelpModal()
setInitBinding()
setHappyDetailCardPagerAdapter()
setCurrentCard()
setBackEnter()
startMakerHelpModal()
setRoutineThemeListAdapter()
setItemDeco()
setupObservers()
}
private fun setBackEnter() { // 이전 버튼
binding.ivAddListBackArrow.setSingleOnClickListener {
finish()
}
}

private fun startMakerHelpModal() { // 메이커 도움말 모달 실행
binding.ivAddListMakerHelp.setSingleOnClickListener {
MakerHelpDialogFragment().show(supportFragmentManager, "MakerHelpDialog")
}
}

private fun setInitBinding() { // 초기 바인딩 설정
viewModel.getMakerCard()
Expand Down Expand Up @@ -63,17 +74,7 @@ class AddListActivity : BindingActivity<ActivityAddListBinding>(R.layout.activit
return itemId.toInt()
}

private fun setBackEnter() { // 이전 버튼
binding.ivAddListBackArrow.setSingleOnClickListener {
finish()
}
}

private fun startMakerHelpModal() { // 메이커 도움말 모달 실행
binding.ivAddListMakerHelp.setSingleOnClickListener {
// 모달 띄우기
}
}

private fun setRoutineThemeListAdapter() {
with(binding) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.sopetit.softie.ui.addroutine.list

import android.app.Dialog
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import androidx.fragment.app.DialogFragment
import com.sopetit.softie.R
import com.sopetit.softie.databinding.DialogMakerHelpBinding

class MakerHelpDialogFragment : DialogFragment() {

private var _binding: DialogMakerHelpBinding? = null
private val binding get() = _binding
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState)
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
dialog.setContentView(R.layout.dialog_maker_help)

_binding =
DialogMakerHelpBinding.bind(dialog.findViewById<View>(R.id.cl_maker_help_dialog_border))
return dialog
}

override fun onStart() {
super.onStart()
dialog?.window?.attributes?.let {
it.dimAmount = 0.72f
dialog?.window?.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
}

dialog?.window?.setGravity(Gravity.TOP or Gravity.END)
val params: WindowManager.LayoutParams? = dialog?.window?.attributes

params?.x =
requireContext().resources.getDimensionPixelSize(R.dimen.maker_help_dialog_end_margin)
params?.y =
requireContext().resources.getDimensionPixelSize(R.dimen.maker_help_dialog_top_margin)
dialog?.window?.attributes = params

binding?.ivMakerHelpDialogExit?.setOnClickListener {
dismiss()
}
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_exit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportWidth="18"
android:viewportHeight="18">
<path
android:pathData="M14.069,5.532C14.281,5.32 14.4,5.032 14.4,4.732C14.4,4.432 14.281,4.144 14.069,3.932C13.856,3.719 13.568,3.6 13.268,3.6C12.968,3.6 12.68,3.719 12.468,3.932L9,7.4L5.532,3.932C5.32,3.719 5.032,3.6 4.732,3.6C4.432,3.6 4.144,3.719 3.932,3.932C3.719,4.144 3.6,4.432 3.6,4.732C3.6,5.032 3.719,5.32 3.932,5.532L7.4,9L3.932,12.468C3.719,12.68 3.6,12.968 3.6,13.268C3.6,13.568 3.719,13.856 3.932,14.069C4.144,14.281 4.432,14.4 4.732,14.4C5.032,14.4 5.32,14.281 5.532,14.069L9,10.601L12.468,14.069C12.68,14.281 12.968,14.4 13.268,14.4C13.568,14.4 13.856,14.281 14.069,14.069C14.281,13.856 14.4,13.568 14.4,13.268C14.4,12.968 14.281,12.68 14.069,12.468L10.601,9L14.069,5.532Z"
android:fillColor="#9FA4A9"/>
</vector>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/shape_gray0_fill_10_rect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="@color/gray0" />
<corners android:radius="10dp" />
</shape>
54 changes: 54 additions & 0 deletions app/src/main/res/layout/dialog_maker_help.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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:id="@+id/cl_maker_help_dialog_border"
android:layout_width="272dp"
android:layout_height="wrap_content"
android:background="@drawable/shape_gray0_fill_10_rect">

<TextView
android:id="@+id/tv_maker_help_dialog_title"
style="@style/head4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/maker_help_dialog_title"
android:textColor="@color/gray700"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/iv_maker_help_dialog_exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:src="@drawable/ic_exit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_maker_help_dialog_content"
style="@style/caption1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="16dp"
android:text="@string/maker_help_dialog_content"
android:textColor="@color/gray650"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_maker_help_dialog_title" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

2 changes: 2 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
<dimen name="chip_margin">6dp</dimen>
<dimen name="happy_list_first_margin">8dp</dimen>
<dimen name="happy_list_margin">4dp</dimen>
<dimen name="maker_help_dialog_top_margin">112dp</dimen>
<dimen name="maker_help_dialog_end_margin">20dp</dimen>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@
<string name="binding_error">Binding not initialized to reference the view.</string>
<string name="dialog_update_store_link">https://play.google.com/store/apps/details?id=com.sopetit.softie</string>

<!-- maker dialog -->
<string name="maker_help_dialog_title">루틴메이커 테마란?</string>
<string name="maker_help_dialog_content">전문가들이 만드는 루틴을 직접 실천해 볼 수 있는 테마에요.</string>

<!-- tutorial -->
<string name="home_tutorial_title_routine">소프티엔 총 2가지 루틴이 있어요!</string>
<string name="home_tutorial_title_cotton">솜뭉치를 얻으면?</string>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,10 @@
<item name="android:textColor">@color/selector_happy_type_text_color</item>
</style>

<!-- Dim Style -->
<style name="MakerHelpDialog" parent="@style/Theme.MaterialComponents.Dialog">
<item name="android:background">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.72</item>
</style>
</resources>

0 comments on commit e634b0b

Please sign in to comment.