Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable the transition after a Google Sign In?

I'm making an application for my senior project that uses google sign in to let the user create an account more quickly. It was pretty easy to set up, but now I'm having an issue where after a sign-in occurs, a transition animation takes place which I don't want. It looks kind of like a bar falling from the top of the screen. I have looked at how to disable animations/transitions when starting a new activity, and I tried this:

private void signIn()
{
    Intent signInIntent = mGoogleSignInClient.getSignInIntent();
    signInIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivityForResult(signInIntent, RC_SIGN_IN);
    overridePendingTransition(0, 0);
}

The unwanted transition animation still occurs, however. I'm kind of new to Android development, and I couldn't find any more help on SO or in the documentation for google-signin, so I'm at the end of my rope here. How can I disable this unwanted animation!?

Example of unwanted transition behavior

like image 696
mmackliet Avatar asked Nov 16 '18 23:11

mmackliet


1 Answers

I have found a solution. This works for me. AppTheme was set in android manifest Firebase Login activity theme

styles.xml

<style name="AppTheme" parent="Theme.Material">
   <item name="android:windowAnimationStyle">@style/Replace</item>
</style>

<style name="Replace">
    <item name="android:activityOpenEnterAnimation">@anim/replace_anim</item>
    <item name="android:activityOpenExitAnimation">@anim/replace_anim</item>
    <item name="android:activityCloseEnterAnimation">@anim/replace_anim</item>
    <item name="android:activityCloseExitAnimation">@anim/replace_anim</item>
    <item name="android:taskOpenEnterAnimation">@anim/replace_anim</item>
    <item name="android:taskOpenExitAnimation">@anim/replace_anim</item>
</style>

replace_anim.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

</set>
like image 66
Vytautas Berankis Avatar answered Oct 23 '22 20:10

Vytautas Berankis