Skip to content

Commit

Permalink
[ADD] #253 뒤로가기 애니메이션 확장함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
unam98 committed Nov 14, 2023
1 parent 70ce337 commit 6e0735c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.runnect.runnect.data.dto.response.ResponseGetMyDrawDetailDTO
import com.runnect.runnect.databinding.ActivityMyDrawDetailBinding
import com.runnect.runnect.presentation.MainActivity
import com.runnect.runnect.presentation.countdown.CountDownActivity
import com.runnect.runnect.util.extension.navigateToPreviousScreenWithAnimation
import com.runnect.runnect.util.extension.setActivityDialog
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.custom_dialog_delete.view.btn_delete_no
Expand Down Expand Up @@ -58,7 +59,7 @@ class MyDrawDetailActivity :
putExtra(EXTRA_FRAGMENT_REPLACEMENT_DIRECTION, "fromDeleteMyDrawDetail")
}
startActivity(intent)
navigateToPreviousScreen()
navigateToPreviousScreenWithAnimation()
}
this.btn_delete_no.setOnClickListener {
dialog.dismiss()
Expand All @@ -75,7 +76,7 @@ class MyDrawDetailActivity :

private fun backButton() { //png가 imgBtn으로 하면 잘리길래 어차피 임시로 해놓는 거니까 imgView로 component를 추가해줬음
binding.imgBtnBack.setOnClickListener {
navigateToPreviousScreen()
navigateToPreviousScreenWithAnimation()
}
}

Expand Down Expand Up @@ -103,17 +104,12 @@ class MyDrawDetailActivity :
private fun registerBackPressedCallback() { // 이 함수를 addObserver에서 호출
val callback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
navigateToPreviousScreen()
navigateToPreviousScreenWithAnimation()
}
}
onBackPressedDispatcher.addCallback(this, callback)
}

private fun navigateToPreviousScreen() {
finish()
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right)
}

private fun setImage(src: ResponseGetMyDrawDetailDTO) {
with(binding) {
Glide
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.runnect.runnect.util.extension

import android.app.Activity
import com.runnect.runnect.R

fun Activity.navigateToPreviousScreenWithAnimation() {
finish()
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right)
}

0 comments on commit 6e0735c

Please sign in to comment.