Skip to content

Commit

Permalink
[MERGE] #77 -> develop
Browse files Browse the repository at this point in the history
[UI/#77] 생성뷰 / 생성 가이드 다이얼로그 추가
  • Loading branch information
Marchbreeze authored Jul 18, 2024
2 parents f9a2f16 + fc75a47 commit bd8db7a
Show file tree
Hide file tree
Showing 15 changed files with 254 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
when (menu.itemId) {
R.id.menu_feed -> navigateTo<FeedFragment>()

R.id.menu_create -> navigateByGenerateStatus()
R.id.menu_create -> navigateTo<CreateFragment>()

R.id.menu_profile -> navigateTo<ProfileFragment>()

Expand All @@ -82,7 +82,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
private fun navigateByGenerateStatus() {
when (viewModel.currentStatus) {
GenerateStatus.COMPLETED -> {
navigateTo<CreateFragment>()
binding.bnvMain.selectedItemId = R.id.menu_create
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ class MainFinishedDialog :
) {
super.onViewCreated(view, savedInstanceState)

initCloseBtnListener()
initMoveToFinishBtnListener()
}

private fun initCloseBtnListener() {
binding.btnClose.setOnSingleClickListener { dismiss() }
}

private fun initMoveToFinishBtnListener() {
binding.btnMoveToFinish.setOnSingleClickListener {
if (viewModel.checkNerPictureInitialized()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MainViewModel
viewModelScope.launch {
generateRepository.getGenerateStatus()
.onSuccess {
currentStatus = GenerateStatus.ERROR
currentStatus = it.status
newPicture = it
}
.onFailure {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package kr.genti.presentation.main.create

import android.os.Bundle
import android.view.View
import android.view.WindowManager
import kr.genti.core.base.BaseDialog
import kr.genti.core.extension.setOnSingleClickListener
import kr.genti.presentation.R
import kr.genti.presentation.databinding.DialogCreateGuideBinding

class CreateGuideDialog :
BaseDialog<DialogCreateGuideBinding>(R.layout.dialog_create_guide) {
override fun onStart() {
super.onStart()
dialog?.window?.apply {
setLayout(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT,
)
setBackgroundDrawableResource(R.color.transparent)
}
}

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

initCloseBtnListener()
}

private fun initCloseBtnListener() {
binding.btnClose.setOnSingleClickListener { dismiss() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CreateViewModel
val selectedAngle = MutableLiveData<CameraAngle>()
val selectedCoverage = MutableLiveData<ShotCoverage>()
val isSelected = MutableLiveData(false)
var isGuideNeeded = true

var imageList = listOf<ImageFileModel>()
var isCompleted = MutableLiveData(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import kr.genti.presentation.databinding.FragmentPoseBinding
class PoseFragment() : BaseFragment<FragmentPoseBinding>(R.layout.fragment_pose) {
private val viewModel by activityViewModels<CreateViewModel>()

private var createGuideDialog: CreateGuideDialog? = null

override fun onViewCreated(
view: View,
savedInstanceState: Bundle?,
Expand All @@ -24,6 +26,7 @@ class PoseFragment() : BaseFragment<FragmentPoseBinding>(R.layout.fragment_pose)
initView()
initNextBtnListener()
initBackPressedListener()
initGuideIfNeeded()
}

private fun initView() {
Expand All @@ -45,6 +48,27 @@ class PoseFragment() : BaseFragment<FragmentPoseBinding>(R.layout.fragment_pose)
viewModel.modCurrentPercent(-33)
}
}
requireActivity().onBackPressedDispatcher.addCallback(requireActivity(), onBackPressedCallback)
requireActivity().onBackPressedDispatcher.addCallback(
requireActivity(),
onBackPressedCallback,
)
}

private fun initGuideIfNeeded() {
if (viewModel.isGuideNeeded) {
createGuideDialog = CreateGuideDialog()
createGuideDialog?.show(childFragmentManager, DIALOG_GUIDE)
viewModel.isGuideNeeded = false
}
}

override fun onDestroyView() {
super.onDestroyView()

createGuideDialog = null
}

companion object {
const val DIALOG_GUIDE = "DIALOG_GUIDE"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ class WaitingErrorDialog :
) {
super.onViewCreated(view, savedInstanceState)

initCloseBtnListener()
initMoveToFinishBtnListener()
}

private fun initCloseBtnListener() {
binding.btnClose.setOnSingleClickListener { dismiss() }
}

private fun initMoveToFinishBtnListener() {
binding.btnAgain.setOnSingleClickListener {
requireActivity().finish()
Expand Down
16 changes: 16 additions & 0 deletions presentation/src/main/res/drawable/img_green_bg_2_word.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="62dp"
android:height="32dp"
android:viewportWidth="62"
android:viewportHeight="32">
<path
android:pathData="M16,1H1V16"
android:strokeWidth="3"
android:fillColor="#00000000"
android:strokeColor="#1CE718"/>
<path
android:pathData="M46,31L61,31L61,16"
android:strokeWidth="3"
android:fillColor="#00000000"
android:strokeColor="#1CE718"/>
</vector>
20 changes: 20 additions & 0 deletions presentation/src/main/res/drawable/img_green_bg_3_word.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="77dp"
android:height="32dp"
android:viewportWidth="77"
android:viewportHeight="32">
<group>
<clip-path
android:pathData="M0,0h77v32h-77z"/>
<path
android:pathData="M16,1H1V16"
android:strokeWidth="3"
android:fillColor="#00000000"
android:strokeColor="#1CE718"/>
<path
android:pathData="M61,31L76,31L76,16"
android:strokeWidth="3"
android:fillColor="#00000000"
android:strokeColor="#1CE718"/>
</group>
</vector>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 119 additions & 0 deletions presentation/src/main/res/layout/dialog_create_guide.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?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">

<ImageView
android:id="@+id/iv_guide_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:adjustViewBounds="true"
android:src="@drawable/img_guide_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_close_dialog"
app:layout_constraintEnd_toEndOf="@id/iv_guide_bg"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_guide_title_up"
style="@style/TextAppearance.Genti.BodyLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
android:text="@string/create_guide_tv_title_up"
app:layout_constraintStart_toStartOf="@id/iv_guide_bg"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_guide_title_ratio"
style="@style/TextAppearance.Genti.Headline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="25dp"
android:background="@drawable/img_green_bg_2_word"
android:gravity="center"
android:text="@string/create_guide_tv_ratio"
app:layout_constraintEnd_toStartOf="@id/tv_guide_title_angle"
app:layout_constraintTop_toBottomOf="@id/tv_guide_title_up" />

<TextView
android:id="@+id/tv_guide_title_angle"
style="@style/TextAppearance.Genti.Headline4"
android:layout_marginEnd="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="@drawable/img_green_bg_2_word"
android:gravity="center"
android:text="@string/create_guide_tv_angle"
app:layout_constraintEnd_toEndOf="@id/iv_guide_bg"
app:layout_constraintStart_toStartOf="@id/iv_guide_bg"
app:layout_constraintTop_toBottomOf="@id/tv_guide_title_up" />

<TextView
android:id="@+id/tv_guide_title_frame"
style="@style/TextAppearance.Genti.Headline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:layout_marginTop="12dp"
android:background="@drawable/img_green_bg_3_word"
android:gravity="center"
android:text="@string/create_guide_tv_frame"
app:layout_constraintStart_toEndOf="@id/tv_guide_title_angle"
app:layout_constraintTop_toBottomOf="@id/tv_guide_title_up" />

<TextView
android:id="@+id/tv_guide_title_down"
style="@style/TextAppearance.Genti.BodyLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="20dp"
android:text="@string/create_guide_tv_title_down"
app:layout_constraintEnd_toEndOf="@id/iv_guide_bg"
app:layout_constraintTop_toBottomOf="@id/tv_guide_title_angle" />

<TextView
android:id="@+id/tv_guide_ex"
style="@style/TextAppearance.Genti.BodyNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="@string/create_guide_tv_ex"
android:textColor="@color/green_1"
app:layout_constraintBottom_toTopOf="@id/iv_guide_ex"
app:layout_constraintStart_toStartOf="@id/iv_guide_bg" />

<ImageView
android:id="@+id/iv_guide_ex"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:adjustViewBounds="true"
android:src="@drawable/img_guide_ex"
app:layout_constraintBottom_toBottomOf="@id/iv_guide_bg"
app:layout_constraintEnd_toEndOf="@id/iv_guide_bg"
app:layout_constraintStart_toStartOf="@id/iv_guide_bg" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
9 changes: 9 additions & 0 deletions presentation/src/main/res/layout/dialog_main_finished.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_close_dialog"
app:layout_constraintEnd_toEndOf="@id/iv_logout_bg"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/iv_finished_icon"
android:layout_width="wrap_content"
Expand Down
9 changes: 9 additions & 0 deletions presentation/src/main/res/layout/dialog_waiting_error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_close_dialog"
app:layout_constraintEnd_toEndOf="@id/iv_quit_bg"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/iv_error_icon"
android:layout_width="79dp"
Expand Down
7 changes: 7 additions & 0 deletions presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
<string name="selfie_toast_old_picker_limit">3장의 이미지를 선택해 주세요</string>
<string name="selfie_toast_picker_error">갤러리 이미지를 가져오는 과정에서 오류가 발생했습니다.</string>

<string name="create_guide_tv_title_up">이번에는</string>
<string name="create_guide_tv_ratio">비율</string>
<string name="create_guide_tv_angle">앵글</string>
<string name="create_guide_tv_frame">프레임</string>
<string name="create_guide_tv_title_down">을 선택해야 해요!</string>
<string name="create_guide_tv_ex">예시</string>

<string name="wait_tv_title">세상에 없던 나만의\n 사진을 찍고있어요!</string>
<string name="wait_tv_title_dot">• • •</string>
<string name="wait_tv_time">예상 소요시간은 2시간입니다.</string>
Expand Down

0 comments on commit bd8db7a

Please sign in to comment.