Commit 176a61a5 authored by Sébastien Toque's avatar Sébastien Toque

SCREEN_BRIGHT_WAKE_LOCK is deprecated, use setKeepScreenOn instead.

parent 8c0f8fa1
......@@ -10,7 +10,6 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
......
......@@ -54,8 +54,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
import android.util.Log;
......@@ -120,9 +118,6 @@ public class VideoPlayerActivity extends Activity {
private int mVideoHeight;
private int mVideoWidth;
// stop screen from dimming
private WakeLock mWakeLock;
//Audio
private AudioManager mAudioManager;
private int mAudioMax;
......@@ -139,10 +134,6 @@ public class VideoPlayerActivity extends Activity {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
// stop screen from dimming
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, TAG);
/** initialize Views an their Events */
mOverlayHeader = (View) findViewById(R.id.player_overlay_header);
mOverlay = (View) findViewById(R.id.player_overlay);
......@@ -218,8 +209,7 @@ public class VideoPlayerActivity extends Activity {
time = mLibVLC.getTime() - 5000;
mLibVLC.pause();
}
if (mWakeLock.isHeld())
mWakeLock.release();
mOverlay.setKeepScreenOn(false);
// Save position
SharedPreferences preferences = getSharedPreferences(PreferencesActivity.NAME, MODE_PRIVATE);
......@@ -816,8 +806,7 @@ public class VideoPlayerActivity extends Activity {
*/
private void play() {
mLibVLC.play();
if (!mWakeLock.isHeld())
mWakeLock.acquire();
mOverlay.setKeepScreenOn(true);
}
/**
......@@ -825,8 +814,7 @@ public class VideoPlayerActivity extends Activity {
*/
private void pause() {
mLibVLC.pause();
if (mWakeLock.isHeld())
mWakeLock.release();
mOverlay.setKeepScreenOn(false);
}
/**
......@@ -850,8 +838,7 @@ public class VideoPlayerActivity extends Activity {
if (location != null && location.length() > 0) {
mLibVLC.readMedia(location, false);
if (!mWakeLock.isHeld())
mWakeLock.acquire();
mOverlay.setKeepScreenOn(true);
// Save media for next time, and restore position if it's the same one as before
lastLocation = preferences.getString(PreferencesActivity.LAST_MEDIA, null);
......
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