Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.
Rust androiddocument-scannerdocximage-editorjetpack-composekotlinliquid-glassofflineopen-sourcepdfpdf-compressorpdf-editorpdf-mergerpdf-readerpdf-splitterpdf-toolspdf-viewerpptxspreadsheet-editorxlsx
Respect Android display mode and power policy (#32)
Chethan Krishnaf9ab21c002b7
diff --git a/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt b/app/src/main/java/com/chethan616/clearpdf/MainActivity.ktindex 4ccbef7..719e95d 100644--- a/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt+++ b/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt@@ -4,7 +4,6 @@ import android.content.Intentimport android.net.Uriimport android.os.Buildimport android.os.Bundle-import android.view.WindowManagerimport androidx.activity.ComponentActivityimport androidx.activity.compose.setContentimport androidx.activity.enableEdgeToEdge@@ -35,9 +34,6 @@ class MainActivity : ComponentActivity() {// the system's own cross-fade would just stack on top of ours.com.chethan616.clearpdf.ui.utils.LocaleHelper.suppressActivityTransition(this)- // Request the highest available refresh rate (90Hz/120Hz)- requestHighRefreshRate()-// Map deep-link URIs from app shortcuts to nav routesval shortcutRoute: String? = intent?.data?.host?.let { host ->when (host) {@@ -103,33 +99,4 @@ class MainActivity : ComponentActivity() {supportedExtension}- private fun requestHighRefreshRate() {- // Prefer the display mode with the highest refresh rate- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {- val bestMode = display?.supportedModes?.maxByOrNull { it.refreshRate }- if (bestMode != null) {- val params = window.attributes- params.preferredDisplayModeId = bestMode.modeId- window.attributes = params- }- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {- @Suppress("DEPRECATION")- val bestMode = windowManager.defaultDisplay.supportedModes.maxByOrNull { it.refreshRate }- if (bestMode != null) {- val params = window.attributes- params.preferredDisplayModeId = bestMode.modeId- window.attributes = params- }- }-- // Reduce post-processing latency (API 30+)- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {- window.attributes = window.attributes.apply {- preferMinimalPostProcessing = true- }- }-- // Keep the screen rendering at high performance while the app is active- window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)- }}