Skip to content

Commit

Permalink
Remove animation from the activity when finishing it (#2022)
Browse files Browse the repository at this point in the history
  • Loading branch information
luizgrp authored Feb 5, 2024
1 parent d3301de commit 9d3cec9
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.google.android.horologist.datalayer.phone.ui.prompt.installapp

import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
Expand Down Expand Up @@ -77,22 +78,32 @@ internal class InstallAppBottomSheetActivity : ComponentActivity() {
try {
installAppBottomSheetState.hide()
} finally {
finish()
finishWithoutAnimation()
}
}
},
onConfirmation = {
this.launchPlay(appPackageName)

setResult(RESULT_OK)
finish()
finishWithoutAnimation()
},
sheetState = installAppBottomSheetState,
)
}
}
}

private fun finishWithoutAnimation() {
finish()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideActivityTransition(OVERRIDE_TRANSITION_CLOSE, 0, 0)
} else {
@Suppress("DEPRECATION")
overridePendingTransition(0, 0)
}
}

internal companion object {
fun getIntent(
context: Context,
Expand Down

0 comments on commit 9d3cec9

Please sign in to comment.