Android AppWidget PendingIntent Activity Transition Animation

25 Views Asked by At

I am trying to control the activity transition animation when the user taps a home widget with a pending intent to start an activity that is not the launcher activity.

This is the tap intent:

val pendingIntent: PendingIntent = PendingIntent.getActivity(
        /* context = */ this,
        /* requestCode = */  0,
        /* intent = */ Intent(this, ActivityEdit::class.java),
        /* flags = */ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
    )

When trying the usual methods, for example:

overridePendingTransition(R.anim.fadein, R.anim.fadeout)

right after finish(), it is still showing the default system animation of sliding down the activity.

From documentation:

Af of Build.VERSION_CODES.S application can only specify a transition animation when the transition happens within the same task. System default animation is used for cross-task transition animations.

When I try to start the launcher activity, the system default animation is more than acceptable, but another type of activity starts fine with fade in, but finished with sliding down, which I wanted to change to fade out.

My app's min SDK is 31. Does that mean there is no way of controlling the activity transition animation that starts from a home widget tap?

0

There are 0 best solutions below