1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-10-01 08:20:50 +00:00

Fix 'keep screen on'

This commit is contained in:
Mauricio Colli 2017-05-14 00:32:28 -03:00
parent 2f181ce7c9
commit e47761750a
2 changed files with 8 additions and 3 deletions

View File

@ -184,6 +184,7 @@ public class MainVideoPlayer extends Activity {
repeatButton.setAlpha(77); repeatButton.setAlpha(77);
} }
getRootView().setKeepScreenOn(true);
} }
@Override @Override
@ -308,12 +309,14 @@ public class MainVideoPlayer extends Activity {
super.onLoading(); super.onLoading();
playPauseButton.setImageResource(R.drawable.ic_pause_white); playPauseButton.setImageResource(R.drawable.ic_pause_white);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
} }
@Override @Override
public void onBuffering() { public void onBuffering() {
super.onBuffering(); super.onBuffering();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
} }
@Override @Override
@ -326,8 +329,8 @@ public class MainVideoPlayer extends Activity {
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, true, 200); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, true, 200);
} }
}); });
showSystemUi(); showSystemUi();
getRootView().setKeepScreenOn(true);
} }
@Override @Override
@ -342,12 +345,14 @@ public class MainVideoPlayer extends Activity {
}); });
showSystemUi(); showSystemUi();
getRootView().setKeepScreenOn(false);
} }
@Override @Override
public void onPausedSeek() { public void onPausedSeek() {
super.onPausedSeek(); super.onPausedSeek();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100); animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
} }
@ -365,6 +370,7 @@ public class MainVideoPlayer extends Activity {
} }
}); });
} }
getRootView().setKeepScreenOn(false);
super.onCompleted(); super.onCompleted();
} }

View File

@ -5,8 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/black" android:background="@android:color/black"
android:gravity="center" android:gravity="center">
android:keepScreenOn="true">
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout <com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@+id/aspectRatioLayout" android:id="@+id/aspectRatioLayout"