fix: avoid truncated prints (#275)

* fix change print enconding to base64 #104

Signed-off-by: Jan Guegel <jan@guegel.eu>

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com>

* use ensureBackgroundThread to avoid ANR on large files

Signed-off-by: Jan Guegel <jan@guegel.eu>

---------

Signed-off-by: Jan Guegel <jan@guegel.eu>
Co-authored-by: Jan Guegel <jan@guegel.eu>
Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
This commit is contained in:
Jan
2025-09-28 09:47:40 +02:00
committed by GitHub
parent 223e644f36
commit 630d7b2cea
2 changed files with 14 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed folders showing up incorrectly as files in copy/move dialog ([#267])
- Fixed error when saving files with unsupported characters ([#250])
- Fixed missing permission prompt on initial "Save as" launch ([#85])
- Fixed printing text files containing a "#" ([#104])
## [1.2.3] - 2025-09-15
### Fixed
@@ -78,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#267]: https://github.com/FossifyOrg/File-Manager/issues/267
[#250]: https://github.com/FossifyOrg/File-Manager/issues/250
[#85]: https://github.com/FossifyOrg/File-Manager/issues/85
[#104]: https://github.com/FossifyOrg/File-Manager/issues/104
[Unreleased]: https://github.com/FossifyOrg/File-Manager/compare/1.2.3...HEAD
[1.2.3]: https://github.com/FossifyOrg/File-Manager/compare/1.2.2...1.2.3

View File

@@ -7,6 +7,7 @@ import android.net.Uri
import android.os.Bundle
import android.print.PrintAttributes
import android.print.PrintManager
import android.util.Base64
import android.view.inputmethod.EditorInfo
import android.webkit.WebResourceRequest
import android.webkit.WebView
@@ -229,7 +230,17 @@ class ReadTextActivity : SimpleActivity() {
}
}
webView.loadData(binding.readTextView.text.toString(), "text/plain", "UTF-8")
val text = binding.readTextView.text.toString()
ensureBackgroundThread {
try {
val base64 = Base64.encodeToString(text.toByteArray(), Base64.DEFAULT)
runOnUiThread {
webView.loadData(base64, "text/plain", "base64")
}
} catch (e: Exception) {
showErrorToast(e)
}
}
} catch (e: Exception) {
showErrorToast(e)
}