Skip to content

Commit

Permalink
Disable fade transition
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamescaper committed Jan 29, 2021
1 parent aaf46e2 commit 57ec7e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import com.codingbuffalo.aerialdream.data.Apple2015Video;
import com.codingbuffalo.aerialdream.data.Apple2017Video;
import com.codingbuffalo.aerialdream.data.Apple2018Video;
Expand Down Expand Up @@ -55,10 +54,8 @@ public VideoController(Context context) {
binding.setCacheSize(cacheSize);

binding.videoView0.setController(binding.videoView0.videoView);
binding.videoView1.setController(binding.videoView1.videoView);

binding.videoView0.videoView.setOnPlayerListener(this);
binding.videoView1.videoView.setOnPlayerListener(this);

new VideoInteractor(
context,
Expand All @@ -75,45 +72,16 @@ public View getView() {
}

public void start() {
binding.videoView0.getRoot().setAlpha(0);

loadVideo(binding.videoView0, getVideo());
loadVideo(binding.videoView1, getVideo());

binding.videoView1.videoView.start();
playVideo(binding.videoView0);
}

public void stop() {
binding.videoView0.videoView.release();
binding.videoView1.videoView.release();
}

private void playVideo(final VideoViewBinding deactivate, final VideoViewBinding activate) {
activate.videoView.start();

Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(ExoPlayerView.DURATION);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}

@Override
public void onAnimationEnd(Animation animation) {
binding.container.bringChildToFront(activate.getRoot());
deactivate.videoView.pause();
deactivate.getRoot().setAlpha(1);
loadVideo(deactivate, getVideo());

binding.loadingView.setVisibility(View.GONE);
}

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

deactivate.getRoot().startAnimation(animation);
private void playVideo(final VideoViewBinding videoView) {
loadVideo(videoView, getVideo());
videoView.videoView.start();
}

@Override
Expand All @@ -139,9 +107,7 @@ private Video getVideo() {

@Override
public void onPrepared(ExoPlayerView view) {
if (binding.loadingView.getVisibility() == View.VISIBLE && view == binding.videoView1.videoView) {
binding.videoView0.getRoot().setAlpha(1);

if (binding.loadingView.getVisibility() == View.VISIBLE) {
Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(ExoPlayerView.DURATION / 2);
animation.setAnimationListener(new Animation.AnimationListener() {
Expand All @@ -165,10 +131,6 @@ public void onAnimationRepeat(Animation animation) {

@Override
public void onAlmostFinished(ExoPlayerView view) {
if (view == binding.videoView0.videoView) {
playVideo(binding.videoView0, binding.videoView1);
} else {
playVideo(binding.videoView1, binding.videoView0);
}
playVideo(binding.videoView0);
}
}
8 changes: 0 additions & 8 deletions app/src/main/res/layout/aerial_dream.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
app:showLocation="@{showLocation}"
app:showProgress="@{showProgress}" />

<include
android:id="@+id/video_view_1"
layout="@layout/video_view"
app:cacheSize="@{cacheSize}"
app:showClock="@{showClock}"
app:showLocation="@{showLocation}"
app:showProgress="@{showProgress}" />

<TextView
android:id="@+id/loading_view"
style="@style/LoadingText"
Expand Down

0 comments on commit 57ec7e7

Please sign in to comment.