[Android] Keep screen on during the scan

Ludovic Fauvet git at videolan.org
Tue Oct 30 12:14:07 CET 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Tue Oct 30 12:09:46 2012 +0100| [43c7b6dccf0987954407ed3816eaaf922dd92910] | committer: Ludovic Fauvet

Keep screen on during the scan

This gives a chance to the scan to finish instead of being stopped when
the screen is automatically turned off while still offering the
possibility to the user to stop it by turning the screen off manually.

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=43c7b6dccf0987954407ed3816eaaf922dd92910
---

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index eafc6d6..1387b79 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -539,8 +539,10 @@ public class MainActivity extends SherlockFragmentActivity {
 
             if (action.equalsIgnoreCase(ACTION_SHOW_PROGRESSBAR)) {
                 setSupportProgressBarIndeterminateVisibility(true);
+                getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
             } else if (action.equalsIgnoreCase(ACTION_HIDE_PROGRESSBAR)) {
                 setSupportProgressBarIndeterminateVisibility(false);
+                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
             } else if (action.equalsIgnoreCase(ACTION_SHOW_TEXTINFO)) {
                 String info = intent.getStringExtra("info");
                 int max = intent.getIntExtra("max", 0);



More information about the Android mailing list