Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fade in rather than intended animation when view first displayed #95

Closed
HolySamosa opened this issue Mar 8, 2017 · 6 comments
Closed

Comments

@HolySamosa
Copy link

HolySamosa commented Mar 8, 2017

I'm trying to use SlideInLeft when the visibility is set for a particular view. for some inexplicable reason, the first time this code executes, the view fades in rather than slides in, I thought perhaps if could be an issue with android:animateLayoutChanges="true", however I have explicitly set it to false.

Any ideas? I've tried various hacks to achieve the desired behavior, but nothing has thus far worked.

    public void setNewLabelVisible(boolean isVisible) {
        this.layoutNewLabel.setVisibility(isVisible ? VISIBLE : INVISIBLE);
        if (isVisible) {
            YoYo.with(Techniques.SlideInLeft)
                    .duration(1000)
                    .playOn(layoutNewLabel);
        }
    }
@daimajia
Copy link
Owner

Hi, when you are execute the animation, please make sure that the view has enough room to slide in. Just like this figure:

image

@daimajia
Copy link
Owner

Close this issue, if you are still confused, it will be opened again.

@srujanb
Copy link

srujanb commented Jun 23, 2017

The same is happening with me. I have applied slideInUp animation which happens to a fragment on button click. The first time I click on the button after app restart, no animation happen, there after, It happens as expected.

I have been using this lib since quite a long time and this issue has always bugged me.

@sandysultan
Copy link

anyone solved this?

@LuiguiBalarezo
Copy link

Aun persiste el problema con el FadeInUp y slideInUp.
Solo funciona con el código de ejemplo dentro del mismo proyecto, pero no funciona usandolo en un proyecto propio con AndroidX.

Alguna solución?
Gracias.

@LuiguiBalarezo
Copy link

/********** App Gradle ***********/

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.zetagas.myapplication"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'com.android.support:support-compat:25.1.1'
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'

}

/**************** Layout Activity Main .xml **************/

<TextView
    android:id="@+id/textexample"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerInParent="true"
    android:gravity="center"
    android:text="hOLA"
    android:textSize="40sp" />

/******************** MainLayout.java ********************/
package com.zetagas.myapplication;

import android.animation.Animator;
import android.os.Bundle;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.daimajia.androidanimations.library.Techniques;
import com.daimajia.androidanimations.library.YoYo;

public class MainActivity extends AppCompatActivity {

private TextView text;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    text = findViewById(R.id.textexample);
    YoYo.with(Techniques.FadeInUp)
            .duration(1200)
            .repeat(YoYo.INFINITE)
            .interpolate(new AccelerateDecelerateInterpolator())
            .withListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animation) {

                }

                @Override
                public void onAnimationEnd(Animator animation) {
                }

                @Override
                public void onAnimationCancel(Animator animation) {

                }

                @Override
                public void onAnimationRepeat(Animator animation) {

                }
            })
            .playOn(text);
}

}

/******* IMAGE *****/
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants