Commit c9214156 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Set custom video player rotation animation

Improves activity rotation, by preventing image freeze
parent cba9ae20
...@@ -59,6 +59,8 @@ import android.view.DragEvent; ...@@ -59,6 +59,8 @@ import android.view.DragEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationSet; import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
...@@ -446,4 +448,13 @@ public class UiTools { ...@@ -446,4 +448,13 @@ public class UiTools {
} }
}); });
} }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static void setRotationAnimation(Activity activity) {
if (!AndroidUtil.isJellyBeanMR2OrLater) return;
final Window win = activity.getWindow();
final WindowManager.LayoutParams winParams = win.getAttributes();
winParams.rotationAnimation = AndroidUtil.isOOrLater ? WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS : WindowManager.LayoutParams.ROTATION_ANIMATION_JUMPCUT;
win.setAttributes(winParams);
}
} }
...@@ -446,6 +446,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -446,6 +446,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
final ScreenConfig sc = new ScreenConfig(dm, xRange, yRange, mCurrentScreenOrientation); final ScreenConfig sc = new ScreenConfig(dm, xRange, yRange, mCurrentScreenOrientation);
mTouchDelegate = new VideoTouchDelegate(this, touch, sc, isRtl); mTouchDelegate = new VideoTouchDelegate(this, touch, sc, isRtl);
} }
UiTools.setRotationAnimation(this);
} }
@Override @Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment