mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
WakeLock refactoring: see ChangeLog for details
This commit is contained in:
parent
c365690633
commit
66f6de1c3b
4 changed files with 38 additions and 15 deletions
|
@ -24,7 +24,6 @@ import java.util.LinkedList;
|
|||
import android.app.SearchManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
|
@ -154,28 +153,14 @@ public final class FBReader extends ZLAndroidActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private PowerManager.WakeLock myWakeLock;
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
ControlButtonPanel.restoreVisibilities();
|
||||
if (ZLAndroidApplication.Instance().DontTurnScreenOffOption.getValue()) {
|
||||
myWakeLock =
|
||||
((PowerManager)getSystemService(POWER_SERVICE)).
|
||||
newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "FBReader");
|
||||
myWakeLock.acquire();
|
||||
} else {
|
||||
myWakeLock = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (myWakeLock != null) {
|
||||
myWakeLock.release();
|
||||
myWakeLock = null;
|
||||
}
|
||||
ControlButtonPanel.saveVisibilities();
|
||||
super.onPause();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue