aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java26
-rw-r--r--src/main/res/values-de/strings.xml2
-rw-r--r--src/main/res/values/strings.xml2
-rw-r--r--src/main/res/xml/preferences.xml5
4 files changed, 31 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
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index eb6af903e..2da868dfd 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -690,5 +690,7 @@
<string name="timeout_7_days">7 Tage</string>
<string name="today">Heute</string>
<string name="start_chatting">Fange an zu schreiben…</string>
+ <string name="pref_use_max_brightness">Maximale Helligkeit</string>
+ <string name="pref_use_max_brightness_summary">Maximale Helligkeit aktivieren, wenn Videos oder Bilder im Vollbild betracht werden.</string>
</resources>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index bdd6c6fb7..fd109379b 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -739,4 +739,6 @@
<string name="timeout_6_months">6 months</string>
<string name="today">Today</string>
<string name="start_chatting">Start chtatting…</string>
+ <string name="pref_use_max_brightness_summary">Switch to maximum brightness while watching videos or images in fullscreen.</string>
+ <string name="pref_use_max_brightness">Maximum brightness</string>
</resources>
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index 05d4551fb..ac3ea1445 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -28,6 +28,11 @@
android:key="quick_action"
android:summary="@string/pref_quick_action_summary"
android:title="@string/pref_quick_action" />
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:key="use_max_brightness"
+ android:summary="@string/pref_use_max_brightness_summary"
+ android:title="@string/pref_use_max_brightness" />
</PreferenceScreen>
<!--Notifications-->
<PreferenceScreen