Skip to content

Commit

Permalink
Fix bug with set listener getting called twice (BUT AFTER AN HOUR OF …
Browse files Browse the repository at this point in the history
…DEBUGGING, I STILL DON'T KNOW WHY THIS FIX WORKS!!!)
  • Loading branch information
aphexcx committed Nov 12, 2015
1 parent 8ec64aa commit 98e0d2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ private Observable<Void> hideCategoryLayout() {

private Observable<Void> showCurrentRequestLayout() {
return Observable.create(subscriber -> {
Log.e(logTag(), "showCurrentREquestLayout");
// mCurrentRequestLayoutShowing = true;

Collection<DonationCategory> items = mPickupRequest.getDonationCategories();
Expand Down Expand Up @@ -560,6 +561,11 @@ private Observable<Void> showCurrentRequestLayout() {
set.play(slideDown).before(slideUp).with(fade_in);
set.addListener((AnimatorEndListener) animation -> {
btnBottomSubmit.setVisibility(View.GONE);
//LISTENER GETS CALLED TWICE.
animation.getListeners(); //THE FIX?!?!?!?!?!?!?
//(OR CALL ANY OTHER METHOD THAT ACCESSES A MEMBER VARIABLE OF animation

// Log.e(logTag(), "Adding items!!!!!" + animation.isStarted());
for (DonationCategory item : items) {
item.setSelected(true);
item.setClickable(false);
Expand Down Expand Up @@ -609,6 +615,7 @@ private Observable<Void> hideCurrentRequestLayout() {
AnimatorSet set = new AnimatorSet();
set.play(fade_out).with(slideDown).before(slideUp);
set.addListener((AnimatorEndListener) animation -> {
// Log.e(logTag(), "Hiding currentREquestLayout!");
adaptableGradientRectView.setGradientColorTo(getResources().getColor(R.color.colorPrimaryLight));
rlCurrentRequestContainer.setVisibility(View.GONE);
btnBottomSubmit.setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package io.givenow.app.interfaces;

import android.animation.Animator;
import android.util.Log;

/**
* Created by aphex on 11/10/15.
*/
public interface AnimatorEndListener extends Animator.AnimatorListener {
@Override
default void onAnimationStart(Animator animation) {

Log.e("AEL", "STARTED" + animation);
}

@Override
void onAnimationEnd(Animator animation);

@Override
default void onAnimationCancel(Animator animation) {

Log.e("AEL", "CANCELED" + animation);
}

@Override
Expand Down

0 comments on commit 98e0d2e

Please sign in to comment.