Skip to content

Commit ceeec79

Browse files
committed
[ADD] #335 Navaigator에서 쓸 startActivity 확장 함수 추가
1 parent 2a7a5a6 commit ceeec79

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

app/src/main/java/com/runnect/runnect/util/extension/ActivityExt.kt

+17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
package com.runnect.runnect.util.extension
22

33
import android.app.Activity
4+
import android.content.Intent
45
import com.runnect.runnect.R
56

7+
/**
8+
* 애니메이션과 함께 새로운 액티비티를 시작합니다.
9+
*
10+
* @param intentBuilder 새로 시작할 액티비티의 [Intent]
11+
* @param withFinish 현재 액티비티를 종료할 지 여부
12+
*/
13+
inline fun <reified T : Activity> Activity.startActivityWithAnimation(
14+
intentBuilder: Intent.() -> Intent = { this },
15+
withFinish: Boolean = false,
16+
) {
17+
startActivity(intentBuilder(Intent(this, T::class.java)))
18+
applyScreenEnterAnimation()
19+
20+
if (withFinish) finish()
21+
}
22+
623
fun Activity.navigateToPreviousScreenWithAnimation() {
724
finish()
825
applyScreenExitAnimation()

0 commit comments

Comments
 (0)