use an editable EditText at file editor
This commit is contained in:
parent
5d13b65b03
commit
b2434fb6f2
2 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/read_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/smaller_text_size"/>
|
||||
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in a new issue