A Text viewer for Android written in Kotlin. Allows viewing of .txt, .html, .xml, .css and .csv file types. Makes use of JetPack Compose's LazyColumn and fully implemented in Jetpack compose using Material You 3.0 dynamic theming.
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.BharathVishal:TextFileViewerAndroid:1.4.1'
}
1. To launch the Text viewer with a given Content Uri/File path:
TextReaderModule().setContext(mContext).setFileUri(uri).launchTextViewer()
TextReaderModule().setContext(mContext).useFilePath().setFilePath(path).launchTextViewer()
2. To launch the Document picker intent. This launches the document chooser intent and then dislays the selected text file using the built-in Text Viewer.
TextReaderModule().setContext(mContext).launchTextViewerWithFileChooser()
- To display line length
TextReaderModule().shouldShowLineLength(true).setFileUri(uri).launchTextViewer()
- To display line number
TextReaderModule().shouldShowLineNumber(true).setFileUri(uri).launchTextViewer()
- To use File path instead of Content Uri
TextReaderModule().useFilePath().setFilePath(path).launchTextViewer()
- To use Content Uri instead of File path
TextReaderModule().setFileUri(uri).launchTextViewer()
- Allows viewing of .txt, .html, .xml, .css and .csv types.
- Clean and light weight implementation.
- Supports night mode.
- Has options to toggle line number and line length.
- Loads file using content Uri or File scheme.
- Uses coroutines to load the file asynchronously.
- Implemented using Jetpack Compose.
- Material You 3.0 design with dynamic theming.
2023
Min SDK : 22 | Target SDK : 35 | Gradle : 8.6.0 | Kotlin | Jetpack Compose
Android Studio Koala Feature Drop | 2024.1.2
Android is a trademark of Google LLC.
© 2023-2024. Developed by Bharath Vishal G (https://github.com/BharathVishal).
Thank you. 🙂