aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-22 21:36:07 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-22 21:36:07 +0100
commit5665a1a0a5a32e3f66bddd22221f2957746c9511 (patch)
tree90a7a7b0cd0539cb4a55ada90796eb63daa07eeb /src/main/java/de/pixart/messenger
parent20db67fd023dba5e3276609d98db187783afbcc3 (diff)
make max brightness in fullscreen configurable
fixes #105
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
index 75c6d8849..c333d1cb5 100644
--- a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
@@ -2,12 +2,14 @@ package de.pixart.messenger.ui;
import android.app.Activity;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.Bundle;
+import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
@@ -54,7 +56,9 @@ public class ShowFullscreenMessageActivity extends Activity {
oldOrientation = getRequestedOrientation();
WindowManager.LayoutParams layout = getWindow().getAttributes();
- layout.screenBrightness = 1;
+ if (useMaxBrightness()) {
+ layout.screenBrightness = 1;
+ }
getWindow().setAttributes(layout);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_fullscreen_message);
@@ -212,7 +216,9 @@ public class ShowFullscreenMessageActivity extends Activity {
@Override
protected void onResume() {
WindowManager.LayoutParams layout = getWindow().getAttributes();
- layout.screenBrightness = 1;
+ if (useMaxBrightness()) {
+ layout.screenBrightness = 1;
+ }
getWindow().setAttributes(layout);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mVideo.setShouldAutoplay(true);
@@ -223,7 +229,9 @@ public class ShowFullscreenMessageActivity extends Activity {
protected void onPause() {
mVideo.reset();
WindowManager.LayoutParams layout = getWindow().getAttributes();
- layout.screenBrightness = -1;
+ if (useMaxBrightness()) {
+ layout.screenBrightness = -1;
+ }
getWindow().setAttributes(layout);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setRequestedOrientation(oldOrientation);
@@ -234,10 +242,20 @@ public class ShowFullscreenMessageActivity extends Activity {
public void onStop() {
mVideo.reset();
WindowManager.LayoutParams layout = getWindow().getAttributes();
- layout.screenBrightness = -1;
+ if (useMaxBrightness()) {
+ layout.screenBrightness = -1;
+ }
getWindow().setAttributes(layout);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setRequestedOrientation(oldOrientation);
super.onStop();
}
+
+ public boolean useMaxBrightness() {
+ return getPreferences().getBoolean("use_max_brightness", true);
+ }
+
+ protected SharedPreferences getPreferences() {
+ return PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+ }
} \ No newline at end of file