-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
android: introduces the helper class
- Loading branch information
Showing
2 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
android/package-sources/src/io/github/janbar/osmin/QtAndroidHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.github.janbar.osmin; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.util.Log; | ||
import android.view.Window; | ||
import android.view.WindowManager; | ||
|
||
public class QtAndroidHelper { | ||
|
||
private static final String TAG = "helper"; | ||
|
||
public static void preventBlanking(Context context, boolean on) { | ||
if (context instanceof Activity) { | ||
Log.i(TAG, "FLAG_KEEP_SCREEN: " + (on ? "ON" : "OFF")); | ||
Window window = ((Activity) context).getWindow(); | ||
if (on) | ||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); | ||
else | ||
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters