-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 사진 버튼을 클릭하면 사진 다이얼로그를 띄우는 기능 구현 (#40)
* design: close icon 추가 * feat: 화면에 관련된 유틸 파일과 메서드 생성 * design: OnAdventure 액티비티에서 사진을 보여주기 위한 다이얼로그 UI 구현 * feat: 목적지에 대한 사진을 띄워주는 DestinationPhotoDialog 구현 * refactor: LocationDialogFragment의 메서드를 DisplayUtil로 분리 * style: 코드 정렬 * feat: 생성시 액티비티로부터 사진을 받아오는 기능 구현 * design: 사진 아이콘 버튼 추가 * feat: 액티비티에서 사진 아이콘 버튼 클릭시 다이얼로그를 띄우는 로직 구현 * feat: 사진이 로딩중 문구 strings 리소스화 * feat: 뷰모델로부터 얻어온 사진을 넘기도록 로직 수정 * refactor: 다이얼로그 및 변수 네이밍 변경 * refactor: strings 리소스화 * refactor: 객체 네이밍 변경
- Loading branch information
Showing
2 changed files
with
66 additions
and
73 deletions.
There are no files selected for viewing
73 changes: 0 additions & 73 deletions
73
...oid/app/src/main/java/com/now/naaga/presentation/beginadventure/LocationDialogFragment.kt
This file was deleted.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
android/app/src/main/java/com/now/naaga/presentation/beginadventure/PolaroidDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.now.naaga.presentation.beginadventure | ||
|
||
import android.graphics.Color | ||
import android.graphics.drawable.ColorDrawable | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT | ||
import androidx.fragment.app.DialogFragment | ||
import com.bumptech.glide.Glide | ||
import com.now.naaga.databinding.DialogPolaroidBinding | ||
import com.now.naaga.util.getWidthProportionalToDevice | ||
|
||
class PolaroidDialog : DialogFragment() { | ||
private lateinit var binding: DialogPolaroidBinding | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View { | ||
binding = DialogPolaroidBinding.inflate(layoutInflater) | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) | ||
dialog?.setCanceledOnTouchOutside(false) | ||
clickClose() | ||
setSize() | ||
setPhoto() | ||
} | ||
|
||
private fun setPhoto() { | ||
val photo: String? = arguments?.getString(PHOTO) | ||
Glide.with(binding.ivImageDialogDestinationImage) | ||
.load(photo) | ||
.into(binding.ivImageDialogDestinationImage) | ||
} | ||
|
||
private fun clickClose() { | ||
binding.ivImageDialogClose.setOnClickListener { | ||
dialog?.hide() | ||
} | ||
} | ||
|
||
private fun setSize() { | ||
val dialogWidth = getWidthProportionalToDevice(requireContext(), WIDTH_RATE) | ||
dialog?.window?.setLayout(dialogWidth, WRAP_CONTENT) | ||
} | ||
|
||
companion object { | ||
private const val WIDTH_RATE = 0.9f | ||
private const val PHOTO = "PHOTO" | ||
|
||
fun makeDialog(photo: String): PolaroidDialog { | ||
return PolaroidDialog().apply { | ||
val bundle = Bundle() | ||
bundle.putString(PHOTO, photo) | ||
arguments = bundle | ||
} | ||
} | ||
} | ||
} |