Visibility events not working when using Animation with shared element transition











up vote
-1
down vote

favorite












I want to implement an animation where there is an ImageView rotating animation and after finishing it, want to start a new activity with shared element transition.



This is the following code i've done



Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate);

animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Log.e("Animation", "Start");
}

@Override
public void onAnimationEnd(Animation animation) {
companyLogo.clearAnimation();
isFinished = true;

Intent intent = new Intent(SplashscreenActivity.this, LoginActivity.class);
ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(SplashscreenActivity.this,
companyLogo, ViewCompat.getTransitionName(companyLogo));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
startActivity(intent, optionsCompat.toBundle());
}
else {
startActivity(intent);
}

}

@Override
public void onAnimationRepeat(Animation animation) {
Log.e("Animation", "Repeat");
}
});
companyLogo.startAnimation(animation);


The problem occures when in the Login activity.



In login activity, i've 3 buttons and on click, i show a particular view for the same but it is not working with animation. When i remove the animation and load the same, it works.



This is the code for button click



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

create_with_email_btn = findViewById(R.id.create_with_email_btn);

create_with_email_btn.setOnClickListener(this);

callbackManager = CallbackManager.Factory.create();


}

public void onClick(View v) {

switch (v.getId()){

case R.id.create_with_email_btn:
isLogin = true;
login_type_layout.setVisibility(View.GONE);
create_with_email_layout.setVisibility(View.VISIBLE);
break;

}

}


The visibility events are not working when using shared element transition with animation. Without it, it works fine.










share|improve this question




















  • 1




    Please post your code. What you have already achieved.
    – webianks
    6 hours ago










  • Possible duplicate of Animate ImageView between two activities using shared element transitions with ChangeImageTransform
    – Jantzilla
    5 hours ago










  • @webianks Please check the same, i've updated the question.
    – Saikiran Bait
    4 hours ago















up vote
-1
down vote

favorite












I want to implement an animation where there is an ImageView rotating animation and after finishing it, want to start a new activity with shared element transition.



This is the following code i've done



Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate);

animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Log.e("Animation", "Start");
}

@Override
public void onAnimationEnd(Animation animation) {
companyLogo.clearAnimation();
isFinished = true;

Intent intent = new Intent(SplashscreenActivity.this, LoginActivity.class);
ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(SplashscreenActivity.this,
companyLogo, ViewCompat.getTransitionName(companyLogo));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
startActivity(intent, optionsCompat.toBundle());
}
else {
startActivity(intent);
}

}

@Override
public void onAnimationRepeat(Animation animation) {
Log.e("Animation", "Repeat");
}
});
companyLogo.startAnimation(animation);


The problem occures when in the Login activity.



In login activity, i've 3 buttons and on click, i show a particular view for the same but it is not working with animation. When i remove the animation and load the same, it works.



This is the code for button click



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

create_with_email_btn = findViewById(R.id.create_with_email_btn);

create_with_email_btn.setOnClickListener(this);

callbackManager = CallbackManager.Factory.create();


}

public void onClick(View v) {

switch (v.getId()){

case R.id.create_with_email_btn:
isLogin = true;
login_type_layout.setVisibility(View.GONE);
create_with_email_layout.setVisibility(View.VISIBLE);
break;

}

}


The visibility events are not working when using shared element transition with animation. Without it, it works fine.










share|improve this question




















  • 1




    Please post your code. What you have already achieved.
    – webianks
    6 hours ago










  • Possible duplicate of Animate ImageView between two activities using shared element transitions with ChangeImageTransform
    – Jantzilla
    5 hours ago










  • @webianks Please check the same, i've updated the question.
    – Saikiran Bait
    4 hours ago













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I want to implement an animation where there is an ImageView rotating animation and after finishing it, want to start a new activity with shared element transition.



This is the following code i've done



Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate);

animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Log.e("Animation", "Start");
}

@Override
public void onAnimationEnd(Animation animation) {
companyLogo.clearAnimation();
isFinished = true;

Intent intent = new Intent(SplashscreenActivity.this, LoginActivity.class);
ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(SplashscreenActivity.this,
companyLogo, ViewCompat.getTransitionName(companyLogo));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
startActivity(intent, optionsCompat.toBundle());
}
else {
startActivity(intent);
}

}

@Override
public void onAnimationRepeat(Animation animation) {
Log.e("Animation", "Repeat");
}
});
companyLogo.startAnimation(animation);


The problem occures when in the Login activity.



In login activity, i've 3 buttons and on click, i show a particular view for the same but it is not working with animation. When i remove the animation and load the same, it works.



This is the code for button click



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

create_with_email_btn = findViewById(R.id.create_with_email_btn);

create_with_email_btn.setOnClickListener(this);

callbackManager = CallbackManager.Factory.create();


}

public void onClick(View v) {

switch (v.getId()){

case R.id.create_with_email_btn:
isLogin = true;
login_type_layout.setVisibility(View.GONE);
create_with_email_layout.setVisibility(View.VISIBLE);
break;

}

}


The visibility events are not working when using shared element transition with animation. Without it, it works fine.










share|improve this question















I want to implement an animation where there is an ImageView rotating animation and after finishing it, want to start a new activity with shared element transition.



This is the following code i've done



Animation animation = AnimationUtils.loadAnimation(this, R.anim.rotate);

animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Log.e("Animation", "Start");
}

@Override
public void onAnimationEnd(Animation animation) {
companyLogo.clearAnimation();
isFinished = true;

Intent intent = new Intent(SplashscreenActivity.this, LoginActivity.class);
ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(SplashscreenActivity.this,
companyLogo, ViewCompat.getTransitionName(companyLogo));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
startActivity(intent, optionsCompat.toBundle());
}
else {
startActivity(intent);
}

}

@Override
public void onAnimationRepeat(Animation animation) {
Log.e("Animation", "Repeat");
}
});
companyLogo.startAnimation(animation);


The problem occures when in the Login activity.



In login activity, i've 3 buttons and on click, i show a particular view for the same but it is not working with animation. When i remove the animation and load the same, it works.



This is the code for button click



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

create_with_email_btn = findViewById(R.id.create_with_email_btn);

create_with_email_btn.setOnClickListener(this);

callbackManager = CallbackManager.Factory.create();


}

public void onClick(View v) {

switch (v.getId()){

case R.id.create_with_email_btn:
isLogin = true;
login_type_layout.setVisibility(View.GONE);
create_with_email_layout.setVisibility(View.VISIBLE);
break;

}

}


The visibility events are not working when using shared element transition with animation. Without it, it works fine.







android android-intent shared-element-transition






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 4 hours ago

























asked 6 hours ago









Saikiran Bait

98




98








  • 1




    Please post your code. What you have already achieved.
    – webianks
    6 hours ago










  • Possible duplicate of Animate ImageView between two activities using shared element transitions with ChangeImageTransform
    – Jantzilla
    5 hours ago










  • @webianks Please check the same, i've updated the question.
    – Saikiran Bait
    4 hours ago














  • 1




    Please post your code. What you have already achieved.
    – webianks
    6 hours ago










  • Possible duplicate of Animate ImageView between two activities using shared element transitions with ChangeImageTransform
    – Jantzilla
    5 hours ago










  • @webianks Please check the same, i've updated the question.
    – Saikiran Bait
    4 hours ago








1




1




Please post your code. What you have already achieved.
– webianks
6 hours ago




Please post your code. What you have already achieved.
– webianks
6 hours ago












Possible duplicate of Animate ImageView between two activities using shared element transitions with ChangeImageTransform
– Jantzilla
5 hours ago




Possible duplicate of Animate ImageView between two activities using shared element transitions with ChangeImageTransform
– Jantzilla
5 hours ago












@webianks Please check the same, i've updated the question.
– Saikiran Bait
4 hours ago




@webianks Please check the same, i've updated the question.
– Saikiran Bait
4 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369213%2fvisibility-events-not-working-when-using-animation-with-shared-element-transitio%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369213%2fvisibility-events-not-working-when-using-animation-with-shared-element-transitio%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Volksrepublik China

How to test boost logger output in unit testing?

How do you send bulk inserts with no ids to elasticsearch