According to the guidelines: https://developer.android.com/design/wear/patterns.html#Continuing
"In cases where the phone must be used, a generic animation should be played once the action button has been tapped and the corresponding Android app will open on the phone."
The animation can be seen in the Google Keep app. Here is a sample recording: https://dl.dropboxusercontent.com/u/25670071/IMG_0274.MOV
Is there a standard implementation of this animation somewhere?
The steps needed to implement this functionality depends on whether the notification is submitted from phone or from wearable device.
If your notification came from phone - the "Open on phone" action page is added automatically when your notification has setContentIntent(PendingIntent intent) set.
If you need to play this animation in a notification that is submitted from wearable device directly (or from any other place from your wearable application) you will need to launch this animation by yourself.
There is a nice ConfirmationActivity
that supports few predefined animation types:
ConfirmationActivity.SUCCESS_ANIMATION
ConfirmationActivity.OPEN_ON_PHONE_ANIMATION
ConfirmationActivity.FAILURE_ANIMATION
The animation you should be interested it is ConfirmationActivity.OPEN_ON_PHONE_ANIMATION
. You need to pass the type of animation in the ConfirmationActivity.EXTRA_ANIMATION_TYPE
extra.
Intent intent = new Intent(context, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.OPEN_ON_PHONE_ANIMATION);
startActivity(intent);
IMPORTANT:
To launch the ConfirmationActivity
you need to add it to your Manifest file:
<activity android:name="android.support.wearable.activity.ConfirmationActivity" />
Next step is to tweak the style of this ConfirmationActivity
. For example if you want to disable the default sliding animation or to make the window transparent you will need to set a custom theme to it in your manifest:
<activity android:name="android.support.wearable.activity.ConfirmationActivity"
android:theme="@style/TransparentTheme"/>
and define the TransparentTheme
in themes.xml
:
<style name="TransparentTheme" parent="@android:style/Theme.DeviceDefault">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With