add a simple text file reader

This commit is contained in:
tibbi 2017-10-23 11:27:16 +02:00
parent a3f5d8f18d
commit f996cceb7a
19 changed files with 95 additions and 0 deletions

View File

@ -33,6 +33,16 @@
</intent-filter>
</activity>
<activity
android:name=".activities.ReadTextActivity"
android:label="@string/file_editor">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/*"/>
</intent-filter>
</activity>
<activity
android:name="com.simplemobiletools.commons.activities.AboutActivity"
android:label="@string/about"

View File

@ -0,0 +1,22 @@
package com.simplemobiletools.filemanager.activities
import android.os.Bundle
import com.simplemobiletools.filemanager.R
import com.simplemobiletools.filemanager.extensions.config
import kotlinx.android.synthetic.main.activity_read_text.*
import java.io.File
class ReadTextActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_read_text)
read_text_view.setTextColor(config.textColor)
val uri = intent.data
if (uri.scheme == "file") {
read_text_view.text = File(uri.path).readText()
} else {
read_text_view.text = contentResolver.openInputStream(uri).bufferedReader().use { it.readText() }
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/read_text_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/read_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/medium_margin"
android:textSize="@dimen/smaller_text_size"/>
</ScrollView>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Jít na oblíbené</string>
<string name="favorites_activity_placeholder">Můžete přidat často využívané složky do oblíbených pro jednoduchý přístup odkudkoli.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Go to favorite</string>
<string name="favorites_activity_placeholder">You can add frequently used folders to favorites for easy access from anywhere.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Ir a favoritos</string>
<string name="favorites_activity_placeholder">Puede agregar carpetas de uso frecuente a favoritos para facilitar el acceso desde cualquier lugar.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Aller au favori</string>
<string name="favorites_activity_placeholder">Vous pouvez ajouter des dossiers souvent utilisés comme favoris pour y avoir accès rapidement depuis n\'importe où.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Activer les droits root</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Ugrás kedvenchez</string>
<string name="favorites_activity_placeholder">A gyakran használt mappákat kedvencnek jelölheted, hogy bárhonnan könnyen elérd őket.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Vai al preferito</string>
<string name="favorites_activity_placeholder">Puoi aggiungere le cartelle usate frequentemente ai preferiti per un rapido accesso da qualsiasi posizione.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Abilita accesso root</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Go to favorite</string>
<string name="favorites_activity_placeholder">You can add frequently used folders to favorites for easy access from anywhere.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">즐겨찾기 이동</string>
<string name="favorites_activity_placeholder">자주 사용하는 폴더를 즐겨찾기에 추가하여 어디서나 쉽게 접근 할 수 있습니다.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Przejdź do ulubionych</string>
<string name="favorites_activity_placeholder">Możesz dodawać często używane foldery do ulubionych, aby ułatwić sobie do nich dostęp.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Ir para favorito</string>
<string name="favorites_activity_placeholder">Pode adicionar pastas como favoritos, para um acesso mais rápido.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Ir para favorito</string>
<string name="favorites_activity_placeholder">Pode adicionar pastas como favoritos para um acesso mais rápido.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Ativar acesso root</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Открыть избранное</string>
<string name="favorites_activity_placeholder">Вы можете добавить часто используемые папки в избранное для быстрого доступа к ним.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Ísť medzi obľúbené</string>
<string name="favorites_activity_placeholder">Pre jednoduchý prístup k často používaným priečinkom si ich viete pridať medzi obľúbené</string>
<!-- File Editor -->
<string name="file_editor">Editor súborov</string>
<!-- Settings -->
<string name="enable_root_access">Povoliť prístup ku koreňovým súborom</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Gå till favorit</string>
<string name="favorites_activity_placeholder">Du kan lägga till ofta använda mappar i favoriter för enkel åtkomst överallt.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Aktivera rotåtkomst</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Go to favorite</string>
<string name="favorites_activity_placeholder">You can add frequently used folders to favorites for easy access from anywhere.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>

View File

@ -27,6 +27,9 @@
<string name="go_to_favorite">Go to favorite</string>
<string name="favorites_activity_placeholder">You can add frequently used folders to favorites for easy access from anywhere.</string>
<!-- File Editor -->
<string name="file_editor">File Editor</string>
<!-- Settings -->
<string name="enable_root_access">Enable root access</string>