Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 2acf40bf authored by Francesco Saltori's avatar Francesco Saltori Committed by GitHub
Browse files

Add option to keep the screen on (#121)

parent fca28687
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.preference.PreferenceManager;
import android.print.PrintManager;
import android.provider.OpenableColumns;
import android.util.Log;
import android.view.WindowManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@@ -146,6 +147,10 @@ public class MainActivity extends CyaneaAppCompatActivity {
    @Override
    public void onResume() {
        super.onResume();
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        if (prefManager.getBoolean("screen_on_pref", false)) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        }
        // Workaround for android:background XML attribute not being applied on all devices
        viewBinding.bottomNavigation.setBackgroundColor(Cyanea.getInstance().getPrimary());
    }
+1 −0
Original line number Diff line number Diff line
@@ -72,4 +72,5 @@
    <string name="enter_password">Inserisci la password corretta per aprire il documento:</string>
    <string name="wrong_password">Password errata.</string>
    <string name="dark_pdf">Modalità scura per il PDF</string>
    <string name="keep_screen_on">Mantieni lo schermo acceso</string>
</resources>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -119,4 +119,5 @@


    <string name="dark_pdf">Dark theme for PDF</string>
    <string name="keep_screen_on">Keep the screen on</string>
</resources>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@
            android:defaultValue="false"
            android:title="@string/dark_pdf" android:key="pdftheme_pref"/>

        <SwitchPreference
            android:defaultValue="false"
            android:title="@string/keep_screen_on" android:key="screen_on_pref"/>

    </PreferenceCategory>

    <PreferenceCategory