Skip to content

Commit 9d3cec9

Browse files
authored
Remove animation from the activity when finishing it (#2022)
1 parent d3301de commit 9d3cec9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

datalayer/phone-ui/src/main/java/com/google/android/horologist/datalayer/phone/ui/prompt/installapp/InstallAppBottomSheetActivity.kt

+13-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package com.google.android.horologist.datalayer.phone.ui.prompt.installapp
1818

1919
import android.content.Context
2020
import android.content.Intent
21+
import android.os.Build
2122
import android.os.Bundle
2223
import androidx.activity.ComponentActivity
2324
import androidx.activity.compose.setContent
@@ -77,22 +78,32 @@ internal class InstallAppBottomSheetActivity : ComponentActivity() {
7778
try {
7879
installAppBottomSheetState.hide()
7980
} finally {
80-
finish()
81+
finishWithoutAnimation()
8182
}
8283
}
8384
},
8485
onConfirmation = {
8586
this.launchPlay(appPackageName)
8687

8788
setResult(RESULT_OK)
88-
finish()
89+
finishWithoutAnimation()
8990
},
9091
sheetState = installAppBottomSheetState,
9192
)
9293
}
9394
}
9495
}
9596

97+
private fun finishWithoutAnimation() {
98+
finish()
99+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
100+
overrideActivityTransition(OVERRIDE_TRANSITION_CLOSE, 0, 0)
101+
} else {
102+
@Suppress("DEPRECATION")
103+
overridePendingTransition(0, 0)
104+
}
105+
}
106+
96107
internal companion object {
97108
fun getIntent(
98109
context: Context,

0 commit comments

Comments
 (0)