I'm facing this issue and am not able to find a solution to it. I have Google Sign In implemented in my app using firebase. The problem I'm facing is that whenever the Sign In dialog dismisses a black strip runs across the screen from top to bottom. It moves very fast but still is noticeable. I want to remove this black strip that runs across the screen so the user smoothly returns to the screen.
I tried to add
overridePendingTransition(0, 0);
in onPause() and onResume() methods but still found no success.
Could anybody please help me to find a way around this and/or how could I achieve it?
I had the same problem and it bothered me, it didn't look good.
I found a solution! You can define activity open and close animations in styles.xml
and assign them to the activity which starts the google sign in by using android:windowAnimationStyle
. Here is an example using fade animations:
styles.xml
:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowAnimationStyle">@style/ActivityAnimations</item>
</style>
<style name="ActivityAnimations" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/fade_in</item>
<item name="android:activityOpenExitAnimation">@anim/fade_out</item>
<item name="android:activityCloseEnterAnimation">@anim/fade_in</item>
<item name="android:activityCloseExitAnimation">@anim/fade_out</item>
</style>
The style AppTheme
is assigned to the application or the activity that launches the google sign in flow in the AndroidManifest.xml
using android:theme="@style/AppTheme"
.
FadeIn:
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="500"
/>
FadeOut:
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillAfter="true"
android:duration="500"
/>
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