Skip to content
This repository has been archived by the owner on May 7, 2019. It is now read-only.

Commit

Permalink
Remove view transition because it may cause app crash
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-tai committed Jan 20, 2017
1 parent 71c7290 commit f92f779
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@

import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.github.ayltai.newspaper.item.ItemPresenter;
import com.github.ayltai.newspaper.item.ItemScreen;
Expand Down Expand Up @@ -101,8 +97,7 @@ public Object toKey(@NonNull final Parcelable parcelable) {
((ItemPresenter)presenter).bind((ListScreen.Key)key.getParentKey(), key.getItem(), Settings.getListViewType(this.activity));
}

//this.dispatch((View)view, incomingState, callback);
this.transit(outgoingState, incomingState, outgoingState == null ? null : (View)this.screens.get(outgoingState.getKey().getClass()), (View)view, callback);
this.dispatch((View)view, incomingState, callback);
}).build())
.defaultKey(Constants.KEY_SCREEN_MAIN)
.install();
Expand Down Expand Up @@ -136,33 +131,6 @@ public void onDestroy() {
if (!this.realm.isClosed()) this.realm.close();
}

private void transit(@Nullable final State outgoingState, @NonNull final State incomingState, @Nullable final View fromView, @NonNull final View toView, @NonNull final TraversalCallback callback) {
if (outgoingState == null || fromView == null || Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
this.dispatch(toView, incomingState, callback);
} else {
final Animation animation = AnimationUtils.loadAnimation(this.activity, R.anim.slide_out_bottom);

animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(final Animation animation) {
}

@Override
public void onAnimationEnd(final Animation animation) {
FlowController.this.dispatch(toView, incomingState, callback);

toView.startAnimation(AnimationUtils.loadAnimation(FlowController.this.activity, R.anim.slide_in_bottom));
}

@Override
public void onAnimationRepeat(final Animation animation) {
}
});

fromView.startAnimation(animation);
}
}

private void dispatch(@NonNull final View view, @NonNull final State incomingState, @NonNull final TraversalCallback callback) {
incomingState.restore(view);

Expand Down
13 changes: 0 additions & 13 deletions app/src/main/res/anim/slide_in_bottom.xml

This file was deleted.

13 changes: 0 additions & 13 deletions app/src/main/res/anim/slide_out_bottom.xml

This file was deleted.

0 comments on commit f92f779

Please sign in to comment.