Skip to content

Commit

Permalink
[ADD] #335 Navaigator에서 쓸 startActivity 확장 함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dongx0915 committed Feb 22, 2024
1 parent 2a7a5a6 commit ceeec79
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
package com.runnect.runnect.util.extension

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

/**
* 애니메이션과 함께 새로운 액티비티를 시작합니다.
*
* @param intentBuilder 새로 시작할 액티비티의 [Intent]
* @param withFinish 현재 액티비티를 종료할 지 여부
*/
inline fun <reified T : Activity> Activity.startActivityWithAnimation(
intentBuilder: Intent.() -> Intent = { this },
withFinish: Boolean = false,
) {
startActivity(intentBuilder(Intent(this, T::class.java)))
applyScreenEnterAnimation()

if (withFinish) finish()
}

fun Activity.navigateToPreviousScreenWithAnimation() {
finish()
applyScreenExitAnimation()
Expand Down

0 comments on commit ceeec79

Please sign in to comment.