From b2434fb6f2d0795b11ad003a7dec8414e62d1431 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 11:52:26 +0200 Subject: [PATCH] use an editable EditText at file editor --- .../filemanager/activities/ReadTextActivity.kt | 8 +++++--- app/src/main/res/layout/activity_read_text.xml | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt index 2abe33fd..bf3977bb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt @@ -26,10 +26,12 @@ class ReadTextActivity : SimpleActivity() { private fun checkIntent() { read_text_view.setTextColor(config.textColor) val uri = intent.data - if (uri.scheme == "file") { - read_text_view.text = File(uri.path).readText() + val text = if (uri.scheme == "file") { + File(uri.path).readText() } else { - read_text_view.text = contentResolver.openInputStream(uri).bufferedReader().use { it.readText() } + contentResolver.openInputStream(uri).bufferedReader().use { it.readText() } } + + read_text_view.setText(text) } } diff --git a/app/src/main/res/layout/activity_read_text.xml b/app/src/main/res/layout/activity_read_text.xml index a197d992..e04cdf36 100644 --- a/app/src/main/res/layout/activity_read_text.xml +++ b/app/src/main/res/layout/activity_read_text.xml @@ -5,11 +5,13 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> -